Updates Packets & Randomizer (#43)

* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand.

* WIP - Rewriting packets.

* Cleanup and updates README

* Converts more packets

* Fixes header

* Converts Effects packets.

* Forgot the send command

* Adds the start of containers packets.

* Adds message packets with caching

* Extends the send methods

* Starts to add Acquire methods

* Converted the packets

* Cleanup

* Cleanup

* Adds more packets

* Adds more packets

* Fixes clearing arrays from pool. Adds Mobile Incoming

* Converts more packets.

* Moves more packets

* Moves more packets

* Test compression

* Merges

* Migrating to an idiomatic syntax that also supports compression, and proxying.

* Optimize the stack alloc. Changes attributes

* Converted container packets

* Visual Studio doesn't auto save files. I am still getting used to subpar IDEs.

* Adds static packet caching. Will profile later. Converts more packets

* Fixes packets and changes how compression is configured

* WIP - Adds basics for Gumps. Not finished though.

* Fix file

* Fixes formatting

* Changed SpanWriter to be more idiomatic.

* Fixes Span vs RawSpan and missing stackallocs

* Converts over some more gumps

* WIP - Deletes 32bit support.

* Drops RDRand32 support.

* Fixes gump compilation

* Converting gump components

* Removes old huffman compression function

* Revert signature for backwards compatibility

* WIP - Converting more gump components

* Creates ArraySet for the strings. Updates AppendTo to reference that.

* Converts the maining gump components

* Cleans up gump components

* Cleans up directives

* Cleans up ArraySet and moves it. Adds null-coalescing-assignment

* Cleanup, Target Packets, and C# 8 changes.

* Removed OPL Packet

* World packets

* Fixing packet uses

* Cleans up code. Fixes packet uses in various places.

* More cleanup for packets

* Code cleanup

* Converts more packet uses and cleans up more code

* More code cleanup

* Finishes fixing the packets in Item

* Updates secure trade packets

* Updates core and gets it to compile.

* Moved packets to scripts. Fixed account handler use of packets

* Code cleanup

* Updates chat packets

* Code cleanuo

* Adds party packets, but need to implement them.

* Party packets WIP

* Finishes party packets

* Rearrange movement namespaces and classes

* Finishes plant packets

* Code Formatting

* Fixes moving effects

* Code cleanup, eliminates equipinfo

* Adds more packets. Fixes bugs with various packets.

* Finishes mahjon packets

* Fixes mahjong packet

* Code cleanup

* Finishes mahjong packets

* Adds Map packets

* Add multifacet maps and charts

* Cleans up some packets with UTF8

* Optimizes packets

* Cleans up more packets. Moves the MessageHelper

* Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets.

* Updates protocol extensions packet receiver

* Fixes a few bugs. Fixes a few more packets.

* Code cleanup and fixing more packets

* Fixes packet effects

* Cleaned up more code

* Buff Icon cleanup

* Removed unused constructors

* Code Cleanup. Adds BoatHS Packets

* Moves house files. Updates house foundation packets.

* Deployment cleanup

* Fixes:

* Code cleanup

* More code cleanup

* More code cleanup

* Cleaned up BaseHouse

* Enforces styling

* Converts foreach to linq where possible.

* Dont need that

* Goals/Readme updates

* Removes 32bit support at the highest level. Turns on HRT by default.

* Code cleanup. Fixes extended features packet.

* Fixes various bugs

* Code cleanup

* Code cleanup

* Code cleanup. Fixes gump X/Y assignment.

* Code cleanup using |= operator

* More code cleanup

* Cleanup

* Fixes spacing issues. Thanks Visual Studio. You suck.

* Compiler error

* Fixes NPE from RunUO 2.7

* Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README

* Fixes more packets. Stupid trailing nulls.

* Fixes various bugs.

* Fixes for gumps

* Fixes more gump stuff. Going to split it out later since it is getting insane

* Recoded the gump writing

* WIP

* *Added output path of scripts project to dev branch
*Activated debugging in code
This commit is contained in:
Kamron Batman 2019-11-11 03:40:16 -08:00 committed by 3HMonkey
parent 7aa8fd3df1
commit 179cb50557
588 changed files with 10843 additions and 16177 deletions

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Engines.ConPVP;
using Server.Items;
using Server.Network;
@ -11,7 +12,7 @@ namespace Server.Spells
{
public abstract class SpecialMove
{
private static Dictionary<Mobile, SpecialMoveContext> m_PlayersTable = new Dictionary<Mobile, SpecialMoveContext>();
private static readonly Dictionary<Mobile, SpecialMoveContext> m_PlayersTable = new Dictionary<Mobile, SpecialMoveContext>();
public virtual int BaseMana => 0;
@ -181,13 +182,8 @@ namespace Server.Spells
public static void ClearAllMoves(Mobile m)
{
foreach (KeyValuePair<int, SpecialMove> kvp in SpellRegistry.SpecialMoves)
{
int moveID = kvp.Key;
if (moveID != -1)
m.Send(new ToggleSpecialAbility(moveID + 1, false));
}
foreach (var (moveID, _) in SpellRegistry.SpecialMoves.Where(kvp => kvp.Key != -1))
Packets.SendToggleSpecialAbility(m.NetState, (short)(moveID + 1), false);
}
public static SpecialMove GetCurrentMove(Mobile m)
@ -242,7 +238,7 @@ namespace Server.Spells
int moveID = SpellRegistry.GetRegistryNumber(move);
if (moveID > 0)
m.Send(new ToggleSpecialAbility(moveID + 1, true));
Packets.SendToggleSpecialAbility(m.NetState, (short)(moveID + 1), true);
TextDefinition.SendMessageTo(m, move.AbilityMessage);
}
@ -259,7 +255,7 @@ namespace Server.Spells
int moveID = SpellRegistry.GetRegistryNumber(move);
if (moveID > 0)
m.Send(new ToggleSpecialAbility(moveID + 1, false));
Packets.SendToggleSpecialAbility(m.NetState, (short)(moveID + 1), false);
}
Table.Remove(m);

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Engines.CannedEvil;
using Server.Engines.ConPVP;
using Server.Engines.PartySystem;
@ -148,13 +149,8 @@ namespace Server.Spells
public static bool DisableSkillCheck{ get; set; }
public static TimeSpan GetDamageDelayForSpell(Spell sp)
{
if (!sp.DelayedDamage)
return TimeSpan.Zero;
return Core.AOS ? AosDamageDelay : OldDamageDelay;
}
public static TimeSpan GetDamageDelayForSpell(Spell sp) =>
!sp.DelayedDamage ? TimeSpan.Zero : Core.AOS ? AosDamageDelay : OldDamageDelay;
public static bool CheckMulti(Point3D p, Map map, bool houses = true, int housingrange = 0)
{
@ -173,9 +169,7 @@ namespace Server.Spells
return true;
}
else if (multi.Contains(p))
{
return true;
}
}
return false;
@ -191,36 +185,15 @@ namespace Server.Spells
if (item.RootParent != from)
from.Direction = from.GetDirectionTo(item.GetWorldLocation());
}
else if (from != target)
{
else if (!ReferenceEquals(from, target))
from.Direction = from.GetDirectionTo(target);
}
}
public static bool CheckCombat(Mobile m)
{
if (!RestrictTravelCombat)
return false;
for (int i = 0; i < m.Aggressed.Count; ++i)
{
AggressorInfo info = m.Aggressed[i];
if (info.Defender.Player && DateTime.UtcNow - info.LastCombatTime < CombatHeatDelay)
return true;
}
if (Core.Expansion == Expansion.AOS)
for (int i = 0; i < m.Aggressors.Count; ++i)
{
AggressorInfo info = m.Aggressors[i];
if (info.Attacker.Player && DateTime.UtcNow - info.LastCombatTime < CombatHeatDelay)
return true;
}
return false;
}
public static bool CheckCombat(Mobile m) =>
RestrictTravelCombat &&
(m.Aggressed.Any(info => info.Defender.Player && DateTime.UtcNow - info.LastCombatTime < CombatHeatDelay) ||
Core.Expansion == Expansion.AOS && m.Aggressors.Any(info =>
info.Attacker.Player && DateTime.UtcNow - info.LastCombatTime < CombatHeatDelay));
public static bool AdjustField(ref Point3D p, Map map, int height, bool mobsBlock)
{
@ -246,9 +219,7 @@ namespace Server.Spells
public static void GetSurfaceTop(ref IPoint3D p)
{
if (p is Item item)
{
p = item.GetSurfaceTop();
}
else if (p is StaticTarget t)
{
int z = t.Z;
@ -260,15 +231,10 @@ namespace Server.Spells
}
}
public static bool AddStatOffset(Mobile m, StatType type, int offset, TimeSpan duration)
{
if (offset > 0)
return AddStatBonus(m, m, type, offset, duration);
if (offset < 0)
return AddStatCurse(m, m, type, -offset, duration);
return true;
}
public static bool AddStatOffset(Mobile m, StatType type, int offset, TimeSpan duration) =>
offset > 0
? AddStatBonus(m, m, type, offset, duration)
: offset >= 0 || AddStatCurse(m, m, type, -offset, duration);
public static bool AddStatBonus(Mobile caster, Mobile target, StatType type) => AddStatBonus(caster, target, type, GetOffset(caster, target, type, false), GetDuration(caster, target));
@ -604,7 +570,7 @@ namespace Server.Spells
// Always allow monsters to teleport
if (caster is BaseCreature bc && !bc.Controlled && !bc.Summoned && (type == TravelCheckType.TeleportTo || type == TravelCheckType.TeleportFrom))
return true;
return true;
m_TravelCaster = caster;
m_TravelType = type;

View file

@ -106,7 +106,7 @@ namespace Server.Spells.Bushido
int spellID = SpellRegistry.GetRegistryNumber(this);
if (spellID > 0)
caster.Send(new ToggleSpecialAbility(spellID + 1, true));
Packets.SendToggleSpecialAbility(caster.NetState, (short)(spellID + 1), true);
}
public static void OnEffectEnd(Mobile caster, Type type)
@ -114,7 +114,7 @@ namespace Server.Spells.Bushido
int spellID = SpellRegistry.GetRegistryNumber(type);
if (spellID > 0)
caster.Send(new ToggleSpecialAbility(spellID + 1, false));
Packets.SendToggleSpecialAbility(caster.NetState, (short)(spellID + 1), false);
}
}
}

View file

@ -74,7 +74,7 @@ namespace Server.Spells.Chivalry
if (evil)
{
// TODO: Is this right?
double fleeChance = (100 - Math.Sqrt(m.Fame / 2)) * chiv * dispelSkill;
double fleeChance = (100 - Math.Sqrt(m.Fame / 2.0)) * chiv * dispelSkill;
fleeChance /= 1000000;
if (fleeChance > Utility.RandomDouble()) bc.BeginFlee(TimeSpan.FromSeconds(30.0));

View file

@ -135,16 +135,10 @@ namespace Server.Spells.Chivalry
sendEffect = true;
}
if (EvilOmenSpell.TryEndEffect(m))
sendEffect = true;
if (StrangleSpell.RemoveCurse(m))
sendEffect = true;
if (CorpseSkinSpell.RemoveCurse(m))
sendEffect = true;
// TODO: Should this remove blood oath? Pain spike?
sendEffect |= EvilOmenSpell.TryEndEffect(m);
sendEffect |= StrangleSpell.RemoveCurse(m);
sendEffect |= CorpseSkinSpell.RemoveCurse(m);
if (sendEffect)
{

View file

@ -76,13 +76,9 @@ namespace Server.Spells.Chivalry
public void Effect(Point3D loc, Map map, bool checkMulti)
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (map == null || !Core.AOS && Caster.Map != map)
{
Caster.SendLocalizedMessage(1005569); // You can not recall to another facet.
}
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.RecallFrom))
{
}
@ -90,37 +86,21 @@ namespace Server.Spells.Chivalry
{
}
else if (map == Map.Felucca && Caster is PlayerMobile mobile && mobile.Young)
{
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
}
else if (Caster.Kills >= 5 && map != Map.Felucca)
{
Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
}
else if (Caster.Criminal)
{
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
}
else if (SpellHelper.CheckCombat(Caster))
{
Caster.SendLocalizedMessage(1061282); // You cannot use the Sacred Journey ability to flee from combat.
}
else if (WeightOverloading.IsOverloaded(Caster))
{
Caster.SendLocalizedMessage(502359, "", 0x22); // Thou art too encumbered to move.
}
else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (checkMulti && SpellHelper.CheckMulti(loc, map))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (m_Book != null && m_Book.CurCharges <= 0)
{
Caster.SendLocalizedMessage(502412); // There are no charges left on that item.
}
else if (CheckSequence())
{
BaseCreature.TeleportPets(Caster, loc, map, true);

View file

@ -39,7 +39,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS)
SpellHelper.Summon(new SummonedAirElemental(), Caster, 0x217, duration, false, false);

