More casting fixes
This commit is contained in:
parent
f211efc3bd
commit
20a80ea2f3
40 changed files with 125 additions and 211 deletions
|
|
@ -22,53 +22,41 @@ namespace Server.Mobiles
|
|||
|
||||
public static bool CheckRedFriendship( Mobile m )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( bc.Controlled && bc.ControlMaster is PlayerMobile )
|
||||
return CheckRedFriendship( bc.ControlMaster );
|
||||
else if ( bc.Summoned && bc.SummonMaster is PlayerMobile )
|
||||
if ( bc.Summoned && bc.SummonMaster is PlayerMobile )
|
||||
return CheckRedFriendship( bc.SummonMaster );
|
||||
}
|
||||
|
||||
PlayerMobile player = m as PlayerMobile;
|
||||
|
||||
return player != null && player.SolenFriendship == SolenFriendship.Red;
|
||||
return m is PlayerMobile player && player.SolenFriendship == SolenFriendship.Red;
|
||||
}
|
||||
|
||||
public static bool CheckBlackFriendship( Mobile m )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( bc.Controlled && bc.ControlMaster is PlayerMobile )
|
||||
return CheckBlackFriendship( bc.ControlMaster );
|
||||
else if ( bc.Summoned && bc.SummonMaster is PlayerMobile )
|
||||
if ( bc.Summoned && bc.SummonMaster is PlayerMobile )
|
||||
return CheckBlackFriendship( bc.SummonMaster );
|
||||
}
|
||||
|
||||
PlayerMobile player = m as PlayerMobile;
|
||||
|
||||
return player != null && player.SolenFriendship == SolenFriendship.Black;
|
||||
return m is PlayerMobile player && player.SolenFriendship == SolenFriendship.Black;
|
||||
}
|
||||
|
||||
public static void OnRedDamage( Mobile from )
|
||||
{
|
||||
if ( from is BaseCreature )
|
||||
if ( from is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)from;
|
||||
|
||||
if ( bc.Controlled && bc.ControlMaster is PlayerMobile )
|
||||
OnRedDamage( bc.ControlMaster );
|
||||
else if ( bc.Summoned && bc.SummonMaster is PlayerMobile )
|
||||
OnRedDamage( bc.SummonMaster );
|
||||
}
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null && player.SolenFriendship == SolenFriendship.Red )
|
||||
if ( from is PlayerMobile player && player.SolenFriendship == SolenFriendship.Red )
|
||||
{
|
||||
player.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1054103 ); // The solen revoke their friendship. You will now be considered an intruder.
|
||||
|
||||
|
|
@ -78,19 +66,15 @@ namespace Server.Mobiles
|
|||
|
||||
public static void OnBlackDamage( Mobile from )
|
||||
{
|
||||
if ( from is BaseCreature )
|
||||
if ( from is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)from;
|
||||
|
||||
if ( bc.Controlled && bc.ControlMaster is PlayerMobile )
|
||||
OnBlackDamage( bc.ControlMaster );
|
||||
else if ( bc.Summoned && bc.SummonMaster is PlayerMobile )
|
||||
OnBlackDamage( bc.SummonMaster );
|
||||
}
|
||||
|
||||
PlayerMobile player = from as PlayerMobile;
|
||||
|
||||
if ( player != null && player.SolenFriendship == SolenFriendship.Black )
|
||||
if ( from is PlayerMobile player && player.SolenFriendship == SolenFriendship.Black )
|
||||
{
|
||||
player.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1054103 ); // The solen revoke their friendship. You will now be considered an intruder.
|
||||
|
||||
|
|
@ -98,4 +82,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue