Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -46,7 +46,6 @@ namespace Server.Mobiles
{
}
public override bool ClickTitle => false;
public override void Serialize(IGenericWriter writer)

View file

@ -12,12 +12,10 @@ namespace Server.Mobiles
SetSkill(SkillName.Healing, 36, 68);
SpeechHue = Utility.RandomDyedHue();
Title = "the artist";
Hue = Race.Human.RandomSkinHue();
if (Female = Utility.RandomBool())
{
Body = 0x191;
@ -45,7 +43,6 @@ namespace Server.Mobiles
AddItem(pack);
}
public Artist(Serial serial)
: base(serial)
{

View file

@ -10,7 +10,7 @@ namespace Server.Mobiles
{
public class Banker : BaseVendor
{
private List<SBInfo> m_SBInfos = new List<SBInfo>();
private readonly List<SBInfo> m_SBInfos = new List<SBInfo>();
[Constructible]
public Banker() : base("the banker")
@ -66,7 +66,7 @@ namespace Server.Mobiles
if (balance > int.MaxValue)
{
gold = checks = new Item[0];
gold = checks = Array.Empty<Item>();
return int.MaxValue;
}
}
@ -84,7 +84,7 @@ namespace Server.Mobiles
}
else
{
gold = checks = new Item[0];
gold = checks = Array.Empty<Item>();
}
return Math.Max(0, (int)Math.Min(int.MaxValue, balance));
@ -265,139 +265,139 @@ namespace Server.Mobiles
switch (keyword)
{
case 0x0000: // *withdraw*
{
e.Handled = true;
if (e.Mobile.Criminal)
{
Say(500389); // I will not do business with a criminal!
e.Handled = true;
if (e.Mobile.Criminal)
{
Say(500389); // I will not do business with a criminal!
break;
}
string[] split = e.Speech.Split(' ');
if (split.Length >= 2)
{
Container pack = e.Mobile.Backpack;
if (!int.TryParse(split[1], out int amount))
break;
if ((!Core.ML && amount > 5000) || (Core.ML && amount > 60000))
{
Say(500381); // Thou canst not withdraw so much at one time!
}
else if (pack?.Deleted != false || !(pack.TotalWeight < pack.MaxWeight) ||
!(pack.TotalItems < pack.MaxItems))
{
Say(1048147); // Your backpack can't hold anything else.
}
else if (amount > 0)
{
BankBox box = e.Mobile.FindBankNoCreate();
if (box == null || !Withdraw(e.Mobile, amount))
{
Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold!
}
else
{
pack.DropItem(new Gold(amount));
Say(1010005); // Thou hast withdrawn gold from thy account.
}
}
}
break;
}
string[] split = e.Speech.Split(' ');
if (split.Length >= 2)
{
Container pack = e.Mobile.Backpack;
if (!int.TryParse(split[1], out int amount))
break;
if (!Core.ML && amount > 5000 || Core.ML && amount > 60000)
{
Say(500381); // Thou canst not withdraw so much at one time!
}
else if (pack?.Deleted != false || !(pack.TotalWeight < pack.MaxWeight) ||
!(pack.TotalItems < pack.MaxItems))
{
Say(1048147); // Your backpack can't hold anything else.
}
else if (amount > 0)
{
BankBox box = e.Mobile.FindBankNoCreate();
if (box == null || !Withdraw(e.Mobile, amount))
{
Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold!
}
else
{
pack.DropItem(new Gold(amount));
Say(1010005); // Thou hast withdrawn gold from thy account.
}
}
}
break;
}
case 0x0001: // *balance*
{
e.Handled = true;
if (e.Mobile.Criminal)
{
Say(500389); // I will not do business with a criminal!
e.Handled = true;
if (e.Mobile.Criminal)
{
Say(500389); // I will not do business with a criminal!
break;
}
if (AccountGold.Enabled && e.Mobile.Account != null)
Say(1155855,
$"{e.Mobile.Account.TotalPlat:#,0}\t{e.Mobile.Account.TotalGold:#,0}"); // Thy current bank balance is ~1_AMOUNT~ platinum and ~2_AMOUNT~ gold.
else
Say(1042759,
GetBalance(e.Mobile).ToString("#,0")); // Thy current bank balance is ~1_AMOUNT~ gold.
break;
}
if (AccountGold.Enabled && e.Mobile.Account != null)
Say(1155855,
$"{e.Mobile.Account.TotalPlat:#,0}\t{e.Mobile.Account.TotalGold:#,0}"); // Thy current bank balance is ~1_AMOUNT~ platinum and ~2_AMOUNT~ gold.
else
Say(1042759,
GetBalance(e.Mobile).ToString("#,0")); // Thy current bank balance is ~1_AMOUNT~ gold.
break;
}
case 0x0002: // *bank*
{
e.Handled = true;
if (e.Mobile.Criminal)
{
Say(500378); // Thou art a criminal and cannot access thy bank box.
e.Handled = true;
if (e.Mobile.Criminal)
{
Say(500378); // Thou art a criminal and cannot access thy bank box.
break;
}
e.Mobile.BankBox.Open();
break;
}
e.Mobile.BankBox.Open();
break;
}
case 0x0003: // *check*
{
e.Handled = true;
if (AccountGold.Enabled)
break;
if (e.Mobile.Criminal)
{
Say(500389); // I will not do business with a criminal!
break;
}
e.Handled = true;
string[] split = e.Speech.Split(' ');
if (split.Length >= 2)
{
if (!int.TryParse(split[1], out int amount))
if (AccountGold.Enabled)
break;
if (amount < 5000)
if (e.Mobile.Criminal)
{
Say(1010006); // We cannot create checks for such a paltry amount of gold!
Say(500389); // I will not do business with a criminal!
break;
}
else if (amount > 1000000)
{
Say(1010007); // Our policies prevent us from creating checks worth that much!
}
else
{
BankCheck check = new BankCheck(amount);
BankBox box = e.Mobile.BankBox;
string[] split = e.Speech.Split(' ');
if (!box.TryDropItem(e.Mobile, check, false))
if (split.Length >= 2)
{
if (!int.TryParse(split[1], out int amount))
break;
if (amount < 5000)
{
Say(500386); // There's not enough room in your bankbox for the check!
check.Delete();
Say(1010006); // We cannot create checks for such a paltry amount of gold!
}
else if (!box.ConsumeTotal(typeof(Gold), amount))
else if (amount > 1000000)
{
Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold!
check.Delete();
Say(1010007); // Our policies prevent us from creating checks worth that much!
}
else
{
Say(1042673, AffixType.Append, amount.ToString(),
""); // Into your bank box I have placed a check in the amount of:
BankCheck check = new BankCheck(amount);
BankBox box = e.Mobile.BankBox;
if (!box.TryDropItem(e.Mobile, check, false))
{
Say(500386); // There's not enough room in your bankbox for the check!
check.Delete();
}
else if (!box.ConsumeTotal(typeof(Gold), amount))
{
Say(500384); // Ah, art thou trying to fool me? Thou hast not so much gold!
check.Delete();
}
else
{
Say(1042673, AffixType.Append, amount.ToString(),
""); // Into your bank box I have placed a check in the amount of:
}
}
}
}
break;
}
break;
}
}
}

