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

@ -7,8 +7,8 @@ namespace Server.Items
{
public abstract class BaseConflagrationPotion : BasePotion
{
private static readonly Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
private readonly List<Mobile> m_Users = new List<Mobile>();
private static readonly Dictionary<Mobile, Timer> m_Delay = new();
private readonly List<Mobile> m_Users = new();
public BaseConflagrationPotion(PotionEffect effect) : base(0xF06, effect) => Hue = 0x489;

View file

@ -9,8 +9,8 @@ namespace Server.Items
{
public abstract class BaseConfusionBlastPotion : BasePotion
{
private static readonly Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
private readonly List<Mobile> m_Users = new List<Mobile>();
private static readonly Dictionary<Mobile, Timer> m_Delay = new();
private readonly List<Mobile> m_Users = new();
public BaseConfusionBlastPotion(PotionEffect effect) : base(0xF06, effect) => Hue = 0x48D;

View file

@ -4,19 +4,19 @@ namespace Server.Items
{
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 0.75), // 75% chance to cure regular poison
new CureLevelInfo(Poison.Greater, 0.50), // 50% chance to cure greater poison
new CureLevelInfo(Poison.Deadly, 0.15) // 15% chance to cure deadly poison
new(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new(Poison.Regular, 0.75), // 75% chance to cure regular poison
new(Poison.Greater, 0.50), // 50% chance to cure greater poison
new(Poison.Deadly, 0.15) // 15% chance to cure deadly poison
};
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00),
new CureLevelInfo(Poison.Regular, 0.95),
new CureLevelInfo(Poison.Greater, 0.75),
new CureLevelInfo(Poison.Deadly, 0.50),
new CureLevelInfo(Poison.Lethal, 0.25)
new(Poison.Lesser, 1.00),
new(Poison.Regular, 0.95),
new(Poison.Greater, 0.75),
new(Poison.Deadly, 0.50),
new(Poison.Lethal, 0.25)
};
[Constructible]

View file

@ -4,20 +4,20 @@ namespace Server.Items
{
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 1.00), // 100% chance to cure regular poison
new CureLevelInfo(Poison.Greater, 1.00), // 100% chance to cure greater poison
new CureLevelInfo(Poison.Deadly, 0.75), // 75% chance to cure deadly poison
new CureLevelInfo(Poison.Lethal, 0.25) // 25% chance to cure lethal poison
new(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new(Poison.Regular, 1.00), // 100% chance to cure regular poison
new(Poison.Greater, 1.00), // 100% chance to cure greater poison
new(Poison.Deadly, 0.75), // 75% chance to cure deadly poison
new(Poison.Lethal, 0.25) // 25% chance to cure lethal poison
};
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00),
new CureLevelInfo(Poison.Regular, 1.00),
new CureLevelInfo(Poison.Greater, 1.00),
new CureLevelInfo(Poison.Deadly, 0.95),
new CureLevelInfo(Poison.Lethal, 0.75)
new(Poison.Lesser, 1.00),
new(Poison.Regular, 1.00),
new(Poison.Greater, 1.00),
new(Poison.Deadly, 0.95),
new(Poison.Lethal, 0.75)
};
[Constructible]

View file

@ -4,16 +4,16 @@ namespace Server.Items
{
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 0.75), // 75% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 0.50), // 50% chance to cure regular poison
new CureLevelInfo(Poison.Greater, 0.15) // 15% chance to cure greater poison
new(Poison.Lesser, 0.75), // 75% chance to cure lesser poison
new(Poison.Regular, 0.50), // 50% chance to cure regular poison
new(Poison.Greater, 0.15) // 15% chance to cure greater poison
};
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 0.75),
new CureLevelInfo(Poison.Regular, 0.50),
new CureLevelInfo(Poison.Greater, 0.25)
new(Poison.Lesser, 0.75),
new(Poison.Regular, 0.50),
new(Poison.Greater, 0.25)
};
[Constructible]

View file

@ -191,7 +191,7 @@ namespace Server.Items
Consume();
for (var i = 0; Users != null && i < Users.Count; ++i)
for (var i = 0; i < Users?.Count; ++i)
{
var m = Users[i];

View file

@ -5,7 +5,7 @@ namespace Server.Items
{
public class InvisibilityPotion : BasePotion
{
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Table = new();
[Constructible]
public InvisibilityPotion() : base(0xF0A, PotionEffect.Invisibility) => Hue = 0x48D;

View file

@ -87,7 +87,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public int MaxCharges { get; set; }
public List<Mobile> Openers { get; set; } = new List<Mobile>();
public List<Mobile> Openers { get; set; } = new();
public override int LabelNumber => 1041267; // runebook

View file

@ -30,7 +30,7 @@ namespace Server.Items
public class Spellbook : Item, ICraftable, ISlayer
{
private static readonly Dictionary<Mobile, List<Spellbook>> m_Table = new Dictionary<Mobile, List<Spellbook>>();
private static readonly Dictionary<Mobile, List<Spellbook>> m_Table = new();
private static readonly int[] m_LegendPropertyCounts =
{