Fixes dictionary uses (#7)
This commit is contained in:
parent
d4a52344f2
commit
916d404c51
161 changed files with 1211 additions and 1722 deletions
|
|
@ -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