Fixes sequential checks

This commit is contained in:
Kamron Batman 2018-09-14 13:00:41 -07:00
parent 83dcf536d8
commit 42d0b6271f
67 changed files with 99 additions and 99 deletions

View file

@ -82,7 +82,7 @@ namespace Server.Engines.CannedEvil
public bool Validate( ChampionSkullBrazier brazier )
{
return ( brazier != null && brazier.Skull != null && !brazier.Skull.Deleted );
return ( brazier?.Skull != null && !brazier.Skull.Deleted );
}
public ChampionSkullPlatform( Serial serial ) : base( serial )

View file

@ -59,7 +59,7 @@ namespace Server.Engines.ConPVP
protected override void OnTick()
{
if ( m_Bomb.Parent == null && m_Bomb.m_Game != null && m_Bomb.m_Game.Controller != null )
if ( m_Bomb.Parent == null && m_Bomb.m_Game?.Controller != null )
{
if ( !m_Bomb.m_Flying && m_Bomb.Map != Map.Internal )
Effects.SendLocationEffect( m_Bomb.GetWorldLocation(), m_Bomb.Map, 0x377A, 16, 10, m_Bomb.Hue, 0 );
@ -483,7 +483,7 @@ namespace Server.Engines.ConPVP
int height;
bool found = false;
if ( m_PathIdx < m_Path.Count && Map != null && Map.Tiles != null && Map != Map.Internal )
if ( m_PathIdx < m_Path.Count && Map?.Tiles != null && Map != Map.Internal )
{
int pathCheckEnd = m_PathIdx + 5;
@ -927,7 +927,7 @@ namespace Server.Engines.ConPVP
if ( !Visible )
return true;
if ( m == null || !m.Player || !m.Alive || m.Backpack == null || m_Team == null || m_Team.Game == null )
if ( m == null || !m.Player || !m.Alive || m.Backpack == null || m_Team?.Game == null )
return true;
if ( !base.OnMoveOver( m ) )
@ -960,7 +960,7 @@ namespace Server.Engines.ConPVP
public override void OnDoubleClick( Mobile from )
{
if ( m_TeamInfo != null && m_TeamInfo.Game != null )
if ( m_TeamInfo?.Game != null )
{
from.CloseGump( typeof( BRBoardGump ) );
from.SendGump( new BRBoardGump( from, m_TeamInfo.Game ) );
@ -1522,7 +1522,7 @@ namespace Server.Engines.ConPVP
{
public override bool CantDoAnything( Mobile mob )
{
if ( mob == null || mob.Backpack == null || GetTeamInfo( mob ) == null )
if ( mob?.Backpack == null || GetTeamInfo( mob ) == null )
return false;
Item bomb = mob.Backpack.FindItemByType( typeof( BRBomb ), true );
@ -1880,7 +1880,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer dp = p.Players[j];
if ( dp != null && dp.Mobile != null )
if ( dp?.Mobile != null )
{
dp.Mobile.CloseGump( typeof( BRBoardGump ) );
dp.Mobile.SendGump( new BRBoardGump( dp.Mobile, this ) );

View file

@ -24,7 +24,7 @@ namespace Server.Engines.ConPVP
public override void OnDoubleClick( Mobile from )
{
if ( m_TeamInfo != null && m_TeamInfo.Game != null )
if ( m_TeamInfo?.Game != null )
{
from.CloseGump( typeof( CTFBoardGump ) );
from.SendGump( new CTFBoardGump( from, m_TeamInfo.Game ) );
@ -105,7 +105,7 @@ namespace Server.Engines.ConPVP
{
CTFTeamInfo teamInfo = game.Controller.TeamInfo[i % 8];
if ( teamInfo == null || teamInfo.Flag == null )
if ( teamInfo?.Flag == null )
continue;
entries.Add( teamInfo );
@ -250,7 +250,7 @@ namespace Server.Engines.ConPVP
public override void OnDoubleClick( Mobile from )
{
if ( m_TeamInfo != null && m_TeamInfo.Game != null )
if ( m_TeamInfo?.Game != null )
{
CTFTeamInfo ourTeam = m_TeamInfo;
CTFTeamInfo useTeam = m_TeamInfo.Game.GetTeamInfo( from );
@ -380,7 +380,7 @@ namespace Server.Engines.ConPVP
SendHome();
if ( m_TeamInfo != null && m_TeamInfo.Game != null )
if ( m_TeamInfo?.Game != null )
m_TeamInfo.Game.Alert( "The {0} cookies have been returned.", m_TeamInfo.Name );
return;
@ -1125,7 +1125,7 @@ namespace Server.Engines.ConPVP
{
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i % 8];
if ( teamInfo == null || teamInfo.Flag == null )
if ( teamInfo?.Flag == null )
continue;
teams.Add( teamInfo );
@ -1262,7 +1262,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer dp = p.Players[j];
if ( dp != null && dp.Mobile != null )
if ( dp?.Mobile != null )
{
dp.Mobile.CloseGump( typeof( CTFBoardGump ) );
dp.Mobile.SendGump( new CTFBoardGump( dp.Mobile, this ) );

View file

@ -22,7 +22,7 @@ namespace Server.Engines.ConPVP
public override void OnDoubleClick( Mobile from )
{
if ( m_TeamInfo != null && m_TeamInfo.Game != null )
if ( m_TeamInfo?.Game != null )
{
from.CloseGump( typeof( DDBoardGump ) );
from.SendGump( new DDBoardGump( from, m_TeamInfo.Game ) );
@ -971,9 +971,9 @@ namespace Server.Engines.ConPVP
{
DDTeamInfo team = null;
if ( m_Controller.PointA != null && m_Controller.PointA.TeamOwner != null )
if ( m_Controller.PointA?.TeamOwner != null )
team = m_Controller.PointA.TeamOwner;
else if ( m_Controller.PointB != null && m_Controller.PointB.TeamOwner != null )
else if ( m_Controller.PointB?.TeamOwner != null )
team = m_Controller.PointB.TeamOwner;
if ( team == null )

View file

@ -551,7 +551,7 @@ namespace Server.Engines.ConPVP
{
get
{
if (m_Player == null || m_Player.Name == null)
if (m_Player?.Name == null)
return "";
return m_Player.Name;
}
@ -960,7 +960,7 @@ namespace Server.Engines.ConPVP
{
get
{
if (m_Context != null && m_Context.Arena != null)
if (m_Context?.Arena != null)
return m_Context.Arena.Facet;
return m_Controller.Map;

View file

@ -2227,7 +2227,7 @@ namespace Server.Engines.ConPVP
public void Alert( Arena arena, params string[] alerts )
{
if ( arena != null && arena.Announcer != null )
if ( arena?.Announcer != null )
{
for ( int j = 0; j < alerts.Length; ++j )
Timer.DelayCall( TimeSpan.FromSeconds( Math.Max( j-0.5, 0.0 ) ), new TimerStateCallback( Alert_Callback ), new object[]{ arena.Announcer, alerts[j] } );

View file

@ -161,7 +161,7 @@ namespace Server.Engines.Doom
public override bool HandlesOnMovement => true;
public override bool OnMoveOver( Mobile m )
{
if ( m != null && m is PlayerMobile )
if ( m is PlayerMobile )
{
if ( SpellHelper.CheckCombat( m ) )
{

View file

@ -830,7 +830,7 @@ namespace Server.Factions
sigil.GraceStart = DateTime.MinValue;
}
if ( sigil.LastMonolith == null || sigil.LastMonolith.Sigil == null )
if ( sigil.LastMonolith?.Sigil == null )
{
if ( (sigil.LastStolen + Sigil.ReturnPeriod) < DateTime.UtcNow )
sigil.ReturnHome();

View file

@ -118,10 +118,10 @@ namespace Server.Factions
PlayerState pl = PlayerState.Find( m_Commander );
if ( pl != null && pl.Finance != null )
if ( pl?.Finance != null )
pl.Finance.Finance = null;
if ( pl != null && pl.Sheriff != null )
if ( pl?.Sheriff != null )
pl.Sheriff.Sheriff = null;
}
}

View file

@ -37,7 +37,7 @@ namespace Server.Factions
{
if ( text != null && text.Number > 0 )
AddHtmlLocalized( x, y, width, height, text.Number, back, scroll );
else if ( text != null && text.String != null )
else if ( text?.String != null )
AddHtml( x, y, width, height, text.String, back, scroll );
}

View file

@ -104,7 +104,7 @@ namespace Server.Factions
BaseMonolith monolith = town.Monolith;
AddImage( 20, 60 + (i * 30), ( monolith != null && monolith.Sigil != null && monolith.Sigil.IsPurifying ) ? 0x938 : 0x939 );
AddImage( 20, 60 + (i * 30), ( monolith?.Sigil != null && monolith.Sigil.IsPurifying ) ? 0x938 : 0x939 );
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Factions
m_Sigil = value;
if ( m_Sigil != null && m_Sigil.LastMonolith != null && m_Sigil.LastMonolith != this && m_Sigil.LastMonolith.Sigil == m_Sigil )
if ( m_Sigil?.LastMonolith != null && m_Sigil.LastMonolith != this && m_Sigil.LastMonolith.Sigil == m_Sigil )
m_Sigil.LastMonolith.Sigil = null;
if ( m_Sigil != null )

View file

@ -25,7 +25,7 @@ namespace Server.Factions
m_LabelNumber = name.Number;
Name = null;
}
else if ( name != null && name.String != null )
else if ( name?.String != null )
{
m_LabelNumber = 0;
Name = name.String;

View file

@ -138,7 +138,7 @@ namespace Server.Factions
if ( def != null && def.Number > 0 )
Say( def.Number );
else if ( def != null && def.String != null )
else if ( def?.String != null )
Say( def.String );
}

View file

@ -63,7 +63,7 @@ namespace Server.Engines.MLQuests
private void Register()
{
if ( m_Quest != null && m_Quest.Instances != null )
if ( m_Quest?.Instances != null )
m_Quest.Instances.Add( this );
if ( m_Player != null )
@ -72,7 +72,7 @@ namespace Server.Engines.MLQuests
private void Unregister()
{
if ( m_Quest != null && m_Quest.Instances != null )
if ( m_Quest?.Instances != null )
m_Quest.Instances.Remove( this );
if ( m_Player != null )

View file

@ -45,7 +45,7 @@ namespace Server.Engines.Reports
mob = check;
}
if ( mob != null && mob.Name != null && mob.Name.Length > 0 )
if ( mob?.Name != null && mob.Name.Length > 0 )
return ( m_Display = mob.Name );
}
}

View file

@ -66,7 +66,7 @@ namespace Server.Items
m_Statue = reader.ReadMobile() as CharacterStatue;
if ( m_Statue == null || m_Statue.SculptedBy == null || Map == Map.Internal )
if ( m_Statue?.SculptedBy == null || Map == Map.Internal )
{
Timer.DelayCall( TimeSpan.Zero, new TimerCallback( Delete ) );
}