chore: Cleans up pattern checks. (#892)
This commit is contained in:
parent
171df32257
commit
63e1b02d93
283 changed files with 587 additions and 702 deletions
|
|
@ -32,7 +32,7 @@ namespace Server.Items
|
|||
{
|
||||
var dir = PlayerMobile.GetDirection4(from.Location, Location);
|
||||
|
||||
if (dir == Direction.North || dir == Direction.South)
|
||||
if (dir is Direction.North or Direction.South)
|
||||
{
|
||||
ItemID = 0xA55;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(obj is IPoint3D p3D))
|
||||
if (obj is not IPoint3D p3D)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ namespace Server.Items
|
|||
Effects.SendLocationEffect(p, Map, 0x352D, 16, 4);
|
||||
Effects.PlaySound(p, Map, 0x364);
|
||||
}
|
||||
else if (index <= 7 || index == 14)
|
||||
else if (index is <= 7 or 14)
|
||||
{
|
||||
if (RequireDeepWater)
|
||||
{
|
||||
|
|
@ -397,7 +397,7 @@ namespace Server.Items
|
|||
|
||||
private static bool ValidateUndeepWater(Map map, object obj, ref int z)
|
||||
{
|
||||
if (!(obj is StaticTarget))
|
||||
if (obj is not StaticTarget)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(from is PlayerMobile pm))
|
||||
if (@from is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ namespace Server.Items
|
|||
|
||||
public override bool OnDragDrop(Mobile from, Item item)
|
||||
{
|
||||
if (!(item is BasePotion pot))
|
||||
if (item is not BasePotion pot)
|
||||
{
|
||||
from.SendLocalizedMessage(502232); // The keg is not designed to hold that type of object.
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ namespace Server.Items
|
|||
// if (keg == null)
|
||||
// continue;
|
||||
|
||||
if (keg.Held <= 0 || keg.Held >= 100)
|
||||
if (keg.Held is <= 0 or >= 100)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(targeted is IPoint3D p) || from.Map == null)
|
||||
if (targeted is not IPoint3D p || from.Map == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
if (!(newItem is Runebook book))
|
||||
if (newItem is not Runebook book)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnAfterDuped(Item newItem)
|
||||
{
|
||||
if (!(newItem is Spellbook book))
|
||||
if (newItem is not Spellbook book)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ namespace Server.Items
|
|||
|
||||
private static void EventSink_BandageTargetRequest(Mobile from, Item item, Mobile target)
|
||||
{
|
||||
if (!(item is Bandage b) || b.Deleted)
|
||||
if (item is not Bandage b || b.Deleted)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -234,7 +234,7 @@ namespace Server.Items
|
|||
|
||||
public static void OnPickedInstrument(Mobile from, object targeted, InstrumentPickedCallback callback)
|
||||
{
|
||||
if (!(targeted is BaseInstrument instrument))
|
||||
if (targeted is not BaseInstrument instrument)
|
||||
{
|
||||
from.SendLocalizedMessage(500619); // That is not a musical instrument.
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@ namespace Server.Items
|
|||
val += 100;
|
||||
}
|
||||
|
||||
if (targ is VampireBat || targ is VampireBatFamiliar)
|
||||
if (targ is VampireBat or VampireBatFamiliar)
|
||||
{
|
||||
val += 100;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -178,7 +178,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
else if ((item is Runebook || item is RecallRune) && m_Tub.AllowRunebooks)
|
||||
else if (item is Runebook or RecallRune && m_Tub.AllowRunebooks)
|
||||
{
|
||||
if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
|
||||
{
|
||||
|
|
@ -211,9 +211,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
else if ((item is BaseArmor armor &&
|
||||
(armor.MaterialType == ArmorMaterialType.Leather ||
|
||||
armor.MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots ||
|
||||
item is WoodlandBelt) && m_Tub.AllowLeather)
|
||||
armor.MaterialType is ArmorMaterialType.Leather or ArmorMaterialType.Studded || item is ElvenBoots or WoodlandBelt) && m_Tub.AllowLeather)
|
||||
{
|
||||
if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server.Items
|
|||
}
|
||||
else if (targeted is Item item && !item.Movable)
|
||||
{
|
||||
if (item is IScissorable obj && (obj is PlagueBeastInnard || obj is PlagueBeastMutationCore))
|
||||
if (item is IScissorable obj && obj is PlagueBeastInnard or PlagueBeastMutationCore)
|
||||
{
|
||||
if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
|
||||
{
|
||||
|
|
@ -107,7 +107,7 @@ namespace Server.Items
|
|||
|
||||
protected override void OnNonlocalTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is IScissorable obj && (obj is PlagueBeastInnard || obj is PlagueBeastMutationCore))
|
||||
if (targeted is IScissorable obj && obj is PlagueBeastInnard or PlagueBeastMutationCore)
|
||||
{
|
||||
if (CanScissor(from, obj) && obj.Scissor(from, m_Item))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if (m_Item.LockLevel == 0 || m_Item.LockLevel == -255)
|
||||
if (m_Item.LockLevel is 0 or -255)
|
||||
{
|
||||
// LockLevel of 0 means that the door can't be picklocked
|
||||
// LockLevel of -255 means it's magic locked
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace Server.Items
|
|||
{
|
||||
var qs = player.Quest;
|
||||
|
||||
if (!(qs is WitchApprenticeQuest))
|
||||
if (qs is not WitchApprenticeQuest)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
@ -61,7 +61,7 @@ namespace Server.Items
|
|||
{
|
||||
Clock.GetTime(from.Map, from.X, from.Y, out var hours, out int _);
|
||||
|
||||
if (hours < 5 || hours > 17)
|
||||
if (hours is < 5 or > 17)
|
||||
{
|
||||
player.SendLocalizedMessage(
|
||||
1055040
|
||||
|
|
|
|||
|
|
@ -141,14 +141,14 @@ namespace Server.Items
|
|||
{
|
||||
var check = m.FindItemOnLayer(Layer.OneHanded);
|
||||
|
||||
if (check is BaseTool && check != tool && !(check is AncientSmithyHammer))
|
||||
if (check is BaseTool && check != tool && check is not AncientSmithyHammer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
check = m.FindItemOnLayer(Layer.TwoHanded);
|
||||
|
||||
return !(check is BaseTool) || check == tool || check is AncientSmithyHammer;
|
||||
return check is not BaseTool || check == tool || check is AncientSmithyHammer;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ namespace Server.Items
|
|||
|
||||
var version = reader.ReadInt();
|
||||
|
||||
if (ItemID == 0x13E4 || ItemID == 0x13E3)
|
||||
if (ItemID is 0x13E4 or 0x13E3)
|
||||
{
|
||||
ItemID = 0xF9D;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue