Fixes implicit ternary expressions

This commit is contained in:
Kamron Batman 2018-09-14 14:56:48 -07:00
parent c85b0a740c
commit ff26dfa375
345 changed files with 1905 additions and 2336 deletions

View file

@ -92,11 +92,9 @@ namespace Server.Mobiles
return true;
}
else
{
if ( m_Mobile.Debug )
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
if ( m_Mobile.Debug )
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
if ( !m_Mobile.Controlled && !m_Mobile.Summoned && m_Mobile.CanFlee )

View file

@ -117,7 +117,7 @@ namespace Server.Mobiles
if (!isOwner && !isFriend)
return;
else if (isFriend && m_Order != OrderType.Follow && m_Order != OrderType.Stay && m_Order != OrderType.Stop)
if (isFriend && m_Order != OrderType.Follow && m_Order != OrderType.Stay && m_Order != OrderType.Stop)
return;
switch (m_Order)
@ -141,8 +141,7 @@ namespace Server.Mobiles
{
if (m_Mobile.Summoned)
goto default;
else
m_From.SendGump(new Gumps.ConfirmReleaseGump(m_From, m_Mobile));
m_From.SendGump(new Gumps.ConfirmReleaseGump(m_From, m_Mobile));
break;
}
@ -203,7 +202,7 @@ namespace Server.Mobiles
if (!isOwner && !isFriend)
return;
else if (isFriend && order != OrderType.Follow && order != OrderType.Stay && order != OrderType.Stop)
if (isFriend && order != OrderType.Follow && order != OrderType.Stay && order != OrderType.Stop)
return;
if (from.Target == null)
@ -947,10 +946,8 @@ namespace Server.Mobiles
Action = ActionType.Guard;
return true;
}
else
{
m_Mobile.DebugSay("I am fleeing!");
}
m_Mobile.DebugSay("I am fleeing!");
return true;
}
@ -1353,7 +1350,7 @@ namespace Server.Mobiles
/* ~1_NAME~ has granted you the ability to give orders to their pet ~2_PET_NAME~.
* This creature will now consider you as a friend.
*/
to.SendLocalizedMessage(1043246, $"{@from.Name}\t{m_Mobile.Name}");
to.SendLocalizedMessage(1043246, $"{from.Name}\t{m_Mobile.Name}");
m_Mobile.AddPetFriend(to);
@ -1393,7 +1390,7 @@ namespace Server.Mobiles
/* ~1_NAME~ has no longer granted you the ability to give orders to their pet ~2_PET_NAME~.
* This creature will no longer consider you as a friend.
*/
to.SendLocalizedMessage(1070952, $"{@from.Name}\t{m_Mobile.Name}");
to.SendLocalizedMessage(1070952, $"{from.Name}\t{m_Mobile.Name}");
m_Mobile.RemovePetFriend(to);
}
@ -1679,7 +1676,7 @@ namespace Server.Mobiles
}
else if (accepted && !m_Creature.CanBeControlledBy(to))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043248, args); // The pet refuses to be transferred because it will not obey ~1_NAME~.~3_BLANK~
to.SendLocalizedMessage(1043249, args); // The pet will not accept you as a master because it does not trust you.~3_BLANK~
@ -1688,7 +1685,7 @@ namespace Server.Mobiles
}
else if (accepted && !m_Creature.CanBeControlledBy(from))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043250, args); // The pet refuses to be transferred because it will not obey you sufficiently.~3_BLANK~
to.SendLocalizedMessage(1043251, args); // The pet will not accept you as a master because it does not trust ~2_NAME~.~3_BLANK~
@ -1739,7 +1736,7 @@ namespace Server.Mobiles
m_Creature.PlaySound(m_Creature.GetIdleSound());
string args = $"{@from.Name}\t{m_Creature.Name}\t{to.Name}";
string args = $"{from.Name}\t{m_Creature.Name}\t{to.Name}";
from.SendLocalizedMessage(1043253, args); // You have transferred your pet to ~3_GETTER~.
to.SendLocalizedMessage(1043252, args); // ~1_NAME~ has transferred the allegiance of ~2_PET_NAME~ to you.
@ -1773,14 +1770,14 @@ namespace Server.Mobiles
}
else if (!m_Mobile.CanBeControlledBy(to))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043248, args); // The pet refuses to be transferred because it will not obey ~1_NAME~.~3_BLANK~
to.SendLocalizedMessage(1043249, args); // The pet will not accept you as a master because it does not trust you.~3_BLANK~
}
else if (!m_Mobile.CanBeControlledBy(from))
{
string args = $"{to.Name}\t{@from.Name}\t ";
string args = $"{to.Name}\t{from.Name}\t ";
from.SendLocalizedMessage(1043250, args); // The pet refuses to be transferred because it will not obey you sufficiently.~3_BLANK~
to.SendLocalizedMessage(1043251, args); // The pet will not accept you as a master because it does not trust ~2_NAME~.~3_BLANK~
@ -2410,7 +2407,8 @@ namespace Server.Mobiles
m_Mobile.FocusMob = m_Mobile.BardTarget;
return (m_Mobile.FocusMob != null);
}
else if (m_Mobile.Controlled)
if (m_Mobile.Controlled)
{
if (m_Mobile.ControlTarget == null || m_Mobile.ControlTarget.Deleted || m_Mobile.ControlTarget.Hidden || !m_Mobile.ControlTarget.Alive || m_Mobile.ControlTarget.IsDeadBondedPet || !m_Mobile.InRange(m_Mobile.ControlTarget, m_Mobile.RangePerception * 2))
{

View file

@ -30,8 +30,7 @@ namespace Server.Mobiles
if ( ProcessTarget() )
return true;
else
return base.Think();
return base.Think();
}
public virtual bool SmartAI => ( m_Mobile is BaseVendor || m_Mobile is BaseEscortable || m_Mobile is Changeling );
@ -547,14 +546,12 @@ namespace Server.Mobiles
{
return TimeSpan.FromSeconds( m_Mobile.ActiveSpeed );
}
else
{
double del = ScaleBySkill( 3.0, SkillName.Magery );
double min = 6.0 - ( del * 0.75 );
double max = 6.0 - ( del * 1.25 );
return TimeSpan.FromSeconds( min + ( ( max - min ) * Utility.RandomDouble() ) );
}
double del = ScaleBySkill( 3.0, SkillName.Magery );
double min = 6.0 - ( del * 0.75 );
double max = 6.0 - ( del * 1.25 );
return TimeSpan.FromSeconds( min + ( ( max - min ) * Utility.RandomDouble() ) );
}
private Mobile m_LastTarget;
@ -864,45 +861,43 @@ namespace Server.Mobiles
return active;
}
else
Map map = m_Mobile.Map;
if ( map != null )
{
Map map = m_Mobile.Map;
Mobile active = null, inactive = null;
double actPrio = 0.0, inactPrio = 0.0;
if ( map != null )
Mobile comb = m_Mobile.Combatant;
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
{
Mobile active = null, inactive = null;
double actPrio = 0.0, inactPrio = 0.0;
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
}
Mobile comb = m_Mobile.Combatant;
if ( comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel( comb ) )
foreach( Mobile m in m_Mobile.GetMobilesInRange( Core.ML ? 10 : 12 ) )
{
if ( m != m_Mobile && CanDispel( m ) )
{
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt( comb );
}
double prio = m_Mobile.GetDistanceToSqrt( m );
foreach( Mobile m in m_Mobile.GetMobilesInRange( Core.ML ? 10 : 12 ) )
{
if ( m != m_Mobile && CanDispel( m ) )
if ( !activeOnly && ( inactive == null || prio < inactPrio ) )
{
double prio = m_Mobile.GetDistanceToSqrt( m );
inactive = m;
inactPrio = prio;
}
if ( !activeOnly && ( inactive == null || prio < inactPrio ) )
{
inactive = m;
inactPrio = prio;
}
if ( ( m_Mobile.Combatant == m || m.Combatant == m_Mobile ) && ( active == null || prio < actPrio ) )
{
active = m;
actPrio = prio;
}
if ( ( m_Mobile.Combatant == m || m.Combatant == m_Mobile ) && ( active == null || prio < actPrio ) )
{
active = m;
actPrio = prio;
}
}
return active != null ? active : inactive;
}
return active ?? inactive;
}
return null;

View file

@ -59,10 +59,8 @@ namespace Server.Mobiles
Action = ActionType.Wander;
return true;
}
else
{
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
m_Mobile.DebugSay( "I should be closer to {0}", combatant.Name );
}
return true;

View file

@ -118,37 +118,38 @@ namespace Server.Mobiles
from.SayTo( from, 1010095 ); // This must be on your person to use.
return false;
}
else if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
{
// CheckIsUsableBy sends the message
return false;
}
else if ( !BaseMount.CheckMountAllowed( from ) )
if ( !BaseMount.CheckMountAllowed( from ) )
{
// CheckMountAllowed sends the message
return false;
}
else if ( from.Mounted )
if ( from.Mounted )
{
from.SendLocalizedMessage( 1005583 ); // Please dismount first.
return false;
}
else if ( from.IsBodyMod && !from.Body.IsHuman )
if ( from.IsBodyMod && !from.Body.IsHuman )
{
from.SendLocalizedMessage( 1061628 ); // You can't do that while polymorphed.
return false;
}
else if ( from.HasTrade )
if ( from.HasTrade )
{
from.SendLocalizedMessage( 1042317, "", 0x41 ); // You may not ride at this time
return false;
}
else if ( ( from.Followers + FollowerSlots ) > from.FollowersMax )
if ( ( from.Followers + FollowerSlots ) > from.FollowersMax )
{
from.SendLocalizedMessage( 1049679 ); // You have too many followers to summon your mount.
return false;
}
else if ( !Multis.DesignContext.Check( from ) )
if ( !Multis.DesignContext.Check( from ) )
{
// Check sends the message
return false;

View file

@ -42,29 +42,29 @@ namespace Server.Mobiles
if ( rand <= 0 )
return 0x855C;
else if ( rand <= 1 )
if ( rand <= 1 )
return 0x8490;
else if ( rand <= 3 )
if ( rand <= 3 )
return 0x8030;
else if ( rand <= 5 )
if ( rand <= 5 )
return 0x8037;
else if ( rand <= 8 )
if ( rand <= 8 )
return 0x8295;
else if ( rand <= 11 )
if ( rand <= 11 )
return 0x8123;
else if ( rand <= 16 )
if ( rand <= 16 )
return 0x8482;
else if ( rand <= 24 )
if ( rand <= 24 )
return 0x8487;
else if ( rand <= 34 )
if ( rand <= 34 )
return 0x8032;
else if ( rand <= 44 )
if ( rand <= 44 )
return 0x8899;
else if ( rand <= 54 )
if ( rand <= 54 )
return 0x8495;
else if ( rand <= 64 )
if ( rand <= 64 )
return 0x848D;
else if ( rand <= 74 )
if ( rand <= 74 )
return 0x847F;

View file

@ -30,13 +30,13 @@ namespace Server.Mobiles
if ( rand <= 0 )
return 0x8258;
else if ( rand <= 1 )
if ( rand <= 1 )
return 0x88AB;
else if ( rand <= 6 )
if ( rand <= 6 )
return 0x87D4;
else if ( rand <= 16 )
if ( rand <= 16 )
return 0x8163;
else if ( rand <= 26 )
if ( rand <= 26 )
return 0x8295;

View file

@ -592,7 +592,7 @@ namespace Server.Mobiles
{
if ( m_Paragon == value )
return;
else if ( value )
if ( value )
Paragon.Convert( this );
else
Paragon.UnConvert( this );
@ -2822,10 +2822,8 @@ namespace Server.Mobiles
return -GetDistanceToSqrt( m ); // returns closest mobile
}
}
else
{
return double.MinValue;
}
return double.MinValue;
}
// Turn, - for left, + for right

