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

@ -105,24 +105,12 @@ namespace Server.Items
public static bool ValidateDefault(Mobile from, BaseBoard board)
{
if (from.AccessLevel >= AccessLevel.GameMaster)
return true;
if (!from.Alive)
return false;
if (board.IsChildOf(from.Backpack))
return true;
IEntity root = board.RootParent;
if (root is Mobile && root != from)
return false;
if (board.Deleted || board.Map != from.Map || !from.InRange(board.GetWorldLocation(), 1))
return false;
return BaseHouse.FindHouseAt(board)?.IsOwner(from) == true;
// Fixed this because it implies you can use it from your bank, if you can access your bank
// while in your house. (!(board.RootParent is Mobile) || board.RootParent == from)
return !board.Deleted && (from.AccessLevel >= AccessLevel.GameMaster || from.Alive &&
(board.IsChildOf(from.Backpack) || !(board.RootParent is Mobile) &&
board.Map == from.Map && from.InRange(board.GetWorldLocation(), 1) &&
BaseHouse.FindHouseAt(board)?.IsOwner(from) == true));
}
public class DefaultEntry : ContextMenuEntry