Fixes dictionary uses (#7)

This commit is contained in:
Kamron Batman 2018-11-02 08:16:42 -07:00 • committed by GitHub
parent d4a52344f2
commit 916d404c51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
161 changed files with 1211 additions and 1722 deletions

View file

@ -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
}
}
}
}
}