Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -111,19 +111,16 @@ namespace Server.Mobiles
|
|||
if (m_Rider == null)
|
||||
return;
|
||||
|
||||
Mobile attacker = from;
|
||||
if (attacker == null)
|
||||
attacker = m_Rider.FindMostRecentDamager(true);
|
||||
Mobile attacker = from ?? m_Rider.FindMostRecentDamager(true);
|
||||
|
||||
if (!(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < NextMountAbility))
|
||||
if (DoMountAbility(amount, from))
|
||||
if (!(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < NextMountAbility)
|
||||
&& DoMountAbility(amount, from))
|
||||
NextMountAbility = DateTime.UtcNow + MountAbilityDelay;
|
||||
}
|
||||
|
||||
public override bool OnBeforeDeath()
|
||||
{
|
||||
Rider = null;
|
||||
|
||||
return base.OnBeforeDeath();
|
||||
}
|
||||
|
||||
|
|
@ -351,4 +348,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ namespace Server.Mobiles
|
|||
public class Beetle : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Beetle() : this("a giant beetle")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Beetle(string name) : base(name, 0x317, 0x3EBC, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.25, 0.5)
|
||||
public Beetle(string name = "a giant beetle") :
|
||||
base(name, 0x317, 0x3EBC, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.25, 0.5)
|
||||
{
|
||||
SetStr(300);
|
||||
SetDex(100);
|
||||
|
|
@ -172,4 +168,4 @@ namespace Server.Mobiles
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class DesertOstard : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public DesertOstard() : this("a desert ostard")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public DesertOstard(string name) : base(name, 0xD2, 0x3EA3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public DesertOstard(string name = "a desert ostard") :
|
||||
base(name, 0xD2, 0x3EA3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x270;
|
||||
|
||||
|
|
@ -62,4 +58,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ namespace Server.Mobiles
|
|||
if (m_Rider != null)
|
||||
m_Rider.Followers -= FollowerSlots;
|
||||
|
||||
if (m_Rider != null && m_Rider.Followers < 0)
|
||||
if (m_Rider?.Followers < 0)
|
||||
m_Rider.Followers = 0;
|
||||
}
|
||||
|
||||
|
|
@ -161,8 +161,9 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null)) return false;
|
||||
if (!BaseMount.CheckMountAllowed(from)) return false;
|
||||
if (IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this) || !BaseMount.CheckMountAllowed(from))
|
||||
return false;
|
||||
|
||||
if (from.Mounted)
|
||||
{
|
||||
from.SendLocalizedMessage(1005583); // Please dismount first.
|
||||
|
|
@ -187,9 +188,7 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!DesignContext.Check(from)) return false;
|
||||
|
||||
return true;
|
||||
return DesignContext.Check(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
|
|
@ -202,10 +201,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
if (m_IsDonationItem)
|
||||
LabelTo(from, "Donation Ethereal");
|
||||
else
|
||||
LabelTo(from, "Veteran Reward");
|
||||
LabelTo(from, m_IsDonationItem ? "Donation Ethereal" : "Veteran Reward");
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
|
|
@ -840,4 +836,4 @@ namespace Server.Mobiles
|
|||
if (version <= 1 && Hue != 0) Hue = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,8 @@ namespace Server.Mobiles
|
|||
public class FireSteed : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public FireSteed() : this("a fire steed")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FireSteed(string name) : base(name, 0xBE, 0x3E9E, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public FireSteed(string name = "a fire steed") :
|
||||
base(name, 0xBE, 0x3E9E, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0xA8;
|
||||
|
||||
|
|
@ -85,4 +81,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class ForestOstard : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public ForestOstard() : this("a forest ostard")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ForestOstard(string name) : base(name, 0xDB, 0x3EA5, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public ForestOstard(string name = "a forest ostard") :
|
||||
base(name, 0xDB, 0x3EA5, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Hue = Utility.RandomSlimeHue() | 0x8000;
|
||||
|
||||
|
|
@ -63,4 +59,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class FrenziedOstard : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public FrenziedOstard() : this("a frenzied ostard")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public FrenziedOstard(string name) : base(name, 0xDA, 0x3EA4, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public FrenziedOstard(string name = "a frenzied ostard") :
|
||||
base(name, 0xDA, 0x3EA4, AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
Hue = Race.Human.RandomHairHue() | 0x8000;
|
||||
|
||||
|
|
@ -66,4 +62,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class HellSteed : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public HellSteed() : this("a hellsteed")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public HellSteed(string name) : base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public HellSteed(string name = "a hellsteed") :
|
||||
base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
SetStats(this);
|
||||
}
|
||||
|
|
@ -61,4 +57,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -13,12 +13,8 @@ namespace Server.Mobiles
|
|||
};
|
||||
|
||||
[Constructible]
|
||||
public Horse() : this("a horse")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Horse(string name) : base(name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public Horse(string name = "a horse") :
|
||||
base(name, 0xE2, 0x3EA0, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
int random = Utility.Random(4);
|
||||
|
||||
|
|
@ -75,4 +71,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ namespace Server.Mobiles
|
|||
public class Kirin : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Kirin() : this("a ki-rin")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Kirin(string name) : base(name, 132, 0x3EAD, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
public Kirin(string name = "a ki-rin") :
|
||||
base(name, 132, 0x3EAD, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3C5;
|
||||
|
||||
|
|
@ -129,4 +125,4 @@ namespace Server.Mobiles
|
|||
AI = AIType.AI_Mage;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Server.Engines.Plants;
|
||||
using Server.Items;
|
||||
|
|
|
|||
|
|
@ -5,12 +5,8 @@ namespace Server.Mobiles
|
|||
public class Nightmare : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Nightmare() : this("a nightmare")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Nightmare(string name) : base(name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
public Nightmare(string name = "a nightmare") :
|
||||
base(name, 0x74, 0x3EA7, AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = Core.AOS ? 0xA8 : 0x16A;
|
||||
|
||||
|
|
@ -120,4 +116,4 @@ namespace Server.Mobiles
|
|||
BaseSoundID = 0x16A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class RidableLlama : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public RidableLlama() : this("a ridable llama")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public RidableLlama(string name) : base(name, 0xDC, 0x3EA6, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public RidableLlama(string name = "a ridable llama") :
|
||||
base(name, 0xDC, 0x3EA6, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
|
|
@ -65,4 +61,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class Ridgeback : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Ridgeback() : this("a ridgeback")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Ridgeback(string name) : base(name, 187, 0x3EBA, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public Ridgeback(string name = "a ridgeback") :
|
||||
base(name, 187, 0x3EBA, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
|
|
@ -76,4 +72,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SavageRidgeback : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SavageRidgeback() : this("a savage ridgeback")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SavageRidgeback(string name) : base(name, 188, 0x3EB8, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SavageRidgeback(string name = "a savage ridgeback") :
|
||||
base(name, 188, 0x3EB8, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x3F3;
|
||||
|
||||
|
|
@ -76,4 +72,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,8 @@ namespace Server.Mobiles
|
|||
public class ScaledSwampDragon : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public ScaledSwampDragon() : this("a swamp dragon")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public ScaledSwampDragon(string name) : base(name, 0x31F, 0x3EBE, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2,
|
||||
0.4)
|
||||
public ScaledSwampDragon(string name = "a swamp dragon") :
|
||||
base(name, 0x31F, 0x3EBE, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
SetStr(201, 300);
|
||||
SetDex(66, 85);
|
||||
|
|
@ -74,4 +69,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SeaHorse : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SeaHorse() : this("a sea horse")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SeaHorse(string name) : base(name, 0x90, 0x3EB3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SeaHorse(string name = "a sea horse") :
|
||||
base(name, 0x90, 0x3EB3, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
InitStats(Utility.Random(50, 30), Utility.Random(50, 30), 10);
|
||||
Skills.MagicResist.Base = 25.0 + Utility.RandomDouble() * 5.0;
|
||||
|
|
@ -36,4 +32,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SilverSteed : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SilverSteed() : this("a silver steed")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SilverSteed(string name) : base(name, 0x75, 0x3EA8, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SilverSteed(string name = "a silver steed") :
|
||||
base(name, 0x75, 0x3EA8, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
InitStats(Utility.Random(50, 30), Utility.Random(50, 30), 10);
|
||||
Skills.MagicResist.Base = 25.0 + Utility.RandomDouble() * 5.0;
|
||||
|
|
@ -40,4 +36,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,12 +3,8 @@ namespace Server.Mobiles
|
|||
public class SkeletalMount : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public SkeletalMount() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SkeletalMount(string name) : base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SkeletalMount(string name = null) :
|
||||
base(name, 793, 0x3EBB, AIType.AI_Animal, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
SetStr(91, 100);
|
||||
SetDex(46, 55);
|
||||
|
|
@ -69,4 +65,4 @@ namespace Server.Mobiles
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,12 +11,8 @@ namespace Server.Mobiles
|
|||
private bool m_HasBarding;
|
||||
|
||||
[Constructible]
|
||||
public SwampDragon() : this("a swamp dragon")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SwampDragon(string name) : base(name, 0x31A, 0x3EBD, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
public SwampDragon(string name = "a swamp dragon") :
|
||||
base(name, 0x31A, 0x3EBD, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x16A;
|
||||
|
||||
|
|
@ -220,4 +216,4 @@ namespace Server.Mobiles
|
|||
BaseSoundID = 0x16A;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,12 +7,8 @@ namespace Server.Mobiles
|
|||
public class Unicorn : BaseMount
|
||||
{
|
||||
[Constructible]
|
||||
public Unicorn() : this("a unicorn")
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public Unicorn(string name) : base(name, 0x7A, 0x3EB4, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
public Unicorn(string name = "a unicorn") :
|
||||
base(name, 0x7A, 0x3EB4, AIType.AI_Mage, FightMode.Evil, 10, 1, 0.2, 0.4)
|
||||
{
|
||||
BaseSoundID = 0x4BC;
|
||||
|
||||
|
|
@ -134,4 +130,4 @@ namespace Server.Mobiles
|
|||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue