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

@ -4,11 +4,7 @@ namespace Server.Items
{
private CraftResource m_Resource;
public BaseIngot(CraftResource resource) : this(resource, 1)
{
}
public BaseIngot(CraftResource resource, int amount) : base(0x1BF2)
public BaseIngot(CraftResource resource, int amount = 1) : base(0x1BF2)
{
Stackable = true;
Amount = amount;
@ -142,12 +138,7 @@ namespace Server.Items
public class IronIngot : BaseIngot
{
[Constructible]
public IronIngot() : this(1)
{
}
[Constructible]
public IronIngot(int amount) : base(CraftResource.Iron, amount)
public IronIngot(int amount = 1) : base(CraftResource.Iron, amount)
{
}
@ -174,12 +165,7 @@ namespace Server.Items
public class DullCopperIngot : BaseIngot
{
[Constructible]
public DullCopperIngot() : this(1)
{
}
[Constructible]
public DullCopperIngot(int amount) : base(CraftResource.DullCopper, amount)
public DullCopperIngot(int amount = 1) : base(CraftResource.DullCopper, amount)
{
}
@ -206,12 +192,7 @@ namespace Server.Items
public class ShadowIronIngot : BaseIngot
{
[Constructible]
public ShadowIronIngot() : this(1)
{
}
[Constructible]
public ShadowIronIngot(int amount) : base(CraftResource.ShadowIron, amount)
public ShadowIronIngot(int amount = 1) : base(CraftResource.ShadowIron, amount)
{
}
@ -238,12 +219,7 @@ namespace Server.Items
public class CopperIngot : BaseIngot
{
[Constructible]
public CopperIngot() : this(1)
{
}
[Constructible]
public CopperIngot(int amount) : base(CraftResource.Copper, amount)
public CopperIngot(int amount = 1) : base(CraftResource.Copper, amount)
{
}
@ -270,12 +246,7 @@ namespace Server.Items
public class BronzeIngot : BaseIngot
{
[Constructible]
public BronzeIngot() : this(1)
{
}
[Constructible]
public BronzeIngot(int amount) : base(CraftResource.Bronze, amount)
public BronzeIngot(int amount = 1) : base(CraftResource.Bronze, amount)
{
}
@ -302,12 +273,7 @@ namespace Server.Items
public class GoldIngot : BaseIngot
{
[Constructible]
public GoldIngot() : this(1)
{
}
[Constructible]
public GoldIngot(int amount) : base(CraftResource.Gold, amount)
public GoldIngot(int amount = 1) : base(CraftResource.Gold, amount)
{
}
@ -334,12 +300,7 @@ namespace Server.Items
public class AgapiteIngot : BaseIngot
{
[Constructible]
public AgapiteIngot() : this(1)
{
}
[Constructible]
public AgapiteIngot(int amount) : base(CraftResource.Agapite, amount)
public AgapiteIngot(int amount = 1) : base(CraftResource.Agapite, amount)
{
}
@ -366,12 +327,7 @@ namespace Server.Items
public class VeriteIngot : BaseIngot
{
[Constructible]
public VeriteIngot() : this(1)
{
}
[Constructible]
public VeriteIngot(int amount) : base(CraftResource.Verite, amount)
public VeriteIngot(int amount = 1) : base(CraftResource.Verite, amount)
{
}
@ -398,12 +354,7 @@ namespace Server.Items
public class ValoriteIngot : BaseIngot
{
[Constructible]
public ValoriteIngot() : this(1)
{
}
[Constructible]
public ValoriteIngot(int amount) : base(CraftResource.Valorite, amount)
public ValoriteIngot(int amount = 1) : base(CraftResource.Valorite, amount)
{
}
@ -425,4 +376,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -8,11 +8,7 @@ namespace Server.Items
{
private CraftResource m_Resource;
public BaseOre(CraftResource resource) : this(resource, 1)
{
}
public BaseOre(CraftResource resource, int amount) : base(RandomSize())
public BaseOre(CraftResource resource, int amount = 1) : base(RandomSize())
{
Stackable = true;
Amount = amount;
@ -423,16 +419,11 @@ namespace Server.Items
public class IronOre : BaseOre
{
[Constructible]
public IronOre() : this(1)
public IronOre(int amount = 1) : base(CraftResource.Iron, amount)
{
}
[Constructible]
public IronOre(int amount) : base(CraftResource.Iron, amount)
{
}
public IronOre(bool fixedSize) : this(1)
public IronOre(bool fixedSize) : this()
{
if (fixedSize)
ItemID = 0x19B8;
@ -465,12 +456,7 @@ namespace Server.Items
public class DullCopperOre : BaseOre
{
[Constructible]
public DullCopperOre() : this(1)
{
}
[Constructible]
public DullCopperOre(int amount) : base(CraftResource.DullCopper, amount)
public DullCopperOre(int amount = 1) : base(CraftResource.DullCopper, amount)
{
}
@ -501,12 +487,7 @@ namespace Server.Items
public class ShadowIronOre : BaseOre
{
[Constructible]
public ShadowIronOre() : this(1)
{
}
[Constructible]
public ShadowIronOre(int amount) : base(CraftResource.ShadowIron, amount)
public ShadowIronOre(int amount = 1) : base(CraftResource.ShadowIron, amount)
{
}
@ -537,12 +518,7 @@ namespace Server.Items
public class CopperOre : BaseOre
{
[Constructible]
public CopperOre() : this(1)
{
}
[Constructible]
public CopperOre(int amount) : base(CraftResource.Copper, amount)
public CopperOre(int amount = 1) : base(CraftResource.Copper, amount)
{
}
@ -573,12 +549,7 @@ namespace Server.Items
public class BronzeOre : BaseOre
{
[Constructible]
public BronzeOre() : this(1)
{
}
[Constructible]
public BronzeOre(int amount) : base(CraftResource.Bronze, amount)
public BronzeOre(int amount = 1) : base(CraftResource.Bronze, amount)
{
}
@ -609,12 +580,7 @@ namespace Server.Items
public class GoldOre : BaseOre
{
[Constructible]
public GoldOre() : this(1)
{
}
[Constructible]
public GoldOre(int amount) : base(CraftResource.Gold, amount)
public GoldOre(int amount = 1) : base(CraftResource.Gold, amount)
{
}
@ -645,12 +611,7 @@ namespace Server.Items
public class AgapiteOre : BaseOre
{
[Constructible]
public AgapiteOre() : this(1)
{
}
[Constructible]
public AgapiteOre(int amount) : base(CraftResource.Agapite, amount)
public AgapiteOre(int amount = 1) : base(CraftResource.Agapite, amount)
{
}
@ -681,12 +642,7 @@ namespace Server.Items
public class VeriteOre : BaseOre
{
[Constructible]
public VeriteOre() : this(1)
{
}
[Constructible]
public VeriteOre(int amount) : base(CraftResource.Verite, amount)
public VeriteOre(int amount = 1) : base(CraftResource.Verite, amount)
{
}
@ -717,12 +673,7 @@ namespace Server.Items
public class ValoriteOre : BaseOre
{
[Constructible]
public ValoriteOre() : this(1)
{
}
[Constructible]
public ValoriteOre(int amount) : base(CraftResource.Valorite, amount)
public ValoriteOre(int amount = 1) : base(CraftResource.Valorite, amount)
{
}
@ -749,4 +700,4 @@ namespace Server.Items
return new ValoriteIngot();
}
}
}
}

View file

@ -4,11 +4,7 @@ namespace Server.Items
{
private CraftResource m_Resource;
public BaseScales(CraftResource resource) : this(resource, 1)
{
}
public BaseScales(CraftResource resource, int amount) : base(0x26B4)
public BaseScales(CraftResource resource, int amount = 1) : base(0x26B4)
{
Stackable = true;
Amount = amount;
@ -68,12 +64,7 @@ namespace Server.Items
public class RedScales : BaseScales
{
[Constructible]
public RedScales() : this(1)
{
}
[Constructible]
public RedScales(int amount) : base(CraftResource.RedScales, amount)
public RedScales(int amount = 1) : base(CraftResource.RedScales, amount)
{
}
@ -99,12 +90,7 @@ namespace Server.Items
public class YellowScales : BaseScales
{
[Constructible]
public YellowScales() : this(1)
{
}
[Constructible]
public YellowScales(int amount) : base(CraftResource.YellowScales, amount)
public YellowScales(int amount = 1) : base(CraftResource.YellowScales, amount)
{
}
@ -130,12 +116,7 @@ namespace Server.Items
public class BlackScales : BaseScales
{
[Constructible]
public BlackScales() : this(1)
{
}
[Constructible]
public BlackScales(int amount) : base(CraftResource.BlackScales, amount)
public BlackScales(int amount = 1) : base(CraftResource.BlackScales, amount)
{
}
@ -161,12 +142,7 @@ namespace Server.Items
public class GreenScales : BaseScales
{
[Constructible]
public GreenScales() : this(1)
{
}
[Constructible]
public GreenScales(int amount) : base(CraftResource.GreenScales, amount)
public GreenScales(int amount = 1) : base(CraftResource.GreenScales, amount)
{
}
@ -192,12 +168,7 @@ namespace Server.Items
public class WhiteScales : BaseScales
{
[Constructible]
public WhiteScales() : this(1)
{
}
[Constructible]
public WhiteScales(int amount) : base(CraftResource.WhiteScales, amount)
public WhiteScales(int amount = 1) : base(CraftResource.WhiteScales, amount)
{
}
@ -223,12 +194,7 @@ namespace Server.Items
public class BlueScales : BaseScales
{
[Constructible]
public BlueScales() : this(1)
{
}
[Constructible]
public BlueScales(int amount) : base(CraftResource.BlueScales, amount)
public BlueScales(int amount = 1) : base(CraftResource.BlueScales, amount)
{
}
@ -252,4 +218,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}