Fixes sequential checks
This commit is contained in:
parent
83dcf536d8
commit
42d0b6271f
67 changed files with 99 additions and 99 deletions
|
|
@ -351,7 +351,7 @@ namespace Server.Commands.Generic
|
|||
{
|
||||
Mobile owner = m_Item.RootParent as Mobile;
|
||||
|
||||
if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( m_From, owner ) /* !m_From.CanSee( owner )*/ )
|
||||
if ( owner?.Map != null && owner.Map != Map.Internal && !BaseCommand.IsAccessible( m_From, owner ) /* !m_From.CanSee( owner )*/ )
|
||||
{
|
||||
m_From.SendMessage( "You can not get what you can not see." );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -629,7 +629,7 @@ namespace Server.Commands
|
|||
|
||||
Mobile owner = item.RootParent as Mobile;
|
||||
|
||||
if ( owner != null && (owner.Map != null && owner.Map != Map.Internal) && !BaseCommand.IsAccessible( from, owner ) /* !from.CanSee( owner )*/ )
|
||||
if ( owner?.Map != null && owner.Map != Map.Internal && !BaseCommand.IsAccessible( @from, owner ) /* !from.CanSee( owner )*/ )
|
||||
{
|
||||
from.SendMessage( "You can not go to what you can not see." );
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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] } );
|
||||
|
|
|
|||
|
|
@ -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 ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ namespace Server.Guilds
|
|||
{
|
||||
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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ namespace Server.Guilds
|
|||
|
||||
if ( m_LowerText != null && m_LowerText.Number > 0 )
|
||||
AddHtmlLocalized( 66, 153 + itemNumber * 28, 280, 26, m_LowerText.Number, 0xF, false, false );
|
||||
else if ( m_LowerText != null && m_LowerText.String != null )
|
||||
else if ( m_LowerText?.String != null )
|
||||
AddHtml( 66, 153 + itemNumber * 28, 280, 26, Color( m_LowerText.String, 0x99 ), false, false );
|
||||
|
||||
if ( AllowAdvancedSearch )
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace Server.Gumps
|
|||
AddHtmlLocalized( 45, 110, 150, 20, 1061279, GetColor( SecureLevel.Friends ), false, false ); // Friends
|
||||
|
||||
Mobile houseOwner = house.Owner;
|
||||
if ( Guild.NewGuildSystem && house != null && houseOwner != null && houseOwner.Guild != null && ((Guild)houseOwner.Guild).Leader == houseOwner ) //Only the actual House owner AND guild master can set guild secures
|
||||
if ( Guild.NewGuildSystem && house != null && houseOwner?.Guild != null && ((Guild)houseOwner.Guild).Leader == houseOwner ) //Only the actual House owner AND guild master can set guild secures
|
||||
{
|
||||
AddButton( 10, 130, GetFirstID( SecureLevel.Guild ), 4007, 5, GumpButtonType.Reply, 0 );
|
||||
AddHtmlLocalized( 45, 130, 150, 20, 1063455, GetColor( SecureLevel.Guild ), false, false ); // Guild Members
|
||||
|
|
|
|||
|
|
@ -218,7 +218,7 @@ namespace Server.Engines.Events
|
|||
|
||||
public static bool CheckMobile( Mobile mobile )
|
||||
{
|
||||
return ( mobile != null && mobile.Map != null && !mobile.Deleted && mobile.Alive && mobile.Map != Map.Internal );
|
||||
return ( mobile?.Map != null && !mobile.Deleted && mobile.Alive && mobile.Map != Map.Internal );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if ( Utility.RandomBool() )
|
||||
{
|
||||
if ( from != null && from.Map != null && Map != Map.Internal && Map == from.Map && from.InRange( this, 12 ) )
|
||||
if ( @from?.Map != null && Map != Map.Internal && Map == @from.Map && @from.InRange( this, 12 ) )
|
||||
{
|
||||
SpillAcid( ( willKill ) ? this : from, ( willKill ) ? 3 : 1 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 ) );
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace Server.Misc
|
|||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
if (m != null && m.NetState != null && m.NetState.Running)
|
||||
if (m?.NetState != null && m.NetState.Running)
|
||||
{
|
||||
m.Send(new BeginHandshake());
|
||||
|
||||
|
|
@ -122,7 +122,7 @@ namespace Server.Misc
|
|||
{
|
||||
pvSrc.Trace(state);
|
||||
|
||||
if (state == null || state.Mobile == null || !state.Running)
|
||||
if (state?.Mobile == null || !state.Running)
|
||||
return;
|
||||
|
||||
Mobile m = state.Mobile;
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ namespace Server.Items
|
|||
{
|
||||
from.SendMessage( "You may not throw snow here." );
|
||||
}
|
||||
else if ( pack != null && pack.FindItemByType( new[]{ typeof( SnowPile ), typeof( PileOfGlacialSnow ) } ) != null )
|
||||
else if ( pack?.FindItemByType( new[]{ typeof( SnowPile ), typeof( PileOfGlacialSnow ) } ) != null )
|
||||
{
|
||||
if ( from.BeginAction( typeof( SnowPile ) ) )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ namespace Server.Mobiles
|
|||
// When we have no ammo, we flee
|
||||
Container pack = m_Mobile.Backpack;
|
||||
|
||||
if ( pack == null || pack.FindItemByType( typeof( Arrow ) ) == null )
|
||||
if ( pack?.FindItemByType( typeof( Arrow ) ) == null )
|
||||
{
|
||||
Action = ActionType.Flee;
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static bool IsInsideKhaldun( Mobile from )
|
||||
{
|
||||
return from != null && from.Region != null && from.Region.IsPartOf( "Khaldun" );
|
||||
return @from?.Region != null && @from.Region.IsPartOf( "Khaldun" );
|
||||
}
|
||||
|
||||
private Mobile m_Target;
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ namespace Server.Mobiles
|
|||
|
||||
public bool Devour( Corpse corpse )
|
||||
{
|
||||
if ( corpse == null || corpse.Owner == null ) // sorry we can't devour because the corpse's owner is null
|
||||
if ( corpse?.Owner == null ) // sorry we can't devour because the corpse's owner is null
|
||||
return false;
|
||||
|
||||
if ( corpse.Owner.Body.IsHuman )
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDamage( int amount, Mobile from, bool willKill )
|
||||
{
|
||||
if ( from != null && from.Map != null )
|
||||
if ( @from?.Map != null )
|
||||
{
|
||||
int amt=0;
|
||||
Mobile target = this;
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Server.Mobiles
|
|||
BaseShield shield = Shield;
|
||||
Item twoHanded = from.FindItemOnLayer( Layer.TwoHanded );
|
||||
|
||||
if ( (pack != null && pack.FindItemByType( shield.GetType() ) != null) || ( twoHanded != null && shield.GetType().IsAssignableFrom( twoHanded.GetType() ) ) )
|
||||
if ( (pack?.FindItemByType( shield.GetType() ) != null) || ( twoHanded != null && shield.GetType().IsAssignableFrom( twoHanded.GetType() ) ) )
|
||||
{
|
||||
Say( 1007110 ); // Why dost thou ask about virtue guards when thou art one?
|
||||
shield.Delete();
|
||||
|
|
|
|||
|
|
@ -220,7 +220,7 @@ namespace Server.Mobiles
|
|||
|
||||
VendorItem vi = pv.GetVendorItem( item );
|
||||
|
||||
if ( vi != null && vi.Description != null && vi.Description.Length > 0 )
|
||||
if ( vi?.Description != null && vi.Description.Length > 0 )
|
||||
list.Add( 1043305, vi.Description ); // <br>Seller's Description:<br>"~1_DESC~"
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3266,7 +3266,7 @@ namespace Server.Multis
|
|||
|
||||
public bool IsGuildMember( Mobile m )
|
||||
{
|
||||
if ( m == null || Owner == null || Owner.Guild == null )
|
||||
if ( m == null || Owner?.Guild == null )
|
||||
return false;
|
||||
|
||||
return ( m.Guild == Owner.Guild );
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Items
|
|||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
if ( m_Boat != null && m_Boat.ShipName != null )
|
||||
if ( m_Boat?.ShipName != null )
|
||||
list.Add( 1042884, m_Boat.ShipName ); // the tiller man of the ~1_SHIP_NAME~
|
||||
else
|
||||
base.AddNameProperty( list );
|
||||
|
|
@ -55,7 +55,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( m_Boat != null && m_Boat.ShipName != null )
|
||||
if ( m_Boat?.ShipName != null )
|
||||
LabelTo( from, 1042884, m_Boat.ShipName ); // the tiller man of the ~1_SHIP_NAME~
|
||||
else
|
||||
base.OnSingleClick( from );
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnResponse( Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_From.CheckAlive() || m_From.Backpack == null || m_From.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !m_From.CheckAlive() || m_From.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
switch ( info.ButtonID )
|
||||
|
|
@ -195,7 +195,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnResponse( Network.NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_From.CheckAlive() || m_From.Backpack == null || m_From.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !m_From.CheckAlive() || m_From.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
int index = info.ButtonID - 1;
|
||||
|
|
@ -231,7 +231,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTarget( Mobile from, object o )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
IPoint3D ip = o as IPoint3D;
|
||||
|
|
@ -260,7 +260,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnTargetFinish( Mobile from )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
if ( !m_Placed )
|
||||
|
|
@ -332,7 +332,7 @@ namespace Server.Items
|
|||
|
||||
public void PlacementWarning_Callback( Mobile from, bool okay, object state )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return;
|
||||
|
||||
PreviewHouse prevHouse = (PreviewHouse)state;
|
||||
|
|
@ -447,7 +447,7 @@ namespace Server.Items
|
|||
|
||||
public bool OnPlacement( Mobile from, Point3D p )
|
||||
{
|
||||
if ( !from.CheckAlive() || from.Backpack == null || from.Backpack.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
if ( !@from.CheckAlive() || @from.Backpack?.FindItemByType( typeof( HousePlacementTool ) ) == null )
|
||||
return false;
|
||||
|
||||
ArrayList toMove;
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Server.Multis
|
|||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1061639, Utility.FixHtml( GetName() ) ); // Name: ~1_NAME~
|
||||
list.Add( 1061640, (m_Owner == null || m_Owner.Owner == null) ? "nobody" : m_Owner.Owner.Name ); // Owner: ~1_OWNER~
|
||||
list.Add( 1061640, (m_Owner?.Owner == null) ? "nobody" : m_Owner.Owner.Name ); // Owner: ~1_OWNER~
|
||||
|
||||
if ( m_Owner != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Server.Regions
|
|||
{
|
||||
BaseRegion br = region as BaseRegion;
|
||||
|
||||
if ( br != null && br.m_RuneName != null )
|
||||
if ( br?.m_RuneName != null )
|
||||
return br.m_RuneName;
|
||||
|
||||
region = region.Parent;
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ namespace Server.Regions
|
|||
|
||||
BaseRegion br = reg as BaseRegion;
|
||||
|
||||
if ( br == null || br.Spawns == null )
|
||||
if ( br?.Spawns == null )
|
||||
{
|
||||
from.SendMessage( "There are no spawners in region '{0}'.", reg );
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ namespace Server.SkillHandlers
|
|||
|
||||
m_Thief.SendLocalizedMessage( 1010586 ); // YOU STOLE THE SIGIL!!! (woah, calm down now)
|
||||
|
||||
if ( sig.LastMonolith != null && sig.LastMonolith.Sigil != null ) {
|
||||
if ( sig.LastMonolith?.Sigil != null ) {
|
||||
sig.LastMonolith.Sigil = null;
|
||||
sig.LastStolen = DateTime.UtcNow;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace Server.Misc
|
|||
|
||||
private static bool HasDisconnected( Mobile m )
|
||||
{
|
||||
return ( m.NetState == null || m.NetState.Socket == null );
|
||||
return ( m.NetState?.Socket == null );
|
||||
}
|
||||
|
||||
private static LocationInfo GetRandomDestination()
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ namespace Server.Spells
|
|||
|
||||
TransformContext context = TransformationSpellHelper.GetContext( Caster );
|
||||
|
||||
if ( context != null && context.Spell is ReaperFormSpell )
|
||||
if ( context?.Spell is ReaperFormSpell )
|
||||
damageBonus += ((ReaperFormSpell)context.Spell).SpellDamageBonus;
|
||||
|
||||
damage = AOS.Scale( damage, 100 + damageBonus );
|
||||
|
|
@ -173,7 +173,7 @@ namespace Server.Spells
|
|||
object o = ProtectionSpell.Registry[m_Caster];
|
||||
bool disturb = true;
|
||||
|
||||
if ( o != null && o is double )
|
||||
if ( o is double )
|
||||
{
|
||||
if ( ((double)o) > Utility.RandomDouble()*100.0 )
|
||||
disturb = false;
|
||||
|
|
@ -513,7 +513,7 @@ namespace Server.Spells
|
|||
m_Caster.SendLocalizedMessage( 1072060 ); // You cannot cast a spell while calmed.
|
||||
}
|
||||
#region Dueling
|
||||
else if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
|
||||
else if ( (m_Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, this ) )
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
|
@ -899,7 +899,7 @@ namespace Server.Spells
|
|||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if ( m_Spell == null || m_Spell.m_Caster == null )
|
||||
if ( m_Spell?.m_Caster == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -747,7 +747,7 @@ namespace Server.Spells
|
|||
{
|
||||
PlayerMobile pm = m_TravelCaster as PlayerMobile;
|
||||
|
||||
if ( pm != null && pm.DuelPlayer != null && !pm.DuelPlayer.Eliminated )
|
||||
if ( pm?.DuelPlayer != null && !pm.DuelPlayer.Eliminated )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -880,7 +880,7 @@ namespace Server.Spells
|
|||
{
|
||||
PlayerMobile pm = (PlayerMobile) caster;
|
||||
|
||||
if ( pm == null || pm.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated )
|
||||
if ( pm?.DuelContext == null || !pm.DuelContext.Started || pm.DuelPlayer == null || pm.DuelPlayer.Eliminated )
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ namespace Server.Spells.Chivalry
|
|||
}
|
||||
|
||||
TransformContext context = TransformationSpellHelper.GetContext( m );
|
||||
if ( context != null && context.Spell is NecromancerSpell ) //Trees are not evil! TODO: OSI confirm?
|
||||
if ( context?.Spell is NecromancerSpell ) //Trees are not evil! TODO: OSI confirm?
|
||||
{
|
||||
// transformed ..
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace Server.Spells.Fifth
|
|||
|
||||
PlayerMobile pm = Caster as PlayerMobile;
|
||||
|
||||
if ( pm != null && pm.Race != null )
|
||||
if ( pm?.Race != null )
|
||||
{
|
||||
pm.SetHairMods( pm.Race.RandomHair( pm.Female ), pm.Race.RandomFacialHair( pm.Female ) );
|
||||
pm.HairHue = pm.Race.RandomHairHue();
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ namespace Server.Spells.Necromancy
|
|||
type = c.Owner.GetType();
|
||||
}
|
||||
|
||||
if ( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( ( c.Owner != null ) && ( c.Owner is BaseCreature ) && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) )
|
||||
if ( c.ItemID != 0x2006 || c.Animated || type == typeof( PlayerMobile ) || type == null || ( c.Owner != null && c.Owner.Fame < 100 ) || ( c.Owner is BaseCreature && ( ( ( BaseCreature )c.Owner ).Summoned || ( ( BaseCreature )c.Owner ).IsBonded ) ) )
|
||||
{
|
||||
Caster.SendLocalizedMessage( 1061085 ); // There's not enough life force there to animate.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ namespace Server.Spells.Necromancy
|
|||
BaseCreature check = (BaseCreature)SummonFamiliarSpell.Table[m_From];
|
||||
|
||||
#region Dueling
|
||||
if ( m_From is PlayerMobile && ( (PlayerMobile)m_From ).DuelContext != null && !( (PlayerMobile)m_From ).DuelContext.AllowSpellCast( m_From, m_Spell ) )
|
||||
if ( (m_From as PlayerMobile)?.DuelContext != null && !( (PlayerMobile)m_From ).DuelContext.AllowSpellCast( m_From, m_Spell ) )
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -479,7 +479,7 @@ namespace Server.Spells.Ninjitsu
|
|||
else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type))
|
||||
{
|
||||
#region Dueling
|
||||
if ( m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, m_Spell ) )
|
||||
if ( (m_Caster as PlayerMobile)?.DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast( m_Caster, m_Spell ) )
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
public static ArcaneFocus FindArcaneFocus( Mobile from )
|
||||
{
|
||||
if ( from == null || from.Backpack == null )
|
||||
if ( @from?.Backpack == null )
|
||||
return null;
|
||||
|
||||
if ( from.Holding is ArcaneFocus )
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Server.Spells.Spellweaving
|
|||
BaseCreature pet = (BaseCreature)m;
|
||||
Mobile master = pet.GetMaster();
|
||||
|
||||
if ( master != null && master.NetState != null && Utility.InUpdateRange( pet, master ) )
|
||||
if ( master?.NetState != null && Utility.InUpdateRange( pet, master ) )
|
||||
{
|
||||
master.CloseGump( typeof( PetResurrectGump ) );
|
||||
master.SendGump( new PetResurrectGump( master, pet, hitsScalar ) );
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace Server.Spells.Spellweaving
|
|||
|
||||
HouseRegion r = Region.Find( p, map ).GetRegion( typeof( HouseRegion ) ) as HouseRegion;
|
||||
|
||||
if ( r != null && r.House != null && !r.House.IsFriend( Caster ) )
|
||||
if ( r?.House != null && !r.House.IsFriend( Caster ) )
|
||||
return;
|
||||
|
||||
if ( !map.CanSpawnMobile( p.X, p.Y, p.Z ) )
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Server.Spells.Third
|
|||
else if ( !item.CheckItemUse( Caster, item ) )
|
||||
{
|
||||
}
|
||||
else if ( root != null && root is Mobile && root != Caster )
|
||||
else if ( root is Mobile && root != Caster )
|
||||
{
|
||||
item.OnSnoop( Caster );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ namespace Server
|
|||
|
||||
public override bool Equals( object o )
|
||||
{
|
||||
if ( o == null || !(o is Body) ) return false;
|
||||
if ( !(o is Body) ) return false;
|
||||
|
||||
return ((Body)o).m_BodyID == m_BodyID;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace Server.Items
|
|||
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
if (AccountGold.Enabled && Owner != null && Owner.Account != null && type == TotalType.Gold)
|
||||
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold)
|
||||
{
|
||||
return Owner.Account.TotalGold;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ namespace Server
|
|||
{
|
||||
if (UseEditGump && IsAccessibleTo(from))
|
||||
{
|
||||
if (Editor == null || Editor.Check == null || Editor.Check.Deleted)
|
||||
if (Editor?.Check == null || Editor.Check.Deleted)
|
||||
{
|
||||
Editor = new EditGump(from, this);
|
||||
Editor.Send();
|
||||
|
|
@ -125,7 +125,7 @@ namespace Server
|
|||
{
|
||||
var c = GetSecureTradeCont();
|
||||
|
||||
if (c == null || c.Trade == null)
|
||||
if (c?.Trade == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Server
|
|||
|
||||
public static IEnumerable<NetState> SelectClients(Sector s, Rectangle2D bounds)
|
||||
{
|
||||
return s.Clients.Where(o => o != null && o.Mobile != null && !o.Mobile.Deleted && bounds.Contains(o.Mobile));
|
||||
return s.Clients.Where(o => o?.Mobile != null && !o.Mobile.Deleted && bounds.Contains(o.Mobile));
|
||||
}
|
||||
|
||||
public static IEnumerable<IEntity> SelectEntities(Sector s, Rectangle2D bounds)
|
||||
|
|
|
|||
|
|
@ -1610,7 +1610,7 @@ namespace Server.Network
|
|||
bool rightClick = pvSrc.ReadBoolean();
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( from != null && from.QuestArrow != null )
|
||||
if ( @from?.QuestArrow != null )
|
||||
from.QuestArrow.OnClick( rightClick );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue