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,13 +6,7 @@ namespace Server.Items
private CraftResource m_Resource;
[Constructible]
public Board()
: this(1)
{
}
[Constructible]
public Board(int amount)
public Board(int amount = 1)
: this(CraftResource.RegularWood, amount)
{
}
@ -23,12 +17,7 @@ namespace Server.Items
}
[Constructible]
public Board(CraftResource resource) : this(resource, 1)
{
}
[Constructible]
public Board(CraftResource resource, int amount)
public Board(CraftResource resource, int amount = 1)
: base(0x1BD7)
{
Stackable = true;
@ -122,13 +111,7 @@ namespace Server.Items
public class HeartwoodBoard : Board
{
[Constructible]
public HeartwoodBoard()
: this(1)
{
}
[Constructible]
public HeartwoodBoard(int amount)
public HeartwoodBoard(int amount = 1)
: base(CraftResource.Heartwood, amount)
{
}
@ -156,13 +139,7 @@ namespace Server.Items
public class BloodwoodBoard : Board
{
[Constructible]
public BloodwoodBoard()
: this(1)
{
}
[Constructible]
public BloodwoodBoard(int amount)
public BloodwoodBoard(int amount = 1)
: base(CraftResource.Bloodwood, amount)
{
}
@ -190,13 +167,7 @@ namespace Server.Items
public class FrostwoodBoard : Board
{
[Constructible]
public FrostwoodBoard()
: this(1)
{
}
[Constructible]
public FrostwoodBoard(int amount)
public FrostwoodBoard(int amount = 1)
: base(CraftResource.Frostwood, amount)
{
}
@ -224,13 +195,7 @@ namespace Server.Items
public class OakBoard : Board
{
[Constructible]
public OakBoard()
: this(1)
{
}
[Constructible]
public OakBoard(int amount)
public OakBoard(int amount = 1)
: base(CraftResource.OakWood, amount)
{
}
@ -258,13 +223,7 @@ namespace Server.Items
public class AshBoard : Board
{
[Constructible]
public AshBoard()
: this(1)
{
}
[Constructible]
public AshBoard(int amount)
public AshBoard(int amount = 1)
: base(CraftResource.AshWood, amount)
{
}
@ -292,13 +251,7 @@ namespace Server.Items
public class YewBoard : Board
{
[Constructible]
public YewBoard()
: this(1)
{
}
[Constructible]
public YewBoard(int amount)
public YewBoard(int amount = 1)
: base(CraftResource.YewWood, amount)
{
}
@ -322,4 +275,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -169,14 +169,8 @@ namespace Server.Items
private Mobile m_Hunter;
[Constructible]
public TrophyAddon(Mobile from, int itemID, int westID, int northID, int deedNumber, int addonNumber) : this(from,
itemID, westID, northID, deedNumber, addonNumber, null, 0)
{
}
public TrophyAddon(Mobile from, int itemID, int westID, int northID, int deedNumber, int addonNumber, Mobile hunter,
int animalWeight) : base(itemID)
public TrophyAddon(Mobile from, int itemID, int westID, int northID, int deedNumber,
int addonNumber, Mobile hunter = null, int animalWeight = 0) : base(itemID)
{
WestID = westID;
NorthID = northID;
@ -335,7 +329,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
if (from.InRange(GetWorldLocation(), 1))
{
@ -358,14 +352,8 @@ namespace Server.Items
private Mobile m_Hunter;
[Constructible]
public TrophyDeed(int westID, int northID, int deedNumber, int addonNumber) : this(westID, northID, deedNumber,
addonNumber, null, 0)
{
}
public TrophyDeed(int westID, int northID, int deedNumber, int addonNumber, Mobile hunter, int animalWeight) :
base(0x14F0)
public TrophyDeed(int westID, int northID, int deedNumber, int addonNumber,
Mobile hunter = null, int animalWeight = 0) : base(0x14F0)
{
WestID = westID;
NorthID = northID;
@ -487,7 +475,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
bool westWall = BaseAddon.IsWall(from.X - 1, from.Y, from.Z, from.Map);
@ -497,14 +485,12 @@ namespace Server.Items
{
case Direction.North:
case Direction.South:
northWall = true;
westWall = false;
break;
case Direction.East:
case Direction.West:
northWall = false;
westWall = true;
break;
default: