Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue