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

@ -19,6 +19,11 @@ namespace Server.Items
private BookQuality m_Quality;
[Constructible]
public Runebook() : this(Core.SE ? 12 : 6)
{
}
[Constructible]
public Runebook(int maxCharges) : base(Core.AOS ? 0x22C5 : 0xEFA)
{
@ -37,11 +42,6 @@ namespace Server.Items
Level = SecureLevel.CoOwners;
}
[Constructible]
public Runebook() : this(Core.SE ? 12 : 6)
{
}
public Runebook(Serial serial) : base(serial)
{
}
@ -289,7 +289,7 @@ namespace Server.Items
public override void OnSingleClick(Mobile from)
{
if (m_Description != null && m_Description.Length > 0)
if (m_Description?.Length > 0)
LabelTo(from, m_Description);
base.OnSingleClick(from);
@ -349,10 +349,8 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsAosRules && (house.Public ? house.IsBanned(m) : !house.HasAccess(m)))
return false;
return house != null && house.HasSecureAccess(m, Level);
return (house?.IsAosRules != true || house.Public && !house.IsBanned(m) || house.HasAccess(m)) &&
house?.HasSecureAccess(m, Level) == true;
}
public override bool OnDragDrop(Mobile from, Item dropped)
@ -427,7 +425,7 @@ namespace Server.Items
public class RunebookEntry
{
public RunebookEntry(Point3D loc, Map map, string desc, BaseHouse house)
public RunebookEntry(Point3D loc, Map map, string desc, BaseHouse house = null)
{
Location = loc;
Map = map;
@ -467,7 +465,7 @@ namespace Server.Items
public void Serialize(GenericWriter writer)
{
if (House != null && !House.Deleted)
if (House?.Deleted == false)
{
writer.Write((byte)1); // version
@ -483,4 +481,4 @@ namespace Server.Items
writer.Write(Description);
}
}
}
}