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

@ -97,8 +97,8 @@ namespace Server.Items
{
Opened = false;
if (Owner != null && SendDeleteOnClose)
Owner.Send(RemovePacket);
if (SendDeleteOnClose)
Owner?.Send(RemovePacket);
}
public override void OnSingleClick(Mobile from)
@ -116,30 +116,26 @@ namespace Server.Items
public override bool IsAccessibleTo(Mobile check)
{
if (check == Owner && Opened || check.AccessLevel >= AccessLevel.GameMaster)
return base.IsAccessibleTo(check);
return false;
return (check == Owner && Opened || check.AccessLevel >= AccessLevel.GameMaster) && base.IsAccessibleTo(check);
}
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (from == Owner && Opened || from.AccessLevel >= AccessLevel.GameMaster)
return base.OnDragDrop(from, dropped);
return false;
return (from == Owner && Opened || from.AccessLevel >= AccessLevel.GameMaster) && base.OnDragDrop(from, dropped);
}
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
{
if (from == Owner && Opened || from.AccessLevel >= AccessLevel.GameMaster)
return base.OnDragDropInto(from, item, p);
return false;
return (from == Owner && Opened || from.AccessLevel >= AccessLevel.GameMaster) &&
base.OnDragDropInto(from, item, p);
}
public override int GetTotal(TotalType type)
{
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold) return Owner.Account.TotalGold;
if (AccountGold.Enabled && Owner?.Account != null && type == TotalType.Gold)
return Owner.Account.TotalGold;
return base.GetTotal(type);
}
}
}
}