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

@ -106,12 +106,7 @@ namespace Server.Items
private InternalItem m_Item;
[Constructible]
public AnkhWest() : this(false)
{
}
[Constructible]
public AnkhWest(bool bloodied) : base(bloodied ? 0x1D98 : 0x3)
public AnkhWest(bool bloodied = false) : base(bloodied ? 0x1D98 : 0x3)
{
Movable = false;
@ -281,12 +276,7 @@ namespace Server.Items
private InternalItem m_Item;
[Constructible]
public AnkhNorth() : this(false)
{
}
[Constructible]
public AnkhNorth(bool bloodied) : base(bloodied ? 0x1E5D : 0x4)
public AnkhNorth(bool bloodied = false) : base(bloodied ? 0x1E5D : 0x4)
{
Movable = false;
@ -452,4 +442,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -94,7 +94,7 @@ namespace Server.Items
{
get
{
if (m_Link != null && m_Link.Deleted)
if (m_Link?.Deleted == true)
m_Link = null;
return m_Link;
@ -435,7 +435,7 @@ namespace Server.Items
BaseDoor link = Link;
if (m_Open && link != null && !link.Open)
if (m_Open && link?.Open == false)
link.Open = true;
}
}
@ -521,4 +521,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -63,13 +63,7 @@ namespace Server.Items
public class GenericHouseDoor : BaseHouseDoor
{
[Constructible]
public GenericHouseDoor(DoorFacing facing, int baseItemID, int openedSound, int closedSound) : this(facing,
baseItemID, openedSound, closedSound, true)
{
}
[Constructible]
public GenericHouseDoor(DoorFacing facing, int baseItemID, int openedSound, int closedSound, bool autoAdjust)
public GenericHouseDoor(DoorFacing facing, int baseItemID, int openedSound, int closedSound, bool autoAdjust = true)
: base(facing, baseItemID + (autoAdjust ? 2 * (int)facing : 0),
baseItemID + 1 + (autoAdjust ? 2 * (int)facing : 0), openedSound, closedSound, GetOffset(facing))
{
@ -151,18 +145,16 @@ namespace Server.Items
{
BaseHouse house = FindHouse();
if (house != null && house.IsFriend(from) && from.AccessLevel == AccessLevel.Player && house.RefreshDecay())
if (house?.IsFriend(from) == true && from.AccessLevel == AccessLevel.Player && house.RefreshDecay())
from.SendLocalizedMessage(1043293); // Your house's age and contents have been refreshed.
if (house != null && house.Public && !house.IsFriend(from))
if (house?.Public == true && !house.IsFriend(from))
house.Visits++;
}
public override bool UseLocks()
{
BaseHouse house = FindHouse();
return house == null || !house.IsAosRules;
return FindHouse()?.IsAosRules != true;
}
public override void Use(Mobile from)
@ -250,7 +242,7 @@ namespace Server.Items
h = bs;
break;
//No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until furthur information gained
//No way to test the 'insideness' of SE Sliding doors on OSI, so leaving them default to false until further information gained
default: return false;
}
@ -262,4 +254,4 @@ namespace Server.Items
return rx >= x && rx < x + w && ry >= y && ry < y + h && az <= 4;
}
}
}
}