View file

@ -249,7 +249,8 @@ namespace Server.Mobiles
Stop();
return;
}
else if ( m_Owner.Weapon is Fists )
if ( m_Owner.Weapon is Fists )
{
m_Owner.Kill();
Stop();

View file

@ -263,7 +263,8 @@ namespace Server.Mobiles
Stop();
return;
}
else if ( m_Owner.Weapon is Fists )
if ( m_Owner.Weapon is Fists )
{
m_Owner.Kill();
Stop();

View file

@ -43,12 +43,13 @@ namespace Server.Mobiles
Say( 501222 ); // Thou art a criminal. I shall not resurrect thee.
return false;
}
else if ( m.Kills >= 5 )
if ( m.Kills >= 5 )
{
Say( 501223 ); // Thou'rt not a decent and good person. I shall not resurrect thee.
return false;
}
else if ( m.Karma < 0 )
if ( m.Karma < 0 )
{
Say( 501224 ); // Thou hast strayed from the path of virtue, but thou still deservest a second chance.
}

View file

@ -39,12 +39,13 @@ namespace Server.Mobiles
Say( 501222 ); // Thou art a criminal. I shall not resurrect thee.
return false;
}
else if ( m.Kills >= 5 )
if ( m.Kills >= 5 )
{
Say( 501223 ); // Thou'rt not a decent and good person. I shall not resurrect thee.
return false;
}
else if ( m.Karma < 0 )
if ( m.Karma < 0 )
{
Say( 501224 ); // Thou hast strayed from the path of virtue, but thou still deservest a second chance.
}

View file

@ -91,7 +91,8 @@ namespace Server.Mobiles
Kill();
return;
}
else if ( Map != m_Target.Map || !InRange( m_Target, 15 ) )
if ( Map != m_Target.Map || !InRange( m_Target, 15 ) )
{
Map fromMap = Map;
Point3D from = Location;
@ -110,15 +111,13 @@ namespace Server.Mobiles
to = loc;
break;
}
else
{
loc.Z = toMap.GetAverageZ( loc.X, loc.Y );
if ( toMap.CanSpawnMobile( loc ) )
{
to = loc;
break;
}
loc.Z = toMap.GetAverageZ( loc.X, loc.Y );
if ( toMap.CanSpawnMobile( loc ) )
{
to = loc;
break;
}
}
}

View file

@ -79,8 +79,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckBlackFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -80,8 +80,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckBlackFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -86,8 +86,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckBlackFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -87,8 +87,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckBlackFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -80,8 +80,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckBlackFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -78,8 +78,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckRedFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -80,8 +80,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckRedFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -86,8 +86,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckRedFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -86,8 +86,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckRedFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -79,8 +79,7 @@ namespace Server.Mobiles
{
if ( SolenHelper.CheckRedFriendship( m ) )
return false;
else
return base.IsEnemy( m );
return base.IsEnemy( m );
}
public override void OnDamage( int amount, Mobile from, bool willKill )

View file

@ -48,7 +48,7 @@ namespace Server.Mobiles
public static bool IsInsideKhaldun( Mobile from )
{
return @from?.Region != null && @from.Region.IsPartOf( "Khaldun" );
return from?.Region != null && from.Region.IsPartOf( "Khaldun" );
}
private Mobile m_Target;

View file

@ -53,8 +53,7 @@ namespace Server.Mobiles
{
if ( Utility.RandomBool() )
return WeaponAbility.ParalyzingBlow;
else
return WeaponAbility.BleedAttack;
return WeaponAbility.BleedAttack;
}
public override bool GivesMLMinorArtifact => true;

View file

@ -50,8 +50,7 @@ namespace Server.Mobiles
{
if ( Utility.RandomBool() )
return WeaponAbility.ParalyzingBlow;
else
return WeaponAbility.BleedAttack;
return WeaponAbility.BleedAttack;
}
public override bool GivesMLMinorArtifact => true;

View file

@ -64,7 +64,7 @@ namespace Server.Mobiles
public override void AlterMeleeDamageFrom( Mobile from, ref int damage )
{
if ( @from is BaseCreature bc )
if ( from is BaseCreature bc )
{
if ( bc.Controlled || bc.BardTarget == this )
damage = 0; // Immune to pets and provoked creatures

View file

@ -144,7 +144,7 @@ namespace Server.Mobiles
public override void OnDamage( int amount, Mobile from, bool willKill )
{
if ( @from?.Map != null )
if ( from?.Map != null )
{
int amt=0;
Mobile target = this;

View file

@ -93,7 +93,8 @@ namespace Server.Mobiles
{
return;
}
else if (Flying)
if (Flying)
{
Freeze(TimeSpan.FromSeconds(1));
Animate(61, 10, 1, true, false, 0);
@ -232,8 +233,7 @@ namespace Server.Mobiles
{
if ( AccessLevel >= AccessLevel.GameMaster )
return Guilds.RankDefinition.Leader;
else
return m_GuildRank;
return m_GuildRank;
}
set => m_GuildRank = value;
}
@ -880,7 +880,7 @@ namespace Server.Mobiles
{
string notice;
if ( !(@from.Account is Account acct) || !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.";
@ -902,7 +902,7 @@ namespace Server.Mobiles
return;
}
if ( @from is PlayerMobile mobile )
if ( from is PlayerMobile mobile )
mobile.ClaimAutoStabledPets();
}
@ -2526,10 +2526,10 @@ namespace Server.Mobiles
WeightOverloading.FatigueOnDamage( this, amount );
m_ReceivedHonorContext?.OnTargetDamaged( @from, amount );
m_SentHonorContext?.OnSourceDamaged( @from, amount );
m_ReceivedHonorContext?.OnTargetDamaged( from, amount );
m_SentHonorContext?.OnSourceDamaged( from, amount );
if ( willKill && @from is PlayerMobile mobile )
if ( willKill && from is PlayerMobile mobile )
Timer.DelayCall( TimeSpan.FromSeconds( 10 ), mobile.RecoverAmmo );
base.OnDamage( amount, from, willKill );
@ -2857,18 +2857,16 @@ namespace Server.Mobiles
{
return true;
}
else
{
for (int i = 0; i < m_StuckMenuUses.Length; ++i)
{
if ((DateTime.UtcNow - m_StuckMenuUses[i]) > TimeSpan.FromDays(1.0))
{
return true;
}
}
return false;
for (int i = 0; i < m_StuckMenuUses.Length; ++i)
{
if ((DateTime.UtcNow - m_StuckMenuUses[i]) > TimeSpan.FromDays(1.0))
{
return true;
}
}
return false;
}
public void UsedStuckMenu()
@ -3218,8 +3216,7 @@ namespace Server.Mobiles
++count.Count;
if ( count.Count <= SkillCheck.Allowance )
return true;
else
return false;
return false;
}
tbl[obj] = count = new CountAndTimeStamp();
@ -3716,8 +3713,7 @@ namespace Server.Mobiles
{
if ( NetState != null )
return m_GameTime + (DateTime.UtcNow - m_SessionStart);
else
return m_GameTime;
return m_GameTime;
}
}
@ -4388,7 +4384,7 @@ namespace Server.Mobiles
if ( Region is BaseRegion region && !region.YoungProtected )
return false;
if ( @from is BaseCreature creature && creature.IgnoreYoungProtection )
if ( from is BaseCreature creature && creature.IgnoreYoungProtection )
return false;
if ( Quest != null && Quest.IgnoreYoungProtection( from ) )

View file

@ -50,10 +50,11 @@ namespace Server.Mobiles
double random = Utility.RandomDouble();
if ( 0.05 >= random )
return CreateArtifact( UniqueList );
else if ( 0.15 >= random )
if ( 0.15 >= random )
return CreateArtifact( SharedList );
else if ( 0.30 >= random )
if ( 0.30 >= random )
return CreateArtifact( DecorativeList );
return null;
}
@ -169,15 +170,13 @@ namespace Server.Mobiles
m.AddToBackpack( ps );
}
if ( m is PlayerMobile )
if ( m is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m;
for( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
if ( prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( pm, prot ) )
continue;
int chance = 0;

View file

@ -291,15 +291,13 @@ namespace Server.Mobiles
m.SendLocalizedMessage( 1049524 ); // You have received a scroll of power!
m.AddToBackpack( new StatCapScroll( 225 + level ) );
if ( m is PlayerMobile )
if ( m is PlayerMobile pm )
{
PlayerMobile pm = (PlayerMobile)m;
for ( int j = 0; j < pm.JusticeProtectors.Count; ++j )
{
Mobile prot = (Mobile)pm.JusticeProtectors[j];
Mobile prot = pm.JusticeProtectors[j];
if ( prot.Map != m.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( m, prot ) )
if ( prot.Map != pm.Map || prot.Kills >= 5 || prot.Criminal || !JusticeVirtue.CheckMapRegion( pm, prot ) )
continue;
int chance = 0;
@ -377,11 +375,9 @@ namespace Server.Mobiles
return base.OnBeforeDeath();
}
else
{
Morph();
return false;
}
Morph();
return false;
}
Dictionary<Mobile, int> m_DamageEntries;
@ -414,7 +410,7 @@ namespace Server.Mobiles
else
m_DamageEntries.Add( from, amount );
from.SendMessage($"Total Damage: {m_DamageEntries[@from]}");
from.SendMessage($"Total Damage: {m_DamageEntries[from]}");
}
public void AwardArtifact( Item artifact )
@ -476,10 +472,11 @@ namespace Server.Mobiles
double random = Utility.RandomDouble();
if ( 0.05 >= random )
return CreateArtifact( UniqueList );
else if ( 0.15 >= random )
if ( 0.15 >= random )
return CreateArtifact( SharedList );
else if ( 0.30 >= random )
if ( 0.30 >= random )
return CreateArtifact( DecorativeList );
return null;
}
@ -560,15 +557,13 @@ namespace Server.Mobiles
to = new Point3D( x, y, m_Owner.Z );
break;
}
else
{
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
to = new Point3D( x, y, z );
break;
}
int z = map.GetAverageZ( x, y );
if ( map.CanSpawnMobile( x, y, z ) )
{
to = new Point3D( x, y, z );
break;
}
}