View file

@ -39,7 +39,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS)
SpellHelper.Summon(new SummonedEarthElemental(), Caster, 0x217, duration, false, false);

View file

@ -40,7 +40,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS)
SpellHelper.Summon(new SummonedFireElemental(), Caster, 0x217, duration, false, false);

View file

@ -40,7 +40,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS) /* Why two diff daemons? TODO: solve this */
{

View file

@ -39,7 +39,7 @@ namespace Server.Spells.Eighth
{
if (CheckSequence())
{
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
TimeSpan duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
if (Core.AOS)
SpellHelper.Summon(new SummonedWaterElemental(), Caster, 0x217, duration, false, false);

View file

@ -47,16 +47,7 @@ namespace Server.Spells.Fifth
int rx = (dx - dy) * 44;
int ry = (dx + dy) * 44;
bool eastToWest;
if (rx >= 0 && ry >= 0)
eastToWest = false;
else if (rx >= 0)
eastToWest = true;
else if (ry >= 0)
eastToWest = true;
else
eastToWest = false;
bool eastToWest = (rx < 0 || ry < 0) && (rx >= 0 || ry >= 0);
Effects.PlaySound(p, Caster.Map, 0x20B);

View file

@ -70,7 +70,7 @@ namespace Server.Spells.Fifth
TimeSpan duration;
if (Core.AOS)
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5);
duration = TimeSpan.FromSeconds(2 * Caster.Skills.Magery.Fixed / 5.0);
else
duration = TimeSpan.FromSeconds(4.0 * Caster.Skills.Magery.Value);

View file

@ -51,7 +51,7 @@ namespace Server.Spells.First
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
TimeSpan length = SpellHelper.GetDuration(Caster, m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Clumsy, 1075831, length, m, percentage.ToString()));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Clumsy, 1075831, percentage.ToString(), length, m));
HarmfulSpell(m);
}

View file

@ -49,7 +49,7 @@ namespace Server.Spells.First
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
TimeSpan length = SpellHelper.GetDuration(Caster, m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.FeebleMind, 1075833, length, m, percentage.ToString()));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.FeebleMind, 1075833, percentage.ToString(), length, m));
HarmfulSpell(m);
}

View file

@ -35,7 +35,7 @@ namespace Server.Spells.First
{
SpellHelper.Turn(m_Spell.Caster, targ);
if (targ.BeginAction<LightCycle>())
if (targ.BeginAction<LightCycle.NightSightTimer>())
{
new LightCycle.NightSightTimer(targ).Start();
int level = (int)(LightCycle.DungeonLevel *

View file

@ -80,7 +80,7 @@ namespace Server.Spells.First
int physresist = 15 + (int)(targ.Skills.Inscribe.Value / 20);
string args = $"{physresist}\t{5}\t{5}\t{5}\t{5}";
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, 1075813, args));
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.ReactiveArmor, 1075812, args));
}
else
{

View file

@ -49,7 +49,7 @@ namespace Server.Spells.First
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, true) * 100);
TimeSpan length = SpellHelper.GetDuration(Caster, m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Weaken, 1075837, length, m, percentage.ToString()));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Weaken, 1075837, percentage.ToString(), length, m));
HarmfulSpell(m);
}

View file

@ -124,23 +124,9 @@ namespace Server.Spells.Fourth
return true;
}
private bool IsAggressor(Mobile m)
{
foreach (AggressorInfo info in Caster.Aggressors)
if (m == info.Attacker && !info.Expired)
return true;
private bool IsAggressor(Mobile m) => Caster.Aggressors.Any(info => m == info.Attacker && !info.Expired);
return false;
}
private bool IsAggressed(Mobile m)
{
foreach (AggressorInfo info in Caster.Aggressed)
if (m == info.Defender && !info.Expired)
return true;
return false;
}
private bool IsAggressed(Mobile m) => Caster.Aggressed.Any(info => m == info.Defender && !info.Expired);
private static bool IsInnocentTo(Mobile from, Mobile to) => Notoriety.Compute(from, to) == Notoriety.Innocent;

View file

@ -77,7 +77,7 @@ namespace Server.Spells.Fourth
string args = $"{percentage}\t{percentage}\t{percentage}\t{10}\t{10}\t{10}\t{10}";
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Curse, 1075835, 1075836, length, m, args));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Curse, 1075835, args, length, m));
HarmfulSpell(m);
}

View file

@ -47,16 +47,7 @@ namespace Server.Spells.Fourth
int rx = (dx - dy) * 44;
int ry = (dx + dy) * 44;
bool eastToWest;
if (rx >= 0 && ry >= 0)
eastToWest = false;
else if (rx >= 0)
eastToWest = true;
else if (ry >= 0)
eastToWest = true;
else
eastToWest = false;
bool eastToWest = (rx < 0 || ry < 0) && (rx >= 0 || ry >= 0);
Effects.PlaySound(p, Caster.Map, 0x20C);
@ -65,7 +56,7 @@ namespace Server.Spells.Fourth
TimeSpan duration;
if (Core.AOS)
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5) / 4);
duration = TimeSpan.FromSeconds((15 + Caster.Skills.Magery.Fixed / 5.0) / 4.0);
else
duration = TimeSpan.FromSeconds(4.0 + Caster.Skills.Magery.Value * 0.5);

