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

@ -44,7 +44,7 @@ namespace Server.Factions
{
get
{
if (Item == null || Item.Deleted)
if (Item?.Deleted != false)
return true;
return Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration;
@ -77,7 +77,7 @@ namespace Server.Factions
if (Item is IFactionItem item)
item.FactionItemState = null;
if (Faction != null && Faction.State.FactionItems.Contains(this))
if (Faction?.State.FactionItems.Contains(this) == true)
Faction.State.FactionItems.Remove(this);
}
@ -93,13 +93,7 @@ namespace Server.Factions
{
PlayerState pl = PlayerState.Find(mob);
if (pl == null)
return 0;
if (pl.Faction.IsCommander(mob))
return 9;
return pl.Rank.MaxWearables;
return pl == null ? 0 : pl.Faction.IsCommander(mob) ? 9 : pl.Rank.MaxWearables;
}
public static FactionItem Find(Item item)
@ -140,4 +134,4 @@ namespace Server.Factions
return item;
}
}
}
}