View file

@ -176,10 +176,8 @@ namespace Server.Mobiles
if ( m == m_Owner || m == m_Owner.Harrower || !m_Owner.CanBeHarmful( m ) )
continue;
if ( m is BaseCreature )
if ( m is BaseCreature bc )
{
BaseCreature bc = m as BaseCreature;
if ( bc.Controlled || bc.Summoned )
m_ToDrain.Add( m );
}

View file

@ -71,8 +71,7 @@ namespace Server.Mobiles
}
}
List<MLQuest> result = new List<MLQuest>();
result.Add( m_MLQuest );
List<MLQuest> result = new List<MLQuest> { m_MLQuest };
return result;
}
@ -105,7 +104,7 @@ namespace Server.Mobiles
[CommandProperty(AccessLevel.GameMaster)]
public string Destination
{
get => m_Destination == null ? null : m_Destination.Name;
get => m_Destination?.Name;
set { m_DestinationString = value; m_Destination = EDI.Find(value); }
}
@ -220,7 +219,8 @@ namespace Server.Mobiles
Say("I am looking to go to {0}, will you take me?", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name);
return true;
}
else if (escorter == m)
if (escorter == m)
{
Say("Lead on! Payment will be made when we arrive in {0}.", (dest.Name == "Ocllo" && m.Map == Map.Trammel) ? "Haven" : dest.Name);
return true;
@ -252,14 +252,15 @@ namespace Server.Mobiles
Say("I see you already have an escort.");
return false;
}
else if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + EscortDelay) >= DateTime.UtcNow)
if (m is PlayerMobile && (((PlayerMobile)m).LastEscortTime + EscortDelay) >= DateTime.UtcNow)
{
int minutes = (int)Math.Ceiling(((((PlayerMobile)m).LastEscortTime + EscortDelay) - DateTime.UtcNow).TotalMinutes);
Say("You must rest {0} minute{1} before we set out on this journey.", minutes, minutes == 1 ? "" : "s");
return false;
}
else if (SetControlMaster(m))
if (SetControlMaster(m))
{
m_LastSeenEscorter = DateTime.UtcNow;
@ -391,11 +392,9 @@ namespace Server.Mobiles
Timer.DelayCall(TimeSpan.FromSeconds(5.0), Delete);
return null;
}
else
{
ControlOrder = OrderType.Stay;
return master;
}
ControlOrder = OrderType.Stay;
return master;
}
if (ControlOrder != OrderType.Follow)
@ -585,8 +584,7 @@ namespace Server.Mobiles
{
if (!Core.ML)
return m_TownNames;
else
return m_MLTownNames;
return m_MLTownNames;
}
public virtual string PickRandomDestination()

