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

@ -23,7 +23,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -4,7 +4,7 @@ namespace Server.Items
{
public class ClothingBlessTarget : Target // Create our targeting class (which we derive from the base target class)
{
private ClothingBlessDeed m_Deed;
private readonly ClothingBlessDeed m_Deed;
public ClothingBlessTarget(ClothingBlessDeed deed) : base(1, false, TargetFlags.None) => m_Deed = deed;
@ -21,8 +21,7 @@ namespace Server.Items
return;
}
if (item.LootType == LootType.Blessed || item.BlessedFor == from || Mobile.InsuranceEnabled && item.Insured
) // Check if its already newbied (blessed)
if (item.LootType == LootType.Blessed || item.BlessedFor == from || (Mobile.InsuranceEnabled && item.Insured)) // Check if its already newbied (blessed)
{
from.SendLocalizedMessage(1045113); // That item is already blessed
}

View file

@ -4,8 +4,8 @@ namespace Server.Items
{
public interface ICommodity /* added IsDeedable prop so expansion-based deedables can determine true/false */
{
int DescriptionNumber{ get; }
bool IsDeedable{ get; }
int DescriptionNumber { get; }
bool IsDeedable { get; }
}
public class CommodityDeed : Item
@ -26,7 +26,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Item Commodity{ get; private set; }
public Item Commodity { get; private set; }
public override int LabelNumber => Commodity == null ? 1047016 : 1047017;
@ -66,10 +66,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
if (Commodity != null) Hue = 0x592;
break;
}
{
if (Commodity != null) Hue = 0x592;
break;
}
}
}
@ -182,7 +182,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private CommodityDeed m_Deed;
private readonly CommodityDeed m_Deed;
public InternalTarget(CommodityDeed deed) : base(3, false, TargetFlags.None) => m_Deed = deed;
@ -203,8 +203,8 @@ namespace Server.Items
CommodityDeedBox cox = CommodityDeedBox.Find(m_Deed);
// Veteran Rewards mods
if (box != null && m_Deed.IsChildOf(box) && item.IsChildOf(box) ||
cox?.IsSecure != true && item.IsChildOf(cox))
if ((box != null && m_Deed.IsChildOf(box) && item.IsChildOf(box)) ||
(cox?.IsSecure != true && item.IsChildOf(cox)))
{
if (m_Deed.SetCommodity(item))
{

View file

@ -54,8 +54,6 @@ namespace Server.Items
}
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -76,8 +74,6 @@ namespace Server.Items
return quality;
}
#endregion
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
@ -153,16 +149,16 @@ namespace Server.Items
{
case 1:
case 0:
{
m_Exceptional = reader.ReadBool();
m_Crafter = reader.ReadMobile();
{
m_Exceptional = reader.ReadBool();
m_Crafter = reader.ReadMobile();
if (version < 1)
reader.ReadInt();
if (version < 1)
reader.ReadInt();
m_Resource = (CraftResource)reader.ReadInt();
break;
}
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
}
}

View file