View file

@ -58,7 +58,7 @@ namespace Server.Spells.Fourth
damage *= GetDamageScalar(m);
}
m.BoltEffect(0);
m.BoltEffect();
SpellHelper.Damage(this, m, damage, 0, 0, 0, 0, 100);
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Network;
namespace Server.Spells.Mysticism
{
@ -67,8 +66,7 @@ namespace Server.Spells.Mysticism
targets.Add(m);
if (m.Player)
pvp = true;
pvp |= m.Player;
}
}
}
@ -113,9 +111,7 @@ namespace Server.Spells.Mysticism
private static void SendEffectPacket(IPoint3D p, Map map, Point3D orig, Point3D dest)
{
Effects.SendPacket(p, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x36D4, orig, dest, 0, 0, false, false, 0x63,
0x4));
Effects.SendMovingEffect(p, orig, dest, map, 0x36D4, 0, 0, false, false, 0x63, 4);
}
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Network;
namespace Server.Spells.Mysticism
{
@ -70,8 +69,7 @@ namespace Server.Spells.Mysticism
targets.Add(m);
if (m.Player)
pvp = true;
pvp |= m.Player;
}
}
}
@ -122,9 +120,7 @@ namespace Server.Spells.Mysticism
private static void SendEffectPacket(IPoint3D p, Map map, Point3D orig, Point3D dest)
{
Effects.SendPacket(p, map,
new HuedEffect(EffectType.Moving, Serial.Zero, Serial.Zero, 0x375A, orig, dest, 0, 0, false, false, 0x49A,
0x4));
Effects.SendMovingEffect(p, orig, dest, map, 0x375A, 0, 0, false, false, 0x49A, 4);
}
}
}

View file

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using Server.Factions;
using Server.Mobiles;
using Server.Spells.Fifth;
using Server.Spells.Ninjitsu;
using Server.Spells.Seventh;
@ -118,7 +117,7 @@ namespace Server.Spells.Mysticism
Caster.PlaySound(0x65A);
Caster.Delta(MobileDelta.Resistances);
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.StoneForm, 1080145, 1080146,
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.StoneForm, 1080145,
$"-10\t-2\t{offset}\t{GetResistCapBonus(Caster)}\t{GetDIBonus(Caster)}", false));
}
}

View file

@ -81,8 +81,8 @@ namespace Server.Spells.Necromancy
timer = new ExpireTimer(Caster, m, duration);
timer.Start();
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.BloodOathCaster, 1075659, duration, Caster, m.Name));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.BloodOathCurse, 1075661, duration, m, Caster.Name));
BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.BloodOathCaster, 1075659, m.Name, duration, Caster));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.BloodOathCurse, 1075661, Caster.Name, duration, m));
m_Table[m] = timer;
HarmfulSpell(m);

View file

@ -87,9 +87,7 @@ namespace Server.Spells.Necromancy
{
ChampionSpawnRegion r = Caster.Region.GetRegion<ChampionSpawnRegion>();
if (r == null || !Caster.InRange(r.ChampionSpawn, Range))
{
Caster.SendLocalizedMessage(1072111); // You are not in a valid exorcism region.
}
else if (CheckSequence())
{
Map map = Caster.Map;
@ -98,6 +96,7 @@ namespace Server.Spells.Necromancy
{
IEnumerable<Mobile> targets = r.ChampionSpawn.GetMobilesInRange(Range).Where(IsValidTarget);
//Surprisingly, no sparkle type effects
foreach (Mobile m in targets)
//Surprisingly, no sparkle type effects
m.Location = GetNearestShrine(m);
@ -134,7 +133,7 @@ namespace Server.Spells.Necromancy
Guild mGuild = m.Guild as Guild;
Guild cGuild = Caster.Guild as Guild;
if (mGuild.IsAlly(cGuild))
if (mGuild?.IsAlly(cGuild) == true)
return false;
if (mGuild == cGuild)

View file

@ -73,7 +73,7 @@ namespace Server.Spells.Necromancy
buffTime = timer.Next - DateTime.UtcNow;
}
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, buffTime, m, Convert.ToString((int)damage)));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.PainSpike, 1075667, ((int)damage).ToString(), buffTime, m));
// TODO: Find a better way to do this
WeightOverloading.DFA = DFAlgorithm.PainSpike;

View file

@ -14,7 +14,7 @@ namespace Server.Spells.Necromancy
Reagent.NoxCrystal
);
private static Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
private static readonly Dictionary<Mobile, InternalTimer> m_Table = new Dictionary<Mobile, InternalTimer>();
public StrangleSpell(Mobile caster, Item scroll = null) : base(caster, scroll, m_Info)
{
@ -104,7 +104,7 @@ namespace Server.Spells.Necromancy
}
TimeSpan t_Duration = TimeSpan.FromSeconds(i_Length);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, 1075795, t_Duration, m, args));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strangle, 1075794, args, t_Duration, m));
FinishSequence();
}

View file

@ -70,7 +70,7 @@ namespace Server.Spells.Ninjitsu
public static void OnLogin(LoginEventArgs e)
{
if (GetContext(e.Mobile)?.SpeedBoost == true)
e.Mobile.Send(SpeedControl.MountSpeed);
Packets.SendSpeedControlMount(e.Mobile.NetState);
}
public override bool CheckCast()
@ -228,7 +228,7 @@ namespace Server.Spells.Ninjitsu
m.HueMod = hueMod;
if (entry.SpeedBoost)
m.Send(SpeedControl.MountSpeed);
Packets.SendSpeedControlMount(m.NetState);
SkillMod mod = null;
@ -275,7 +275,7 @@ namespace Server.Spells.Ninjitsu
m_Table.Remove(m);
if (context.SpeedBoost)
m.Send(SpeedControl.Disable);
Packets.SendSpeedControlDisabled(m.NetState);
SkillMod mod = context.Mod;
@ -575,7 +575,7 @@ namespace Server.Spells.Ninjitsu
{
m_Mobile.RevealingAction();
m_Mobile.PlaySound(0x227);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0, false, false);
Effects.SendMovingEffect(m_Mobile, target, 0x36D4, 5, 0);
DelayCall(TimeSpan.FromSeconds(1), BreathDamage_Callback, target);
}

View file

@ -55,7 +55,7 @@ namespace Server.Spells.Second
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
TimeSpan length = SpellHelper.GetDuration(Caster, m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Agility, 1075841, length, m, percentage.ToString()));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Agility, 1075841, percentage.ToString(), length, m));
}
FinishSequence();

View file

@ -55,7 +55,7 @@ namespace Server.Spells.Second
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
TimeSpan length = SpellHelper.GetDuration(Caster, m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Cunning, 1075843, length, m, percentage.ToString()));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Cunning, 1075843, percentage.ToString(), length, m));
}
FinishSequence();

View file

@ -75,7 +75,7 @@ namespace Server.Spells.Second
int physloss = -15 + (int)(caster.Skills.Inscribe.Value / 20);
int resistloss = -35 + (int)(caster.Skills.Inscribe.Value / 20);
string args = $"{physloss}\t{resistloss}";
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, 1075815, args));
BuffInfo.AddBuff(target, new BuffInfo(BuffIcon.Protection, 1075814, args));
}
else
{

View file

@ -55,7 +55,7 @@ namespace Server.Spells.Second
int percentage = (int)(SpellHelper.GetOffsetScalar(Caster, m, false) * 100);
TimeSpan length = SpellHelper.GetDuration(Caster, m);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strength, 1075845, length, m, percentage.ToString()));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Strength, 1075845, percentage.ToString(), length, m));
}
FinishSequence();

View file

@ -59,8 +59,7 @@ namespace Server.Spells.Seventh
!Caster.CanBeHarmful(m, false))
return false;
if (m.Player)
playerVsPlayer = true;
playerVsPlayer |= m.Player;
return true;
}).ToList());
@ -68,9 +67,7 @@ namespace Server.Spells.Seventh
eable.Free();
}
double damage;
damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
double damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
: Utility.Random(27, 22);
if (targets.Count > 0)
@ -96,13 +93,11 @@ namespace Server.Spells.Seventh
Caster.DoHarmful(m);
SpellHelper.Damage(this, m, toDeal, 0, 0, 0, 0, 100);
m.BoltEffect(0);
m.BoltEffect();
}
}
else
{
Caster.PlaySound(0x29);
}
}
FinishSequence();

View file