View file

@ -20,8 +20,7 @@ namespace Server.Mobiles
{
if ( Core.ML )
return m_MLDestinations;
else
return m_Dungeons;
return m_Dungeons;
}
[Constructible]

View file

@ -97,8 +97,7 @@ namespace Server.Mobiles
{
if ( item.Name != null )
return item.Name;
else
return item.LabelNumber.ToString();
return item.LabelNumber.ToString();
}
public bool IsSellable( Item item )

View file

@ -230,7 +230,7 @@ namespace Server.Mobiles
from.Stabled.Remove( pet );
(@from as PlayerMobile)?.AutoStabled.Remove( pet );
(from as PlayerMobile)?.AutoStabled.Remove( pet );
}
else
{
@ -373,7 +373,7 @@ namespace Server.Mobiles
from.Stabled.RemoveAt( i );
(@from as PlayerMobile)?.AutoStabled.Remove( pet );
(from as PlayerMobile)?.AutoStabled.Remove( pet );
--i;
@ -468,4 +468,4 @@ namespace Server.Mobiles
int version = reader.ReadInt();
}
}
}
}

View file

@ -40,12 +40,13 @@ namespace Server.Mobiles
SayTo( pm, 502089 ); // You cannot be a member of the Thieves' Guild while you are Young.
return false;
}
else if ( pm.Kills > 0 )
if ( pm.Kills > 0 )
{
SayTo( pm, 501050 ); // This guild is for cunning thieves, not oafish cutthroats.
return false;
}
else if ( pm.Skills[SkillName.Stealing].Base < 60.0 )
if ( pm.Skills[SkillName.Stealing].Base < 60.0 )
{
SayTo( pm, 501051 ); // You must be at least a journeyman pickpocket to join this elite organization.
return false;

View file

@ -82,17 +82,13 @@ namespace Server.Mobiles
deed.Delete();
return true;
}
else
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500390 ); // Your bank box is full.
return false;
}
}
else
{
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500607 ); // I'm not interested in that.
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500390 ); // Your bank box is full.
return false;
}
PublicOverheadMessage( MessageType.Regular, 0x3B2, 500607 ); // I'm not interested in that.
return false;
}
return base.OnDragDrop (from, dropped);

View file

@ -935,7 +935,7 @@ namespace Server.Mobiles
AddHtml( 250, 95, 500, 20, "Change this tip message", false, false );
AddHtml( 100, 190, 50, 20, "Message", false, false );
AddHtml( 100, 210, 450, 40, m_Barkeeper.TipMessage == null ? "No current message" : m_Barkeeper.TipMessage, true, false );
AddHtml( 100, 210, 450, 40, m_Barkeeper.TipMessage ?? "No current message", true, false );
AddButton( 60, 210, 4005, 4007, GetButtonID( 3, 0 ), GumpButtonType.Reply, 0 );
@ -951,7 +951,7 @@ namespace Server.Mobiles
AddHtml( 250, 95, 500, 20, "Remove this tip message", false, false );
AddHtml( 100, 190, 50, 20, "Message", false, false );
AddHtml( 100, 210, 450, 40, m_Barkeeper.TipMessage == null ? "No current message" : m_Barkeeper.TipMessage, true, false );
AddHtml( 100, 210, 450, 40, m_Barkeeper.TipMessage ?? "No current message", true, false );
AddButton( 60, 210, 4005, 4007, GetButtonID( 4, 0 ), GumpButtonType.Reply, 0 );

View file

@ -568,21 +568,19 @@ namespace Server.Mobiles
{
return ChargePerRealWorldDay / 12;
}
else
long total = 0;
foreach ( VendorItem vi in m_SellItems.Values )
{
long total = 0;
foreach ( VendorItem vi in m_SellItems.Values )
{
total += vi.Price;
}
total -= 500;
if ( total < 0 )
total = 0;
return (int)( 20 + (total / 500) );
total += vi.Price;
}
total -= 500;
if ( total < 0 )
total = 0;
return (int)( 20 + (total / 500) );
}
}
@ -600,10 +598,8 @@ namespace Server.Mobiles
return (int)( 60 + (total / 500) * 3 );
}
else
{
return ChargePerDay * 12;
}
return ChargePerDay * 12;
}
}
@ -616,10 +612,8 @@ namespace Server.Mobiles
{
return House.IsOwner( m );
}
else
{
return m == Owner;
}
return m == Owner;
}
protected List<Item> GetItems()
@ -883,49 +877,39 @@ namespace Server.Mobiles
return true;
}
else
{
from.SendLocalizedMessage( 1062493 ); // Your vendor has sufficient funds for operation and cannot accept this gold.
return false;
}
from.SendLocalizedMessage( 1062493 ); // Your vendor has sufficient funds for operation and cannot accept this gold.
return false;
}
else
if ( BankAccount < 1000000 )
{
if ( BankAccount < 1000000 )
{
SayTo( from, 503210 ); // I'll take that to fund my services.
SayTo( from, 503210 ); // I'll take that to fund my services.
BankAccount += item.Amount;
item.Delete();
return true;
}
else
{
from.SendLocalizedMessage( 1062493 ); // Your vendor has sufficient funds for operation and cannot accept this gold.
return false;
}
}
}
else
{
bool newItem = ( GetVendorItem( item ) == null );
if ( Backpack != null && Backpack.TryDropItem( from, item, false ) )
{
if ( newItem )
OnItemGiven( from, item );
BankAccount += item.Amount;
item.Delete();
return true;
}
else
{
SayTo( from, 503211 ); // I can't carry any more.
return false;
}
from.SendLocalizedMessage( 1062493 ); // Your vendor has sufficient funds for operation and cannot accept this gold.
return false;
}
bool newItem = ( GetVendorItem( item ) == null );
if ( Backpack != null && Backpack.TryDropItem( from, item, false ) )
{
if ( newItem )
OnItemGiven( from, item );
return true;
}
SayTo( from, 503211 ); // I can't carry any more.
return false;
}
public override bool CheckNonlocalDrop( Mobile from, Item item, Item target )
@ -940,11 +924,9 @@ namespace Server.Mobiles
return true;
}
else
{
SayTo( from, 503209 ); // I can only take item from the shop owner.
return false;
}
SayTo( from, 503209 ); // I can only take item from the shop owner.
return false;
}
private void NonLocalDropCallback( object state )
@ -990,13 +972,12 @@ namespace Server.Mobiles
{
return true;
}
else
{
SayTo( from, 503223 ); // If you'd like to purchase an item, just ask.
return false;
}
SayTo( from, 503223 ); // If you'd like to purchase an item, just ask.
return false;
}
else if ( BaseHouse.NewVendorSystem && IsOwner( from ) )
if ( BaseHouse.NewVendorSystem && IsOwner( from ) )
{
return true;
}
@ -1359,8 +1340,7 @@ namespace Server.Mobiles
{
if ( BaseHouse.NewVendorSystem )
return TimeSpan.FromDays( 1.0 );
else
return TimeSpan.FromMinutes( Clock.MinutesPerUODay );
return TimeSpan.FromMinutes( Clock.MinutesPerUODay );
}
private PlayerVendor m_Vendor;