chore: Cleans up pattern checks. (#892)

This commit is contained in:
Kamron Batman 2021-12-24 15:53:59 -08:00 • committed by GitHub
parent 171df32257
commit 63e1b02d93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
283 changed files with 587 additions and 702 deletions

View file

@ -76,7 +76,7 @@ namespace Server.Items
{
var item = list[i];
if (!(item is Container) && item.StackWith(from, dropped, false))
if (item is not Container && item.StackWith(from, dropped, false))
{
return true;
}

View file

@ -646,11 +646,11 @@ namespace Server.Items
(int)KeyType.Rusty
);
}
else if (item is Arrow || item is Bolt)
else if (item is Arrow or Bolt)
{
item.Amount = Utility.RandomMinMax(2, 6);
}
else if (item is Bandage || item is Lockpick)
else if (item is Bandage or Lockpick)
{
item.Amount = Utility.RandomMinMax(1, 3);
}

View file

@ -356,7 +356,7 @@ namespace Server.Items
return false;
}
if (c is Armoire || c is FancyArmoire)
if (c is Armoire or FancyArmoire)
{
Timer t = new FurnitureTimer(c, m);
t.Start();
@ -382,7 +382,7 @@ namespace Server.Items
t.Stop();
}
if (c is Armoire || c is FancyArmoire)
if (c is Armoire or FancyArmoire)
{
c.ItemID = c.ItemID switch
{

View file

@ -157,13 +157,12 @@ namespace Server.Items
{
foreach (var i in Items)
{
if (!(i is IScissorable) || i.Deleted)
if (i is not IScissorable || i.Deleted)
{
continue;
}
if (i is BaseClothing || i is Cloth || i is BoltOfCloth || i is Hides || i is BonePile ||
i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Leather)
if (i is BaseClothing or Cloth or BoltOfCloth or Hides or BonePile || i is BaseArmor armor && CraftResources.GetType(armor.Resource) == CraftResourceType.Leather)
{
return true;
}
@ -249,7 +248,7 @@ namespace Server.Items
{
var item = scissorables[i];
if (!(item is IScissorable scissorable))
if (item is not IScissorable scissorable)
{
continue;
}