View file

@ -24,7 +24,7 @@ namespace Server.Mobiles
// Classic list
// Used when: !MLQuestSystem.Enabled && !Core.ML
private static string[] m_TownNames =
private static readonly string[] m_TownNames =
{
"Cove", "Britain", "Jhelom",
"Minoc", "Ocllo", "Trinsic",
@ -34,7 +34,7 @@ namespace Server.Mobiles
// ML list, pre-ML quest system
// Used when: !MLQuestSystem.Enabled && Core.ML
private static string[] m_MLTownNames =
private static readonly string[] m_MLTownNames =
{
"Cove", "Serpent's Hold", "Jhelom",
"Nujel'm"
@ -42,7 +42,7 @@ namespace Server.Mobiles
// ML quest system general list
// Used when: MLQuestSystem.Enabled && !Region.IsPartOf( "Haven Island" )
private static Type[] m_MLQuestTypes =
private static readonly Type[] m_MLQuestTypes =
{
typeof(EscortToYew),
typeof(EscortToVesper),
@ -57,12 +57,12 @@ namespace Server.Mobiles
typeof(EscortToCove),
typeof(EscortToBritain)
// Ocllo was removed in pub 56
//typeof( EscortToOcllo )
// typeof( EscortToOcllo )
};
// ML quest system New Haven list
// Used when: MLQuestSystem.Enabled && Region.IsPartOf( "Haven Island" )
private static Type[] m_MLQuestTypesNH =
private static readonly Type[] m_MLQuestTypesNH =
{
typeof(EscortToNHAlchemist),
typeof(EscortToNHBard),
@ -73,7 +73,7 @@ namespace Server.Mobiles
typeof(EscortToNHMage),
typeof(EscortToNHInn),
// Farm destination was removed
//typeof( EscortToNHFarm ),
// typeof( EscortToNHFarm ),
typeof(EscortToNHDocks),
typeof(EscortToNHBowyer),
typeof(EscortToNHBank)
@ -127,7 +127,7 @@ namespace Server.Mobiles
}
}
public static Dictionary<Mobile, BaseEscortable> EscortTable{ get; } = new Dictionary<Mobile, BaseEscortable>();
public static Dictionary<Mobile, BaseEscortable> EscortTable { get; } = new Dictionary<Mobile, BaseEscortable>();
protected override List<MLQuest> ConstructQuestList()
{
@ -615,7 +615,7 @@ namespace Server.Mobiles
private class DeleteTimer : Timer
{
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public DeleteTimer(Mobile m, TimeSpan delay)
: base(delay)
@ -642,9 +642,9 @@ namespace Server.Mobiles
Region = region;
}
public string Name{ get; }
public string Name { get; }
public Region Region{ get; }
public Region Region { get; }
public bool Contains(Point3D p) => Region.Contains(p);
@ -677,8 +677,8 @@ namespace Server.Mobiles
public class AskDestinationEntry : ContextMenuEntry
{
private Mobile m_From;
private BaseEscortable m_Mobile;
private readonly Mobile m_From;
private readonly BaseEscortable m_Mobile;
public AskDestinationEntry(BaseEscortable m, Mobile from)
: base(6100, 3)
@ -695,8 +695,8 @@ namespace Server.Mobiles
public class AcceptEscortEntry : ContextMenuEntry
{
private Mobile m_From;
private BaseEscortable m_Mobile;
private readonly Mobile m_From;
private readonly BaseEscortable m_Mobile;
public AcceptEscortEntry(BaseEscortable m, Mobile from)
: base(6101, 3)
@ -713,7 +713,7 @@ namespace Server.Mobiles
public class AbandonEscortEntry : ContextMenuEntry
{
private BaseEscortable m_Mobile;
private readonly BaseEscortable m_Mobile;
public AbandonEscortEntry(BaseEscortable m)
: base(6102, 3) =>

View file

@ -56,7 +56,6 @@ namespace Server.Mobiles
{
}
public override bool CanTeach => true;
public override bool ClickTitle => false;

View file

@ -12,12 +12,10 @@ namespace Server.Mobiles
SetSkill(SkillName.Mining, 36, 68);
SpeechHue = Utility.RandomDyedHue();
Hue = Race.Human.RandomSkinHue();
Blessed = true;
if (Female = Utility.RandomBool())
{
Body = 0x191;
@ -47,7 +45,6 @@ namespace Server.Mobiles
AddItem(pack);
}
public HarborMaster(Serial serial)
: base(serial)
{

View file

@ -54,9 +54,8 @@ namespace Server.Mobiles
if (!Female)
AddItem(new BodySash(lowHue));
//if ( !Female )
//AddItem( new Longsword() );
// if (!Female)
// AddItem( new Longsword() );
Utility.AssignRandomHair(this);
@ -77,4 +76,4 @@ namespace Server.Mobiles
int version = reader.ReadInt();
}
}
}
}

View file

@ -43,7 +43,6 @@ namespace Server.Mobiles
int hairHue = Utility.RandomNondyedHue();
Utility.AssignRandomHair(this, hairHue);
if (Utility.Random(7) != 0)

View file

@ -44,13 +44,13 @@ namespace Server.Mobiles
else
AddItem(new Shoes(lowHue));
//if ( !Female )
//AddItem( new BodySash( lowHue ) );
// if (!Female)
// AddItem( new BodySash( lowHue ) );
//AddItem( new Cloak( GetRandomHue() ) );
// AddItem( new Cloak( GetRandomHue() ) );
//if ( !Female )
//AddItem( new Longsword() );
// if (!Female)
// AddItem( new Longsword() );
Utility.AssignRandomHair(this);
@ -71,4 +71,4 @@ namespace Server.Mobiles
int version = reader.ReadInt();
}
}
}
}

