Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -6,12 +6,7 @@ namespace Server.Items
public class BoltOfCloth : Item, IScissorable, IDyable, ICommodity
{
[Constructible]
public BoltOfCloth() : this(1)
{
}
[Constructible]
public BoltOfCloth(int amount) : base(0xF95)
public BoltOfCloth(int amount = 1) : base(0xF95)
{
Stackable = true;
Weight = 5.0;
@ -65,4 +60,4 @@ namespace Server.Items
new MessageLocalized(Serial, ItemID, MessageType.Label, 0x3B2, 3, number, "", (Amount * 50).ToString()));
}
}
}
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class Bone : Item, ICommodity
{
[Constructible]
public Bone() : this(1)
{
}
[Constructible]
public Bone(int amount) : base(0xf7e)
public Bone(int amount = 1) : base(0xf7e)
{
Stackable = true;
Amount = amount;
@ -37,4 +32,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -6,12 +6,7 @@ namespace Server.Items
public class Cloth : Item, IScissorable, IDyable, ICommodity
{
[Constructible]
public Cloth() : this(1)
{
}
[Constructible]
public Cloth(int amount) : base(0x1766)
public Cloth(int amount = 1) : base(0x1766)
{
Stackable = true;
Amount = amount;
@ -65,4 +60,4 @@ namespace Server.Items
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString()));
}
}
}
}

View file

