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

@ -80,8 +80,8 @@ namespace Server.Items
private class ResurrectEntry : ContextMenuEntry
{
private AnkhOfSacrificeAddon m_Ankh;
private Mobile m_Mobile;
private readonly AnkhOfSacrificeAddon m_Ankh;
private readonly Mobile m_Mobile;
public ResurrectEntry(Mobile mobile, AnkhOfSacrificeAddon ankh) : base(6195, 2)
{
@ -100,8 +100,8 @@ namespace Server.Items
private class LockKarmaEntry : ContextMenuEntry
{
private AnkhOfSacrificeAddon m_Ankh;
private PlayerMobile m_Mobile;
private readonly AnkhOfSacrificeAddon m_Ankh;
private readonly PlayerMobile m_Mobile;
public LockKarmaEntry(PlayerMobile mobile, AnkhOfSacrificeAddon ankh) : base(mobile.KarmaLocked ? 6197 : 6196, 2)
{

View file

@ -201,7 +201,7 @@ namespace Server.Items
public const int Start = 0x15AE;
public const int End = 0x15F4;
private BannerDeed m_Banner;
private readonly BannerDeed m_Banner;
public InternalGump(BannerDeed banner) : base(100, 200)
{
@ -217,7 +217,6 @@ namespace Server.Items
AddBackground(25, 0, 520, 230, 0xA28);
AddLabel(70, 12, 0x3E3, "Choose a Banner:");
int itemID = Start;
for (int i = 1; i <= 4; i++)
@ -254,8 +253,8 @@ namespace Server.Items
private class InternalTarget : Target
{
private BannerDeed m_Banner;
private int m_ItemID;
private readonly BannerDeed m_Banner;
private readonly int m_ItemID;
public InternalTarget(BannerDeed banner, int itemID) : base(-1, true, TargetFlags.None)
{
@ -336,10 +335,10 @@ namespace Server.Items
private class FacingGump : Gump
{
private BannerDeed m_Banner;
private BaseHouse m_House;
private int m_ItemID;
private Point3D m_Location;
private readonly BannerDeed m_Banner;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
public FacingGump(BannerDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{

View file

@ -7,7 +7,7 @@ namespace Server.Items
{
public class RewardBrazier : Item, IRewardItem
{
private static int[] m_Art =
private static readonly int[] m_Art =
{
0x19AA, 0x19BB
};
@ -204,7 +204,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private RewardBrazierDeed m_Brazier;
private readonly RewardBrazierDeed m_Brazier;
public InternalGump(RewardBrazierDeed brazier) : base(100, 200)
{

View file

@ -47,7 +47,7 @@ namespace Server.Items
public class CannonAddon : BaseAddon
{
private static int[] m_Effects =
private static readonly int[] m_Effects =
{
0x36B0, 0x3728, 0x3709, 0x36FE
};
@ -63,37 +63,37 @@ namespace Server.Items
switch (direction)
{
case CannonDirection.North:
{
AddComponent(new CannonAddonComponent(0xE8D), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8C), 0, 1, 0);
AddComponent(new CannonAddonComponent(0xE8B), 0, 2, 0);
{
AddComponent(new CannonAddonComponent(0xE8D), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8C), 0, 1, 0);
AddComponent(new CannonAddonComponent(0xE8B), 0, 2, 0);
break;
}
break;
}
case CannonDirection.East:
{
AddComponent(new CannonAddonComponent(0xE96), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE95), -1, 0, 0);
AddComponent(new CannonAddonComponent(0xE94), -2, 0, 0);
{
AddComponent(new CannonAddonComponent(0xE96), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE95), -1, 0, 0);
AddComponent(new CannonAddonComponent(0xE94), -2, 0, 0);
break;
}
break;
}
case CannonDirection.South:
{
AddComponent(new CannonAddonComponent(0xE91), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE92), 0, -1, 0);
AddComponent(new CannonAddonComponent(0xE93), 0, -2, 0);
{
AddComponent(new CannonAddonComponent(0xE91), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE92), 0, -1, 0);
AddComponent(new CannonAddonComponent(0xE93), 0, -2, 0);
break;
}
break;
}
default:
{
AddComponent(new CannonAddonComponent(0xE8E), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8F), 1, 0, 0);
AddComponent(new CannonAddonComponent(0xE90), 2, 0, 0);
{
AddComponent(new CannonAddonComponent(0xE8E), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8F), 1, 0, 0);
AddComponent(new CannonAddonComponent(0xE90), 2, 0, 0);
break;
}
break;
}
}
}
@ -114,7 +114,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public CannonDirection CannonDirection{ get; private set; }
public CannonDirection CannonDirection { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
@ -245,7 +245,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private CannonAddon m_Cannon;
private readonly CannonAddon m_Cannon;
public InternalTarget(CannonAddon cannon) : base(12, true, TargetFlags.None) => m_Cannon = cannon;
@ -314,8 +314,8 @@ namespace Server.Items
private class InternalGump : Gump
{
private CannonAddon m_Cannon;
private PotionKeg m_Keg;
private readonly CannonAddon m_Cannon;
private readonly PotionKeg m_Keg;
public InternalGump(CannonAddon cannon, PotionKeg keg) : base(50, 50)
{
@ -373,7 +373,8 @@ namespace Server.Items
public override BaseAddon Addon => new CannonAddon(m_Direction)
{
Charges = m_Charges, IsRewardItem = m_IsRewardItem
Charges = m_Charges,
IsRewardItem = m_IsRewardItem
};
[CommandProperty(AccessLevel.GameMaster)]

View file

@ -42,8 +42,8 @@ namespace Server.Items
}
public bool CouldFit(IPoint3D p, Map map) =>
map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) == true && (FacingSouth
&& BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map)
map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) == true && ((FacingSouth
&& BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map))
|| BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));
[CommandProperty(AccessLevel.GameMaster)]
@ -185,7 +185,7 @@ namespace Server.Items
0x1583 => 0x1634,
0x1584 => 0x1637,
0x1585 => 0x1636,
_ => (east + 1)
_ => east + 1
};
}
@ -195,7 +195,7 @@ namespace Server.Items
public const int End = 0x1585;
private int m_Page;
private DecorativeShieldDeed m_Shield;
private readonly DecorativeShieldDeed m_Shield;
public InternalGump(DecorativeShieldDeed shield, int page = 1) : base(150, 50)
{
@ -243,8 +243,8 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Shield?.Deleted != false || info.ButtonID < Start || info.ButtonID > End ||
((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) &&
(info.ButtonID < 0x1582 || info.ButtonID > 0x1585))
(((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) &&
(info.ButtonID < 0x1582 || info.ButtonID > 0x1585)))
return;
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
@ -254,8 +254,8 @@ namespace Server.Items
private class InternalTarget : Target
{
private int m_ItemID;
private DecorativeShieldDeed m_Shield;
private readonly int m_ItemID;
private readonly DecorativeShieldDeed m_Shield;
public InternalTarget(DecorativeShieldDeed shield, int itemID) : base(-1, true, TargetFlags.None)
{
@ -332,10 +332,10 @@ namespace Server.Items
private class FacingGump : Gump
{
private BaseHouse m_House;
private int m_ItemID;
private Point3D m_Location;
private DecorativeShieldDeed m_Shield;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
private readonly DecorativeShieldDeed m_Shield;
public FacingGump(DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{

View file

@ -194,7 +194,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private FlamingHeadDeed m_Head;
private readonly FlamingHeadDeed m_Head;
public InternalTarget(FlamingHeadDeed head) : base(-1, true, TargetFlags.None) => m_Head = head;

View file

@ -202,13 +202,13 @@ namespace Server.Items
{
0x1B1E => 0x1B1D,
0x1B7F => 0x1B7C,
_ => (south + 1)
_ => south + 1
};
}
private class InternalGump : Gump
{
private HangingSkeletonDeed m_Skeleton;
private readonly HangingSkeletonDeed m_Skeleton;
public InternalGump(HangingSkeletonDeed skeleton) : base(100, 200)
{
@ -243,8 +243,8 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Skeleton?.Deleted != false || info.ButtonID != 0x1A03 && info.ButtonID != 0x1A05 &&
info.ButtonID != 0x1A09 && info.ButtonID != 0x1B1E && info.ButtonID != 0x1B7F)
if (m_Skeleton?.Deleted != false || (info.ButtonID != 0x1A03 && info.ButtonID != 0x1A05 &&
info.ButtonID != 0x1A09 && info.ButtonID != 0x1B1E && info.ButtonID != 0x1B7F))
return;
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
@ -254,8 +254,8 @@ namespace Server.Items
private class InternalTarget : Target
{
private int m_ItemID;
private HangingSkeletonDeed m_Skeleton;
private readonly int m_ItemID;
private readonly HangingSkeletonDeed m_Skeleton;
public InternalTarget(HangingSkeletonDeed banner, int itemID) : base(-1, true, TargetFlags.None)
{
@ -332,10 +332,10 @@ namespace Server.Items
private class FacingGump : Gump
{
private BaseHouse m_House;
private int m_ItemID;
private Point3D m_Location;
private HangingSkeletonDeed m_Skeleton;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
private readonly HangingSkeletonDeed m_Skeleton;
public FacingGump(HangingSkeletonDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{

View file

@ -88,16 +88,16 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public MiningCartType CartType{ get; private set; }
public MiningCartType CartType { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Gems{ get; set; }
public int Gems { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Ore{ get; set; }
public int Ore { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
private void GiveResources()
{
@ -236,12 +236,8 @@ namespace Server.Items
writer.WriteEncodedInt(1); // version
#region version 1
writer.Write((int)CartType);
#endregion
writer.Write(IsRewardItem);
writer.Write(Gems);
writer.Write(Ore);
@ -308,10 +304,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int Gems{ get; set; }
public int Gems { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Ore{ get; set; }
public int Ore { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem

View file

@ -100,7 +100,6 @@ namespace Server.Items
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
@ -129,7 +128,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private PottedCactusDeed m_Cactus;
private readonly PottedCactusDeed m_Cactus;
public InternalGump(PottedCactusDeed cactus) : base(100, 200)
{

View file

@ -223,7 +223,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private StoneAnkhDeed m_Deed;
private readonly StoneAnkhDeed m_Deed;
public InternalGump(StoneAnkhDeed deed) : base(150, 50)
{

View file

@ -139,7 +139,6 @@ namespace Server.Items
AddComponent(new WallBannerComponent(0x159D), 2, 0, 0);
break;
case 17:
AddComponent(new WallBannerComponent(0x1610), 0, 0, 0);
AddComponent(new WallBannerComponent(0x160F), 0, 1, 0);
@ -350,11 +349,11 @@ namespace Server.Items
private class InternalGump : Gump
{
private WallBannerDeed m_WallBanner;
private readonly WallBannerDeed m_WallBanner;
public InternalGump(WallBannerDeed WallBanner) : base(150, 50)
public InternalGump(WallBannerDeed wallBanner) : base(150, 50)
{
m_WallBanner = WallBanner;
m_WallBanner = wallBanner;
Closable = true;
Disposable = true;

View file

@ -189,7 +189,7 @@ namespace Server.Items
private class TargetWeapon : Target
{
private WeaponEngravingTool m_Tool;
private readonly WeaponEngravingTool m_Tool;
public TargetWeapon(WeaponEngravingTool tool) : base(-1, true, TargetFlags.None) => m_Tool = tool;
@ -212,8 +212,8 @@ namespace Server.Items
private class InternalGump : Gump
{
private BaseWeapon m_Target;
private WeaponEngravingTool m_Tool;
private readonly BaseWeapon m_Target;
private readonly WeaponEngravingTool m_Tool;
public InternalGump(WeaponEngravingTool tool, BaseWeapon target) : base(0, 0)
{
@ -285,8 +285,8 @@ namespace Server.Items
public class ConfirmGump : Gump
{
private WeaponEngravingTool m_Engraver;
private Mobile m_Guildmaster;
private readonly WeaponEngravingTool m_Engraver;
private readonly Mobile m_Guildmaster;
public ConfirmGump(WeaponEngravingTool engraver, Mobile guildmaster) : base(200, 200)
{