View file

@ -79,7 +79,6 @@ namespace Server.Mobiles
int hairHue = Utility.RandomNondyedHue();
Utility.AssignRandomHair(this, hairHue);
if (Utility.Random(7) != 0)

View file

@ -27,7 +27,6 @@ namespace Server.Mobiles
AddItem(new LongPants(Utility.RandomNeutralHue()));
}
AddItem(new Doublet(Utility.RandomNeutralHue()));
AddItem(new HalfApron());

View file

@ -4,14 +4,14 @@ namespace Server.Mobiles
{
public class SeekerOfAdventure : BaseEscortable
{
private static string[] m_Dungeons =
private static readonly string[] m_Dungeons =
{
"Covetous", "Deceit", "Despise",
"Destard", "Hythloth", "Shame", // Old Code for Pre-ML shards.
"Wrong"
};
private static string[] m_MLDestinations =
private static readonly string[] m_MLDestinations =
{
"Cove", "Serpent's Hold", "Jhelom", // ML List
"Nujel'm"

View file

@ -10,7 +10,7 @@ namespace Server.Mobiles
{
public interface ITownCrierEntryList
{
List<TownCrierEntry> Entries{ get; }
List<TownCrierEntry> Entries { get; }
TownCrierEntry GetRandomEntry();
TownCrierEntry AddEntry(string[] lines, TimeSpan duration);
void RemoveEntry(TownCrierEntry entry);
@ -24,7 +24,7 @@ namespace Server.Mobiles
public bool IsEmpty => Entries == null || Entries.Count == 0;
public List<TownCrierEntry> Entries{ get; private set; }
public List<TownCrierEntry> Entries { get; private set; }
public TownCrierEntry GetRandomEntry()
{
@ -102,16 +102,16 @@ namespace Server.Mobiles
ExpireTime = DateTime.UtcNow + duration;
}
public string[] Lines{ get; }
public string[] Lines { get; }
public DateTime ExpireTime{ get; }
public DateTime ExpireTime { get; }
public bool Expired => DateTime.UtcNow >= ExpireTime;
}
public class TownCrierDurationPrompt : Prompt
{
private ITownCrierEntryList m_Owner;
private readonly ITownCrierEntryList m_Owner;
public TownCrierDurationPrompt(ITownCrierEntryList owner) => m_Owner = owner;
@ -142,10 +142,10 @@ namespace Server.Mobiles
public class TownCrierLinesPrompt : Prompt
{
private TimeSpan m_Duration;
private TownCrierEntry m_Entry;
private List<string> m_Lines;
private ITownCrierEntryList m_Owner;
private readonly TimeSpan m_Duration;
private readonly TownCrierEntry m_Entry;
private readonly List<string> m_Lines;
private readonly ITownCrierEntryList m_Owner;
public TownCrierLinesPrompt(ITownCrierEntryList owner, TownCrierEntry entry, List<string> lines, TimeSpan duration)
{
@ -187,8 +187,8 @@ namespace Server.Mobiles
public class TownCrierGump : Gump
{
private Mobile m_From;
private ITownCrierEntryList m_Owner;
private readonly Mobile m_From;
private readonly ITownCrierEntryList m_Owner;
public TownCrierGump(Mobile from, ITownCrierEntryList owner) : base(50, 50)
{
@ -347,9 +347,9 @@ namespace Server.Mobiles
Instances.Add(this);
}
public static List<TownCrier> Instances{ get; } = new List<TownCrier>();
public static List<TownCrier> Instances { get; } = new List<TownCrier>();
public List<TownCrierEntry> Entries{ get; private set; }
public List<TownCrierEntry> Entries { get; private set; }
public TownCrierEntry GetRandomEntry()
{