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

@ -1,4 +1,5 @@
using System;
using System.Linq;
namespace Server.Items
{
@ -80,21 +81,8 @@ namespace Server.Items
public void Refresh()
{
bool found = false;
foreach (Mobile mob in GetMobilesInRange(CurrentRange))
{
if (mob.Hidden && mob.AccessLevel > AccessLevel.Player)
continue;
found = true;
break;
}
if (found)
ItemID = ActiveItemID;
else
ItemID = InactiveItemID;
bool found = GetMobilesInRange(CurrentRange).Any(mob => !mob.Hidden || mob.AccessLevel <= AccessLevel.Player);
ItemID = found ? ActiveItemID : InactiveItemID;
Visible = ItemID != 0x1;
}
@ -141,4 +129,4 @@ namespace Server.Items
Timer.DelayCall(TimeSpan.Zero, Refresh);
}
}
}
}