@ -5,12 +5,7 @@ namespace Server.Items
public class Cotton : Item, IDyable
{
[Constructible]
public Cotton() : this(1)
{
}
[Constructible]
public Cotton(int amount) : base(0xDF9)
public Cotton(int amount = 1) : base(0xDF9)
{
Stackable = true;
Weight = 4.0;
@ -109,4 +104,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -5,12 +5,7 @@ namespace Server.Items
public class Flax : Item
{
[Constructible]
public Flax() : this(1)
{
}
[Constructible]
public Flax(int amount) : base(0x1A9C)
public Flax(int amount = 1) : base(0x1A9C)
{
Stackable = true;
Weight = 1.0;
@ -99,4 +94,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -4,11 +4,7 @@ namespace Server.Items
{
private CraftResource m_Resource;
public BaseHides(CraftResource resource) : this(resource, 1)
{
}
public BaseHides(CraftResource resource, int amount) : base(0x1079)
public BaseHides(CraftResource resource, int amount = 1) : base(0x1079)
{
Stackable = true;
Weight = 5.0;
@ -107,12 +103,7 @@ namespace Server.Items
public class Hides : BaseHides, IScissorable
{
[Constructible]
public Hides() : this(1)
{
}
[Constructible]
public Hides(int amount) : base(CraftResource.RegularLeather, amount)
public Hides(int amount = 1) : base(CraftResource.RegularLeather, amount)
{
}
@ -154,12 +145,7 @@ namespace Server.Items
public class SpinedHides : BaseHides, IScissorable
{
[Constructible]
public SpinedHides() : this(1)
{
}
[Constructible]
public SpinedHides(int amount) : base(CraftResource.SpinedLeather, amount)
public SpinedHides(int amount = 1) : base(CraftResource.SpinedLeather, amount)
{
}
@ -201,12 +187,7 @@ namespace Server.Items
public class HornedHides : BaseHides, IScissorable
{
[Constructible]
public HornedHides() : this(1)
{
}
[Constructible]
public HornedHides(int amount) : base(CraftResource.HornedLeather, amount)
public HornedHides(int amount = 1) : base(CraftResource.HornedLeather, amount)
{
}
@ -248,12 +229,7 @@ namespace Server.Items
public class BarbedHides : BaseHides, IScissorable
{
[Constructible]
public BarbedHides() : this(1)
{
}
[Constructible]
public BarbedHides(int amount) : base(CraftResource.BarbedLeather, amount)
public BarbedHides(int amount = 1) : base(CraftResource.BarbedLeather, amount)
{
}
@ -290,4 +266,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,11 +4,7 @@ namespace Server.Items
{
private CraftResource m_Resource;
public BaseLeather(CraftResource resource) : this(resource, 1)
{
}
public BaseLeather(CraftResource resource, int amount) : base(0x1081)
public BaseLeather(CraftResource resource, int amount = 1) : base(0x1081)
{
Stackable = true;
Weight = 1.0;
@ -107,12 +103,7 @@ namespace Server.Items
public class Leather : BaseLeather
{
[Constructible]
public Leather() : this(1)
{
}
[Constructible]
public Leather(int amount) : base(CraftResource.RegularLeather, amount)
public Leather(int amount = 1) : base(CraftResource.RegularLeather, amount)
{
}
@ -139,12 +130,7 @@ namespace Server.Items
public class SpinedLeather : BaseLeather
{
[Constructible]
public SpinedLeather() : this(1)
{
}
[Constructible]
public SpinedLeather(int amount) : base(CraftResource.SpinedLeather, amount)
public SpinedLeather(int amount = 1) : base(CraftResource.SpinedLeather, amount)
{
}
@ -171,12 +157,7 @@ namespace Server.Items
public class HornedLeather : BaseLeather
{
[Constructible]
public HornedLeather() : this(1)
{
}
[Constructible]
public HornedLeather(int amount) : base(CraftResource.HornedLeather, amount)
public HornedLeather(int amount = 1) : base(CraftResource.HornedLeather, amount)
{
}
@ -203,12 +184,7 @@ namespace Server.Items
public class BarbedLeather : BaseLeather
{
[Constructible]
public BarbedLeather() : this(1)
{
}
[Constructible]
public BarbedLeather(int amount) : base(CraftResource.BarbedLeather, amount)
public BarbedLeather(int amount = 1) : base(CraftResource.BarbedLeather, amount)
{
}
@ -230,4 +206,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -6,12 +6,7 @@ namespace Server.Items
public class UncutCloth : Item, IScissorable, IDyable, ICommodity
{
[Constructible]
public UncutCloth() : this(1)
{
}
[Constructible]
public UncutCloth(int amount) : base(0x1767)
public UncutCloth(int amount = 1) : base(0x1767)
{
Stackable = true;
Amount = amount;
@ -65,4 +60,4 @@ namespace Server.Items
from.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, 0x3B2, 3, number, "", Amount.ToString()));
}
}
}
}

View file

@ -5,12 +5,7 @@ namespace Server.Items
public class Wool : Item, IDyable
{
[Constructible]
public Wool() : this(1)
{
}
[Constructible]
public Wool(int amount) : base(0xDF8)
public Wool(int amount = 1) : base(0xDF8)
{
Stackable = true;
Weight = 4.0;
@ -113,12 +108,7 @@ namespace Server.Items
public class TaintedWool : Wool
{
[Constructible]
public TaintedWool() : this(1)
{
}
[Constructible]
public TaintedWool(int amount) : base(0x101F)
public TaintedWool(int amount = 1) : base(0x101F)
{
Stackable = true;
Weight = 4.0;
@ -145,11 +135,11 @@ namespace Server.Items
public override void OnSpun(ISpinningWheel wheel, Mobile from, int hue)
{
Item item = new DarkYarn(1);
Item item = new DarkYarn();
item.Hue = hue;
from.AddToBackpack(item);
from.SendLocalizedMessage(1010574); // You put a ball of yarn in your backpack.
}
}
}
}

View file

@ -4,11 +4,7 @@ namespace Server.Items
{
public abstract class BaseClothMaterial : Item, IDyable
{
public BaseClothMaterial(int itemID) : this(itemID, 1)
{
}
public BaseClothMaterial(int itemID, int amount) : base(itemID)
public BaseClothMaterial(int itemID, int amount = 1) : base(itemID)
{
Stackable = true;
Weight = 1.0;
@ -110,12 +106,7 @@ namespace Server.Items
public class DarkYarn : BaseClothMaterial
{
[Constructible]
public DarkYarn() : this(1)
{
}
[Constructible]
public DarkYarn(int amount) : base(0xE1D, amount)
public DarkYarn(int amount = 1) : base(0xE1D, amount)
{
}
@ -141,12 +132,7 @@ namespace Server.Items
public class LightYarn : BaseClothMaterial
{
[Constructible]
public LightYarn() : this(1)
{
}
[Constructible]
public LightYarn(int amount) : base(0xE1E, amount)
public LightYarn(int amount = 1) : base(0xE1E, amount)
{
}
@ -172,12 +158,7 @@ namespace Server.Items
public class LightYarnUnraveled : BaseClothMaterial
{
[Constructible]
public LightYarnUnraveled() : this(1)
{
}
[Constructible]
public LightYarnUnraveled(int amount) : base(0xE1F, amount)
public LightYarnUnraveled(int amount = 1) : base(0xE1F, amount)
{
}
@ -203,12 +184,7 @@ namespace Server.Items
public class SpoolOfThread : BaseClothMaterial
{
[Constructible]
public SpoolOfThread() : this(1)
{
}
[Constructible]
public SpoolOfThread(int amount) : base(0xFA0, amount)
public SpoolOfThread(int amount = 1) : base(0xFA0, amount)
{
}
@ -230,4 +206,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}