Fixes more casting
This commit is contained in:
parent
61937d9c97
commit
e77d695684
91 changed files with 512 additions and 908 deletions
|
|
@ -25,9 +25,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -44,4 +42,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,16 +35,15 @@ namespace Server
|
|||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( targeted == pm )
|
||||
{
|
||||
EmbraceHonor( pm );
|
||||
}
|
||||
else if ( targeted is Mobile )
|
||||
Honor( pm, (Mobile) targeted );
|
||||
else if ( targeted is Mobile mobile )
|
||||
Honor( pm, mobile );
|
||||
}
|
||||
|
||||
protected override void OnTargetOutOfRange( Mobile from, object targeted )
|
||||
|
|
@ -145,8 +144,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
BaseCreature cret = target as BaseCreature;
|
||||
if ( target.Body.IsHuman && (cret == null || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) )
|
||||
if ( target.Body.IsHuman && (!(target is BaseCreature cret) || (!cret.AlwaysAttackable && !cret.AlwaysMurderer)) )
|
||||
{
|
||||
|
||||
if ( reg == null || reg.IsDisabled() )
|
||||
|
|
@ -170,8 +168,7 @@ namespace Server
|
|||
return;
|
||||
}
|
||||
|
||||
if ( source.SentHonorContext != null )
|
||||
source.SentHonorContext.Cancel();
|
||||
source.SentHonorContext?.Cancel();
|
||||
|
||||
new HonorContext( source, target );
|
||||
|
||||
|
|
@ -283,7 +280,7 @@ namespace Server
|
|||
m_HonorDamage += amount * 0.8;
|
||||
}
|
||||
}
|
||||
else if ( from is BaseCreature && ((BaseCreature)from).GetMaster() == m_Source )
|
||||
else if ( from is BaseCreature creature && creature.GetMaster() == m_Source )
|
||||
{
|
||||
m_HonorDamage += amount * 0.8;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,9 +47,7 @@ namespace Server
|
|||
if ( !from.CheckAlive() )
|
||||
return;
|
||||
|
||||
PlayerMobile protector = from as PlayerMobile;
|
||||
|
||||
if ( protector == null )
|
||||
if ( !(from is PlayerMobile protector) )
|
||||
return;
|
||||
|
||||
if ( !VirtueHelper.IsSeeker( protector, VirtueName.Justice ) )
|
||||
|
|
@ -159,17 +157,13 @@ namespace Server
|
|||
|
||||
public static void RejectDelay_Callback( object state )
|
||||
{
|
||||
Mobile m = state as Mobile;
|
||||
|
||||
if ( m != null )
|
||||
if ( state is Mobile m )
|
||||
m.EndAction( typeof( JusticeVirtue ) );
|
||||
}
|
||||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -207,7 +201,7 @@ namespace Server
|
|||
AddImageTiled( 15, 15, 365, 190, 2624 );
|
||||
AddAlphaRegion( 15, 15, 365, 190 );
|
||||
|
||||
AddHtmlLocalized( 30, 20, 360, 25, 1049365, 0x7FFF, false, false ); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
|
||||
AddHtmlLocalized( 30, 20, 360, 25, 1049365, 0x7FFF, false, false ); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
|
||||
AddLabel( 90, 55, 1153, protector.Name );
|
||||
|
||||
AddImage( 50, 45, 9005 );
|
||||
|
|
@ -247,4 +241,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -61,9 +59,7 @@ namespace Server
|
|||
if ( from.Alive )
|
||||
return;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
if ( from.Criminal )
|
||||
|
|
@ -94,14 +90,10 @@ namespace Server
|
|||
if ( !from.CheckAlive() )
|
||||
return;
|
||||
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
Mobile targ = targeted as Mobile;
|
||||
|
||||
if ( targ == null )
|
||||
if ( !(targeted is Mobile targ) )
|
||||
return;
|
||||
|
||||
if ( !ValidateCreature( targ ) )
|
||||
|
|
@ -173,7 +165,7 @@ namespace Server
|
|||
|
||||
public static bool ValidateCreature( Mobile m )
|
||||
{
|
||||
if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned) )
|
||||
if ( m is BaseCreature creature && (creature.Controlled || creature.Summoned) )
|
||||
return false;
|
||||
|
||||
return ( m is Lich || m is Succubus || m is Daemon || m is EvilMage || m is EnslavedGargoyle || m is GargoyleEnforcer );
|
||||
|
|
|
|||
|
|
@ -30,9 +30,7 @@ namespace Server
|
|||
|
||||
public static void CheckAtrophy( Mobile from )
|
||||
{
|
||||
PlayerMobile pm = from as PlayerMobile;
|
||||
|
||||
if ( pm == null )
|
||||
if ( !(from is PlayerMobile pm) )
|
||||
return;
|
||||
|
||||
try
|
||||
|
|
@ -52,9 +50,7 @@ namespace Server
|
|||
|
||||
public static void Valor( Mobile from, object targ )
|
||||
{
|
||||
IdolOfTheChampion idol = targ as IdolOfTheChampion;
|
||||
|
||||
if ( idol == null || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted )
|
||||
if ( !(targ is IdolOfTheChampion idol) || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted )
|
||||
from.SendLocalizedMessage( 1054035 ); // You must target a Champion Idol to challenge the Champion's spawn!
|
||||
else if ( from.Hidden )
|
||||
from.SendLocalizedMessage( 1052015 ); // You cannot do that while hidden.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue