Fixes null propogation

This commit is contained in:
Kamron Batman 2018-09-14 13:49:23 -07:00
parent 22ab83ea9e
commit 3c9842ee5a
218 changed files with 799 additions and 1458 deletions

View file

@ -153,32 +153,26 @@ namespace Server.Spells.Necromancy
{
MaabusCoffinComponent comp = obj as MaabusCoffinComponent;
if ( comp != null )
MaabusCoffin addon = comp?.Addon as MaabusCoffin;
if ( addon != null )
{
MaabusCoffin addon = comp.Addon as MaabusCoffin;
PlayerMobile pm = Caster as PlayerMobile;
if ( addon != null )
QuestSystem qs = pm?.Quest;
if ( qs is DarkTidesQuest )
{
PlayerMobile pm = Caster as PlayerMobile;
QuestObjective objective = qs.FindObjective( typeof( AnimateMaabusCorpseObjective ) );
if ( pm != null )
if ( objective != null && !objective.Completed )
{
QuestSystem qs = pm.Quest;
if ( qs is DarkTidesQuest )
{
QuestObjective objective = qs.FindObjective( typeof( AnimateMaabusCorpseObjective ) );
if ( objective != null && !objective.Completed )
{
addon.Awake( Caster );
objective.Complete();
}
}
addon.Awake( Caster );
objective.Complete();
}
return;
}
return;
}
Corpse c = obj as Corpse;

View file

@ -58,14 +58,12 @@ namespace Server.Spells.Necromancy
*/
ExpireTimer timer = (ExpireTimer)m_Table[m];
if ( timer != null )
timer.DoExpire();
timer?.DoExpire();
m_OathTable[Caster] = Caster;
m_OathTable[m] = Caster;
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Spell?.OnCasterHurt();
Caster.PlaySound( 0x175 );

View file

@ -53,8 +53,7 @@ namespace Server.Spells.Necromancy
else
m.SendLocalizedMessage( 1061689 ); // Your skin turns dry and corpselike.
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Spell?.OnCasterHurt();
m.FixedParticles( 0x373A, 1, 15, 9913, 67, 7, EffectLayer.Head );
m.PlaySound( 0x1BB );

View file

@ -52,8 +52,7 @@ namespace Server.Spells.Necromancy
Timer t = (Timer)m_Table[weapon];
if ( t != null )
t.Stop();
t?.Stop();
weapon.Cursed = true;

View file

@ -48,8 +48,7 @@ namespace Server.Spells.Necromancy
* The effect lasts for one harmful event only.
*/
if (m.Spell != null)
m.Spell.OnCasterHurt();
m.Spell?.OnCasterHurt();
m.PlaySound(0xFC);
m.FixedParticles(0x3728, 1, 13, 9912, 1150, 7, EffectLayer.Head);

View file

@ -44,8 +44,7 @@ namespace Server.Spells.Necromancy
* The effect lasts for ((Spirit Speak skill level - target's Resist Magic skill level) / 50 ) + 20 seconds.
*/
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Spell?.OnCasterHurt();
m.PlaySound( 0x1FB );
m.PlaySound( 0x258 );

View file

@ -50,8 +50,7 @@ namespace Server.Spells.Necromancy
* for a target at 20% Stamina the damage multiplier is 2.6
*/
if ( m.Spell != null )
m.Spell.OnCasterHurt();
m.Spell?.OnCasterHurt();
m.PlaySound( 0x22F );
m.FixedParticles( 0x36CB, 1, 9, 9911, 67, 5, EffectLayer.Head );