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

@ -370,7 +370,7 @@ namespace Server.Items
m_Changing = true;
if ( dest == null || !(dest.Addon is SHTeleporter) )
if ( !(dest?.Addon is SHTeleporter) )
{
m_UpTele.TeleDest = dest;
m_RightTele.TeleDest = dest;

View file

@ -876,7 +876,7 @@ namespace Server.Items
#region Static members
public static FishBowl GetEmptyBowl( Mobile from )
{
if ( from == null || from.Backpack == null )
if ( @from?.Backpack == null )
return null;
Item[] items = from.Backpack.FindItemsByType( typeof( FishBowl ) );

View file

@ -64,7 +64,7 @@ namespace Server.Items
Container root = parent as Container;
while (root != null && root.Parent is Container)
while (root?.Parent is Container)
{
root = (Container)root.Parent;
}

View file

@ -228,7 +228,7 @@ namespace Server.Items
public static bool IsPoisonImmune( BaseCreature bc )
{
return ( bc != null && bc.PoisonImmune != null );
return ( bc?.PoisonImmune != null );
}
public static int GetPoisonLevel( BaseCreature bc )

View file

@ -124,7 +124,7 @@ namespace Server.Items
protected override void OnTick()
{
if ( m_Mobile == null || m_Mobile.Map == null || m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Map == Map.Internal )
if ( m_Mobile?.Map == null || m_Mobile.Deleted || !m_Mobile.Alive || m_Mobile.Map == Map.Internal )
{
Stop();
}

View file

@ -236,8 +236,8 @@ namespace Server.Gumps
public int Compare( RaffleEntry x, RaffleEntry y )
{
bool xIsNull = ( x == null || x.From == null );
bool yIsNull = ( y == null || y.From == null );
bool xIsNull = ( x?.From == null );
bool yIsNull = ( y?.From == null );
if ( xIsNull && yIsNull )
return 0;
@ -265,8 +265,8 @@ namespace Server.Gumps
public int Compare( RaffleEntry x, RaffleEntry y )
{
bool xIsNull = ( x == null || x.From == null );
bool yIsNull = ( y == null || y.From == null );
bool xIsNull = ( x?.From == null );
bool yIsNull = ( y?.From == null );
if ( xIsNull && yIsNull )
return 0;
@ -304,8 +304,8 @@ namespace Server.Gumps
public int Compare( RaffleEntry x, RaffleEntry y )
{
bool xIsNull = ( x == null || x.Address == null );
bool yIsNull = ( y == null || y.Address == null );
bool xIsNull = ( x?.Address == null );
bool yIsNull = ( y?.Address == null );
if ( xIsNull && yIsNull )
return 0;

View file

@ -54,7 +54,7 @@ namespace Server.Regions
public override bool OnTarget( Mobile m, Target t, object o )
{
if ( m.Spell != null && m.Spell is MarkSpell && m.AccessLevel == AccessLevel.Player )
if ( m.Spell is MarkSpell && m.AccessLevel == AccessLevel.Player )
{
m.SendLocalizedMessage( 501800 ); // You cannot mark an object at that location.
return false;

View file

@ -536,7 +536,7 @@ namespace Server.Items
AddComponent( new PlagueBeastComponent( 0x1363, 0x1 ), 0, 22 );
AddComponent( new PlagueBeastComponent( 0x1D04, 0xD ), 0, 22 );
if ( Owner != null && Owner.Backpack != null )
if ( Owner?.Backpack != null )
{
PlagueBeastMutationCore core = new PlagueBeastMutationCore();
Owner.Backpack.AddItem( core );

View file

@ -32,7 +32,7 @@
{
IEntity rootParent = RootParent;
if ( rootParent != null && rootParent.Map != null && rootParent.Map != Map.Internal )
if ( rootParent?.Map != null && rootParent.Map != Map.Internal )
MoveToWorld( rootParent.Location, rootParent.Map );
}

View file

@ -252,7 +252,7 @@ namespace Server.Items
from.SendLocalizedMessage( 1054004 ); // You must equip the bracelet in order to use its power.
return false;
}
else if ( boundRoot == null || boundRoot.NetState == null || boundRoot.FindItemOnLayer( Layer.Bracelet ) != bound )
else if ( boundRoot?.NetState == null || boundRoot.FindItemOnLayer( Layer.Bracelet ) != bound )
{
from.SendLocalizedMessage( 1054006 ); // The bracelet emits a red glow. The bracelet's twin is not available for transport.
return false;

View file

@ -170,7 +170,7 @@ namespace Server.Items
else if ( pack == null || !pack.ConsumeTotal( AmmoType, 1 ) )
return false;
}
else if ( quiver.FindItemByType( AmmoType ) == null && ( pack == null || pack.FindItemByType( AmmoType ) == null ) )
else if ( quiver.FindItemByType( AmmoType ) == null && ( pack?.FindItemByType( AmmoType ) == null ) )
{
// lower ammo cost should not work when we have no ammo at all
return false;