@ -42,7 +42,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private int[][] ElvenArray =
private readonly int[][] ElvenArray =
{
new[] { 0 },
new[] { 1011064, 1011064, 0, 0, 0, 0 }, // bald
@ -56,10 +56,10 @@ namespace Server.Items
new[] { 1074393, 1074390, 0x2fd0, 0x2fcd, 0xedde, 0xc6cb } // buns, long
};
/*
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
*/
private int[][] HumanArray = /* why on earth cant these utilies be consistent with hex/dec */
/*
racial arrays are: cliloc_F, cliloc_M, ItemID_F, ItemID_M, gump_img_F, gump_img_M
*/
private readonly int[][] HumanArray = /* why on earth cant these utilies be consistent with hex/dec */
{
new[] { 0 },
new[] { 1011064, 1011064, 0, 0, 0, 0 }, // bald
@ -73,11 +73,11 @@ namespace Server.Items
new[] { 1011050, 1011050, 0x204A, 0x204A, 0xED29, 0xED29 }, // Topknot
new[] { 1011396, 1011396, 0x2047, 0x2047, 0xed25, 0xc618 } // Curly
};
/*
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
*/
/*
gump data: bgX, bgY, htmlX, htmlY, imgX, imgY, butX, butY
*/
private int[][] LayoutArray =
private readonly int[][] LayoutArray =
{
new[] { 0 }, /* padding: its more efficient than code to ++ the index/buttonid */
new[] { 425, 280, 342, 295, 000, 000, 310, 292 },
@ -92,8 +92,8 @@ namespace Server.Items
new[] { 235, 280, 150, 295, 168, 245, 118, 292 } // slot 10, Curly - N/A for elfs.
};
private HairRestylingDeed m_Deed;
private Mobile m_From;
private readonly HairRestylingDeed m_Deed;
private readonly Mobile m_From;
public InternalGump(Mobile from, HairRestylingDeed deed) : base(50, 50)
{

View file

@ -91,11 +91,12 @@ namespace Server.Items
Point3D loc = new Point3D(p);
if (p is StaticTarget target)
/* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script.
*/
loc.Z -= TileData.ItemTable[target.ItemID]
.CalcHeight; /* NOTE: OSI does not properly normalize Z positioning here.
* A side affect is that you can only place on floors (due to the CanFit call).
* That functionality may be desired. And so, it's included in this script.
*/
.CalcHeight;
if (ValidatePlacement(from, loc))
EndPlace(from, type, loc);
@ -117,8 +118,8 @@ namespace Server.Items
public class HolidayTreeChoiceGump : Gump
{
private HolidayTreeDeed m_Deed;
private Mobile m_From;
private readonly HolidayTreeDeed m_Deed;
private readonly Mobile m_From;
public HolidayTreeChoiceGump(Mobile from, HolidayTreeDeed deed) : base(200, 200)
{
@ -145,15 +146,15 @@ namespace Server.Items
switch (info.ButtonID)
{
case 1:
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Classic);
break;
}
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Classic);
break;
}
case 2:
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Modern);
break;
}
{
m_Deed.BeginPlace(m_From, HolidayTreeType.Modern);
break;
}
}
}
}

View file

@ -45,7 +45,7 @@ namespace Server.Items
public class NameChangeDeedGump : Gump
{
private Item m_Sender;
private readonly Item m_Sender;
public NameChangeDeedGump(Item sender) : base(50, 50)
{
@ -99,7 +99,6 @@ namespace Server.Items
string newName = nameEntry?.Text.Trim();
if (!NameVerification.Validate(newName, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote))
{
m.SendMessage("That name is unacceptable.");

View file

@ -18,7 +18,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Owner{ get; set; }
public Mobile Owner { get; set; }
public override int LabelNumber => 1062094; // a young player ticket
@ -49,10 +49,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
Owner = reader.ReadMobile();
break;
}
{
Owner = reader.ReadMobile();
break;
}
}
if (Name == "a young player ticket")
@ -78,7 +78,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private NewPlayerTicket m_Ticket;
private readonly NewPlayerTicket m_Ticket;
public InternalTarget(NewPlayerTicket ticket) : base(2, false, TargetFlags.None) => m_Ticket = ticket;
@ -115,8 +115,8 @@ namespace Server.Items
private class InternalGump : Gump
{
private Mobile m_From;
private NewPlayerTicket m_Ticket;
private readonly Mobile m_From;
private readonly NewPlayerTicket m_Ticket;
public InternalGump(Mobile from, NewPlayerTicket ticket) : base(50, 50)
{

View file

@ -42,10 +42,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int Price{ get; set; }
public int Price { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool LandlordRenew{ get; set; }
public bool LandlordRenew { get; set; }
public Mobile Offeree
{
@ -223,7 +223,7 @@ namespace Server.Items
private class ContractOptionEntry : ContextMenuEntry
{
private VendorRentalContract m_Contract;
private readonly VendorRentalContract m_Contract;
public ContractOptionEntry(VendorRentalContract contract) : base(6209) => m_Contract = contract;
@ -241,7 +241,7 @@ namespace Server.Items
private class RentTarget : Target
{
private VendorRentalContract m_Contract;
private readonly VendorRentalContract m_Contract;
public RentTarget(VendorRentalContract contract) : base(-1, false, TargetFlags.None) => m_Contract = contract;
@ -318,7 +318,7 @@ namespace Server.Items
private class OfferExpireTimer : Timer
{
private VendorRentalContract m_Contract;
private readonly VendorRentalContract m_Contract;
public OfferExpireTimer(VendorRentalContract contract) : base(TimeSpan.FromSeconds(30.0))
{