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

@ -8,11 +8,11 @@ namespace Server.Gumps
{
public static DoorInfo[] m_Types =
{
new DoorInfo(typeof(MetalDoor), 0x675),
new DoorInfo(typeof(RattanDoor), 0x695),
new DoorInfo(typeof(DarkWoodDoor), 0x6A5),
new DoorInfo(typeof(LightWoodDoor), 0x6D5),
new DoorInfo(typeof(StrongWoodDoor), 0x6E5)
new(typeof(MetalDoor), 0x675),
new(typeof(RattanDoor), 0x695),
new(typeof(DarkWoodDoor), 0x6A5),
new(typeof(LightWoodDoor), 0x6D5),
new(typeof(StrongWoodDoor), 0x6E5)
};
private readonly int m_Type;

View file

@ -3681,7 +3681,7 @@ namespace Server.Gumps
{
index -= 4;
if (m_List != null && index < m_List.Count)
if (index < m_List?.Count)
{
from.SendGump(
new AdminGump(from, AdminGumpPage.FirewallInfo, 0, null, null, m_List[index])
@ -3889,7 +3889,7 @@ namespace Server.Gumps
}
case 8:
{
if (m_List != null && index < m_List.Count)
if (index < m_List?.Count)
{
if (!(m_State is Account a))
{
@ -3933,7 +3933,7 @@ namespace Server.Gumps
}
case 9:
{
if (m_List != null && index < m_List.Count)
if (index < m_List?.Count)
{
if (m_PageType == AdminGumpPage.AccountDetails_Access_ClientIPs)
{
@ -3984,7 +3984,7 @@ namespace Server.Gumps
}
case 10:
{
if (m_List != null && index < m_List.Count)
if (index < m_List?.Count)
{
if (m_PageType == AdminGumpPage.AccountDetails_Access_ClientIPs)
{

View file

@ -101,14 +101,14 @@ namespace Server.Gumps
width = CurrentX + BorderSize;
if (m_Background != null && width > m_Background.Width)
if (width > m_Background?.Width)
{
m_Background.Width = width;
}
width = CurrentX - BorderSize;
if (m_Offset != null && width > m_Offset.Width)
if (width > m_Offset?.Width)
{
m_Offset.Width = width;
}

View file

@ -11,10 +11,10 @@ namespace Server.Guilds
{
private static readonly InfoField<PlayerMobile>[] m_Fields =
{
new InfoField<PlayerMobile>(1062955, 130, NameComparer.Instance), // Name
new InfoField<PlayerMobile>(1062956, 80, RankComparer.Instance), // Rank
new InfoField<PlayerMobile>(1062952, 80, LastOnComparer.Instance), // Last On
new InfoField<PlayerMobile>(1062953, 150, TitleComparer.Instance) // Guild Title
new(1062955, 130, NameComparer.Instance), // Name
new(1062956, 80, RankComparer.Instance), // Rank
new(1062952, 80, LastOnComparer.Instance), // Last On
new(1062953, 150, TitleComparer.Instance) // Guild Title
};
public GuildRosterGump(PlayerMobile pm, Guild g) : this(pm, g, LastOnComparer.Instance)

View file

@ -67,7 +67,7 @@ namespace Server.Gumps
974, 982
};
private static readonly List<int> _HouseSigns = new List<int>();
private static readonly List<int> _HouseSigns = new();
private readonly BaseHouse m_House;
private readonly HouseGumpPageAOS m_Page;

View file

@ -320,7 +320,7 @@ namespace Server.Gumps
{
private static readonly CustomCategory[] Categories =
{
new CustomCategory(
new(
Layer.InnerTorso,
1011357,
true,
@ -335,7 +335,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.MiddleTorso,
1011371,
true,
@ -352,7 +352,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.Shoes,
1011388,
true,
@ -366,7 +366,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.Helm,
1011375,
true,
@ -382,7 +382,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.Helm,
1015319,
true,
@ -398,7 +398,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.Pants,
1011367,
true,
@ -411,7 +411,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.Cloak,
1011393,
true,
@ -422,7 +422,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.Hair,
1011395,
true,
@ -441,7 +441,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.FacialHair,
1015320,
true,
@ -458,7 +458,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.FirstValid,
1011397,
false,
@ -477,7 +477,7 @@ namespace Server.Gumps
}
),
new CustomCategory(
new(
Layer.FirstValid,
1015325,
false,
@ -906,26 +906,26 @@ namespace Server.Gumps
{
private static readonly HairOrBeard[] m_HairStyles =
{
new HairOrBeard(0x203B, 1011052), // Short
new HairOrBeard(0x203C, 1011053), // Long
new HairOrBeard(0x203D, 1011054), // Ponytail
new HairOrBeard(0x2044, 1011055), // Mohawk
new HairOrBeard(0x2045, 1011047), // Pageboy
new HairOrBeard(0x204A, 1011050), // Topknot
new HairOrBeard(0x2047, 1011396), // Curly
new HairOrBeard(0x2048, 1011048), // Receding
new HairOrBeard(0x2049, 1011049) // 2-tails
new(0x203B, 1011052), // Short
new(0x203C, 1011053), // Long
new(0x203D, 1011054), // Ponytail
new(0x2044, 1011055), // Mohawk
new(0x2045, 1011047), // Pageboy
new(0x204A, 1011050), // Topknot
new(0x2047, 1011396), // Curly
new(0x2048, 1011048), // Receding
new(0x2049, 1011049) // 2-tails
};
private static readonly HairOrBeard[] m_BeardStyles =
{
new HairOrBeard(0x2041, 1011062), // Mustache
new HairOrBeard(0x203F, 1011060), // Short beard
new HairOrBeard(0x204B, 1015321), // Short Beard & Moustache
new HairOrBeard(0x203E, 1011061), // Long beard
new HairOrBeard(0x204C, 1015322), // Long Beard & Moustache
new HairOrBeard(0x2040, 1015323), // Goatee
new HairOrBeard(0x204D, 1011401) // Vandyke
new(0x2041, 1011062), // Mustache
new(0x203F, 1011060), // Short beard
new(0x204B, 1015321), // Short Beard & Moustache
new(0x203E, 1011061), // Long beard
new(0x204C, 1015322), // Long Beard & Moustache
new(0x2040, 1015323), // Goatee
new(0x204D, 1011401) // Vandyke
};
private readonly PlayerVendor m_Vendor;

View file

@ -6,24 +6,24 @@ namespace Server.Gumps
{
public class PolymorphEntry
{
public static readonly PolymorphEntry Chicken = new PolymorphEntry(8401, 0xD0, 1015236, 15, 10);
public static readonly PolymorphEntry Dog = new PolymorphEntry(8405, 0xD9, 1015237, 17, 10);
public static readonly PolymorphEntry Wolf = new PolymorphEntry(8426, 0xE1, 1015238, 18, 10);
public static readonly PolymorphEntry Panther = new PolymorphEntry(8473, 0xD6, 1015239, 20, 14);
public static readonly PolymorphEntry Gorilla = new PolymorphEntry(8437, 0x1D, 1015240, 23, 10);
public static readonly PolymorphEntry BlackBear = new PolymorphEntry(8399, 0xD3, 1015241, 22, 10);
public static readonly PolymorphEntry GrizzlyBear = new PolymorphEntry(8411, 0xD4, 1015242, 22, 12);
public static readonly PolymorphEntry PolarBear = new PolymorphEntry(8417, 0xD5, 1015243, 26, 10);
public static readonly PolymorphEntry HumanMale = new PolymorphEntry(8397, 0x190, 1015244, 29, 8);
public static readonly PolymorphEntry HumanFemale = new PolymorphEntry(8398, 0x191, 1015254, 29, 10);
public static readonly PolymorphEntry Slime = new PolymorphEntry(8424, 0x33, 1015246, 5, 10);
public static readonly PolymorphEntry Orc = new PolymorphEntry(8416, 0x11, 1015247, 29, 10);
public static readonly PolymorphEntry LizardMan = new PolymorphEntry(8414, 0x21, 1015248, 26, 10);
public static readonly PolymorphEntry Gargoyle = new PolymorphEntry(8409, 0x04, 1015249, 22, 10);
public static readonly PolymorphEntry Ogre = new PolymorphEntry(8415, 0x01, 1015250, 24, 9);
public static readonly PolymorphEntry Troll = new PolymorphEntry(8425, 0x36, 1015251, 25, 9);
public static readonly PolymorphEntry Ettin = new PolymorphEntry(8408, 0x02, 1015252, 25, 8);
public static readonly PolymorphEntry Daemon = new PolymorphEntry(8403, 0x09, 1015253, 25, 8);
public static readonly PolymorphEntry Chicken = new(8401, 0xD0, 1015236, 15, 10);
public static readonly PolymorphEntry Dog = new(8405, 0xD9, 1015237, 17, 10);
public static readonly PolymorphEntry Wolf = new(8426, 0xE1, 1015238, 18, 10);
public static readonly PolymorphEntry Panther = new(8473, 0xD6, 1015239, 20, 14);
public static readonly PolymorphEntry Gorilla = new(8437, 0x1D, 1015240, 23, 10);
public static readonly PolymorphEntry BlackBear = new(8399, 0xD3, 1015241, 22, 10);
public static readonly PolymorphEntry GrizzlyBear = new(8411, 0xD4, 1015242, 22, 12);
public static readonly PolymorphEntry PolarBear = new(8417, 0xD5, 1015243, 26, 10);
public static readonly PolymorphEntry HumanMale = new(8397, 0x190, 1015244, 29, 8);
public static readonly PolymorphEntry HumanFemale = new(8398, 0x191, 1015254, 29, 10);
public static readonly PolymorphEntry Slime = new(8424, 0x33, 1015246, 5, 10);
public static readonly PolymorphEntry Orc = new(8416, 0x11, 1015247, 29, 10);
public static readonly PolymorphEntry LizardMan = new(8414, 0x21, 1015248, 26, 10);
public static readonly PolymorphEntry Gargoyle = new(8409, 0x04, 1015249, 22, 10);
public static readonly PolymorphEntry Ogre = new(8415, 0x01, 1015250, 24, 9);
public static readonly PolymorphEntry Troll = new(8425, 0x36, 1015251, 25, 9);
public static readonly PolymorphEntry Ettin = new(8408, 0x02, 1015252, 25, 8);
public static readonly PolymorphEntry Daemon = new(8403, 0x09, 1015253, 25, 8);
private PolymorphEntry(int art, int body, int locNum, int x, int y)
{
@ -49,7 +49,7 @@ namespace Server.Gumps
{
private static readonly PolymorphCategory[] Categories =
{
new PolymorphCategory(
new(
1015235, // Animals
PolymorphEntry.Chicken,
PolymorphEntry.Dog,
@ -62,7 +62,7 @@ namespace Server.Gumps
PolymorphEntry.HumanMale
),
new PolymorphCategory(
new(
1015245, // Monsters
PolymorphEntry.Slime,
PolymorphEntry.Orc,

View file

@ -850,7 +850,7 @@ namespace Server.Gumps
private class PropertySorter : IComparer<PropertyInfo>
{
public static readonly PropertySorter Instance = new PropertySorter();
public static readonly PropertySorter Instance = new();
private PropertySorter()
{

View file

@ -525,7 +525,7 @@ namespace Server.Gumps
public static SkillsGumpGroup[] Groups { get; } =
{
new SkillsGumpGroup(
new(
"Crafting",
new[]
{
@ -541,7 +541,7 @@ namespace Server.Gumps
SkillName.Imbuing
}
),
new SkillsGumpGroup(
new(
"Bardic",
new[]
{
@ -551,7 +551,7 @@ namespace Server.Gumps
SkillName.Provocation
}
),
new SkillsGumpGroup(
new(
"Magical",
new[]
{
@ -568,7 +568,7 @@ namespace Server.Gumps
SkillName.Mysticism
}
),
new SkillsGumpGroup(
new(
"Miscellaneous",
new[]
{
@ -584,7 +584,7 @@ namespace Server.Gumps
SkillName.Veterinary
}
),
new SkillsGumpGroup(
new(
"Combat Ratings",
new[]
{
@ -598,7 +598,7 @@ namespace Server.Gumps
SkillName.Throwing
}
),
new SkillsGumpGroup(
new(
"Actions",
new[]
{
@ -613,7 +613,7 @@ namespace Server.Gumps
SkillName.Tracking
}
),
new SkillsGumpGroup(
new(
"Lore & Knowledge",
new[]
{