@ -47,16 +47,7 @@ namespace Server.Spells.Seventh
int rx = (dx - dy) * 44;
int ry = (dx + dy) * 44;
bool eastToWest;
if (rx >= 0 && ry >= 0)
eastToWest = false;
else if (rx >= 0)
eastToWest = true;
else if (ry >= 0)
eastToWest = true;
else
eastToWest = false;
bool eastToWest = (rx < 0 || ry < 0) && (rx >= 0 || ry >= 0);
Effects.PlaySound(p, Caster.Map, 0x20B);
@ -143,7 +134,7 @@ namespace Server.Spells.Seventh
{
if (!(m is PlayerMobile))
return base.OnMoveOver(m);
int noto = Notoriety.Compute(m_Caster, m);
return noto != Notoriety.Enemy && noto != Notoriety.Ally && base.OnMoveOver(m);
}

View file

@ -67,13 +67,9 @@ namespace Server.Spells.Seventh
public void Effect(Point3D loc, Map map, bool checkMulti)
{
if (Sigil.ExistsOn(Caster))
{
Caster.SendLocalizedMessage(1061632); // You can't do that while carrying the sigil.
}
else if (map == null || !Core.AOS && Caster.Map != map)
{
Caster.SendLocalizedMessage(1005570); // You can not gate to another facet.
}
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.GateFrom))
{
}
@ -81,34 +77,19 @@ namespace Server.Spells.Seventh
{
}
else if (map == Map.Felucca && Caster is PlayerMobile mobile && mobile.Young)
{
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
}
else if (Caster.Kills >= 5 && map != Map.Felucca)
{
Caster.SendLocalizedMessage(1019004); // You are not allowed to travel there.
}
else if (Caster.Criminal)
{
Caster.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
}
else if (SpellHelper.CheckCombat(Caster))
{
Caster.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
}
else if (!map.CanSpawnMobile(loc.X, loc.Y, loc.Z))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (checkMulti && SpellHelper.CheckMulti(loc, map))
{
Caster.SendLocalizedMessage(501942); // That location is blocked.
}
else if (Core.SE && (GateExistsAt(map, loc) || GateExistsAt(Caster.Map, Caster.Location))
) // SE restricted stacking gates
{
else if (Core.SE && (GateExistsAt(map, loc) || GateExistsAt(Caster.Map, Caster.Location))) // SE restricted stacking gates
Caster.SendLocalizedMessage(1071242); // There is already a gate there.
}
else if (CheckSequence())
{
Caster.SendLocalizedMessage(501024); // You open a magical gate to another location

View file

@ -59,8 +59,7 @@ namespace Server.Spells.Seventh
Core.AOS && !Caster.InLOS(m))
return false;
if (m.Player)
playerVsPlayer = true;
playerVsPlayer |= m.Player;
return true;
}).ToList();
@ -72,9 +71,7 @@ namespace Server.Spells.Seventh
targets = new List<Mobile>();
}
double damage;
damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
double damage = Core.AOS ? GetNewAosDamage(51, 1, 5, playerVsPlayer)
: Utility.Random(27, 22);
if (targets.Count > 0)

View file

@ -3,7 +3,6 @@ using System.Collections.Generic;
using Server.Factions;
using Server.Gumps;
using Server.Items;
using Server.Mobiles;
using Server.Spells.Fifth;
namespace Server.Spells.Seventh

View file

@ -31,8 +31,8 @@ namespace Server.Spells.Sixth
public void Target(Item item)
{
if (!(item is RecallRune rune))
Caster.Send(new MessageLocalized(Caster.Serial, Caster.Body, MessageType.Regular, 0x3B2, 3, 501797, Caster.Name,
"")); // I cannot mark that object.
Packets.SendMessageLocalized(Caster.NetState, Caster.Serial, Caster.Body, MessageType.Regular,
0x3B2, 3, 501797, Caster.Name); // I cannot mark that object.
else if (!Caster.CanSee(rune))
Caster.SendLocalizedMessage(500237); // Target can not be seen.
else if (!SpellHelper.CheckTravel(Caster, TravelCheckType.Mark))

View file

@ -46,16 +46,7 @@ namespace Server.Spells.Sixth
int rx = (dx - dy) * 44;
int ry = (dx + dy) * 44;
bool eastToWest;
if (rx >= 0 && ry >= 0)
eastToWest = false;
else if (rx >= 0)
eastToWest = true;
else if (ry >= 0)
eastToWest = true;
else
eastToWest = false;
bool eastToWest = (rx < 0 || ry < 0) && (rx >= 0 || ry >= 0);
Effects.PlaySound(p, Caster.Map, 0x20B);

View file

@ -61,7 +61,7 @@ namespace Server.Spells.Spellweaving
Caster.BeginAction<AttuneWeaponSpell>();
BuffInfo.AddBuff(Caster,
new BuffInfo(BuffIcon.AttuneWeapon, 1075798, duration, Caster, damageAbsorb.ToString()));
new BuffInfo(BuffIcon.AttuneWeapon, 1075798, damageAbsorb.ToString(), duration, Caster));
}
FinishSequence();

