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

@ -170,7 +170,7 @@ namespace Server.Items
{
private static readonly TilesAndEffect[] m_Table =
{
new TilesAndEffect(
new(
new[]
{
0x71, 0x7C,
@ -209,7 +209,7 @@ namespace Server.Items
typeof(DirtGreenThornsEffect)
),
new TilesAndEffect(
new(
new[]
{
0x9, 0x15,
@ -218,7 +218,7 @@ namespace Server.Items
typeof(FurrowsGreenThornsEffect)
),
new TilesAndEffect(
new(
new[]
{
0x9C4, 0x9EB,
@ -232,7 +232,7 @@ namespace Server.Items
typeof(SwampGreenThornsEffect)
),
new TilesAndEffect(
new(
new[]
{
0x10C, 0x10F,
@ -253,7 +253,7 @@ namespace Server.Items
typeof(SnowGreenThornsEffect)
),
new TilesAndEffect(
new(
new[]
{
0x16, 0x3A,
@ -746,7 +746,7 @@ namespace Server.Items
public class GreenThornsSHTeleporter : Item
{
public static readonly Point3D Destination = new Point3D(5738, 1856, 0);
public static readonly Point3D Destination = new(5738, 1856, 0);
private GreenThornsSHTeleporter() : base(0x913)
{

View file

@ -7,7 +7,7 @@ namespace Server.Items
public class OrangePetals : Item
{
private static readonly Dictionary<Mobile, OrangePetalsContext> m_Table =
new Dictionary<Mobile, OrangePetalsContext>();
new();
[Constructible]
public OrangePetals(int amount = 1) : base(0x1021)

View file

@ -44,25 +44,25 @@ namespace Server.Engines.Plants
static PlantHueInfo() =>
m_Table = new Dictionary<PlantHue, PlantHueInfo>
{
[PlantHue.Plain] = new PlantHueInfo(0, 1060813, PlantHue.Plain, 0x835),
[PlantHue.Red] = new PlantHueInfo(0x66D, 1060814, PlantHue.Red, 0x24),
[PlantHue.Blue] = new PlantHueInfo(0x53D, 1060815, PlantHue.Blue, 0x6),
[PlantHue.Yellow] = new PlantHueInfo(0x8A5, 1060818, PlantHue.Yellow, 0x38),
[PlantHue.BrightRed] = new PlantHueInfo(0x21, 1060814, PlantHue.BrightRed, 0x21),
[PlantHue.BrightBlue] = new PlantHueInfo(0x5, 1060815, PlantHue.BrightBlue, 0x6),
[PlantHue.BrightYellow] = new PlantHueInfo(0x38, 1060818, PlantHue.BrightYellow, 0x35),
[PlantHue.Purple] = new PlantHueInfo(0xD, 1060816, PlantHue.Purple, 0x10),
[PlantHue.Green] = new PlantHueInfo(0x59B, 1060819, PlantHue.Green, 0x42),
[PlantHue.Orange] = new PlantHueInfo(0x46F, 1060817, PlantHue.Orange, 0x2E),
[PlantHue.BrightPurple] = new PlantHueInfo(0x10, 1060816, PlantHue.BrightPurple, 0xD),
[PlantHue.BrightGreen] = new PlantHueInfo(0x42, 1060819, PlantHue.BrightGreen, 0x3F),
[PlantHue.BrightOrange] = new PlantHueInfo(0x2B, 1060817, PlantHue.BrightOrange, 0x2B),
[PlantHue.Black] = new PlantHueInfo(0x455, 1060820, PlantHue.Black, 0),
[PlantHue.White] = new PlantHueInfo(0x481, 1060821, PlantHue.White, 0x481),
[PlantHue.Pink] = new PlantHueInfo(0x48E, 1061854, PlantHue.Pink),
[PlantHue.Magenta] = new PlantHueInfo(0x486, 1061852, PlantHue.Magenta),
[PlantHue.Aqua] = new PlantHueInfo(0x495, 1061853, PlantHue.Aqua),
[PlantHue.FireRed] = new PlantHueInfo(0x489, 1061855, PlantHue.FireRed)
[PlantHue.Plain] = new(0, 1060813, PlantHue.Plain, 0x835),
[PlantHue.Red] = new(0x66D, 1060814, PlantHue.Red, 0x24),
[PlantHue.Blue] = new(0x53D, 1060815, PlantHue.Blue, 0x6),
[PlantHue.Yellow] = new(0x8A5, 1060818, PlantHue.Yellow, 0x38),
[PlantHue.BrightRed] = new(0x21, 1060814, PlantHue.BrightRed, 0x21),
[PlantHue.BrightBlue] = new(0x5, 1060815, PlantHue.BrightBlue, 0x6),
[PlantHue.BrightYellow] = new(0x38, 1060818, PlantHue.BrightYellow, 0x35),
[PlantHue.Purple] = new(0xD, 1060816, PlantHue.Purple, 0x10),
[PlantHue.Green] = new(0x59B, 1060819, PlantHue.Green, 0x42),
[PlantHue.Orange] = new(0x46F, 1060817, PlantHue.Orange, 0x2E),
[PlantHue.BrightPurple] = new(0x10, 1060816, PlantHue.BrightPurple, 0xD),
[PlantHue.BrightGreen] = new(0x42, 1060819, PlantHue.BrightGreen, 0x3F),
[PlantHue.BrightOrange] = new(0x2B, 1060817, PlantHue.BrightOrange, 0x2B),
[PlantHue.Black] = new(0x455, 1060820, PlantHue.Black, 0),
[PlantHue.White] = new(0x481, 1060821, PlantHue.White, 0x481),
[PlantHue.Pink] = new(0x48E, 1061854, PlantHue.Pink),
[PlantHue.Magenta] = new(0x486, 1061852, PlantHue.Magenta),
[PlantHue.Aqua] = new(0x495, 1061853, PlantHue.Aqua),
[PlantHue.FireRed] = new(0x489, 1061855, PlantHue.FireRed)
};
private PlantHueInfo(int hue, int name, PlantHue plantHue) : this(hue, name, plantHue, hue)

View file

@ -169,7 +169,7 @@ namespace Server.Engines.Plants
[CommandProperty(AccessLevel.GameMaster)]
public bool Reproduces => PlantHueInfo.CanReproduce(PlantHue) && PlantTypeInfo.CanReproduce(PlantType);
public static List<PlantItem> Plants { get; } = new List<PlantItem>();
public static List<PlantItem> Plants { get; } = new();
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level { get; set; }

View file

@ -8,15 +8,15 @@ namespace Server.Engines.Plants
{
private static readonly PlantResourceInfo[] m_ResourceList =
{
new PlantResourceInfo(PlantType.ElephantEarPlant, PlantHue.BrightRed, typeof(RedLeaves)),
new PlantResourceInfo(PlantType.PonytailPalm, PlantHue.BrightRed, typeof(RedLeaves)),
new PlantResourceInfo(PlantType.CenturyPlant, PlantHue.BrightRed, typeof(RedLeaves)),
new PlantResourceInfo(PlantType.Poppies, PlantHue.BrightOrange, typeof(OrangePetals)),
new PlantResourceInfo(PlantType.Bulrushes, PlantHue.BrightOrange, typeof(OrangePetals)),
new PlantResourceInfo(PlantType.PampasGrass, PlantHue.BrightOrange, typeof(OrangePetals)),
new PlantResourceInfo(PlantType.SnakePlant, PlantHue.BrightGreen, typeof(GreenThorns)),
new PlantResourceInfo(PlantType.BarrelCactus, PlantHue.BrightGreen, typeof(GreenThorns)),
new PlantResourceInfo(PlantType.CocoaTree, PlantHue.Plain, typeof(CocoaPulp))
new(PlantType.ElephantEarPlant, PlantHue.BrightRed, typeof(RedLeaves)),
new(PlantType.PonytailPalm, PlantHue.BrightRed, typeof(RedLeaves)),
new(PlantType.CenturyPlant, PlantHue.BrightRed, typeof(RedLeaves)),
new(PlantType.Poppies, PlantHue.BrightOrange, typeof(OrangePetals)),
new(PlantType.Bulrushes, PlantHue.BrightOrange, typeof(OrangePetals)),
new(PlantType.PampasGrass, PlantHue.BrightOrange, typeof(OrangePetals)),
new(PlantType.SnakePlant, PlantHue.BrightGreen, typeof(GreenThorns)),
new(PlantType.BarrelCactus, PlantHue.BrightGreen, typeof(GreenThorns)),
new(PlantType.CocoaTree, PlantHue.Plain, typeof(CocoaPulp))
};
private PlantResourceInfo(PlantType plantType, PlantHue plantHue, Type resourceType)

View file

@ -63,26 +63,26 @@ namespace Server.Engines.Plants
{
private static readonly PlantTypeInfo[] m_Table =
{
new PlantTypeInfo(0xC83, 0, 0, PlantType.CampionFlowers, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC86, 0, 0, PlantType.Poppies, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC88, 0, 10, PlantType.Snowdrops, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC94, -15, 0, PlantType.Bulrushes, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC8B, 0, 0, PlantType.Lilies, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xCA5, -8, 0, PlantType.PampasGrass, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xCA7, -10, 0, PlantType.Rushes, false, true, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC97, -20, 0, PlantType.ElephantEarPlant, true, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC9F, -20, 0, PlantType.Fern, false, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xCA6, -16, -5, PlantType.PonytailPalm, false, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xC9C, -5, -10, PlantType.SmallPalm, false, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xD31, 0, -27, PlantType.CenturyPlant, true, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xD04, 0, 10, PlantType.WaterPlant, true, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xCA9, 0, 0, PlantType.SnakePlant, true, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xD2C, 0, 10, PlantType.PricklyPearCactus, false, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xD26, 0, 10, PlantType.BarrelCactus, false, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0xD27, 0, 10, PlantType.TribarrelCactus, false, false, true, true, PlantCategory.Default),
new PlantTypeInfo(0x28DC, -5, 5, PlantType.CommonGreenBonsai, true, false, false, false, PlantCategory.Common),
new PlantTypeInfo(0x28DF, -5, 5, PlantType.CommonPinkBonsai, true, false, false, false, PlantCategory.Common),
new PlantTypeInfo(
new(0xC83, 0, 0, PlantType.CampionFlowers, false, true, true, true, PlantCategory.Default),
new(0xC86, 0, 0, PlantType.Poppies, false, true, true, true, PlantCategory.Default),
new(0xC88, 0, 10, PlantType.Snowdrops, false, true, true, true, PlantCategory.Default),
new(0xC94, -15, 0, PlantType.Bulrushes, false, true, true, true, PlantCategory.Default),
new(0xC8B, 0, 0, PlantType.Lilies, false, true, true, true, PlantCategory.Default),
new(0xCA5, -8, 0, PlantType.PampasGrass, false, true, true, true, PlantCategory.Default),
new(0xCA7, -10, 0, PlantType.Rushes, false, true, true, true, PlantCategory.Default),
new(0xC97, -20, 0, PlantType.ElephantEarPlant, true, false, true, true, PlantCategory.Default),
new(0xC9F, -20, 0, PlantType.Fern, false, false, true, true, PlantCategory.Default),
new(0xCA6, -16, -5, PlantType.PonytailPalm, false, false, true, true, PlantCategory.Default),
new(0xC9C, -5, -10, PlantType.SmallPalm, false, false, true, true, PlantCategory.Default),
new(0xD31, 0, -27, PlantType.CenturyPlant, true, false, true, true, PlantCategory.Default),
new(0xD04, 0, 10, PlantType.WaterPlant, true, false, true, true, PlantCategory.Default),
new(0xCA9, 0, 0, PlantType.SnakePlant, true, false, true, true, PlantCategory.Default),
new(0xD2C, 0, 10, PlantType.PricklyPearCactus, false, false, true, true, PlantCategory.Default),
new(0xD26, 0, 10, PlantType.BarrelCactus, false, false, true, true, PlantCategory.Default),
new(0xD27, 0, 10, PlantType.TribarrelCactus, false, false, true, true, PlantCategory.Default),
new(0x28DC, -5, 5, PlantType.CommonGreenBonsai, true, false, false, false, PlantCategory.Common),
new(0x28DF, -5, 5, PlantType.CommonPinkBonsai, true, false, false, false, PlantCategory.Common),
new(
0x28DD,
-5,
5,
@ -93,7 +93,7 @@ namespace Server.Engines.Plants
false,
PlantCategory.Uncommon
),
new PlantTypeInfo(
new(
0x28E0,
-5,
5,
@ -104,9 +104,9 @@ namespace Server.Engines.Plants
false,
PlantCategory.Uncommon
),
new PlantTypeInfo(0x28DE, -5, 5, PlantType.RareGreenBonsai, true, false, false, false, PlantCategory.Rare),
new PlantTypeInfo(0x28E1, -5, 5, PlantType.RarePinkBonsai, true, false, false, false, PlantCategory.Rare),
new PlantTypeInfo(
new(0x28DE, -5, 5, PlantType.RareGreenBonsai, true, false, false, false, PlantCategory.Rare),
new(0x28E1, -5, 5, PlantType.RarePinkBonsai, true, false, false, false, PlantCategory.Rare),
new(
0x28E2,
-5,
5,
@ -117,13 +117,13 @@ namespace Server.Engines.Plants
false,
PlantCategory.Exceptional
),
new PlantTypeInfo(0x28E3, -5, 5, PlantType.ExoticBonsai, true, false, false, false, PlantCategory.Exotic),
new PlantTypeInfo(0x0D25, 0, 0, PlantType.Cactus, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x1A9A, 5, 10, PlantType.FlaxFlowers, false, true, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0C84, 0, 0, PlantType.FoxgloveFlowers, false, true, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x1A9F, 5, -25, PlantType.HopsEast, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0CC1, 0, 0, PlantType.OrfluerFlowers, false, true, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(
new(0x28E3, -5, 5, PlantType.ExoticBonsai, true, false, false, false, PlantCategory.Exotic),
new(0x0D25, 0, 0, PlantType.Cactus, false, false, false, false, PlantCategory.Peculiar),
new(0x1A9A, 5, 10, PlantType.FlaxFlowers, false, true, false, false, PlantCategory.Peculiar),
new(0x0C84, 0, 0, PlantType.FoxgloveFlowers, false, true, false, false, PlantCategory.Peculiar),
new(0x1A9F, 5, -25, PlantType.HopsEast, false, false, false, false, PlantCategory.Peculiar),
new(0x0CC1, 0, 0, PlantType.OrfluerFlowers, false, true, false, false, PlantCategory.Peculiar),
new(
0x0CFE,
-45,
-30,
@ -134,14 +134,14 @@ namespace Server.Engines.Plants
false,
PlantCategory.Peculiar
),
new PlantTypeInfo(0x0C8F, 0, 0, PlantType.HedgeShort, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0CC8, 0, 0, PlantType.JuniperBush, true, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0C8E, -20, 0, PlantType.SnowdropPatch, false, true, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0CB7, 0, 0, PlantType.Cattails, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0CBE, -20, 0, PlantType.PoppyPatch, false, true, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0CC9, 0, 0, PlantType.SpiderTree, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x0DC1, -5, 15, PlantType.WaterLily, false, true, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(
new(0x0C8F, 0, 0, PlantType.HedgeShort, false, false, false, false, PlantCategory.Peculiar),
new(0x0CC8, 0, 0, PlantType.JuniperBush, true, false, false, false, PlantCategory.Peculiar),
new(0x0C8E, -20, 0, PlantType.SnowdropPatch, false, true, false, false, PlantCategory.Peculiar),
new(0x0CB7, 0, 0, PlantType.Cattails, false, false, false, false, PlantCategory.Peculiar),
new(0x0CBE, -20, 0, PlantType.PoppyPatch, false, true, false, false, PlantCategory.Peculiar),
new(0x0CC9, 0, 0, PlantType.SpiderTree, false, false, false, false, PlantCategory.Peculiar),
new(0x0DC1, -5, 15, PlantType.WaterLily, false, true, false, false, PlantCategory.Peculiar),
new(
0x0CFB,
-45,
-30,
@ -152,9 +152,9 @@ namespace Server.Engines.Plants
false,
PlantCategory.Peculiar
),
new PlantTypeInfo(0x0DB8, 0, -20, PlantType.HedgeTall, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(0x1AA1, 10, -25, PlantType.HopsSouth, false, false, false, false, PlantCategory.Peculiar),
new PlantTypeInfo(
new(0x0DB8, 0, -20, PlantType.HedgeTall, false, false, false, false, PlantCategory.Peculiar),
new(0x1AA1, 10, -25, PlantType.HopsSouth, false, false, false, false, PlantCategory.Peculiar),
new(
0x246C,
-25,
-20,
@ -171,7 +171,7 @@ namespace Server.Engines.Plants
1095221,
1113715
),
new PlantTypeInfo(
new(
0xC9E,
-40,
-30,

View file

@ -70,7 +70,7 @@ namespace Server.Engines.Plants
public static Seed RandomBonsaiSeed() => RandomBonsaiSeed(0.5);
public static Seed RandomBonsaiSeed(double increaseRatio) => new Seed(
public static Seed RandomBonsaiSeed(double increaseRatio) => new(
PlantTypeInfo.RandomBonsai(increaseRatio),
PlantHue.Plain
);