C# 9 Cleanup (#325)

- [X] Removes EventArgs - not needed
- [X] Merges sequential checks
- [X] Removes redundant type declarations
This commit is contained in:
Kamron Batman 2020-11-27 00:29:21 -08:00 • committed by GitHub
parent 351611a23a
commit 3551d962f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
417 changed files with 2209 additions and 2213 deletions

View file

@ -27,7 +27,7 @@ namespace Server.Factions
public static readonly TimeSpan SkillLossPeriod = TimeSpan.FromMinutes(20.0);
private static readonly Dictionary<Mobile, SkillLossContext>
m_SkillLoss = new Dictionary<Mobile, SkillLossContext>();
m_SkillLoss = new();
private FactionDefinition m_Definition;
public int ZeroRankOffset;
@ -573,7 +573,7 @@ namespace Server.Factions
}
}
public bool IsCommander(Mobile mob) => mob != null && mob.AccessLevel >= AccessLevel.GameMaster || mob == Commander;
public bool IsCommander(Mobile mob) => mob?.AccessLevel >= AccessLevel.GameMaster || mob == Commander;
public override string ToString() => m_Definition.FriendlyName;

View file

@ -39,42 +39,42 @@ namespace Server.Factions
{
public static MerchantTitleInfo[] Info { get; } =
{
new MerchantTitleInfo(
new(
SkillName.Inscribe,
90.0,
new TextDefinition(1060773, "Scribe"),
new TextDefinition(1011468, "SCRIBE"),
new TextDefinition(1010121, "You now have the faction title of scribe")
),
new MerchantTitleInfo(
new(
SkillName.Carpentry,
90.0,
new TextDefinition(1060774, "Carpenter"),
new TextDefinition(1011469, "CARPENTER"),
new TextDefinition(1010122, "You now have the faction title of carpenter")
),
new MerchantTitleInfo(
new(
SkillName.Tinkering,
90.0,
new TextDefinition(1022984, "Tinker"),
new TextDefinition(1011470, "TINKER"),
new TextDefinition(1010123, "You now have the faction title of tinker")
),
new MerchantTitleInfo(
new(
SkillName.Blacksmith,
90.0,
new TextDefinition(1023016, "Blacksmith"),
new TextDefinition(1011471, "BLACKSMITH"),
new TextDefinition(1010124, "You now have the faction title of blacksmith")
),
new MerchantTitleInfo(
new(
SkillName.Fletching,
90.0,
new TextDefinition(1023022, "Bowyer"),
new TextDefinition(1011472, "BOWYER"),
new TextDefinition(1010125, "You now have the faction title of Bowyer")
),
new MerchantTitleInfo(
new(
SkillName.Tailoring,
90.0,
new TextDefinition(1022982, "Tailor"),

View file

@ -6,12 +6,12 @@ namespace Server.Factions
{
public class FactionItemDefinition
{
private static readonly FactionItemDefinition m_MetalArmor = new FactionItemDefinition(1000, typeof(Blacksmith));
private static readonly FactionItemDefinition m_Weapon = new FactionItemDefinition(1000, typeof(Blacksmith));
private static readonly FactionItemDefinition m_RangedWeapon = new FactionItemDefinition(1000, typeof(Bowyer));
private static readonly FactionItemDefinition m_LeatherArmor = new FactionItemDefinition(750, typeof(Tailor));
private static readonly FactionItemDefinition m_Clothing = new FactionItemDefinition(200, typeof(Tailor));
private static readonly FactionItemDefinition m_Scroll = new FactionItemDefinition(500, typeof(Mage));
private static readonly FactionItemDefinition m_MetalArmor = new(1000, typeof(Blacksmith));
private static readonly FactionItemDefinition m_Weapon = new(1000, typeof(Blacksmith));
private static readonly FactionItemDefinition m_RangedWeapon = new(1000, typeof(Bowyer));
private static readonly FactionItemDefinition m_LeatherArmor = new(750, typeof(Tailor));
private static readonly FactionItemDefinition m_Clothing = new(200, typeof(Tailor));
private static readonly FactionItemDefinition m_Scroll = new(500, typeof(Mage));
public FactionItemDefinition(int silverCost, Type vendorType)
{

View file

@ -36,7 +36,7 @@ namespace Server.Factions
public static VendorDefinition[] Definitions { get; } =
{
new VendorDefinition(
new(
typeof(FactionBottleVendor),
0xF0E,
5000,
@ -45,7 +45,7 @@ namespace Server.Factions
new TextDefinition(1011549, "POTION BOTTLE VENDOR"),
new TextDefinition(1011544, "Buy Potion Bottle Vendor")
),
new VendorDefinition(
new(
typeof(FactionBoardVendor),
0x1BD7,
3000,
@ -54,7 +54,7 @@ namespace Server.Factions
new TextDefinition(1011552, "WOOD VENDOR"),
new TextDefinition(1011545, "Buy Wooden Board Vendor")
),
new VendorDefinition(
new(
typeof(FactionOreVendor),
0x19B8,
3000,
@ -63,7 +63,7 @@ namespace Server.Factions
new TextDefinition(1011553, "IRON ORE VENDOR"),
new TextDefinition(1011546, "Buy Iron Ore Vendor")
),
new VendorDefinition(
new(
typeof(FactionReagentVendor),
0xF86,
5000,
@ -72,7 +72,7 @@ namespace Server.Factions
new TextDefinition(1011554, "REAGENT VENDOR"),
new TextDefinition(1011547, "Buy Reagent Vendor")
),
new VendorDefinition(
new(
typeof(FactionHorseVendor),
0x20DD,
5000,

View file

@ -70,7 +70,7 @@ namespace Server.Factions
}
}
public static List<BaseMonolith> Monoliths { get; set; } = new List<BaseMonolith>();
public static List<BaseMonolith> Monoliths { get; set; } = new();
public override void OnLocationChange(Point3D oldLocation)
{

View file

@ -30,7 +30,7 @@ namespace Server.Factions
public virtual void AssignName(TextDefinition name)
{
if (name != null && name.Number > 0)
if (name?.Number > 0)
{
m_LabelNumber = name.Number;
Name = null;

View file

@ -11,11 +11,11 @@ namespace Server
{
private static readonly WeightedItem[] _items =
{
new WeightedItem(30, typeof(GemOfEmpowerment)),
new WeightedItem(25, typeof(BloodRose)),
new WeightedItem(20, typeof(ClarityPotion)),
new WeightedItem(15, typeof(UrnOfAscension)),
new WeightedItem(10, typeof(StormsEye))
new(30, typeof(GemOfEmpowerment)),
new(25, typeof(BloodRose)),
new(20, typeof(ClarityPotion)),
new(15, typeof(UrnOfAscension)),
new(10, typeof(StormsEye))
};
public PowerFactionItem(int itemId)

View file

@ -121,7 +121,7 @@ namespace Server.Factions
}
}
public static List<Sigil> Sigils { get; } = new List<Sigil>();
public static List<Sigil> Sigils { get; } = new();
public void Update()
{

View file

@ -188,7 +188,7 @@ namespace Server.Factions
_ => faction.Definition.GuardAttack // ReactionType.Attack
};
if (def != null && def.Number > 0)
if (def?.Number > 0)
{
Say(def.Number);
}

View file

@ -48,7 +48,7 @@ namespace Server.Factions
public class SpellCombo
{
public static readonly SpellCombo Simple = new SpellCombo(
public static readonly SpellCombo Simple = new(
50,
new ComboEntry(typeof(ParalyzeSpell), 20),
new ComboEntry(typeof(ExplosionSpell), 100, TimeSpan.FromSeconds(2.8)),
@ -56,7 +56,7 @@ namespace Server.Factions
new ComboEntry(typeof(EnergyBoltSpell))
);
public static readonly SpellCombo Strong = new SpellCombo(
public static readonly SpellCombo Strong = new(
90,
new ComboEntry(typeof(ParalyzeSpell), 20),
new ComboEntry(typeof(ExplosionSpell), 50, TimeSpan.FromSeconds(2.8)),