View file

@ -51,8 +51,7 @@ namespace Server.Spells.Spellweaving
m_Table[m] = new EssenceOfWindInfo(m, fcMalus, ssiMalus, duration);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EssenceOfWind, 1075802, duration, m,
$"{fcMalus.ToString()}\t{ssiMalus.ToString()}"));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.EssenceOfWind, 1075802, $"{fcMalus}\t{ssiMalus}", duration, m));
}
eable.Free();

View file

@ -77,7 +77,7 @@ namespace Server.Spells.Spellweaving
m_Table[m] = t;
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.GiftOfLife, 1031615, 1075807, duration, m, null, true));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.GiftOfLife, 1031615, 1075807, duration, true, m));
}
FinishSequence();

View file

@ -75,7 +75,7 @@ namespace Server.Spells.Spellweaving
Caster.BeginAction<GiftOfRenewalSpell>();
BuffInfo.AddBuff(m,
new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, duration, m, hitsPerRound.ToString()));
new BuffInfo(BuffIcon.GiftOfRenewal, 1031602, 1075797, hitsPerRound.ToString(), duration, m));
}
}

View file

@ -37,19 +37,19 @@ namespace Server.Spells.Spellweaving
TransformContext context = TransformationSpellHelper.GetContext(e.Mobile);
if (context?.Type == typeof(ReaperFormSpell))
e.Mobile.Send(SpeedControl.WalkSpeed);
Packets.SendSpeedControlWalk(e.Mobile.NetState);
}
public override void DoEffect(Mobile m)
{
m.PlaySound(0x1BA);
m.Send(SpeedControl.WalkSpeed);
Packets.SendSpeedControlWalk(m.NetState);
}
public override void RemoveEffect(Mobile m)
{
m.Send(SpeedControl.Disable);
Packets.SendSpeedControlDisabled(m.NetState);
}
}
}

View file

@ -66,7 +66,7 @@ namespace Server.Spells.Spellweaving
m_Table[m] = Timer.DelayCall(duration, DoExpire, m);
BuffInfo.AddBuff(m,
new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, m, GetCastRecoveryMalus(m)));
new BuffInfo(BuffIcon.Thunderstorm, 1075800, GetCastRecoveryMalus(m).ToString(), duration, m));
}
eable.Free();

View file

@ -40,18 +40,13 @@ namespace Server.Spells
if (!boat.Deleted && boat.CheckKey(key.KeyValue))
m_Spell.Effect(boat.GetMarkedLocation(), boat.Map, false);
else
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357,
from.Name, "")); // I can not recall from that object.
Packets.SendMessageLocalized(from.NetState, from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357,
from.Name); // I can not recall from that object.
}
else if (o is HouseRaffleDeed deed && deed.ValidLocation())
{
m_Spell.Effect(deed.PlotLocation, deed.PlotFacet, true);
}
else
{
from.Send(new MessageLocalized(from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name,
"")); // I can not recall from that object.
}
Packets.SendMessageLocalized(from.NetState, from.Serial, from.Body, MessageType.Regular, 0x3B2, 3, 502357, from.Name); // I can not recall from that object.
}
protected override void OnNonlocalTarget(Mobile from, object o)

View file

@ -61,7 +61,7 @@ namespace Server.Spells.Third
string args = $"{percentage}\t{percentage}\t{percentage}";
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Bless, 1075847, 1075848, length, m, args));
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Bless, 1075847, 1075848, args, length, m));
}
FinishSequence();

View file

@ -44,16 +44,7 @@ namespace Server.Spells.Third
int rx = (dx - dy) * 44;
int ry = (dx + dy) * 44;
bool eastToWest;
if (rx >= 0 && ry >= 0)
eastToWest = false;
else if (rx >= 0)
eastToWest = true;
else if (ry >= 0)
eastToWest = true;
else
eastToWest = false;
bool eastToWest = (rx < 0 || ry < 0) && (rx >= 0 || ry >= 0);
Effects.PlaySound(p, Caster.Map, 0x1F6);