More casting fixes
This commit is contained in:
parent
f211efc3bd
commit
20a80ea2f3
40 changed files with 125 additions and 211 deletions
|
|
@ -176,7 +176,7 @@ namespace Server
|
|||
|
||||
if ( reflectPhys != 0 )
|
||||
{
|
||||
if ( @from is ExodusMinion minion && minion.FieldActive || @from is ExodusOverseer overseer && overseer.FieldActive )
|
||||
if ( from is ExodusMinion minion && minion.FieldActive || from is ExodusOverseer overseer && overseer.FieldActive )
|
||||
{
|
||||
from.FixedParticles( 0x376A, 20, 10, 0x2530, EffectLayer.Waist );
|
||||
from.PlaySound( 0x2F4 );
|
||||
|
|
|
|||
|
|
@ -651,7 +651,7 @@ namespace Server.Guilds
|
|||
|
||||
from.SendGump( new PropertiesGump( from, g ) );
|
||||
|
||||
if ( NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && @from is PlayerMobile pm )
|
||||
if ( NewGuildSystem && from.AccessLevel >= AccessLevel.GameMaster && from is PlayerMobile pm )
|
||||
pm.SendGump( new GuildInfoGump( pm, g ) );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Misc
|
|||
{
|
||||
case 0x002A: // *i resign from my guild*
|
||||
{
|
||||
((Guild)@from.Guild)?.RemoveMember( @from );
|
||||
((Guild)from.Guild)?.RemoveMember( from );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ namespace Server.Misc
|
|||
}
|
||||
case 0x0035: // i renounce my young player status*
|
||||
{
|
||||
if ( @from is PlayerMobile mobile && mobile.Young && !mobile.HasGump( typeof( RenounceYoungGump ) ) )
|
||||
if ( from is PlayerMobile mobile && mobile.Young && !mobile.HasGump( typeof( RenounceYoungGump ) ) )
|
||||
{
|
||||
mobile.SendGump( new RenounceYoungGump() );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ namespace Server.Misc
|
|||
{
|
||||
Mobile from = state.Mobile;
|
||||
|
||||
if ( @from.Guild is Guild guild )
|
||||
if ( from.Guild is Guild guild )
|
||||
{
|
||||
bool locations = pvSrc.ReadByte() != 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ namespace Server
|
|||
|
||||
public static bool CheckML( Mobile from, bool message = true)
|
||||
{
|
||||
if ( @from?.NetState == null )
|
||||
if ( from?.NetState == null )
|
||||
return false;
|
||||
|
||||
if ( from.NetState.SupportsExpansion( Expansion.ML ) )
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace Server.Misc
|
|||
PlayerMobile pmFrom = from as PlayerMobile;
|
||||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
|
||||
if ( pmFrom == null && @from is BaseCreature bcFrom )
|
||||
if ( pmFrom == null && from is BaseCreature bcFrom )
|
||||
{
|
||||
if ( bcFrom.Summoned )
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
|
|
@ -103,7 +103,7 @@ namespace Server.Misc
|
|||
if ( (pmFrom?.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg?.DuelContext != null && pmTarg.DuelContext.Started) )
|
||||
return false;
|
||||
|
||||
if ( @from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) is SafeZone sz /*&& sz.IsDisabled()*/ )
|
||||
if ( from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) is SafeZone sz /*&& sz.IsDisabled()*/ )
|
||||
return false;
|
||||
|
||||
sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
|
||||
|
|
@ -137,7 +137,7 @@ namespace Server.Misc
|
|||
if ( pmFrom?.Young == true || pmTarg?.Young == true )
|
||||
return false; // Young players cannot perform beneficial actions towards older players
|
||||
|
||||
if ( @from.Guild is Guild fromGuild && target.Guild is Guild targetGuild && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) )
|
||||
if ( from.Guild is Guild fromGuild && target.Guild is Guild targetGuild && (targetGuild == fromGuild || fromGuild.IsAlly( targetGuild )) )
|
||||
return true; // Guild members can be beneficial
|
||||
|
||||
return CheckBeneficialStatus( GetGuildStatus( from ), GetGuildStatus( target ) );
|
||||
|
|
@ -153,7 +153,7 @@ namespace Server.Misc
|
|||
PlayerMobile pmTarg = target as PlayerMobile;
|
||||
BaseCreature bcTarg = target as BaseCreature;
|
||||
|
||||
if ( pmFrom == null && @from is BaseCreature bcFrom && bcFrom.Summoned )
|
||||
if ( pmFrom == null && from is BaseCreature bcFrom && bcFrom.Summoned )
|
||||
pmFrom = bcFrom.SummonMaster as PlayerMobile;
|
||||
|
||||
if ( pmTarg == null && bcTarg?.Summoned == true )
|
||||
|
|
@ -177,7 +177,7 @@ namespace Server.Misc
|
|||
if ( (pmFrom?.DuelContext != null && pmFrom.DuelContext.Started) || (pmTarg?.DuelContext != null && pmTarg.DuelContext.Started) )
|
||||
return false;
|
||||
|
||||
if ( @from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) is SafeZone sz /*&& sz.IsDisabled()*/ )
|
||||
if ( from.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) is SafeZone sz /*&& sz.IsDisabled()*/ )
|
||||
return false;
|
||||
|
||||
sz = target.Region.GetRegion( typeof( Engines.ConPVP.SafeZone ) ) as Engines.ConPVP.SafeZone;
|
||||
|
|
@ -191,7 +191,7 @@ namespace Server.Misc
|
|||
if ( map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0 )
|
||||
return true; // In felucca, anything goes
|
||||
|
||||
if ( !from.Player && !(@from is BaseCreature bc && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player ) )
|
||||
if ( !from.Player && !(from is BaseCreature bc && bc.GetMaster() != null && bc.GetMaster().AccessLevel == AccessLevel.Player ) )
|
||||
{
|
||||
if ( !CheckAggressor( from.Aggressors, target ) && !CheckAggressed( from.Aggressed, target ) && pmTarg?.CheckYoungProtection( from ) == true )
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ namespace Server.Misc
|
|||
|
||||
int points =(int)(from.Skills[SkillName.Focus].Value * 0.1);
|
||||
|
||||
if ( (@from is BaseCreature creature && creature.IsParagon) || from is Leviathan )
|
||||
if ( (from is BaseCreature creature && creature.IsParagon) || from is Leviathan )
|
||||
points += 40;
|
||||
|
||||
int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenStam );
|
||||
|
|
@ -137,7 +137,7 @@ namespace Server.Misc
|
|||
|
||||
double totalPoints = focusPoints + medPoints + (from.Meditating ? (medPoints > 13.0 ? 13.0 : medPoints) : 0.0);
|
||||
|
||||
if ( (@from is BaseCreature creature && creature.IsParagon) || from is Leviathan )
|
||||
if ( (from is BaseCreature creature && creature.IsParagon) || from is Leviathan )
|
||||
totalPoints += 40;
|
||||
|
||||
int cappedPoints = AosAttributes.GetValue( from, AosAttribute.RegenMana );
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace Server.Misc
|
|||
if ( gc < 0.01 )
|
||||
gc = 0.01;
|
||||
|
||||
if ( @from is BaseCreature creature && creature.Controlled )
|
||||
if ( from is BaseCreature creature && creature.Controlled )
|
||||
gc *= 2;
|
||||
|
||||
if ( from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) )
|
||||
|
|
@ -183,7 +183,7 @@ namespace Server.Misc
|
|||
if ( Core.AOS && Faction.InSkillLoss( from ) ) //Changed some time between the introduction of AoS and SE.
|
||||
return false;
|
||||
|
||||
if ( AntiMacroCode && @from is PlayerMobile mobile && UseAntiMacro[skill.Info.SkillID] )
|
||||
if ( AntiMacroCode && from is PlayerMobile mobile && UseAntiMacro[skill.Info.SkillID] )
|
||||
return mobile.AntiMacroCheck( skill, obj );
|
||||
|
||||
return true;
|
||||
|
|
@ -196,7 +196,7 @@ namespace Server.Misc
|
|||
if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
|
||||
return;
|
||||
|
||||
if ( @from is BaseCreature creature && creature.IsDeadPet )
|
||||
if ( from is BaseCreature creature && creature.IsDeadPet )
|
||||
return;
|
||||
|
||||
if ( skill.SkillName == SkillName.Focus && from is BaseCreature )
|
||||
|
|
@ -227,7 +227,7 @@ namespace Server.Misc
|
|||
|
||||
#region Scroll of Alacrity
|
||||
|
||||
if ( @from is PlayerMobile pm && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow )
|
||||
if ( from is PlayerMobile pm && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.UtcNow )
|
||||
toGain *= Utility.RandomMinMax(2, 5);
|
||||
#endregion
|
||||
|
||||
|
|
@ -264,7 +264,7 @@ namespace Server.Misc
|
|||
|
||||
public static bool CanRaise( Mobile from, Stat stat )
|
||||
{
|
||||
if ( !(@from is BaseCreature creature && creature.Controlled) )
|
||||
if ( !(from is BaseCreature creature && creature.Controlled) )
|
||||
{
|
||||
if ( from.RawStatTotal >= from.StatCap )
|
||||
return false;
|
||||
|
|
@ -343,7 +343,7 @@ namespace Server.Misc
|
|||
{
|
||||
case Stat.Str:
|
||||
{
|
||||
if ( @from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( (creature.LastStrGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
|
|
@ -355,7 +355,7 @@ namespace Server.Misc
|
|||
}
|
||||
case Stat.Dex:
|
||||
{
|
||||
if ( @from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( (creature.LastDexGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
|
|
@ -367,7 +367,7 @@ namespace Server.Misc
|
|||
}
|
||||
case Stat.Int:
|
||||
{
|
||||
if ( @from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( from is BaseCreature creature && creature.Controlled ) {
|
||||
if ( (creature.LastIntGain + m_PetStatGainDelay) >= DateTime.UtcNow )
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ namespace Server.Misc
|
|||
return;
|
||||
}
|
||||
|
||||
if ( @from is PlayerMobile pm )
|
||||
if ( from is PlayerMobile pm )
|
||||
{
|
||||
int amt = ( pm.Mounted ? 48 : 16 );
|
||||
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ namespace Server.Mobiles
|
|||
|
||||
from.Target = new AIControlMobileTarget(this, order);
|
||||
}
|
||||
else if (@from.Target is AIControlMobileTarget t)
|
||||
else if (from.Target is AIControlMobileTarget t)
|
||||
{
|
||||
if (t.Order == order)
|
||||
t.AddAI(this);
|
||||
|
|
@ -1321,7 +1321,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
bool youngFrom = @from is PlayerMobile mobile && mobile.Young;
|
||||
bool youngFrom = from is PlayerMobile mobile && mobile.Young;
|
||||
bool youngTo = to is PlayerMobile playerMobile && playerMobile.Young;
|
||||
|
||||
if (youngFrom && !youngTo)
|
||||
|
|
@ -1675,7 +1675,7 @@ namespace Server.Mobiles
|
|||
if (from.Map != m_Creature.Map || !from.InRange(m_Creature, 14))
|
||||
return false;
|
||||
|
||||
bool youngFrom = @from is PlayerMobile mobile && mobile.Young;
|
||||
bool youngFrom = from is PlayerMobile mobile && mobile.Young;
|
||||
bool youngTo = to is PlayerMobile playerMobile && playerMobile.Young;
|
||||
|
||||
if (accepted && youngFrom && !youngTo)
|
||||
|
|
@ -1769,7 +1769,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_Mobile.DebugSay("Begin transfer with {0}", to.Name);
|
||||
|
||||
bool youngFrom = @from is PlayerMobile mobile && mobile.Young;
|
||||
bool youngFrom = from is PlayerMobile mobile && mobile.Young;
|
||||
bool youngTo = to is PlayerMobile playerMobile && playerMobile.Young;
|
||||
|
||||
if (youngFrom && !youngTo)
|
||||
|
|
|
|||
|
|
@ -1471,7 +1471,7 @@ namespace Server.Mobiles
|
|||
if ( speechType != null && !willKill )
|
||||
speechType.OnDamage( this, amount );
|
||||
|
||||
m_ReceivedHonorContext?.OnTargetDamaged( @from, amount );
|
||||
m_ReceivedHonorContext?.OnTargetDamaged( from, amount );
|
||||
|
||||
if ( !willKill )
|
||||
{
|
||||
|
|
@ -1480,7 +1480,7 @@ namespace Server.Mobiles
|
|||
CheckDistracted( from );
|
||||
}
|
||||
}
|
||||
else if ( @from is PlayerMobile mobile )
|
||||
else if ( from is PlayerMobile mobile )
|
||||
{
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 10 ), new TimerCallback( mobile.RecoverAmmo ) );
|
||||
}
|
||||
|
|
@ -2367,7 +2367,7 @@ namespace Server.Mobiles
|
|||
|
||||
// Note: Yes, this happens for all questers (regardless of type, e.g. escorts),
|
||||
// even if they can't offer you anything at the moment
|
||||
if ( MLQuestSystem.Enabled && CanGiveMLQuest && @from is PlayerMobile mobile )
|
||||
if ( MLQuestSystem.Enabled && CanGiveMLQuest && from is PlayerMobile mobile )
|
||||
{
|
||||
MLQuestSystem.Tell( this, mobile, 1074893 ); // You need to mark your quest items so I don't take the wrong object. Then speak to me.
|
||||
return false;
|
||||
|
|
@ -4370,7 +4370,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
Container pack = this.Backpack;
|
||||
|
||||
pack?.DisplayTo( @from );
|
||||
pack?.DisplayTo( from );
|
||||
}
|
||||
|
||||
if ( this.DeathAdderCharmable && from.CanBeHarmful( this, false ) )
|
||||
|
|
@ -4382,7 +4382,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
|
||||
if ( MLQuestSystem.Enabled && CanGiveMLQuest && @from is PlayerMobile mobile )
|
||||
if ( MLQuestSystem.Enabled && CanGiveMLQuest && from is PlayerMobile mobile )
|
||||
MLQuestSystem.OnDoubleClick( this, mobile );
|
||||
|
||||
base.OnDoubleClick( from );
|
||||
|
|
@ -4402,7 +4402,7 @@ namespace Server.Mobiles
|
|||
if ( !m_Charmed.DeathAdderCharmable || m_Charmed.Combatant != null || !from.CanBeHarmful( m_Charmed, false ) )
|
||||
return;
|
||||
|
||||
if ( !(SummonFamiliarSpell.Table[@from] is DeathAdder da) || da.Deleted )
|
||||
if ( !(SummonFamiliarSpell.Table[from] is DeathAdder da) || da.Deleted )
|
||||
return;
|
||||
|
||||
if ( !(targeted is Mobile targ) || !from.CanBeHarmful( targ, false ) )
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile target = m_Owner.Focus;
|
||||
|
||||
if ( target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful( target )) )
|
||||
if ( target != null && (target.Deleted || !target.Alive || !m_Owner.CanBeHarmful( target )) )
|
||||
{
|
||||
m_Owner.Focus = null;
|
||||
Stop();
|
||||
|
|
@ -274,8 +274,8 @@ namespace Server.Mobiles
|
|||
TeleportTo( target );
|
||||
target.BoltEffect( 0 );
|
||||
|
||||
if ( target is BaseCreature )
|
||||
((BaseCreature)target).NoKillAwards = true;
|
||||
if ( target is BaseCreature creature )
|
||||
creature.NoKillAwards = true;
|
||||
|
||||
target.Damage( target.HitsMax, m_Owner );
|
||||
target.Kill(); // just in case, maybe Damage is overridden on some shard
|
||||
|
|
@ -394,4 +394,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,10 +20,8 @@ namespace Server.Mobiles
|
|||
|
||||
foreach ( Mobile m in target.GetMobilesInRange( 15 ) )
|
||||
{
|
||||
if ( m is BaseGuard )
|
||||
if ( m is BaseGuard g )
|
||||
{
|
||||
BaseGuard g = (BaseGuard)m;
|
||||
|
||||
if ( g.Focus == null ) // idling
|
||||
{
|
||||
g.Focus = target;
|
||||
|
|
@ -83,4 +81,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -289,8 +289,8 @@ namespace Server.Mobiles
|
|||
TeleportTo( target );
|
||||
target.BoltEffect( 0 );
|
||||
|
||||
if ( target is BaseCreature )
|
||||
((BaseCreature)target).NoKillAwards = true;
|
||||
if ( target is BaseCreature creature )
|
||||
creature.NoKillAwards = true;
|
||||
|
||||
target.Damage( target.HitsMax, m_Owner );
|
||||
target.Kill(); // just in case, maybe Damage is overridden on some shard
|
||||
|
|
|
|||
|
|
@ -132,9 +132,9 @@ namespace Server.Mobiles
|
|||
OfferResurrection( m );
|
||||
}
|
||||
}
|
||||
else if ( this.HealsYoungPlayers && m.Hits < m.HitsMax && m is PlayerMobile && ((PlayerMobile)m).Young )
|
||||
else if ( this.HealsYoungPlayers && m.Hits < m.HitsMax && m is PlayerMobile mobile && mobile.Young )
|
||||
{
|
||||
OfferHeal( (PlayerMobile) m );
|
||||
OfferHeal( mobile );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,8 +114,7 @@ namespace Server.Mobiles
|
|||
this.PlaySound( 0xEE );
|
||||
defender.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "You have been stunned by a colossal blow!" );
|
||||
|
||||
BaseWeapon weapon = this.Weapon as BaseWeapon;
|
||||
if ( weapon != null )
|
||||
if ( this.Weapon is BaseWeapon weapon )
|
||||
weapon.OnHit( this, defender );
|
||||
|
||||
if ( defender.Alive )
|
||||
|
|
@ -128,9 +127,7 @@ namespace Server.Mobiles
|
|||
|
||||
private void Recover_Callback( object state )
|
||||
{
|
||||
Mobile defender = state as Mobile;
|
||||
|
||||
if ( defender != null )
|
||||
if ( state is Mobile defender )
|
||||
{
|
||||
defender.Frozen = false;
|
||||
defender.Combatant = null;
|
||||
|
|
|
|||
|
|
@ -60,9 +60,8 @@ namespace Server.Mobiles
|
|||
|
||||
public void AddArcane( Item item )
|
||||
{
|
||||
if ( item is IArcaneEquip )
|
||||
if ( item is IArcaneEquip eq )
|
||||
{
|
||||
IArcaneEquip eq = (IArcaneEquip)item;
|
||||
eq.CurArcaneCharges = eq.MaxArcaneCharges = 20;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -94,8 +94,8 @@ namespace Server.Mobiles
|
|||
aggressor.PlaySound( 0x307 );
|
||||
aggressor.SendLocalizedMessage( 1040008 ); // Your skin is scorched as the tribal paint burns away!
|
||||
|
||||
if ( aggressor is PlayerMobile )
|
||||
((PlayerMobile)aggressor).SavagePaintExpiration = TimeSpan.Zero;
|
||||
if ( aggressor is PlayerMobile mobile )
|
||||
mobile.SavagePaintExpiration = TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ namespace Server.Mobiles
|
|||
if ( m == this || !CanBeHarmful( m ) )
|
||||
continue;
|
||||
|
||||
if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) )
|
||||
if ( m is BaseCreature creature && (creature.Controlled || creature.Summoned || creature.Team != this.Team) )
|
||||
list.Add( m );
|
||||
else if ( m.Player )
|
||||
list.Add( m );
|
||||
|
|
|
|||
|
|
@ -112,8 +112,7 @@ namespace Server.Mobiles
|
|||
this.PlaySound( 0xEE );
|
||||
defender.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "You have been stunned by a colossal blow!" );
|
||||
|
||||
BaseWeapon weapon = this.Weapon as BaseWeapon;
|
||||
if ( weapon != null )
|
||||
if ( this.Weapon is BaseWeapon weapon )
|
||||
weapon.OnHit( this, defender );
|
||||
|
||||
if ( defender.Alive )
|
||||
|
|
@ -126,9 +125,7 @@ namespace Server.Mobiles
|
|||
|
||||
private void Recover_Callback( object state )
|
||||
{
|
||||
Mobile defender = state as Mobile;
|
||||
|
||||
if ( defender != null )
|
||||
if ( state is Mobile defender )
|
||||
{
|
||||
defender.Frozen = false;
|
||||
defender.Combatant = null;
|
||||
|
|
|
|||
|
|
@ -87,9 +87,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override bool IsEnemy( Mobile m )
|
||||
{
|
||||
PlayerMobile player = m as PlayerMobile;
|
||||
|
||||
if ( player != null && Map == Map.Trammel && X >= 5199 && X <= 5271 && Y >= 1812 && Y <= 1865 ) // Schmendrick's cave
|
||||
if ( m is PlayerMobile player && Map == Map.Trammel && X >= 5199 && X <= 5271 && Y >= 1812 && Y <= 1865 ) // Schmendrick's cave
|
||||
{
|
||||
QuestSystem qs = player.Quest;
|
||||
|
||||
|
|
|
|||
|
|
@ -88,8 +88,8 @@ namespace Server.Mobiles
|
|||
aggressor.PlaySound( 0x307 );
|
||||
aggressor.SendLocalizedMessage( 1040008 ); // Your skin is scorched as the tribal paint burns away!
|
||||
|
||||
if ( aggressor is PlayerMobile )
|
||||
((PlayerMobile)aggressor).SavagePaintExpiration = TimeSpan.Zero;
|
||||
if ( aggressor is PlayerMobile mobile )
|
||||
mobile.SavagePaintExpiration = TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ namespace Server.Mobiles
|
|||
if ( mount != null )
|
||||
mount.Rider = null;
|
||||
|
||||
if ( mount is Mobile )
|
||||
((Mobile)mount).Delete();
|
||||
if ( mount is Mobile mobile )
|
||||
mobile.Delete();
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
}
|
||||
|
|
@ -98,8 +98,8 @@ namespace Server.Mobiles
|
|||
aggressor.PlaySound( 0x307 );
|
||||
aggressor.SendLocalizedMessage( 1040008 ); // Your skin is scorched as the tribal paint burns away!
|
||||
|
||||
if ( aggressor is PlayerMobile )
|
||||
((PlayerMobile)aggressor).SavagePaintExpiration = TimeSpan.Zero;
|
||||
if ( aggressor is PlayerMobile mobile )
|
||||
mobile.SavagePaintExpiration = TimeSpan.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -172,8 +172,8 @@ namespace Server.Mobiles
|
|||
|
||||
if ( mount != null )
|
||||
{
|
||||
if ( mount is SwampDragon )
|
||||
((SwampDragon)mount).HasBarding = false;
|
||||
if ( mount is SwampDragon dragon )
|
||||
dragon.HasBarding = false;
|
||||
|
||||
mount.Rider = null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,9 +111,9 @@ namespace Server.Mobiles
|
|||
|
||||
foreach ( Mobile m in this.GetMobilesInRange( 8 ) )
|
||||
{
|
||||
if ( m is JukaLord && IsFriend( m ) && m.Combatant != null && CanBeBeneficial( m ) && m.CanBeginAction( typeof( JukaMage ) ) && InLOS( m ) )
|
||||
if ( m is JukaLord lord && IsFriend( lord ) && lord.Combatant != null && CanBeBeneficial( lord ) && lord.CanBeginAction( typeof( JukaMage ) ) && InLOS( lord ) )
|
||||
{
|
||||
toBuff = (JukaLord)m;
|
||||
toBuff = lord;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,12 +239,7 @@ namespace Server.Mobiles
|
|||
|
||||
else if ( !Combat( SummonMaster ))
|
||||
{
|
||||
BaseCreature bc = null;
|
||||
if ( Combatant is BaseCreature )
|
||||
{
|
||||
bc = (BaseCreature)Combatant;
|
||||
}
|
||||
if ( Combatant.Player || ( bc != null && ( bc.Controlled || bc.SummonMaster != null )))
|
||||
if ( Combatant.Player || ( Combatant is BaseCreature bc && ( bc.Controlled || bc.SummonMaster != null )))
|
||||
{
|
||||
SummonMaster.Combatant = Combatant;
|
||||
}
|
||||
|
|
@ -258,14 +253,9 @@ namespace Server.Mobiles
|
|||
private bool Combat( Mobile mobile )
|
||||
{
|
||||
Mobile combatant = mobile.Combatant;
|
||||
if ( combatant == null || combatant.Deleted )
|
||||
{
|
||||
if ( combatant == null || combatant.Deleted || combatant.IsDeadBondedPet || !combatant.Alive )
|
||||
return false;
|
||||
}
|
||||
else if ( combatant.IsDeadBondedPet || !combatant.Alive )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,10 +89,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds( Utility.RandomMinMax( 20, 30 ) );
|
||||
|
||||
if ( combatant is BaseCreature )
|
||||
if ( combatant is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)combatant;
|
||||
|
||||
if ( bc.Controlled && bc.ControlMaster != null && !bc.ControlMaster.Deleted && bc.ControlMaster.Alive )
|
||||
{
|
||||
if ( bc.ControlMaster.Map == this.Map && bc.ControlMaster.InRange( this, 12 ) && !UnderEffect( bc.ControlMaster ) )
|
||||
|
|
@ -109,8 +107,6 @@ namespace Server.Mobiles
|
|||
new int[]{-4,-6}, new int[]{4,-6}, new int[]{0,-8}, new int[]{-5,5}, new int[]{5,5}
|
||||
};
|
||||
|
||||
BaseCreature rabid;
|
||||
|
||||
for( int i=0; i<5; i++ )
|
||||
{
|
||||
int x = combatant.X + coord[i][0];
|
||||
|
|
@ -121,6 +117,7 @@ namespace Server.Mobiles
|
|||
if ( !combatant.Map.CanSpawnMobile( loc ) )
|
||||
continue;
|
||||
|
||||
BaseCreature rabid;
|
||||
switch ( i )
|
||||
{
|
||||
case 0: rabid = new EnragedRabbit( this ); break;
|
||||
|
|
@ -155,9 +152,7 @@ namespace Server.Mobiles
|
|||
|
||||
public static void StopEffect( Mobile m, bool message )
|
||||
{
|
||||
Timer t = (Timer)m_Table[m];
|
||||
|
||||
if ( t != null )
|
||||
if ( m_Table[m] is Timer t )
|
||||
{
|
||||
if ( message )
|
||||
m.PublicOverheadMessage( Network.MessageType.Emote, m.SpeechHue, true, "* The open flame begins to scatter the swarm of insects *" );
|
||||
|
|
@ -180,9 +175,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
else
|
||||
{
|
||||
Torch torch = m.FindItemOnLayer( Layer.TwoHanded ) as Torch;
|
||||
|
||||
if ( torch != null && torch.Burning )
|
||||
if ( m.FindItemOnLayer( Layer.TwoHanded ) is Torch torch && torch.Burning )
|
||||
{
|
||||
StopEffect( m, true );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,8 +50,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m is Ferret && m.InRange( this, 3 ) && m.Alive )
|
||||
Talk( (Ferret) m );
|
||||
if ( m is Ferret ferret && ferret.InRange( this, 3 ) && ferret.Alive )
|
||||
Talk( ferret );
|
||||
}
|
||||
|
||||
private static string[] m_Vocabulary = new string[]
|
||||
|
|
|
|||
|
|
@ -74,12 +74,10 @@ namespace Server.Mobiles
|
|||
if ( m == this || !CanBeHarmful( m, false ) || ( Core.AOS && !InLOS( m ) ) )
|
||||
continue;
|
||||
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( bc.Controlled || bc.Summoned || bc.Team != Team )
|
||||
list.Add( m );
|
||||
list.Add( bc );
|
||||
}
|
||||
else if ( m.Player )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -70,9 +70,7 @@ namespace Server.Mobiles
|
|||
if ( target == null || Deleted || !Alive || m_NextPeace > DateTime.UtcNow || 0.1 < Utility.RandomDouble() )
|
||||
return;
|
||||
|
||||
PlayerMobile p = target as PlayerMobile;
|
||||
|
||||
if ( p != null && p.PeacedUntil < DateTime.UtcNow && !p.Hidden && CanBeHarmful( p ) )
|
||||
if ( target is PlayerMobile p && p.PeacedUntil < DateTime.UtcNow && !p.Hidden && CanBeHarmful( p ) )
|
||||
{
|
||||
p.PeacedUntil = DateTime.UtcNow + TimeSpan.FromMinutes( 1 );
|
||||
p.SendLocalizedMessage( 500616 ); // You hear lovely music, and forget to continue battling!
|
||||
|
|
@ -121,12 +119,10 @@ namespace Server.Mobiles
|
|||
|
||||
public static void SuppressRemove( Mobile target )
|
||||
{
|
||||
if ( target != null && m_Suppressed.ContainsKey( target ) )
|
||||
if ( target != null && m_Suppressed[target] is Timer t )
|
||||
{
|
||||
Timer timer = m_Suppressed[ target ];
|
||||
|
||||
if ( timer != null || timer.Running )
|
||||
timer.Stop();
|
||||
if ( t.Running )
|
||||
t.Stop();
|
||||
|
||||
m_Suppressed.Remove( target );
|
||||
}
|
||||
|
|
@ -196,10 +192,8 @@ namespace Server.Mobiles
|
|||
|
||||
foreach ( Mobile m in GetMobilesInRange( RangePerception ) )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature c )
|
||||
{
|
||||
BaseCreature c = (BaseCreature) m;
|
||||
|
||||
if ( c == this || c == target || c.Unprovokable || c.IsParagon || c.BardProvoked || c.AccessLevel != AccessLevel.Player || !c.CanBeHarmful( target ) )
|
||||
continue;
|
||||
|
||||
|
|
|
|||
|
|
@ -231,8 +231,8 @@ namespace Server.Mobiles
|
|||
|
||||
private void EndCacophonic_Callback( object state )
|
||||
{
|
||||
if ( state is Mobile )
|
||||
CacophonicEnd( (Mobile)state );
|
||||
if ( state is Mobile mobile )
|
||||
CacophonicEnd( mobile );
|
||||
}
|
||||
|
||||
public virtual void CacophonicEnd( Mobile from )
|
||||
|
|
@ -362,10 +362,8 @@ namespace Server.Mobiles
|
|||
|
||||
foreach ( Mobile m in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
if ( m is BaseCreature )
|
||||
if ( m is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)m;
|
||||
|
||||
if ( !bc.Controlled && !bc.Summoned )
|
||||
continue;
|
||||
}
|
||||
|
|
@ -398,9 +396,7 @@ namespace Server.Mobiles
|
|||
|
||||
for ( int i = 0; i < items.Count; ++i )
|
||||
{
|
||||
IDurability wearable = items[i] as IDurability;
|
||||
|
||||
if ( wearable != null && wearable.HitPoints >= 10 && Utility.RandomDouble() < 0.25 )
|
||||
if ( items[i] is IDurability wearable && wearable.HitPoints >= 10 && Utility.RandomDouble() < 0.25 )
|
||||
{
|
||||
wearable.HitPoints -= ( wearable.HitPoints == 10 ) ? Utility.Random( 1, 5 ) : 10;
|
||||
damaged = true;
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
if (m == this || !CanBeHarmful(m))
|
||||
continue;
|
||||
if (m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team))
|
||||
if (m is BaseCreature creature && (creature.Controlled || creature.Summoned || creature.Team != this.Team))
|
||||
targets.Add(m);
|
||||
else if (m.Player)
|
||||
targets.Add(m);
|
||||
|
|
@ -187,15 +187,14 @@ namespace Server.Mobiles
|
|||
for (int i = 0; i < targets.Count; ++i)
|
||||
{
|
||||
Mobile m = (Mobile)targets[i];
|
||||
if ( m != null && !m.Deleted && m is PlayerMobile )
|
||||
if ( m != null && !m.Deleted && m is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = m as PlayerMobile;
|
||||
if (pm != null && pm.Mounted)
|
||||
if (pm.Mounted)
|
||||
{
|
||||
pm.Mount.Rider=null;
|
||||
pm.Mount.Rider = null;
|
||||
}
|
||||
}
|
||||
double damage = m.Hits * 0.6;//was .6
|
||||
double damage = m.Hits * 0.6; //was .6
|
||||
if (damage < 10.0)
|
||||
damage = 10.0;
|
||||
else if (damage > 75.0)
|
||||
|
|
|
|||
|
|
@ -158,8 +158,7 @@ namespace Server.Mobiles
|
|||
this.PlaySound( 0xEE );
|
||||
defender.LocalOverheadMessage( MessageType.Regular, 0x3B2, false, "You have been stunned by a colossal blow!" );
|
||||
|
||||
BaseWeapon weapon = this.Weapon as BaseWeapon;
|
||||
if ( weapon != null )
|
||||
if ( this.Weapon is BaseWeapon weapon )
|
||||
weapon.OnHit( this, defender );
|
||||
|
||||
if ( defender.Alive )
|
||||
|
|
@ -172,9 +171,7 @@ namespace Server.Mobiles
|
|||
|
||||
private void Recover_Callback( object state )
|
||||
{
|
||||
Mobile defender = state as Mobile;
|
||||
|
||||
if ( defender != null )
|
||||
if ( state is Mobile defender )
|
||||
{
|
||||
defender.Frozen = false;
|
||||
defender.Combatant = null;
|
||||
|
|
|
|||
|
|
@ -29,9 +29,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
for ( int i = 0; i < pack.Items.Count; i++ )
|
||||
{
|
||||
PlagueBeastBlood blood = pack.Items[ i ] as PlagueBeastBlood;
|
||||
|
||||
if ( blood != null && !blood.Patched )
|
||||
if ( pack.Items[ i ] is PlagueBeastBlood blood && !blood.Patched )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -107,7 +105,7 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnDelete()
|
||||
{
|
||||
if ( m_OpenedBy != null && m_OpenedBy.Holding is PlagueBeastInnard )
|
||||
if ( m_OpenedBy?.Holding is PlagueBeastInnard )
|
||||
m_OpenedBy.Holding.Delete();
|
||||
|
||||
if ( Backpack != null )
|
||||
|
|
|
|||
|
|
@ -64,12 +64,9 @@ namespace Server.Mobiles
|
|||
|
||||
public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
|
||||
{
|
||||
if ( from is BaseCreature )
|
||||
if ( from is BaseCreature bc && (bc.Controlled || bc.BardTarget == this) )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)from;
|
||||
|
||||
if ( bc.Controlled || bc.BardTarget == this )
|
||||
damage = 0; // Immune to pets and provoked creatures
|
||||
damage = 0; // Immune to pets and provoked creatures
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,10 +66,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
|
||||
{
|
||||
if ( from is BaseCreature )
|
||||
if ( @from is BaseCreature bc )
|
||||
{
|
||||
BaseCreature bc = (BaseCreature)from;
|
||||
|
||||
if ( bc.Controlled || bc.BardTarget == this )
|
||||
damage = 0; // Immune to pets and provoked creatures
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,16 +99,11 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnGotMeleeAttack( attacker );
|
||||
|
||||
if ( !Core.SE && 0.2 > Utility.RandomDouble() && attacker is BaseCreature )
|
||||
if ( !Core.SE && 0.2 > Utility.RandomDouble() && attacker is BaseCreature c && c.Controlled && c.ControlMaster != null )
|
||||
{
|
||||
BaseCreature c = (BaseCreature)attacker;
|
||||
|
||||
if ( c.Controlled && c.ControlMaster != null )
|
||||
{
|
||||
c.ControlTarget = c.ControlMaster;
|
||||
c.ControlOrder = OrderType.Attack;
|
||||
c.Combatant = c.ControlMaster;
|
||||
}
|
||||
c.ControlTarget = c.ControlMaster;
|
||||
c.ControlOrder = OrderType.Attack;
|
||||
c.Combatant = c.ControlMaster;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Server.Mobiles
|
|||
if ( this.Map == null )
|
||||
return;
|
||||
|
||||
if ( attacker is BaseCreature && ((BaseCreature)attacker).BardProvoked )
|
||||
if ( attacker is BaseCreature creature && creature.BardProvoked )
|
||||
return;
|
||||
|
||||
if ( 0.2 > Utility.RandomDouble() )
|
||||
|
|
@ -95,9 +95,9 @@ namespace Server.Mobiles
|
|||
|
||||
Mobile target = null;
|
||||
|
||||
if ( attacker is BaseCreature )
|
||||
if ( attacker is BaseCreature baseCreature )
|
||||
{
|
||||
Mobile m = ((BaseCreature)attacker).GetMaster();
|
||||
Mobile m = baseCreature.GetMaster();
|
||||
|
||||
if ( m != null )
|
||||
target = m;
|
||||
|
|
@ -115,7 +115,7 @@ namespace Server.Mobiles
|
|||
if ( m == this || !CanBeHarmful( m ) )
|
||||
continue;
|
||||
|
||||
if ( m is BaseCreature && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned || ((BaseCreature)m).Team != this.Team) )
|
||||
if ( m is BaseCreature bc && (bc.Controlled || bc.Summoned || bc.Team != this.Team))
|
||||
targets.Add( m );
|
||||
else if ( m.Player && m.Alive )
|
||||
targets.Add( m );
|
||||
|
|
|
|||
|
|
@ -140,11 +140,9 @@ namespace Server.Mobiles
|
|||
if (!Flying)
|
||||
{
|
||||
// No message?
|
||||
if (Spell is FlySpell)
|
||||
{
|
||||
FlySpell spell = (FlySpell)Spell;
|
||||
if (Spell is FlySpell spell)
|
||||
spell.Stop();
|
||||
}
|
||||
|
||||
new FlySpell(this).Cast();
|
||||
}
|
||||
else
|
||||
|
|
@ -629,11 +627,9 @@ namespace Server.Mobiles
|
|||
{
|
||||
object[] objs = type.GetCustomAttributes( typeof( FlippableAttribute ), true );
|
||||
|
||||
if ( objs != null && objs.Length > 0 )
|
||||
if ( objs.Length > 0 )
|
||||
{
|
||||
FlippableAttribute fp = objs[0] as FlippableAttribute;
|
||||
|
||||
if ( fp != null )
|
||||
if ( objs[0] is FlippableAttribute fp )
|
||||
{
|
||||
int[] itemIDs = fp.ItemIDs;
|
||||
|
||||
|
|
@ -732,11 +728,9 @@ namespace Server.Mobiles
|
|||
{
|
||||
foreach( Mobile m in World.Mobiles.Values )
|
||||
{
|
||||
if ( m is PlayerMobile )
|
||||
if ( m is PlayerMobile pm )
|
||||
{
|
||||
PlayerMobile pm = (PlayerMobile)m;
|
||||
|
||||
if ((( !pm.Mounted || ( pm.Mount != null && pm.Mount is EtherealMount )) && ( pm.AllFollowers.Count > pm.AutoStabled.Count )) ||
|
||||
if ((( !pm.Mounted || ( pm.Mount is EtherealMount )) && ( pm.AllFollowers.Count > pm.AutoStabled.Count )) ||
|
||||
( pm.Mounted && ( pm.AllFollowers.Count > ( pm.AutoStabled.Count +1 ))))
|
||||
{
|
||||
pm.AutoStablePets(); /* autostable checks summons, et al: no need here */
|
||||
|
|
@ -915,9 +909,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
string notice;
|
||||
|
||||
Accounting.Account acct = from.Account as Accounting.Account;
|
||||
|
||||
if ( acct == null || !acct.HasAccess( from.NetState ) )
|
||||
if ( !(@from.Account is Account acct) || !acct.HasAccess( from.NetState ) )
|
||||
{
|
||||
if ( from.AccessLevel == AccessLevel.Player )
|
||||
notice = "The server is currently under lockdown. No players are allowed to log in at this time.";
|
||||
|
|
@ -939,8 +931,8 @@ namespace Server.Mobiles
|
|||
return;
|
||||
}
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
((PlayerMobile)from).ClaimAutoStabledPets();
|
||||
if ( @from is PlayerMobile mobile )
|
||||
mobile.ClaimAutoStabledPets();
|
||||
}
|
||||
|
||||
private bool m_NoDeltaRecursion;
|
||||
|
|
@ -1021,10 +1013,8 @@ namespace Server.Mobiles
|
|||
}
|
||||
#endregion
|
||||
|
||||
if ( item is BaseWeapon )
|
||||
if ( item is BaseWeapon weapon )
|
||||
{
|
||||
BaseWeapon weapon = (BaseWeapon)item;
|
||||
|
||||
bool drop = false;
|
||||
|
||||
if ( dex < weapon.DexRequirement )
|
||||
|
|
@ -1048,10 +1038,8 @@ namespace Server.Mobiles
|
|||
moved = true;
|
||||
}
|
||||
}
|
||||
else if ( item is BaseArmor )
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
BaseArmor armor = (BaseArmor)item;
|
||||
|
||||
bool drop = false;
|
||||
|
||||
if ( !armor.AllowMaleWearer && !from.Female && from.AccessLevel < AccessLevel.GameMaster )
|
||||
|
|
@ -1096,10 +1084,8 @@ namespace Server.Mobiles
|
|||
moved = true;
|
||||
}
|
||||
}
|
||||
else if ( item is BaseClothing )
|
||||
else if ( item is BaseClothing clothing )
|
||||
{
|
||||
BaseClothing clothing = (BaseClothing)item;
|
||||
|
||||
bool drop = false;
|
||||
|
||||
if ( !clothing.AllowMaleWearer && !from.Female && from.AccessLevel < AccessLevel.GameMaster )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue