Fixes dictionary uses (#7)
This commit is contained in:
parent
d4a52344f2
commit
916d404c51
161 changed files with 1211 additions and 1722 deletions
|
|
@ -219,9 +219,7 @@ namespace Server.Spells
|
|||
return null;
|
||||
}
|
||||
|
||||
Table.TryGetValue(m, out SpecialMove move);
|
||||
|
||||
if (move != null && move.ValidatesDuringHit && !move.Validate(m))
|
||||
if (Table.TryGetValue(m, out SpecialMove move) && move.ValidatesDuringHit && !move.Validate(m))
|
||||
{
|
||||
ClearCurrentMove(m);
|
||||
return null;
|
||||
|
|
@ -272,9 +270,9 @@ namespace Server.Spells
|
|||
|
||||
public static void ClearCurrentMove(Mobile m)
|
||||
{
|
||||
Table.TryGetValue(m, out SpecialMove move);
|
||||
;
|
||||
|
||||
if (move != null)
|
||||
if (Table.TryGetValue(m, out SpecialMove move))
|
||||
{
|
||||
move.OnClearMove(m);
|
||||
|
||||
|
|
@ -306,17 +304,7 @@ namespace Server.Spells
|
|||
|
||||
private static SpecialMoveContext GetContext(Mobile m)
|
||||
{
|
||||
return m_PlayersTable.ContainsKey(m) ? m_PlayersTable[m] : null;
|
||||
}
|
||||
|
||||
public static bool GetContext(Mobile m, Type type)
|
||||
{
|
||||
m_PlayersTable.TryGetValue(m, out SpecialMoveContext context);
|
||||
|
||||
if (context == null)
|
||||
return false;
|
||||
|
||||
return context.Type == type;
|
||||
return m_PlayersTable.TryGetValue(m, out SpecialMoveContext context) ? context : null;
|
||||
}
|
||||
|
||||
private class SpecialMoveTimer : Timer
|
||||
|
|
@ -349,4 +337,4 @@ namespace Server.Spells
|
|||
public Type Type{ get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,16 +84,9 @@ namespace Server.Spells
|
|||
public virtual void OnCasterHurt()
|
||||
{
|
||||
//Confirm: Monsters and pets cannot be disturbed.
|
||||
if (!Caster.Player)
|
||||
return;
|
||||
|
||||
if (IsCasting)
|
||||
{
|
||||
double d = ProtectionSpell.Registry[Caster];
|
||||
|
||||
if (d <= Utility.RandomDouble() * 100.0)
|
||||
Disturb(DisturbType.Hurt, false, true);
|
||||
}
|
||||
if (Caster.Player && IsCasting && ProtectionSpell.Registry.TryGetValue(Caster, out double d) &&
|
||||
d <= Utility.RandomDouble() * 100.0)
|
||||
Disturb(DisturbType.Hurt, false, true);
|
||||
}
|
||||
|
||||
public virtual void OnCasterKilled()
|
||||
|
|
@ -144,20 +137,15 @@ namespace Server.Spells
|
|||
return; //Sanity
|
||||
|
||||
if (!m_ContextTable.TryGetValue(GetType(), out DelayedDamageContextWrapper contexts))
|
||||
{
|
||||
contexts = new DelayedDamageContextWrapper();
|
||||
m_ContextTable.Add(GetType(), contexts);
|
||||
}
|
||||
m_ContextTable[GetType()] = contexts = new DelayedDamageContextWrapper();
|
||||
|
||||
contexts.Add(m, t);
|
||||
}
|
||||
|
||||
public void RemoveDelayedDamageContext(Mobile m)
|
||||
{
|
||||
if (!m_ContextTable.TryGetValue(GetType(), out DelayedDamageContextWrapper contexts))
|
||||
return;
|
||||
|
||||
contexts.Remove(m);
|
||||
if (m_ContextTable.TryGetValue(GetType(), out DelayedDamageContextWrapper contexts))
|
||||
contexts.Remove(m);
|
||||
}
|
||||
|
||||
public void HarmfulSpell(Mobile m)
|
||||
|
|
|
|||
|
|
@ -1041,7 +1041,7 @@ namespace Server.Spells
|
|||
|
||||
if (context == null) /* cleanup */
|
||||
return;
|
||||
|
||||
|
||||
if (context.Type == typeof(WraithFormSpell))
|
||||
{
|
||||
int wraithLeech =
|
||||
|
|
@ -1137,7 +1137,7 @@ namespace Server.Spells
|
|||
{
|
||||
BaseCreature bcFrom = m_From as BaseCreature;
|
||||
BaseCreature bcTarg = m_Target as BaseCreature;
|
||||
|
||||
|
||||
if (bcFrom != null && m_Target != null)
|
||||
bcFrom.AlterSpellDamageTo(m_Target, ref m_Damage);
|
||||
|
||||
|
|
@ -1299,24 +1299,24 @@ namespace Server.Spells
|
|||
|
||||
public static void RemoveContext(Mobile m, TransformContext context, bool resetGraphics)
|
||||
{
|
||||
if (m_Table.ContainsKey(m))
|
||||
if (!m_Table.ContainsKey(m))
|
||||
return;
|
||||
|
||||
m_Table.Remove(m);
|
||||
|
||||
List<ResistanceMod> mods = context.Mods;
|
||||
|
||||
for (int i = 0; i < mods.Count; ++i)
|
||||
m.RemoveResistanceMod(mods[i]);
|
||||
|
||||
if (resetGraphics)
|
||||
{
|
||||
m_Table.Remove(m);
|
||||
|
||||
List<ResistanceMod> mods = context.Mods;
|
||||
|
||||
for (int i = 0; i < mods.Count; ++i)
|
||||
m.RemoveResistanceMod(mods[i]);
|
||||
|
||||
if (resetGraphics)
|
||||
{
|
||||
m.HueMod = -1;
|
||||
m.BodyMod = 0;
|
||||
}
|
||||
|
||||
context.Timer.Stop();
|
||||
context.Spell.RemoveEffect(m);
|
||||
m.HueMod = -1;
|
||||
m.BodyMod = 0;
|
||||
}
|
||||
|
||||
context.Timer.Stop();
|
||||
context.Spell.RemoveEffect(m);
|
||||
}
|
||||
|
||||
public static TransformContext GetContext(Mobile m)
|
||||
|
|
@ -1406,4 +1406,4 @@ namespace Server.Spells
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,7 @@ namespace Server.Spells
|
|||
|
||||
public static int GetRegistryNumber(Type type)
|
||||
{
|
||||
if (m_IDsFromTypes.ContainsKey(type))
|
||||
return m_IDsFromTypes[type];
|
||||
|
||||
return -1;
|
||||
return m_IDsFromTypes.TryGetValue(type, out int value) ? value : -1;
|
||||
}
|
||||
|
||||
public static void Register(int spellID, Type type)
|
||||
|
|
@ -99,6 +96,7 @@ namespace Server.Spells
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (spm != null)
|
||||
|
|
@ -113,10 +111,11 @@ namespace Server.Spells
|
|||
|
||||
Type t = m_Types[spellID];
|
||||
|
||||
if (t == null || !t.IsSubclassOf(typeof(SpecialMove)) || !SpecialMoves.ContainsKey(spellID))
|
||||
if (t == null || !t.IsSubclassOf(typeof(SpecialMove)))
|
||||
return null;
|
||||
|
||||
return SpecialMoves[spellID];
|
||||
SpecialMoves.TryGetValue(spellID, out SpecialMove move);
|
||||
return move;
|
||||
}
|
||||
|
||||
public static Spell NewSpell(int spellID, Mobile caster, Item scroll)
|
||||
|
|
@ -167,4 +166,4 @@ namespace Server.Spells
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void BeginConfidence(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
m_Table.TryGetValue(m, out Timer timer);
|
||||
timer?.Stop();
|
||||
m_Table[m] = timer = new InternalTimer(m);
|
||||
|
||||
|
|
@ -65,10 +65,11 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void EndConfidence(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
timer?.Stop();
|
||||
|
||||
m_Table.Remove(m);
|
||||
if (m_Table.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
|
||||
OnEffectEnd(m, typeof(Confidence));
|
||||
}
|
||||
|
|
@ -80,7 +81,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void BeginRegenerating(Mobile m)
|
||||
{
|
||||
Timer timer = m_RegenTable[m];
|
||||
m_RegenTable.TryGetValue(m, out Timer timer);
|
||||
timer?.Stop();
|
||||
|
||||
m_RegenTable[m] = timer = new RegenTimer(m);
|
||||
|
|
@ -90,10 +91,11 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void StopRegenerating(Mobile m)
|
||||
{
|
||||
Timer timer = m_RegenTable[m];
|
||||
timer?.Stop();
|
||||
|
||||
m_RegenTable.Remove(m);
|
||||
if (m_RegenTable.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_RegenTable.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void StartCountering(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
m_Table.TryGetValue(m, out Timer timer);
|
||||
timer?.Stop();
|
||||
|
||||
m_Table[m] = timer = new InternalTimer(m);
|
||||
|
|
@ -80,10 +80,11 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void StopCountering(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
timer?.Stop();
|
||||
|
||||
m_Table.Remove(m);
|
||||
if (m_Table.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
|
||||
OnEffectEnd(m, typeof(CounterAttack));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,10 +27,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
if (VerifyCast(Caster, true))
|
||||
return base.CheckCast();
|
||||
|
||||
return false;
|
||||
return VerifyCast(Caster, true) && base.CheckCast();
|
||||
}
|
||||
|
||||
public static bool VerifyCast(Mobile Caster, bool messages)
|
||||
|
|
@ -180,7 +177,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void BeginEvasion(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
m_Table.TryGetValue(m, out Timer timer);
|
||||
timer?.Stop();
|
||||
|
||||
m_Table[m] = timer = new InternalTimer(m, GetEvadeDuration(m));
|
||||
|
|
@ -189,10 +186,11 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static void EndEvasion(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
timer?.Stop();
|
||||
|
||||
m_Table.Remove(m);
|
||||
if (m_Table.TryGetValue(m, out Timer timer))
|
||||
{
|
||||
timer.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
|
||||
OnEffectEnd(m, typeof(Evasion));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@ namespace Server.Spells.Bushido
|
|||
|
||||
ClearCurrentMove(attacker);
|
||||
|
||||
HonorableExecutionInfo info = m_Table[attacker];
|
||||
|
||||
if (info != null)
|
||||
if (m_Table.TryGetValue(attacker, out HonorableExecutionInfo info))
|
||||
{
|
||||
info.Clear();
|
||||
info.m_Timer?.Stop();
|
||||
|
|
@ -79,29 +77,21 @@ namespace Server.Spells.Bushido
|
|||
|
||||
public static int GetSwingBonus(Mobile target)
|
||||
{
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info))
|
||||
return 0;
|
||||
|
||||
return info.m_SwingBonus;
|
||||
return m_Table.TryGetValue(target, out HonorableExecutionInfo info) ? info.m_SwingBonus : 0;
|
||||
}
|
||||
|
||||
public static bool IsUnderPenalty(Mobile target)
|
||||
{
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info))
|
||||
return false;
|
||||
|
||||
return info.m_Penalty;
|
||||
return m_Table.TryGetValue(target, out HonorableExecutionInfo info) && info.m_Penalty;
|
||||
}
|
||||
|
||||
public static void RemovePenalty(Mobile target)
|
||||
{
|
||||
if (!(m_Table[target] is HonorableExecutionInfo info) || !info.m_Penalty)
|
||||
if (!m_Table.TryGetValue(target, out HonorableExecutionInfo info) || !info.m_Penalty)
|
||||
return;
|
||||
|
||||
info.Clear();
|
||||
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
m_Table.Remove(target);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
TimeSpan duration = TimeSpan.FromSeconds(seconds);
|
||||
|
||||
ExpireTimer timer = m_Table[weapon];
|
||||
m_Table.TryGetValue(weapon, out ExpireTimer timer);
|
||||
timer?.Stop();
|
||||
|
||||
weapon.Consecrated = true;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace Server.Spells.Chivalry
|
|||
|
||||
Caster.Stam = Caster.StamMax;
|
||||
|
||||
Timer timer = m_Table[Caster];
|
||||
m_Table.TryGetValue(Caster, out Timer timer);
|
||||
timer?.Stop();
|
||||
|
||||
int delay = ComputePowerValue(10);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Spells.Chivalry
|
|||
Caster.FixedParticles(0x375A, 1, 30, 9966, 33, 2, EffectLayer.Head);
|
||||
Caster.FixedParticles(0x37B9, 1, 30, 9502, 43, 3, EffectLayer.Head);
|
||||
|
||||
Timer timer = m_Table[Caster];
|
||||
m_Table.TryGetValue(Caster, out Timer timer);
|
||||
timer?.Stop();
|
||||
|
||||
double delay = (double)ComputePowerValue(1) / 60;
|
||||
|
|
|
|||
|
|
@ -125,9 +125,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
public static void StopTimer(Mobile m)
|
||||
{
|
||||
Timer t = m_Timers[m];
|
||||
|
||||
if (t == null)
|
||||
if (!m_Timers.TryGetValue(m, out InternalTimer t))
|
||||
return;
|
||||
|
||||
t.Stop();
|
||||
|
|
@ -156,18 +154,18 @@ namespace Server.Spells.Fifth
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (!m_Owner.CanBeginAction<IncognitoSpell>())
|
||||
{
|
||||
(m_Owner as PlayerMobile)?.SetHairMods(-1, -1);
|
||||
if (m_Owner.CanBeginAction<IncognitoSpell>())
|
||||
return;
|
||||
|
||||
m_Owner.BodyMod = 0;
|
||||
m_Owner.HueMod = -1;
|
||||
m_Owner.NameMod = null;
|
||||
m_Owner.EndAction<IncognitoSpell>();
|
||||
(m_Owner as PlayerMobile)?.SetHairMods(-1, -1);
|
||||
|
||||
BaseArmor.ValidateMobile(m_Owner);
|
||||
BaseClothing.ValidateMobile(m_Owner);
|
||||
}
|
||||
m_Owner.BodyMod = 0;
|
||||
m_Owner.HueMod = -1;
|
||||
m_Owner.NameMod = null;
|
||||
m_Owner.EndAction<IncognitoSpell>();
|
||||
|
||||
BaseArmor.ValidateMobile(m_Owner);
|
||||
BaseClothing.ValidateMobile(m_Owner);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,9 +57,7 @@ namespace Server.Spells.Fifth
|
|||
{
|
||||
Mobile targ = Caster;
|
||||
|
||||
ResistanceMod[] mods = m_Table[targ];
|
||||
|
||||
if (mods == null)
|
||||
if (!m_Table.TryGetValue(targ, out ResistanceMod[] mods))
|
||||
{
|
||||
targ.PlaySound(0x1E9);
|
||||
targ.FixedParticles(0x375A, 10, 15, 5037, EffectLayer.Waist);
|
||||
|
|
@ -116,7 +114,7 @@ namespace Server.Spells.Fifth
|
|||
if (Caster.BeginAction<DefensiveSpell>())
|
||||
{
|
||||
int value = (int)(Caster.Skills.Magery.Value + Caster.Skills.Inscribe.Value);
|
||||
value = (int)(8 + value / 200 * 7.0); //absorb from 8 to 15 "circles"
|
||||
value = (int)(8 + value / 200.0 * 7.0); //absorb from 8 to 15 "circles"
|
||||
|
||||
Caster.MagicDamageAbsorb = value;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,9 +58,7 @@ namespace Server.Spells.First
|
|||
{
|
||||
Mobile targ = Caster;
|
||||
|
||||
ResistanceMod[] mods = m_Table[targ];
|
||||
|
||||
if (mods == null)
|
||||
if (!m_Table.TryGetValue(targ, out ResistanceMod[] mods))
|
||||
{
|
||||
targ.PlaySound(0x1E9);
|
||||
targ.FixedParticles(0x376A, 9, 32, 5008, EffectLayer.Waist);
|
||||
|
|
|
|||
|
|
@ -109,9 +109,8 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public static void RemoveEntry(Mobile m)
|
||||
{
|
||||
if (_Table.ContainsKey(m))
|
||||
if (_Table.TryGetValue(m, out int v))
|
||||
{
|
||||
int v = _Table[m];
|
||||
_Table.Remove(m);
|
||||
m.EndAction<ArchProtectionSpell>();
|
||||
m.VirtualArmorMod -= v;
|
||||
|
|
@ -162,4 +161,4 @@ namespace Server.Spells.Fourth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Spells.Fourth
|
|||
Reagent.SulfurousAsh
|
||||
);
|
||||
|
||||
private static Dictionary<Mobile, Timer> m_UnderEffect = new Dictionary<Mobile, Timer>();
|
||||
private static HashSet<Mobile> m_UnderEffect = new HashSet<Mobile>();
|
||||
|
||||
public CurseSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
|
|
@ -38,7 +38,7 @@ namespace Server.Spells.Fourth
|
|||
|
||||
public static bool UnderEffect(Mobile m)
|
||||
{
|
||||
return m_UnderEffect.ContainsKey(m);
|
||||
return m_UnderEffect.Contains(m);
|
||||
}
|
||||
|
||||
public void Target(Mobile m)
|
||||
|
|
@ -59,13 +59,12 @@ namespace Server.Spells.Fourth
|
|||
SpellHelper.AddStatCurse(Caster, m, StatType.Int);
|
||||
SpellHelper.DisableSkillCheck = false;
|
||||
|
||||
Timer t = m_UnderEffect[m];
|
||||
|
||||
if (Caster.Player && m.Player /*&& Caster != m */ && t == null
|
||||
if (Caster.Player && m.Player /*&& Caster != m */ && !UnderEffect(m)
|
||||
) //On OSI you CAN curse yourself and get this effect.
|
||||
{
|
||||
TimeSpan duration = SpellHelper.GetDuration(Caster, m);
|
||||
m_UnderEffect[m] = Timer.DelayCall(duration, RemoveEffect, m);
|
||||
m_UnderEffect.Add(m);
|
||||
Timer.DelayCall(duration, RemoveEffect, m);
|
||||
m.UpdateResistances();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ namespace Server.Spells.Fourth
|
|||
Reagent.SpidersSilk
|
||||
);
|
||||
|
||||
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
|
||||
private static HashSet<Mobile> m_Table = new HashSet<Mobile>();
|
||||
|
||||
public ManaDrainSpell(Mobile caster, Item scroll) : base(caster, scroll, m_Info)
|
||||
{
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Spells.Fourth
|
|||
else if (toDrain > m.Mana)
|
||||
toDrain = m.Mana;
|
||||
|
||||
if (m_Table.ContainsKey(m))
|
||||
if (m_Table.Contains(m))
|
||||
toDrain = 0;
|
||||
|
||||
m.FixedParticles(0x3789, 10, 25, 5032, EffectLayer.Head);
|
||||
|
|
@ -76,7 +76,8 @@ namespace Server.Spells.Fourth
|
|||
{
|
||||
m.Mana -= toDrain;
|
||||
|
||||
m_Table[m] = Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => AosDelay_Callback(m, toDrain));
|
||||
m_Table.Add(m);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), () => AosDelay_Callback(m, toDrain));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -124,4 +125,4 @@ namespace Server.Spells.Fourth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,11 +67,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
SpellPlagueContext context = new SpellPlagueContext(this, targeted);
|
||||
|
||||
if (m_Table.ContainsKey(targeted))
|
||||
{
|
||||
SpellPlagueContext oldContext = m_Table[targeted];
|
||||
if (m_Table.TryGetValue(targeted, out SpellPlagueContext oldContext))
|
||||
oldContext.SetNext(context);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Table[targeted] = context;
|
||||
|
|
@ -89,22 +86,14 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
public static void RemoveEffect(Mobile m)
|
||||
{
|
||||
if (!m_Table.ContainsKey(m))
|
||||
return;
|
||||
|
||||
SpellPlagueContext context = m_Table[m];
|
||||
|
||||
context.EndPlague(false);
|
||||
if (m_Table.TryGetValue(m, out SpellPlagueContext context))
|
||||
context.EndPlague(false);
|
||||
}
|
||||
|
||||
public static void CheckPlague(Mobile m)
|
||||
{
|
||||
if (!m_Table.ContainsKey(m))
|
||||
return;
|
||||
|
||||
SpellPlagueContext context = m_Table[m];
|
||||
|
||||
context.OnDamage();
|
||||
if (m_Table.TryGetValue(m, out SpellPlagueContext context))
|
||||
context.OnDamage();
|
||||
}
|
||||
|
||||
private static void OnPlayerDeath(PlayerDeathEventArgs e)
|
||||
|
|
@ -225,4 +214,4 @@ namespace Server.Spells.Mysticism
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
public static void RemoveEffects(Mobile m)
|
||||
{
|
||||
ResistanceMod[] mods = m_Table[m];
|
||||
if (!m_Table.TryGetValue(m, out ResistanceMod[] mods))
|
||||
return;
|
||||
|
||||
for (int i = 0; i < mods.Length; ++i)
|
||||
m.RemoveResistanceMod(mods[i]);
|
||||
|
|
@ -157,10 +158,7 @@ namespace Server.Spells.Mysticism
|
|||
|
||||
private static void OnPlayerDeath(PlayerDeathEventArgs e)
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
if (UnderEffect(m))
|
||||
RemoveEffects(m);
|
||||
RemoveEffects(e.Mobile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,9 +205,7 @@ namespace Server.Spells.Necromancy
|
|||
if (master == null)
|
||||
return;
|
||||
|
||||
m_Table.TryGetValue(master, out List<Mobile> list);
|
||||
|
||||
if (list == null)
|
||||
if (!m_Table.TryGetValue(master, out List<Mobile> list))
|
||||
return;
|
||||
|
||||
list.Remove(summoned);
|
||||
|
|
@ -221,9 +219,7 @@ namespace Server.Spells.Necromancy
|
|||
if (master == null)
|
||||
return;
|
||||
|
||||
m_Table.TryGetValue(master, out List<Mobile> list);
|
||||
|
||||
if (list == null)
|
||||
if (!m_Table.TryGetValue(master, out List<Mobile> list))
|
||||
m_Table[master] = list = new List<Mobile>();
|
||||
|
||||
for (int i = list.Count - 1; i >= 0; --i)
|
||||
|
|
@ -306,6 +302,7 @@ namespace Server.Spells.Necromancy
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
if (summoned == null)
|
||||
|
|
@ -394,4 +391,4 @@ namespace Server.Spells.Necromancy
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Server.Spells.Necromancy
|
|||
* ((ss-rm)/8)+8
|
||||
*/
|
||||
|
||||
ExpireTimer timer = m_Table[m];
|
||||
m_Table.TryGetValue(m, out ExpireTimer timer);
|
||||
timer?.DoExpire();
|
||||
|
||||
m_OathTable[Caster] = Caster;
|
||||
|
|
@ -96,17 +96,13 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public static void RemoveCurse(Mobile m)
|
||||
{
|
||||
ExpireTimer t = m_Table[m];
|
||||
m_Table.TryGetValue(m, out ExpireTimer t);
|
||||
t?.DoExpire();
|
||||
}
|
||||
|
||||
public static Mobile GetBloodOath(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return null;
|
||||
|
||||
Mobile oath = m_OathTable[m];
|
||||
return oath == m ? null : oath;
|
||||
return m == null || m_OathTable.TryGetValue(m, out Mobile oath) && oath == m ? null : oath;
|
||||
}
|
||||
|
||||
private class ExpireTimer : Timer
|
||||
|
|
|
|||
|
|
@ -49,9 +49,7 @@ namespace Server.Spells.Necromancy
|
|||
* NOTE: Resistance is not checked if targeting yourself
|
||||
*/
|
||||
|
||||
ExpireTimer timer = m_Table[m];
|
||||
|
||||
if (timer != null)
|
||||
if (m_Table.TryGetValue(m, out ExpireTimer timer))
|
||||
timer.DoExpire();
|
||||
else
|
||||
m.SendLocalizedMessage(1061689); // Your skin turns dry and corpselike.
|
||||
|
|
|
|||
|
|
@ -50,12 +50,10 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 3.4 + 1.0);
|
||||
|
||||
|
||||
ExpireTimer timer = m_Table[weapon];
|
||||
m_Table.TryGetValue(weapon, out ExpireTimer timer);
|
||||
timer?.Stop();
|
||||
|
||||
weapon.Cursed = true;
|
||||
|
||||
m_Table[weapon] = timer = new ExpireTimer(weapon, duration);
|
||||
|
||||
timer.Start();
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills.SpiritSpeak.Value / 12 + 1.0);
|
||||
|
||||
Timer.DelayCall(duration, () => TryEndEffect(m));
|
||||
Timer.DelayCall(duration, TryEndEffect_Callback, m);
|
||||
|
||||
HarmfulSpell(m);
|
||||
|
||||
|
|
@ -86,6 +86,10 @@ namespace Server.Spells.Necromancy
|
|||
*
|
||||
* -refactored.
|
||||
*/
|
||||
private static void TryEndEffect_Callback(Mobile m)
|
||||
{
|
||||
TryEndEffect(m);
|
||||
}
|
||||
|
||||
public static bool TryEndEffect(Mobile m)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,10 +58,7 @@ namespace Server.Spells.Necromancy
|
|||
((GetDamageSkill(Caster) - GetResistSkill(m)) / 5.0 + 20.0) * (m.Player ? 1.0 : 2.0));
|
||||
m.CheckSkill(SkillName.MagicResist, 0.0, 120.0); //Skill check for gain
|
||||
|
||||
if (m.Player)
|
||||
SetMindRotScalar(Caster, m, 1.25, duration);
|
||||
else
|
||||
SetMindRotScalar(Caster, m, 2.00, duration);
|
||||
SetMindRotScalar(Caster, m, m.Player ? 1.25 : 2.00, duration);
|
||||
|
||||
HarmfulSpell(m);
|
||||
}
|
||||
|
|
@ -71,9 +68,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public static void ClearMindRotScalar(Mobile m)
|
||||
{
|
||||
MRBucket tmpB = m_Table[m];
|
||||
|
||||
if (tmpB == null)
|
||||
if (!m_Table.TryGetValue(m, out MRBucket tmpB))
|
||||
return;
|
||||
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.Mindrot);
|
||||
|
|
@ -89,13 +84,13 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public static bool GetMindRotScalar(Mobile m, ref double scalar)
|
||||
{
|
||||
MRBucket tmpB = m_Table[m];
|
||||
if (m_Table.TryGetValue(m, out MRBucket tmpB))
|
||||
{
|
||||
scalar = tmpB.m_Scalar;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (tmpB == null)
|
||||
return false;
|
||||
|
||||
scalar = tmpB.m_Scalar;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void SetMindRotScalar(Mobile caster, Mobile target, double scalar, TimeSpan duration)
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
TimeSpan buffTime = TimeSpan.FromSeconds(10.0);
|
||||
|
||||
InternalTimer timer = m_Table[m];
|
||||
|
||||
if (timer == null)
|
||||
if (!m_Table.TryGetValue(m, out InternalTimer timer))
|
||||
{
|
||||
m_Table[m] = timer = new InternalTimer(m, damage);
|
||||
timer.Start();
|
||||
|
|
|
|||
|
|
@ -59,9 +59,7 @@ namespace Server.Spells.Necromancy
|
|||
m.FixedParticles(0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head);
|
||||
m.FixedParticles(0x374A, 1, 17, 9502, 1108, 4, (EffectLayer)255);
|
||||
|
||||
InternalTimer timer = m_Table[m];
|
||||
|
||||
if (timer == null)
|
||||
if (!m_Table.TryGetValue(m, out InternalTimer timer))
|
||||
{
|
||||
m_Table[m] = timer = new InternalTimer(m, Caster);
|
||||
timer.Start();
|
||||
|
|
@ -111,9 +109,7 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public static bool RemoveCurse(Mobile m)
|
||||
{
|
||||
Timer timer = m_Table[m];
|
||||
|
||||
if (timer == null)
|
||||
if (!m_Table.TryGetValue(m, out InternalTimer timer))
|
||||
return false;
|
||||
|
||||
timer.Stop();
|
||||
|
|
|
|||
|
|
@ -40,15 +40,11 @@ namespace Server.Spells.Necromancy
|
|||
|
||||
public override bool CheckCast()
|
||||
{
|
||||
BaseCreature check = Table[Caster];
|
||||
if (!(Table.TryGetValue(Caster, out BaseCreature check) && check?.Deleted == false))
|
||||
return base.CheckCast();
|
||||
|
||||
if (check?.Deleted == false)
|
||||
{
|
||||
Caster.SendLocalizedMessage(1061605); // You already have a familiar.
|
||||
return false;
|
||||
}
|
||||
|
||||
return base.CheckCast();
|
||||
Caster.SendLocalizedMessage(1061605); // You already have a familiar.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
@ -149,18 +145,12 @@ namespace Server.Spells.Necromancy
|
|||
double necro = m_From.Skills.Necromancy.Value;
|
||||
double spirit = m_From.Skills.SpiritSpeak.Value;
|
||||
|
||||
BaseCreature check = SummonFamiliarSpell.Table[m_From];
|
||||
|
||||
#region Dueling
|
||||
|
||||
if ((m_From as PlayerMobile)?.DuelContext != null &&
|
||||
!((PlayerMobile)m_From).DuelContext.AllowSpellCast(m_From, m_Spell))
|
||||
if ((m_From as PlayerMobile)?.DuelContext?.AllowSpellCast(m_From, m_Spell) == false)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
else if (check?.Deleted == false)
|
||||
else if (SummonFamiliarSpell.Table.TryGetValue(m_From, out BaseCreature check) && check?.Deleted == false)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1061605); // You already have a familiar.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,10 +197,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public int GetLastAnimalForm(Mobile m)
|
||||
{
|
||||
if (m_LastAnimalForms.ContainsKey(m))
|
||||
return m_LastAnimalForms[m];
|
||||
|
||||
return -1;
|
||||
return m_LastAnimalForms.TryGetValue(m, out int value) ? value : -1;
|
||||
}
|
||||
|
||||
public static MorphResult Morph(Mobile m, int entryID)
|
||||
|
|
@ -323,7 +320,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public static AnimalFormContext GetContext(Mobile m)
|
||||
{
|
||||
return m_Table[m];
|
||||
return m_Table.TryGetValue(m, out AnimalFormContext context) ? context : null;
|
||||
}
|
||||
|
||||
public static bool UnderTransformation(Mobile m)
|
||||
|
|
@ -445,19 +442,19 @@ namespace Server.Spells.Ninjitsu
|
|||
}
|
||||
}
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
int x = pos % 2 == 0 ? 14 : 264;
|
||||
int y = pos / 2 * 64 + 44;
|
||||
if (!enabled)
|
||||
continue;
|
||||
|
||||
Rectangle2D b = ItemBounds.Table[entries[i].ItemID];
|
||||
int x = pos % 2 == 0 ? 14 : 264;
|
||||
int y = pos / 2 * 64 + 44;
|
||||
|
||||
AddImageTiledButton(x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entries[i].ItemID,
|
||||
entries[i].Hue, 40 - b.Width / 2 - b.X, 30 - b.Height / 2 - b.Y, entries[i].Tooltip);
|
||||
AddHtmlLocalized(x + 84, y, 250, 60, entries[i].Name, 0x7FFF, false, false);
|
||||
Rectangle2D b = ItemBounds.Table[entries[i].ItemID];
|
||||
|
||||
current++;
|
||||
}
|
||||
AddImageTiledButton(x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entries[i].ItemID,
|
||||
entries[i].Hue, 40 - b.Width / 2 - b.X, 30 - b.Height / 2 - b.Y, entries[i].Tooltip);
|
||||
AddHtmlLocalized(x + 84, y, 250, 60, entries[i].Name, 0x7FFF, false, false);
|
||||
|
||||
current++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -484,8 +481,7 @@ namespace Server.Spells.Ninjitsu
|
|||
{
|
||||
#region Dueling
|
||||
|
||||
if ((m_Caster as PlayerMobile)?.DuelContext != null &&
|
||||
!((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, m_Spell))
|
||||
if ((m_Caster as PlayerMobile)?.DuelContext?.AllowSpellCast(m_Caster, m_Spell) == false)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,12 +48,9 @@ namespace Server.Spells.Ninjitsu
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
DeathStrikeInfo info = m_Table[defender];
|
||||
|
||||
int damageBonus = 0;
|
||||
|
||||
if (info != null)
|
||||
if (m_Table.TryGetValue(defender, out DeathStrikeInfo info))
|
||||
{
|
||||
defender.SendLocalizedMessage(1063092); // Your opponent lands another Death Strike!
|
||||
|
||||
|
|
@ -86,18 +83,13 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public static void AddStep(Mobile m)
|
||||
{
|
||||
DeathStrikeInfo info = m_Table[m];
|
||||
if (info == null)
|
||||
return;
|
||||
|
||||
if (++info.m_Steps >= 5)
|
||||
if (m_Table.TryGetValue(m, out DeathStrikeInfo info) && ++info.m_Steps >= 5)
|
||||
ProcessDeathStrike(m);
|
||||
}
|
||||
|
||||
private static void ProcessDeathStrike(Mobile defender)
|
||||
{
|
||||
DeathStrikeInfo info = m_Table[defender];
|
||||
if (info == null)
|
||||
if (!m_Table.TryGetValue(defender, out DeathStrikeInfo info))
|
||||
return;
|
||||
|
||||
int damage;
|
||||
|
|
|
|||
|
|
@ -81,20 +81,16 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public override void OnClearMove(Mobile from)
|
||||
{
|
||||
KiAttackInfo info = m_Table[from];
|
||||
|
||||
if (info == null)
|
||||
if (!m_Table.TryGetValue(from, out KiAttackInfo info))
|
||||
return;
|
||||
|
||||
info.m_Timer?.Stop();
|
||||
info.m_Timer.Stop();
|
||||
m_Table.Remove(info.m_Mobile);
|
||||
}
|
||||
|
||||
public static double GetBonus(Mobile from)
|
||||
{
|
||||
KiAttackInfo info = m_Table[from];
|
||||
|
||||
if (info == null)
|
||||
if (!m_Table.TryGetValue(from, out KiAttackInfo info))
|
||||
return 0;
|
||||
|
||||
int xDelta = info.m_Location.X - from.X;
|
||||
|
|
|
|||
|
|
@ -39,24 +39,18 @@ namespace Server.Spells.Ninjitsu
|
|||
if (m == null)
|
||||
return;
|
||||
|
||||
if (m_CloneCount.ContainsKey(m))
|
||||
m_CloneCount[m]++;
|
||||
else
|
||||
m_CloneCount[m] = 1;
|
||||
m_CloneCount[m] = 1 + (m_CloneCount.TryGetValue(m, out int count) ? count : 0);
|
||||
}
|
||||
|
||||
public static void RemoveClone(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
if (m == null || !m_CloneCount.TryGetValue(m, out int count))
|
||||
return;
|
||||
|
||||
if (m_CloneCount.ContainsKey(m))
|
||||
{
|
||||
if (count <= 1)
|
||||
m_CloneCount.Remove(m);
|
||||
else
|
||||
m_CloneCount[m]--;
|
||||
|
||||
if (m_CloneCount[m] == 0)
|
||||
m_CloneCount.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CheckCast()
|
||||
|
|
@ -272,4 +266,4 @@ namespace Server.Mobiles
|
|||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,9 +53,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
attacker.RevealingAction();
|
||||
|
||||
SurpriseAttackInfo info = m_Table[defender];
|
||||
|
||||
if (info != null)
|
||||
if (m_Table.TryGetValue(defender, out SurpriseAttackInfo info))
|
||||
{
|
||||
info.m_Timer?.Stop();
|
||||
|
||||
|
|
@ -85,9 +83,7 @@ namespace Server.Spells.Ninjitsu
|
|||
|
||||
public static bool GetMalus(Mobile target, ref int malus)
|
||||
{
|
||||
SurpriseAttackInfo info = m_Table[target];
|
||||
|
||||
if (info == null)
|
||||
if (!m_Table.TryGetValue(target, out SurpriseAttackInfo info))
|
||||
return false;
|
||||
|
||||
malus = info.m_Malus;
|
||||
|
|
|
|||
|
|
@ -36,13 +36,12 @@ namespace Server.Spells.Second
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Caster.CanBeginAction<DefensiveSpell>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
|
||||
return false;
|
||||
}
|
||||
if (Caster.CanBeginAction<DefensiveSpell>())
|
||||
return true;
|
||||
|
||||
Caster.SendLocalizedMessage(1005385); // The spell will not adhere to you at this time.
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void Toggle(Mobile caster, Mobile target)
|
||||
|
|
@ -56,9 +55,7 @@ namespace Server.Spells.Second
|
|||
* even after dying<EFBFBD>until you <EFBFBD>turn them off<EFBFBD> by casting them again.
|
||||
*/
|
||||
|
||||
Tuple<ResistanceMod, DefaultSkillMod> mods = m_Table[target];
|
||||
|
||||
if (mods == null)
|
||||
if (m_Table.TryGetValue(target, out Tuple<ResistanceMod, DefaultSkillMod> mods))
|
||||
{
|
||||
target.PlaySound(0x1E9);
|
||||
target.FixedParticles(0x375A, 9, 20, 5016, EffectLayer.Waist);
|
||||
|
|
@ -98,9 +95,7 @@ namespace Server.Spells.Second
|
|||
|
||||
public static void EndProtection(Mobile m)
|
||||
{
|
||||
Tuple<ResistanceMod, DefaultSkillMod> mods = m_Table[m];
|
||||
|
||||
if (mods == null)
|
||||
if (!m_Table.TryGetValue(m, out Tuple<ResistanceMod, DefaultSkillMod> mods))
|
||||
return;
|
||||
|
||||
m_Table.Remove(m);
|
||||
|
|
|
|||
|
|
@ -164,8 +164,7 @@ namespace Server.Spells.Seventh
|
|||
|
||||
public static void StopTimer(Mobile m)
|
||||
{
|
||||
InternalTimer timer = m_Timers[m];
|
||||
if (timer == null)
|
||||
if (!m_Timers.TryGetValue(m, out InternalTimer timer))
|
||||
return;
|
||||
|
||||
timer.Stop();
|
||||
|
|
@ -174,15 +173,15 @@ namespace Server.Spells.Seventh
|
|||
|
||||
private static void EndPolymorph(Mobile m)
|
||||
{
|
||||
if (!m.CanBeginAction<PolymorphSpell>())
|
||||
{
|
||||
m.BodyMod = 0;
|
||||
m.HueMod = -1;
|
||||
m.EndAction<PolymorphSpell>();
|
||||
if (m.CanBeginAction<PolymorphSpell>())
|
||||
return;
|
||||
|
||||
BaseArmor.ValidateMobile(m);
|
||||
BaseClothing.ValidateMobile(m);
|
||||
}
|
||||
m.BodyMod = 0;
|
||||
m.HueMod = -1;
|
||||
m.EndAction<PolymorphSpell>();
|
||||
|
||||
BaseArmor.ValidateMobile(m);
|
||||
BaseClothing.ValidateMobile(m);
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
|
|
|
|||
|
|
@ -88,13 +88,11 @@ namespace Server.Spells.Sixth
|
|||
|
||||
public static void RemoveTimer(Mobile m)
|
||||
{
|
||||
m_Table.TryGetValue(m, out Timer t);
|
||||
if (!m_Table.TryGetValue(m, out Timer t))
|
||||
return;
|
||||
|
||||
if (t != null)
|
||||
{
|
||||
t.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
t.Stop();
|
||||
m_Table.Remove(m);
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
|
|
@ -135,4 +133,4 @@ namespace Server.Spells.Sixth
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,13 +30,12 @@ namespace Server.Spells.Spellweaving
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Caster.CanBeginAction<AttuneWeaponSpell>())
|
||||
{
|
||||
Caster.SendLocalizedMessage(1075124); // You must wait before casting that spell again.
|
||||
return false;
|
||||
}
|
||||
if (Caster.CanBeginAction<AttuneWeaponSpell>())
|
||||
return base.CheckCast();
|
||||
|
||||
Caster.SendLocalizedMessage(1075124); // You must wait before casting that spell again.
|
||||
return false;
|
||||
|
||||
return base.CheckCast();
|
||||
}
|
||||
|
||||
public override void OnCast()
|
||||
|
|
@ -92,7 +91,8 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static void StopAbsorbing(Mobile m, bool message)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out ExpireTimer t)) t.DoExpire(message);
|
||||
if (m_Table.TryGetValue(m, out ExpireTimer t))
|
||||
t.DoExpire(message);
|
||||
}
|
||||
|
||||
private class ExpireTimer : Timer
|
||||
|
|
@ -129,4 +129,4 @@ namespace Server.Spells.Spellweaving
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,18 +64,12 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static int GetFCMalus(Mobile m)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out EssenceOfWindInfo info))
|
||||
return info.FCMalus;
|
||||
|
||||
return 0;
|
||||
return m_Table.TryGetValue(m, out EssenceOfWindInfo info) ? info.FCMalus : 0;
|
||||
}
|
||||
|
||||
public static int GetSSIMalus(Mobile m)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out EssenceOfWindInfo info))
|
||||
return info.SSIMalus;
|
||||
|
||||
return 0;
|
||||
return m_Table.TryGetValue(m, out EssenceOfWindInfo info) ? info.SSIMalus : 0;
|
||||
}
|
||||
|
||||
public static bool IsDebuffed(Mobile m)
|
||||
|
|
@ -127,15 +121,10 @@ namespace Server.Spells.Spellweaving
|
|||
public void DoExpire(bool message)
|
||||
{
|
||||
Stop();
|
||||
/*
|
||||
if ( message )
|
||||
{
|
||||
}
|
||||
*/
|
||||
m_Table.Remove(m_Mobile);
|
||||
|
||||
BuffInfo.RemoveBuff(m_Mobile, BuffIcon.EssenceOfWind);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,45 +95,45 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
private static void HandleDeath_OnCallback(Mobile m)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out ExpireTimer timer))
|
||||
if (!m_Table.TryGetValue(m, out ExpireTimer timer))
|
||||
return;
|
||||
|
||||
double hitsScalar = timer.Spell.HitsScalar;
|
||||
|
||||
if (m is BaseCreature pet && pet.IsDeadBondedPet)
|
||||
{
|
||||
double hitsScalar = timer.Spell.HitsScalar;
|
||||
Mobile master = pet.GetMaster();
|
||||
|
||||
if (m is BaseCreature pet && pet.IsDeadBondedPet)
|
||||
if (master?.NetState != null && Utility.InUpdateRange(pet, master))
|
||||
{
|
||||
Mobile master = pet.GetMaster();
|
||||
|
||||
if (master?.NetState != null && Utility.InUpdateRange(pet, master))
|
||||
{
|
||||
master.CloseGump<PetResurrectGump>();
|
||||
master.SendGump(new PetResurrectGump(master, pet, hitsScalar));
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Mobile> friends = pet.Friends;
|
||||
|
||||
for (int i = 0; friends != null && i < friends.Count; i++)
|
||||
{
|
||||
Mobile friend = friends[i];
|
||||
|
||||
if (friend.NetState != null && Utility.InUpdateRange(pet, friend))
|
||||
{
|
||||
friend.CloseGump<PetResurrectGump>();
|
||||
friend.SendGump(new PetResurrectGump(friend, pet));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
master.CloseGump<PetResurrectGump>();
|
||||
master.SendGump(new PetResurrectGump(master, pet, hitsScalar));
|
||||
}
|
||||
else
|
||||
{
|
||||
m.CloseGump<ResurrectGump>();
|
||||
m.SendGump(new ResurrectGump(m, hitsScalar));
|
||||
}
|
||||
List<Mobile> friends = pet.Friends;
|
||||
|
||||
//Per OSI, buff is removed when gump sent, irregardless of online status or acceptence
|
||||
timer.DoExpire();
|
||||
for (int i = 0; friends != null && i < friends.Count; i++)
|
||||
{
|
||||
Mobile friend = friends[i];
|
||||
|
||||
if (friend.NetState != null && Utility.InUpdateRange(pet, friend))
|
||||
{
|
||||
friend.CloseGump<PetResurrectGump>();
|
||||
friend.SendGump(new PetResurrectGump(friend, pet));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m.CloseGump<ResurrectGump>();
|
||||
m.SendGump(new ResurrectGump(m, hitsScalar));
|
||||
}
|
||||
|
||||
//Per OSI, buff is removed when gump sent, irregardless of online status or acceptence
|
||||
timer.DoExpire();
|
||||
}
|
||||
|
||||
public static void OnLogin(LoginEventArgs e)
|
||||
|
|
@ -199,4 +199,4 @@ namespace Server.Spells.Spellweaving
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -84,19 +84,17 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static bool StopEffect(Mobile m)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out GiftOfRenewalInfo info))
|
||||
{
|
||||
m_Table.Remove(m);
|
||||
if (!m_Table.TryGetValue(m, out GiftOfRenewalInfo info))
|
||||
return false;
|
||||
|
||||
info.m_Timer.Stop();
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.GiftOfRenewal);
|
||||
m_Table.Remove(m);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(60), delegate { info.m_Caster.EndAction<GiftOfRenewalSpell>(); });
|
||||
info.m_Timer.Stop();
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.GiftOfRenewal);
|
||||
|
||||
return true;
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(60), delegate { info.m_Caster.EndAction<GiftOfRenewalSpell>(); });
|
||||
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private class GiftOfRenewalInfo
|
||||
|
|
@ -119,17 +117,17 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
public GiftOfRenewalInfo m_Info;
|
||||
private GiftOfRenewalInfo m_GiftInfo;
|
||||
|
||||
public InternalTimer(GiftOfRenewalInfo info)
|
||||
: base(TimeSpan.FromSeconds(2.0), TimeSpan.FromSeconds(2.0))
|
||||
{
|
||||
m_Info = info;
|
||||
m_GiftInfo = info;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
Mobile m = m_Info.m_Mobile;
|
||||
Mobile m = m_GiftInfo.m_Mobile;
|
||||
|
||||
if (!m_Table.ContainsKey(m))
|
||||
{
|
||||
|
|
@ -147,14 +145,14 @@ namespace Server.Spells.Spellweaving
|
|||
if (m.Hits >= m.HitsMax)
|
||||
return;
|
||||
|
||||
int toHeal = m_Info.m_HitsPerRound;
|
||||
int toHeal = m_GiftInfo.m_HitsPerRound;
|
||||
|
||||
SpellHelper.Heal(toHeal, m, m_Info.m_Caster);
|
||||
SpellHelper.Heal(toHeal, m, m_GiftInfo.m_Caster);
|
||||
m.FixedParticles(0x376A, 9, 32, 5005, EffectLayer.Waist);
|
||||
}
|
||||
}
|
||||
|
||||
public class InternalTarget : Target
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private GiftOfRenewalSpell m_Owner;
|
||||
|
||||
|
|
@ -176,4 +174,4 @@ namespace Server.Spells.Spellweaving
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,10 +70,7 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static int GetImmolatingDamage(BaseWeapon weapon)
|
||||
{
|
||||
if (m_WeaponDamageTable.TryGetValue(weapon, out ImmolatingWeaponEntry entry))
|
||||
return entry.m_Damage;
|
||||
|
||||
return 0;
|
||||
return m_WeaponDamageTable.TryGetValue(weapon, out ImmolatingWeaponEntry entry) ? entry.m_Damage : 0;
|
||||
}
|
||||
|
||||
public static void DoEffect(BaseWeapon weapon, Mobile target)
|
||||
|
|
@ -89,16 +86,14 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static void StopImmolating(BaseWeapon weapon)
|
||||
{
|
||||
if (m_WeaponDamageTable.TryGetValue(weapon, out ImmolatingWeaponEntry entry))
|
||||
{
|
||||
entry.m_Caster?.PlaySound(0x27);
|
||||
if (!m_WeaponDamageTable.TryGetValue(weapon, out ImmolatingWeaponEntry entry))
|
||||
return;
|
||||
|
||||
entry.m_Timer.Stop();
|
||||
entry.m_Caster?.PlaySound(0x27);
|
||||
entry.m_Timer.Stop();
|
||||
m_WeaponDamageTable.Remove(weapon);
|
||||
|
||||
m_WeaponDamageTable.Remove(weapon);
|
||||
|
||||
weapon.InvalidateProperties();
|
||||
}
|
||||
weapon.InvalidateProperties();
|
||||
}
|
||||
|
||||
private class ImmolatingWeaponEntry
|
||||
|
|
@ -127,4 +122,4 @@ namespace Server.Spells.Spellweaving
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,14 +63,13 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
SpellHelper.Damage(this, m, m.Player && Caster.Player ? pvpDamage : pvmDamage, 0, 0, 0, 0, 100);
|
||||
|
||||
if (oldSpell != null && oldSpell != m.Spell)
|
||||
if (!CheckResisted(m))
|
||||
{
|
||||
m_Table[m] = Timer.DelayCall(duration, DoExpire, m);
|
||||
if (oldSpell != null && oldSpell != m.Spell && !CheckResisted(m))
|
||||
{
|
||||
m_Table[m] = Timer.DelayCall(duration, DoExpire, m);
|
||||
|
||||
BuffInfo.AddBuff(m,
|
||||
new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, m, GetCastRecoveryMalus(m)));
|
||||
}
|
||||
BuffInfo.AddBuff(m,
|
||||
new BuffInfo(BuffIcon.Thunderstorm, 1075800, duration, m, GetCastRecoveryMalus(m)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,13 +83,13 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static void DoExpire(Mobile m)
|
||||
{
|
||||
if (m_Table.TryGetValue(m, out Timer t))
|
||||
{
|
||||
t.Stop();
|
||||
m_Table.Remove(m);
|
||||
if (!m_Table.TryGetValue(m, out Timer t))
|
||||
return;
|
||||
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.Thunderstorm);
|
||||
}
|
||||
t.Stop();
|
||||
m_Table.Remove(m);
|
||||
|
||||
BuffInfo.RemoveBuff(m, BuffIcon.Thunderstorm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue