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

@ -50,7 +50,7 @@ namespace Server.Network
{ {
EnsureCapacity(256); EnsureCapacity(256);
Stream.Write(!(vendor.FindItemOnLayer(Layer.ShopBuy) is Container buyPack) ? Serial.MinusOne : buyPack.Serial); Stream.Write(vendor.FindItemOnLayer(Layer.ShopBuy) is not Container buyPack ? Serial.MinusOne : buyPack.Serial);
Stream.Write((byte)list.Count); Stream.Write((byte)list.Count);

View file

@ -71,7 +71,7 @@ namespace Server
return 50; return 50;
} }
if (!(objs[0] is CallPriorityAttribute attr)) if (objs[0] is not CallPriorityAttribute attr)
{ {
return 50; return 50;
} }

View file

@ -451,7 +451,7 @@ namespace Server.Collections
private void ThrowEnumerationNotStartedOrEnded() private void ThrowEnumerationNotStartedOrEnded()
{ {
Debug.Assert(_index == -1 || _index == -2); Debug.Assert(_index is -1 or -2);
throw new InvalidOperationException(_index == -1 ? CollectionThrowStrings.InvalidOperation_EnumNotStarted : CollectionThrowStrings.InvalidOperation_EnumEnded); throw new InvalidOperationException(_index == -1 ? CollectionThrowStrings.InvalidOperation_EnumNotStarted : CollectionThrowStrings.InvalidOperation_EnumEnded);
} }

View file

@ -70,7 +70,7 @@ namespace Server.ContextMenus
for (var i = 0; i < Entries.Length; ++i) for (var i = 0; i < Entries.Length; ++i)
{ {
var number = Entries[i].Number; var number = Entries[i].Number;
if (number < 3000000 || number > 3032767) if (number is < 3000000 or > 3032767)
{ {
return true; return true;
} }

View file

@ -231,7 +231,7 @@ namespace Server.Items
return container.CheckHold(m, item, message, checkItems, plusItems, plusWeight); return container.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
} }
if (!(parent is Item parentItem)) if (parent is not Item parentItem)
{ {
break; break;
} }
@ -504,7 +504,7 @@ namespace Server.Items
{ {
var item = list[i]; var item = list[i];
if (!(item is Container) && CheckHold(from, dropped, false, false) && if (item is not Container && CheckHold(from, dropped, false, false) &&
item.StackWith(from, dropped, playSound)) item.StackWith(from, dropped, playSound))
{ {
return true; return true;
@ -540,7 +540,7 @@ namespace Server.Items
{ {
var item = list[j]; var item = list[j];
if (!(item is Container) && CheckHold(from, dropped, false, false, 0, extraWeight) && if (item is not Container && CheckHold(from, dropped, false, false, 0, extraWeight) &&
item.CanStackWith(dropped)) item.CanStackWith(dropped))
{ {
stackItems.Add(new ItemStackEntry(item, dropped)); stackItems.Add(new ItemStackEntry(item, dropped));

View file

@ -443,7 +443,7 @@ namespace Server
var weight = TileData.ItemTable[m_ItemID].Weight; var weight = TileData.ItemTable[m_ItemID].Weight;
if (weight == 255 || weight == 0) if (weight is 255 or 0)
{ {
weight = 1; weight = 1;
} }

View file

@ -78,7 +78,7 @@ namespace Server.Json
reader.Read(); reader.Read();
if (key == "start" || key == "end") if (key is "start" or "end")
{ {
if (objType > -1 && objType != 2) if (objType > -1 && objType != 2)
{ {
@ -140,7 +140,7 @@ namespace Server.Json
objType = 1; objType = 1;
data[i - 10] = reader.GetInt32(); data[i - 10] = reader.GetInt32();
if (i == 12 || i == 15) if (i is 12 or 15)
{ {
hasZ = true; hasZ = true;
} }

View file

@ -520,7 +520,7 @@ namespace Server
var eable = map.GetItemsInRange(new Point3D(x, y, 0), 0); var eable = map.GetItemsInRange(new Point3D(x, y, 0), 0);
pool.AddRange( pool.AddRange(
eable.Where(item => item.ItemID <= TileData.MaxItemValue && !(item is BaseMulti)) eable.Where(item => item.ItemID <= TileData.MaxItemValue && item is not BaseMulti)
.OrderBy(item => item.Z) .OrderBy(item => item.Z)
.Take(pool.Capacity) .Take(pool.Capacity)
); );
@ -715,7 +715,7 @@ namespace Server
{ {
var item = sector.Items[i]; var item = sector.Items[i];
if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(p.X, p.Y) && if (item is not BaseMulti && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(p.X, p.Y) &&
!item.Movable) !item.Movable)
{ {
var id = item.ItemData; var id = item.ItemData;
@ -1145,7 +1145,7 @@ namespace Server
{ {
var item = items[i]; var item = items[i];
if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y)) if (item is not BaseMulti && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y))
{ {
var id = item.ItemData; var id = item.ItemData;
surface = id.Surface; surface = id.Surface;

View file

@ -1888,7 +1888,7 @@ namespace Server
item ??= FindItemOnLayer(Layer.Mount); item ??= FindItemOnLayer(Layer.Mount);
if (!(item is IMountItem mountItem)) if (item is not IMountItem mountItem)
{ {
return null; return null;
} }
@ -8397,7 +8397,7 @@ namespace Server
var n = Notoriety.Compute(this, target); var n = Notoriety.Compute(this, target);
return n == Notoriety.Criminal || n == Notoriety.Murderer; return n is Notoriety.Criminal or Notoriety.Murderer;
} }
/// <summary> /// <summary>

View file

@ -223,7 +223,7 @@ namespace Server.Network
private void SetPacketTime(int packetID) private void SetPacketTime(int packetID)
{ {
if (packetID < 0 || packetID >= 0x100) if (packetID is < 0 or >= 0x100)
{ {
return; return;
} }
@ -233,7 +233,7 @@ namespace Server.Network
public long GetPacketDelay(int packetID) public long GetPacketDelay(int packetID)
{ {
if (packetID < 0 || packetID >= 0x100) if (packetID is < 0 or >= 0x100)
{ {
return 0; return 0;
} }
@ -243,7 +243,7 @@ namespace Server.Network
private void UpdatePacketCount(int packetID) private void UpdatePacketCount(int packetID)
{ {
if (packetID < 0 || packetID >= 0x100) if (packetID is < 0 or >= 0x100)
{ {
return; return;
} }
@ -728,7 +728,7 @@ namespace Server.Network
{ {
reader.Advance((uint)packetLength); reader.Advance((uint)packetLength);
} }
else if (_parserState == ParserState.AwaitingPartialPacket || _parserState == ParserState.Throttled) else if (_parserState is ParserState.AwaitingPartialPacket or ParserState.Throttled)
{ {
break; break;
} }

View file

@ -60,7 +60,7 @@ namespace Server.Network
reader.ReadInt16(); // font reader.ReadInt16(); // font
var text = reader.ReadAsciiSafe().Trim(); var text = reader.ReadAsciiSafe().Trim();
if (text.Length <= 0 || text.Length > 128) if (text.Length is <= 0 or > 128)
{ {
return; return;
} }
@ -97,7 +97,7 @@ namespace Server.Network
var count = (value & 0xFFF0) >> 4; var count = (value & 0xFFF0) >> 4;
var hold = value & 0xF; var hold = value & 0xF;
if (count < 0 || count > 50) if (count is < 0 or > 50)
{ {
return; return;
} }
@ -141,7 +141,7 @@ namespace Server.Network
text = text.Trim(); text = text.Trim();
if (text.Length <= 0 || text.Length > 128) if (text.Length is <= 0 or > 128)
{ {
return; return;
} }

View file

@ -135,7 +135,7 @@ namespace Server
} }
} }
if (Lock < SkillLock.Up || Lock > SkillLock.Locked) if (Lock is < SkillLock.Up or > SkillLock.Locked)
{ {
Console.WriteLine("Bad skill lock -> {0}.{1}", owner.Owner, Lock); Console.WriteLine("Bad skill lock -> {0}.{1}", owner.Owner, Lock);
Lock = SkillLock.Up; Lock = SkillLock.Up;
@ -323,7 +323,7 @@ namespace Server
public void SetLockNoRelay(SkillLock skillLock) public void SetLockNoRelay(SkillLock skillLock)
{ {
if (skillLock < SkillLock.Up || skillLock > SkillLock.Locked) if (skillLock is < SkillLock.Up or > SkillLock.Locked)
{ {
return; return;
} }

View file

@ -343,7 +343,7 @@ namespace Server
if (endOfSection || i + 1 == end) if (endOfSection || i + 1 == end)
{ {
if (number < 0 || number > 255) if (number is < 0 or > 255)
{ {
valid = false; valid = false;
return false; return false;

View file

@ -758,7 +758,7 @@ namespace Server.Accounting
private static void EventSink_Connected(Mobile m) private static void EventSink_Connected(Mobile m)
{ {
if (!(m.Account is Account acc)) if (m.Account is not Account acc)
{ {
return; return;
} }

View file

@ -110,7 +110,7 @@ namespace Server.Misc
{ {
var from = e.Mobile; var from = e.Mobile;
if (!(from.Account is Account acct)) if (@from.Account is not Account acct)
{ {
return; return;
} }
@ -217,7 +217,7 @@ namespace Server.Misc
private static void EventSink_DeleteRequest(NetState state, int index) private static void EventSink_DeleteRequest(NetState state, int index)
{ {
if (!(state.Account is Account acct)) if (state.Account is not Account acct)
{ {
state.Disconnect("Attempted to delete a character but the account could not be found."); state.Disconnect("Attempted to delete a character but the account could not be found.");
return; return;
@ -349,7 +349,7 @@ namespace Server.Misc
e.Accepted = false; e.Accepted = false;
if (!(Accounts.GetAccount(un) is Account acct)) if (Accounts.GetAccount(un) is not Account acct)
{ {
// To prevent someone from making an account of just '' or a bunch of meaningless spaces // To prevent someone from making an account of just '' or a bunch of meaningless spaces
if (AutoAccountCreation && un.Trim().Length > 0) if (AutoAccountCreation && un.Trim().Length > 0)

View file

@ -37,7 +37,7 @@ namespace Server
protected override void OnTarget(Mobile from, object targeted) protected override void OnTarget(Mobile from, object targeted)
{ {
if (!(targeted is IPoint3D p)) if (targeted is not IPoint3D p)
{ {
return; return;
} }

View file

@ -24,7 +24,7 @@ namespace Server.Commands
foreach (var item in World.Items.Values) foreach (var item in World.Items.Values)
{ {
if ((item is Static || item is BaseFloor || item is BaseWall) if (item is Static or BaseFloor or BaseWall
&& item.RootParent == null) && item.RootParent == null)
{ {
w.WriteLine("SECTION WORLDITEM {0}", count); w.WriteLine("SECTION WORLDITEM {0}", count);

View file

@ -347,9 +347,7 @@ namespace Server.Commands.Generic
{ {
var result = Properties.IncreaseValue(e.Mobile, obj, e.Arguments); var result = Properties.IncreaseValue(e.Mobile, obj, e.Arguments);
if (result == "The property has been increased." || result == "The properties have been increased." || if (result is "The property has been increased." or "The properties have been increased." or "The property has been decreased." or "The properties have been decreased." or "The properties have been changed.")
result == "The property has been decreased." || result == "The properties have been decreased." ||
result == "The properties have been changed.")
{ {
AddResponse(result); AddResponse(result);
} }
@ -556,7 +554,7 @@ namespace Server.Commands.Generic
public override void Execute(CommandEventArgs e, object obj) public override void Execute(CommandEventArgs e, object obj)
{ {
if (!(obj is IPoint3D p)) if (obj is not IPoint3D p)
{ {
return; return;
} }
@ -588,7 +586,7 @@ namespace Server.Commands.Generic
public override void Execute(CommandEventArgs e, object obj) public override void Execute(CommandEventArgs e, object obj)
{ {
if (!(obj is IPoint3D p)) if (obj is not IPoint3D p)
{ {
return; return;
} }
@ -787,8 +785,7 @@ namespace Server.Commands.Generic
{ {
var result = Properties.GetValue(e.Mobile, obj, e.GetString(i)); var result = Properties.GetValue(e.Mobile, obj, e.GetString(i));
if (result == "Property not found." || result == "Property is write only." || if (result is "Property not found." or "Property is write only." || result.StartsWithOrdinal("Getting this property"))
result.StartsWithOrdinal("Getting this property"))
{ {
LogFailure(result); LogFailure(result);
} }
@ -1285,7 +1282,7 @@ namespace Server.Commands.Generic
public override void Execute(CommandEventArgs e, object obj) public override void Execute(CommandEventArgs e, object obj)
{ {
if (!(obj is Item item)) if (obj is not Item item)
{ {
return; return;
} }

View file

@ -35,7 +35,7 @@ namespace Server.Commands.Generic
{ {
house = null; house = null;
if (item == null || item is BaseMulti || item is HouseSign || staticsOnly && !(item is Static)) if (item is null or BaseMulti or HouseSign || staticsOnly && item is not Static)
{ {
return DesignInsertResult.InvalidItem; return DesignInsertResult.InvalidItem;
} }

View file

@ -325,7 +325,7 @@ namespace Server.Commands.Generic
throw new InvalidOperationException("Invalid string comparison operator."); throw new InvalidOperationException("Invalid string comparison operator.");
} }
if (m_Operator == StringOperator.Equal || m_Operator == StringOperator.NotEqual) if (m_Operator is StringOperator.Equal or StringOperator.NotEqual)
{ {
emitter.BeginCall( emitter.BeginCall(
type.GetMethod( type.GetMethod(

View file

@ -44,7 +44,7 @@ namespace Server.Commands.Generic
return; // sanity check return; // sanity check
} }
if (!(targeted is Container cont)) if (targeted is not Container cont)
{ {
from.SendMessage("That is not a container."); from.SendMessage("That is not a container.");
return; return;

View file

@ -46,7 +46,7 @@ namespace Server.Commands.Generic
{ {
case ObjectTypes.Both: case ObjectTypes.Both:
{ {
if (!(targeted is Item || targeted is Mobile)) if (!(targeted is Item or Mobile))
{ {
from.SendMessage("This command does not work on that."); from.SendMessage("This command does not work on that.");
return; return;
@ -56,7 +56,7 @@ namespace Server.Commands.Generic
} }
case ObjectTypes.Items: case ObjectTypes.Items:
{ {
if (!(targeted is Item)) if (targeted is not Item)
{ {
from.SendMessage("This command only works on items."); from.SendMessage("This command only works on items.");
return; return;
@ -66,7 +66,7 @@ namespace Server.Commands.Generic
} }
case ObjectTypes.Mobiles: case ObjectTypes.Mobiles:
{ {
if (!(targeted is Mobile)) if (targeted is not Mobile)
{ {
from.SendMessage("This command only works on mobiles."); from.SendMessage("This command only works on mobiles.");
return; return;

View file

@ -52,7 +52,7 @@ namespace Server.Commands.Generic
{ {
case ObjectTypes.Items: case ObjectTypes.Items:
{ {
if (!(obj is Item)) if (obj is not Item)
{ {
e.Mobile.SendMessage("This command only works on items."); e.Mobile.SendMessage("This command only works on items.");
return; return;
@ -62,7 +62,7 @@ namespace Server.Commands.Generic
} }
case ObjectTypes.Mobiles: case ObjectTypes.Mobiles:
{ {
if (!(obj is Mobile)) if (obj is not Mobile)
{ {
e.Mobile.SendMessage("This command only works on mobiles."); e.Mobile.SendMessage("This command only works on mobiles.");
return; return;

View file

@ -68,7 +68,7 @@ namespace Server.Commands.Generic
{ {
case ObjectTypes.Both: case ObjectTypes.Both:
{ {
if (!(targeted is Item) && !(targeted is Mobile)) if (targeted is not Item && targeted is not Mobile)
{ {
from.SendMessage("This command does not work on that."); from.SendMessage("This command does not work on that.");
return; return;
@ -78,7 +78,7 @@ namespace Server.Commands.Generic
} }
case ObjectTypes.Items: case ObjectTypes.Items:
{ {
if (!(targeted is Item)) if (targeted is not Item)
{ {
from.SendMessage("This command only works on items."); from.SendMessage("This command only works on items.");
return; return;
@ -88,7 +88,7 @@ namespace Server.Commands.Generic
} }
case ObjectTypes.Mobiles: case ObjectTypes.Mobiles:
{ {
if (!(targeted is Mobile)) if (targeted is not Mobile)
{ {
from.SendMessage("This command only works on mobiles."); from.SendMessage("This command only works on mobiles.");
return; return;

View file

@ -566,7 +566,7 @@ namespace Server.Commands
{ {
map = Map.AllMaps[i]; map = Map.AllMaps[i];
if (map.MapIndex == 0x7F || map.MapIndex == 0xFF) if (map.MapIndex is 0x7F or 0xFF)
{ {
continue; continue;
} }
@ -595,7 +595,7 @@ namespace Server.Commands
{ {
map = Map.AllMaps[i]; map = Map.AllMaps[i];
if (map.MapIndex == 0x7F || map.MapIndex == 0xFF || from.Map == map) if (map.MapIndex is 0x7F or 0xFF || @from.Map == map)
{ {
continue; continue;
} }
@ -629,7 +629,7 @@ namespace Server.Commands
from.SendMessage("Region name not found"); from.SendMessage("Region name not found");
} }
else if (e.Length == 2 || e.Length == 3) else if (e.Length is 2 or 3)
{ {
var map = from.Map; var map = from.Map;

View file

@ -76,7 +76,7 @@ namespace Server.Commands
continue; continue;
} }
if (usage == null || !(attrs[0] is DescriptionAttribute desc)) if (usage == null || attrs[0] is not DescriptionAttribute desc)
{ {
continue; continue;
} }

View file

@ -23,14 +23,14 @@ namespace Server.Commands
public override void Execute(CommandEventArgs e, object obj) public override void Execute(CommandEventArgs e, object obj)
{ {
if (!(obj is IPoint3D point)) if (obj is not IPoint3D point)
{ {
LogFailure("That cannot be located."); LogFailure("That cannot be located.");
return; return;
} }
var label = $"(x:{point.X}, y:{point.Y}, z:{point.Z})"; var label = $"(x:{point.X}, y:{point.Y}, z:{point.Z})";
if (obj is LandTarget || obj is StaticTarget) if (obj is LandTarget or StaticTarget)
{ {
List<int> graphics; List<int> graphics;
if (e.Arguments.Length == 0) if (e.Arguments.Length == 0)

View file

@ -73,7 +73,7 @@ namespace Server.Commands
var path = Core.BaseDirectory; var path = Core.BaseDirectory;
var name = !(from.Account is Account acct) ? from.Name : acct.Username; var name = @from.Account is not Account acct ? from.Name : acct.Username;
AppendPath(ref path, "Logs"); AppendPath(ref path, "Logs");
AppendPath(ref path, "Commands"); AppendPath(ref path, "Commands");

View file

@ -1107,7 +1107,7 @@ namespace Server.Commands
} }
} }
} }
else if (srcItem is Teleporter || srcItem is FillableContainer || srcItem is BaseBook) else if (srcItem is Teleporter or FillableContainer or BaseBook)
{ {
eable = map.GetItemsInRange(new Point3D(x, y, z), 0); eable = map.GetItemsInRange(new Point3D(x, y, z), 0);

View file

@ -1103,7 +1103,7 @@ namespace Server.Commands
} }
} }
} }
else if (srcItem is Teleporter || srcItem is FillableContainer || srcItem is BaseBook) else if (srcItem is Teleporter or FillableContainer or BaseBook)
{ {
eable = map.GetItemsInRange(new Point3D(x, y, z), 0); eable = map.GetItemsInRange(new Point3D(x, y, z), 0);

View file

@ -124,7 +124,7 @@ namespace Server.Commands
var count = 0; var count = 0;
foreach (var item in eable) foreach (var item in eable)
{ {
if (!(item is KeywordTeleporter || item is SkillTeleporter) && IsWithinZ(item.Z - worldLocation.Z)) if (!(item is KeywordTeleporter or SkillTeleporter) && IsWithinZ(item.Z - worldLocation.Z))
{ {
count++; count++;
item.Delete(); item.Delete();

View file

@ -263,7 +263,7 @@ namespace Server.Commands
{ {
var obj = realProps[i].GetValue(realObjs[i], null); var obj = realProps[i].GetValue(realObjs[i], null);
if (!(obj is IConvertible)) if (obj is not IConvertible)
{ {
return "Property is not IConvertable."; return "Property is not IConvertable.";
} }

View file

@ -168,7 +168,7 @@ namespace Server
continue; continue;
} }
if (item is Static || item is BaseFloor || item is BaseWall) if (item is Static or BaseFloor or BaseWall)
{ {
var itemMap = item.Map; var itemMap = item.Map;
@ -212,7 +212,7 @@ namespace Server
foreach (var item in eable) foreach (var item in eable)
{ {
if (item is Static || item is BaseFloor || item is BaseWall) if (item is Static or BaseFloor or BaseWall)
{ {
var itemMap = item.Map; var itemMap = item.Map;
@ -306,7 +306,7 @@ namespace Server
var xOffset = item.X - state.m_X * 8; var xOffset = item.X - state.m_X * 8;
var yOffset = item.Y - state.m_Y * 8; var yOffset = item.Y - state.m_Y * 8;
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8) if (xOffset is < 0 or >= 8 || yOffset is < 0 or >= 8)
{ {
continue; continue;
} }

View file

@ -85,7 +85,7 @@ namespace Server.Commands
foreach (var obj in eable) foreach (var obj in eable)
{ {
if (items && obj is Item && !(obj is BaseMulti || obj is HouseSign)) if (items && obj is Item && !(obj is BaseMulti or HouseSign))
{ {
toDelete.Add(obj); toDelete.Add(obj);
} }

View file

@ -709,7 +709,7 @@ namespace Server.Engines.BulkOrders
var price = Utility.ToInt32(text); var price = Utility.ToInt32(text);
if (price < 0 || price > 250000000) if (price is < 0 or > 250000000)
{ {
from.SendLocalizedMessage(1062390); // The price you requested is outrageous! from.SendLocalizedMessage(1062390); // The price you requested is outrageous!
} }

View file

@ -46,7 +46,7 @@ namespace Server.Engines.BulkOrders
return; return;
} }
if (!(m_Book.RootParent is PlayerVendor pv)) if (m_Book.RootParent is not PlayerVendor pv)
{ {
m_From.SendLocalizedMessage(1062382); // The deed selected is not available. m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
return; return;

View file

@ -533,7 +533,7 @@ namespace Server.Engines.BulkOrders
private static Item CreatePowerScroll(int type) private static Item CreatePowerScroll(int type)
{ {
if (type == 5 || type == 10 || type == 15 || type == 20) if (type is 5 or 10 or 15 or 20)
{ {
return new PowerScroll(SkillName.Blacksmith, 100 + type); return new PowerScroll(SkillName.Blacksmith, 100 + type);
} }
@ -545,7 +545,7 @@ namespace Server.Engines.BulkOrders
private static Item CreateAncientHammer(int type) private static Item CreateAncientHammer(int type)
{ {
if (type == 10 || type == 15 || type == 30 || type == 60) if (type is 10 or 15 or 30 or 60)
{ {
return new AncientSmithyHammer(type); return new AncientSmithyHammer(type);
} }
@ -848,7 +848,7 @@ namespace Server.Engines.BulkOrders
private static Item CreatePowerScroll(int type) private static Item CreatePowerScroll(int type)
{ {
if (type == 5 || type == 10 || type == 15 || type == 20) if (type is 5 or 10 or 15 or 20)
{ {
return new PowerScroll(SkillName.Tailoring, 100 + type); return new PowerScroll(SkillName.Tailoring, 100 + type);
} }

View file

@ -132,7 +132,7 @@ namespace Server.Engines.BulkOrders
from.SendLocalizedMessage(1045166); from.SendLocalizedMessage(1045166);
} }
else if (Type == null || objectType != Type && !objectType.IsSubclassOf(Type) || else if (Type == null || objectType != Type && !objectType.IsSubclassOf(Type) ||
!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) item is not BaseWeapon && item is not BaseArmor && item is not BaseClothing)
{ {
from.SendLocalizedMessage(1045169); // The item is not in the request. from.SendLocalizedMessage(1045169); // The item is not in the request.
} }

View file

@ -186,7 +186,7 @@ namespace Server.Engines.ConPVP
if (info.IsSwitched(1)) if (info.IsSwitched(1))
{ {
if (!(m_Challenged is PlayerMobile pm)) if (m_Challenged is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -99,7 +99,7 @@ namespace Server.Engines.ConPVP
public static bool IsFreeConsume(Mobile mob) public static bool IsFreeConsume(Mobile mob)
{ {
if (!(mob is PlayerMobile pm) || pm.DuelContext?.m_EventGame == null) if (mob is not PlayerMobile pm || pm.DuelContext?.m_EventGame == null)
{ {
return false; return false;
} }
@ -257,7 +257,7 @@ namespace Server.Engines.ConPVP
public static bool AllowSpecialAbility(Mobile from, string name, bool message) public static bool AllowSpecialAbility(Mobile from, string name, bool message)
{ {
if (!(from is PlayerMobile pm)) if (@from is not PlayerMobile pm)
{ {
return true; return true;
} }
@ -345,7 +345,7 @@ namespace Server.Engines.ConPVP
return false; return false;
} }
if (!(weapon is BaseRanged) && !Ruleset.GetOption("Weapons", "Melee")) if (weapon is not BaseRanged && !Ruleset.GetOption("Weapons", "Melee"))
{ {
return false; return false;
} }
@ -411,7 +411,7 @@ namespace Server.Engines.ConPVP
return true; return true;
} }
if (!(item is BaseRefreshPotion)) if (item is not BaseRefreshPotion)
{ {
if (CantDoAnything(from)) if (CantDoAnything(from))
{ {
@ -513,7 +513,7 @@ namespace Server.Engines.ConPVP
return false; return false;
} }
if (item is BasePotion && !(item is BaseExplosionPotion) && !(item is BaseRefreshPotion) && IsSuddenDeath) if (item is BasePotion && item is not BaseExplosionPotion && item is not BaseRefreshPotion && IsSuddenDeath)
{ {
from.SendMessage(0x22, "You may not drink potions in sudden death."); from.SendMessage(0x22, "You may not drink potions in sudden death.");
return false; return false;
@ -655,7 +655,7 @@ namespace Server.Engines.ConPVP
public void Requip(Mobile from, Container cont) public void Requip(Mobile from, Container cont)
{ {
if (!(cont is Corpse corpse)) if (cont is not Corpse corpse)
{ {
return; return;
} }
@ -670,7 +670,7 @@ namespace Server.Engines.ConPVP
{ {
var item = items[i]; var item = items[i];
if (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || !item.Movable) if (item.Layer is Layer.Hair or Layer.FacialHair || !item.Movable)
{ {
continue; continue;
} }
@ -1295,7 +1295,7 @@ namespace Server.Engines.ConPVP
private static void EventSink_Login(Mobile m) private static void EventSink_Login(Mobile m)
{ {
if (!(m is PlayerMobile pm)) if (m is not PlayerMobile pm)
{ {
return; return;
} }
@ -1385,7 +1385,7 @@ namespace Server.Engines.ConPVP
return; return;
} }
if (!(e.Mobile is PlayerMobile pm)) if (e.Mobile is not PlayerMobile pm)
{ {
return; return;
} }
@ -2048,7 +2048,7 @@ namespace Server.Engines.ConPVP
int number = item switch int number = item switch
{ {
BaseWeapon _ => 1062001, // You can no longer wield your ~1_WEAPON~ BaseWeapon _ => 1062001, // You can no longer wield your ~1_WEAPON~
_ when !(item is BaseShield) && (item is BaseArmor || item is BaseClothing) => 1062002, // You can no longer wear your ~1_ARMOR~ not BaseShield when item is BaseArmor or BaseClothing => 1062002, // You can no longer wear your ~1_ARMOR~
_ => 1062003 // You can no longer equip your ~1_SHIELD~ _ => 1062003 // You can no longer equip your ~1_SHIELD~
}; };
@ -2403,7 +2403,7 @@ namespace Server.Engines.ConPVP
m_GateFacet = Initiator.Map; m_GateFacet = Initiator.Map;
} }
if (!(arena.Teleporter is ExitTeleporter tp)) if (arena.Teleporter is not ExitTeleporter tp)
{ {
arena.Teleporter = tp = new ExitTeleporter(); arena.Teleporter = tp = new ExitTeleporter();
tp.MoveToWorld(arena.GateOut == Point3D.Zero ? arena.Outside : arena.GateOut, arena.Facet); tp.MoveToWorld(arena.GateOut == Point3D.Zero ? arena.Outside : arena.GateOut, arena.Facet);

View file

@ -210,7 +210,7 @@ namespace Server.Engines.ConPVP
return false; return false;
} }
if (!(obj is IPoint3D)) if (obj is not IPoint3D)
{ {
return false; return false;
} }
@ -1680,7 +1680,7 @@ namespace Server.Engines.ConPVP
public int GetTeamID(Mobile mob) public int GetTeamID(Mobile mob)
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return mob is BaseCreature creature ? creature.Team - 1 : -1; return mob is BaseCreature creature ? creature.Team - 1 : -1;
} }

View file

@ -953,7 +953,7 @@ namespace Server.Engines.ConPVP
public int GetTeamID(Mobile mob) public int GetTeamID(Mobile mob)
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return -1; return -1;
} }

View file

@ -553,7 +553,7 @@ namespace Server.Engines.ConPVP
public int GetTeamID(Mobile mob) public int GetTeamID(Mobile mob)
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return -1; return -1;
} }

View file

@ -924,7 +924,7 @@ namespace Server.Engines.ConPVP
public int GetTeamID(Mobile mob) public int GetTeamID(Mobile mob)
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return mob is BaseCreature creature ? creature.Team - 1 : -1; return mob is BaseCreature creature ? creature.Team - 1 : -1;
} }

View file

@ -318,7 +318,7 @@ namespace Server.Engines.ConPVP
if (info.IsSwitched(1)) if (info.IsSwitched(1))
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -565,7 +565,7 @@ namespace Server.Engines.ConPVP
private void AddPlayer_OnTarget(Mobile from, object obj) private void AddPlayer_OnTarget(Mobile from, object obj)
{ {
if (!(obj is Mobile mob) || mob == from) if (obj is not Mobile mob || mob == from)
{ {
m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players)); m_From.SendGump(new ConfirmSignupGump(m_From, m_Registrar, m_Tournament, m_Players));
@ -604,7 +604,7 @@ namespace Server.Engines.ConPVP
} }
else else
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -217,7 +217,7 @@ namespace Server.Engines.ConPVP
return; return;
} }
if (!(targeted is Mobile mob)) if (targeted is not Mobile mob)
{ {
from.SendMessage("That is not a player."); from.SendMessage("That is not a player.");
} }
@ -238,7 +238,7 @@ namespace Server.Engines.ConPVP
} }
else else
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -211,7 +211,7 @@ namespace Server.Engines.ConPVP
{ {
case 1: // okay case 1: // okay
{ {
if (!(m_From is PlayerMobile pm)) if (m_From is not PlayerMobile pm)
{ {
break; break;
} }

View file

@ -306,7 +306,7 @@ namespace Server.Engines.ConPVP
} }
case TourneyBracketGumpType.Participant_Info: case TourneyBracketGumpType.Participant_Info:
{ {
if (!(obj is TourneyParticipant part)) if (obj is not TourneyParticipant part)
{ {
break; break;
} }
@ -380,7 +380,7 @@ namespace Server.Engines.ConPVP
AddLeftArrow(25, 11, ToButtonID(0, 3)); AddLeftArrow(25, 11, ToButtonID(0, 3));
AddHtml(25, 35, 250, 20, Center("Participants")); AddHtml(25, 35, 250, 20, Center("Participants"));
if (!(obj is Mobile mob)) if (obj is not Mobile mob)
{ {
break; break;
} }
@ -428,7 +428,7 @@ namespace Server.Engines.ConPVP
AddLeftArrow(25, 11, ToButtonID(0, 2)); AddLeftArrow(25, 11, ToButtonID(0, 2));
AddHtml(25, 35, 250, 20, Center("Rounds")); AddHtml(25, 35, 250, 20, Center("Rounds"));
if (!(m_Object is PyramidLevel level)) if (m_Object is not PyramidLevel level)
{ {
break; break;
} }
@ -490,9 +490,7 @@ namespace Server.Engines.ConPVP
} }
} }
else if (m_Tournament.EventController != null || else if (m_Tournament.EventController != null ||
m_Tournament.TourneyType == TourneyType.RandomTeam || m_Tournament.TourneyType is TourneyType.RandomTeam or TourneyType.RedVsBlue or TourneyType.Faction)
m_Tournament.TourneyType == TourneyType.RedVsBlue ||
m_Tournament.TourneyType == TourneyType.Faction)
{ {
for (var j = 0; j < match.Participants.Count; ++j) for (var j = 0; j < match.Participants.Count; ++j)
{ {
@ -572,7 +570,7 @@ namespace Server.Engines.ConPVP
} }
case TourneyBracketGumpType.Match_Info: case TourneyBracketGumpType.Match_Info:
{ {
if (!(obj is TourneyMatch match)) if (obj is not TourneyMatch match)
{ {
break; break;
} }
@ -605,9 +603,7 @@ namespace Server.Engines.ConPVP
} }
} }
else if (m_Tournament.EventController != null || else if (m_Tournament.EventController != null ||
m_Tournament.TourneyType == TourneyType.RandomTeam || m_Tournament.TourneyType is TourneyType.RandomTeam or TourneyType.RedVsBlue or TourneyType.Faction)
m_Tournament.TourneyType == TourneyType.RedVsBlue ||
m_Tournament.TourneyType == TourneyType.Faction)
{ {
for (var i = 0; i < match.Participants.Count; ++i) for (var i = 0; i < match.Participants.Count; ++i)
{ {
@ -840,7 +836,7 @@ namespace Server.Engines.ConPVP
} }
case 5: case 5:
{ {
if (!(m_Object is TourneyMatch match)) if (m_Object is not TourneyMatch match)
{ {
break; break;
} }
@ -990,7 +986,7 @@ namespace Server.Engines.ConPVP
break; break;
} }
if (!(m_Object is PyramidLevel level)) if (m_Object is not PyramidLevel level)
{ {
break; break;
} }

View file

@ -211,7 +211,7 @@ namespace Server.Engines.ConPVP
{ {
var x = ourLevel - theirLevel; var x = ourLevel - theirLevel;
if (x < -6 || x > +6) if (x is < -6 or > +6)
{ {
return 0; return 0;
} }

View file

@ -16,7 +16,7 @@ namespace Server.Engines.ConPVP
{ {
var copy = new List<TourneyParticipant>(participants); var copy = new List<TourneyParticipant>(participants);
if (groupType == GroupingType.Nearest || groupType == GroupingType.HighVsLow) if (groupType is GroupingType.Nearest or GroupingType.HighVsLow)
{ {
copy.Sort(); copy.Sort();
} }

View file

@ -483,7 +483,7 @@ namespace Server.Engines.Craft
for (var j = 0; j < items[i].Length; ++j) for (var j = 0; j < items[i].Length; ++j)
{ {
if (!(items[i][j] is IHasQuantity hq)) if (items[i][j] is not IHasQuantity hq)
{ {
totals[i] += items[i][j].Amount; totals[i] += items[i][j].Amount;
} }
@ -512,7 +512,7 @@ namespace Server.Engines.Craft
{ {
var item = items[i][j]; var item = items[i][j];
if (!(item is IHasQuantity hq)) if (item is not IHasQuantity hq)
{ {
var theirAmount = item.Amount; var theirAmount = item.Amount;
@ -561,7 +561,7 @@ namespace Server.Engines.Craft
for (var i = 0; i < items.Length; ++i) for (var i = 0; i < items.Length; ++i)
{ {
if (!(items[i] is IHasQuantity hq)) if (items[i] is not IHasQuantity hq)
{ {
amount += items[i].Amount; amount += items[i].Amount;
} }

View file

@ -35,7 +35,7 @@ namespace Server.Engines.Craft
return EnhanceResult.NotInBackpack; return EnhanceResult.NotInBackpack;
} }
if (!(item is BaseArmor) && !(item is BaseWeapon)) if (item is not BaseArmor && item is not BaseWeapon)
{ {
return EnhanceResult.BadItem; return EnhanceResult.BadItem;
} }

View file

@ -90,11 +90,7 @@ namespace Server.Engines.Craft
if (m_CraftSystem is DefTailoring) if (m_CraftSystem is DefTailoring)
{ {
return clothing is BearMask return clothing is BearMask or DeerMask or TheMostKnowledgePerson or TheRobeOfBritanniaAri or EmbroideredOakLeafCloak;
|| clothing is DeerMask
|| clothing is TheMostKnowledgePerson
|| clothing is TheRobeOfBritanniaAri
|| clothing is EmbroideredOakLeafCloak;
} }
return false; return false;
@ -106,44 +102,23 @@ namespace Server.Engines.Craft
if (m_CraftSystem is DefTinkering) if (m_CraftSystem is DefTinkering)
{ {
return weapon is Cleaver return weapon is Cleaver or Hatchet or Pickaxe or ButcherKnife or SkinningKnife;
|| weapon is Hatchet
|| weapon is Pickaxe
|| weapon is ButcherKnife
|| weapon is SkinningKnife;
} }
if (m_CraftSystem is DefCarpentry) if (m_CraftSystem is DefCarpentry)
{ {
return weapon is Club return weapon is Club or BlackStaff or MagicWand or WildStaff;
|| weapon is BlackStaff
|| weapon is MagicWand
// TODO: Make these items craftable
|| weapon is WildStaff;
} }
if (m_CraftSystem is DefBlacksmithy) if (m_CraftSystem is DefBlacksmithy)
{ {
return weapon is Pitchfork return weapon is Pitchfork or RadiantScimitar or WarCleaver or ElvenSpellblade or AssassinSpike or Leafblade or RuneBlade or ElvenMachete or OrnateAxe or DiamondMace;
// TODO: Make these items craftable
|| weapon is RadiantScimitar
|| weapon is WarCleaver
|| weapon is ElvenSpellblade
|| weapon is AssassinSpike
|| weapon is Leafblade
|| weapon is RuneBlade
|| weapon is ElvenMachete
|| weapon is OrnateAxe
|| weapon is DiamondMace;
} }
// TODO: Make these items craftable // TODO: Make these items craftable
if (m_CraftSystem is DefBowFletching) if (m_CraftSystem is DefBowFletching)
{ {
return weapon is ElvenCompositeLongbow return weapon is ElvenCompositeLongbow or MagicalShortbow;
|| weapon is MagicalShortbow;
} }
return false; return false;
@ -156,36 +131,17 @@ namespace Server.Engines.Craft
// TODO: Make these items craftable // TODO: Make these items craftable
if (m_CraftSystem is DefTailoring) if (m_CraftSystem is DefTailoring)
{ {
return armor is LeafTonlet return armor is LeafTonlet or LeafArms or LeafChest or LeafGloves or LeafGorget or LeafLegs or HideChest or HideGloves or HideGorget or HidePants or HidePauldrons;
|| armor is LeafArms
|| armor is LeafChest
|| armor is LeafGloves
|| armor is LeafGorget
|| armor is LeafLegs
|| armor is HideChest
|| armor is HideGloves
|| armor is HideGorget
|| armor is HidePants
|| armor is HidePauldrons;
} }
if (m_CraftSystem is DefCarpentry) if (m_CraftSystem is DefCarpentry)
{ {
return armor is WingedHelm return armor is WingedHelm or RavenHelm or VultureHelm or WoodlandArms or WoodlandChest or WoodlandGloves or WoodlandGorget or WoodlandLegs;
|| armor is RavenHelm
|| armor is VultureHelm
|| armor is WoodlandArms
|| armor is WoodlandChest
|| armor is WoodlandGloves
|| armor is WoodlandGorget
|| armor is WoodlandLegs;
} }
if (m_CraftSystem is DefBlacksmithy) if (m_CraftSystem is DefBlacksmithy)
{ {
return armor is Circlet return armor is Circlet or RoyalCirclet or GemmedCirclet;
|| armor is RoyalCirclet
|| armor is GemmedCirclet;
} }
return false; return false;
@ -448,7 +404,7 @@ namespace Server.Engines.Craft
} }
if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null && if (m_CraftSystem.CraftItems.SearchForSubclass(clothing.GetType()) == null &&
!IsSpecialClothing(clothing) && !(clothing is TribalMask || clothing is HornedTribalMask)) !IsSpecialClothing(clothing) && !(clothing is TribalMask or HornedTribalMask))
{ {
number = usingDeed number = usingDeed
? 1061136 ? 1061136

View file

@ -87,7 +87,7 @@ namespace Server.Engines.Craft
int index; int index;
// Other Items // Other Items
if (Core.Expansion == Expansion.AOS || Core.Expansion == Expansion.SE) if (Core.Expansion is Expansion.AOS or Expansion.SE)
{ {
index = AddCraft(typeof(Board), 1044294, 1027127, 0.0, 0.0, typeof(Log), 1044466, 1, 1044465); index = AddCraft(typeof(Board), 1044294, 1027127, 0.0, 0.0, typeof(Log), 1044466, 1, 1044465);
SetUseAllRes(index, true); SetUseAllRes(index, true);

View file

@ -235,7 +235,7 @@ namespace Server.Engines.Doom
_ => new MushroomTrap() _ => new MushroomTrap()
}; };
if (trap is FireColumnTrap || trap is MushroomTrap) if (trap is FireColumnTrap or MushroomTrap)
{ {
trap.Hue = 0x451; trap.Hue = 0x451;
} }

View file

@ -31,7 +31,7 @@ namespace Server.Engines.Doom
public override void OnEnter(Mobile m) public override void OnEnter(Mobile m)
{ {
if (m == null || m is WandererOfTheVoid) if (m is null or WandererOfTheVoid)
{ {
return; return;
} }

View file

@ -160,7 +160,7 @@ namespace Server.Ethics
foreach (var item in eable) foreach (var item in eable)
{ {
if (item is AnkhNorth || item is AnkhWest) if (item is AnkhNorth or AnkhWest)
{ {
found = true; found = true;
break; break;

View file

@ -29,7 +29,7 @@ namespace Server.Ethics.Evil
{ {
var fac = Faction.Find(mob); var fac = Faction.Find(mob);
return fac is Minax || fac is Shadowlords; return fac is Minax or Shadowlords;
} }
} }
} }

View file

@ -23,7 +23,7 @@ namespace Server.Ethics.Evil
private void Power_OnTarget(Mobile fromMobile, object obj, Player from) private void Power_OnTarget(Mobile fromMobile, object obj, Player from)
{ {
if (!(obj is IPoint3D p)) if (obj is not IPoint3D p)
{ {
return; return;
} }

View file

@ -22,7 +22,7 @@ namespace Server.Ethics.Evil
private void Power_OnTarget(Mobile fromMobile, object obj, Player from) private void Power_OnTarget(Mobile fromMobile, object obj, Player from)
{ {
if (!(obj is Item item)) if (obj is not Item item)
{ {
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may not imbue that."); from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may not imbue that.");
return; return;
@ -45,7 +45,7 @@ namespace Server.Ethics.Evil
return; return;
} }
var canImbue = (item is Spellbook || item is BaseClothing || item is BaseArmor || item is BaseWeapon) && var canImbue = item is Spellbook or BaseClothing or BaseArmor or BaseWeapon &&
item.Name == null; item.Name == null;
if (canImbue) if (canImbue)

View file

@ -34,7 +34,7 @@ namespace Server.Ethics.Hero
var fac = Faction.Find(mob); var fac = Faction.Find(mob);
return fac is TrueBritannians || fac is CouncilOfMages; return fac is TrueBritannians or CouncilOfMages;
} }
} }
} }

View file

@ -23,7 +23,7 @@ namespace Server.Ethics.Hero
private void Power_OnTarget(Mobile fromMobile, object obj, Player from) private void Power_OnTarget(Mobile fromMobile, object obj, Player from)
{ {
if (!(obj is IPoint3D p)) if (obj is not IPoint3D p)
{ {
return; return;
} }

View file

@ -22,7 +22,7 @@ namespace Server.Ethics.Hero
private void Power_OnTarget(Mobile fromMobile, object obj, Player from) private void Power_OnTarget(Mobile fromMobile, object obj, Player from)
{ {
if (!(obj is Item item)) if (obj is not Item item)
{ {
from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may not imbue that."); from.Mobile.LocalOverheadMessage(MessageType.Regular, 0x3B2, false, "You may not imbue that.");
return; return;
@ -45,7 +45,7 @@ namespace Server.Ethics.Hero
return; return;
} }
var canImbue = (item is Spellbook || item is BaseClothing || item is BaseArmor || item is BaseWeapon) && var canImbue = item is Spellbook or BaseClothing or BaseArmor or BaseWeapon &&
item.Name == null; item.Name == null;
if (canImbue) if (canImbue)

View file

@ -502,7 +502,7 @@ namespace Server.Factions
public static bool IsFactionBanned(Mobile mob) public static bool IsFactionBanned(Mobile mob)
{ {
if (!(mob.Account is Account acct)) if (mob.Account is not Account acct)
{ {
return false; return false;
} }
@ -512,7 +512,7 @@ namespace Server.Factions
public void OnJoinAccepted(Mobile mob) public void OnJoinAccepted(Mobile mob)
{ {
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return; // sanity return; // sanity
} }
@ -571,7 +571,7 @@ namespace Server.Factions
for (var i = 0; i < members.Count; ++i) for (var i = 0; i < members.Count; ++i)
{ {
if (!(members[i] is PlayerMobile member)) if (members[i] is not PlayerMobile member)
{ {
continue; continue;
} }
@ -767,7 +767,7 @@ namespace Server.Factions
foreach (var item in World.Items.Values) foreach (var item in World.Items.Values)
{ {
if (item is IFactionItem && !(item is HoodedShroudOfShadows)) if (item is IFactionItem && item is not HoodedShroudOfShadows)
{ {
items.Add(item); items.Add(item);
} }

View file

@ -129,7 +129,7 @@ namespace Server.Factions
public static Item Imbue(Item item, Faction faction, bool expire, int hue) public static Item Imbue(Item item, Faction faction, bool expire, int hue)
{ {
if (!(item is IFactionItem)) if (item is not IFactionItem)
{ {
return item; return item;
} }

View file

@ -50,7 +50,7 @@ namespace Server.Factions
{ {
case 1: // continue case 1: // continue
{ {
if (!(m_From.Guild is Guild guild)) if (m_From.Guild is not Guild guild)
{ {
var pl = PlayerState.Find(m_From); var pl = PlayerState.Find(m_From);

View file

@ -32,7 +32,7 @@ namespace Server
TargetFlags.None, TargetFlags.None,
(from, obj, stormsEye) => (from, obj, stormsEye) =>
{ {
if (!stormsEye.Movable || stormsEye.Deleted || !(obj is IPoint3D pt)) if (!stormsEye.Movable || stormsEye.Deleted || obj is not IPoint3D pt)
{ {
return; return;
} }

View file

@ -156,7 +156,7 @@ namespace Server.Factions
return false; return false;
} }
if (m_Guard.Weapon is Item weapon && weapon.Parent == m_Guard && !(weapon is Fists)) if (m_Guard.Weapon is Item weapon && weapon.Parent == m_Guard && weapon is not Fists)
{ {
pack.DropItem(weapon); pack.DropItem(weapon);
return true; return true;

View file

@ -25,13 +25,12 @@ namespace Server.Engines.Harvest
var itemID = target.ItemID; var itemID = target.ItemID;
// grave // grave
if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || if (itemID is 0xED3 or 0xEDF or 0xEE0 or 0xEE1 or 0xEE2 or 0xEE8)
itemID == 0xEE8)
{ {
if (from is PlayerMobile player) if (from is PlayerMobile player)
{ {
var qs = player.Quest; var qs = player.Quest;
if (!(qs is WitchApprenticeQuest)) if (qs is not WitchApprenticeQuest)
{ {
return; return;
} }

View file

@ -350,7 +350,7 @@ namespace Server.Engines.Harvest
public override bool Give(Mobile m, Item item, bool placeAtFeet) public override bool Give(Mobile m, Item item, bool placeAtFeet)
{ {
if (item is TreasureMap || item is MessageInABottle || item is SpecialFishingNet) if (item is TreasureMap or MessageInABottle or SpecialFishingNet)
{ {
BaseCreature serp; BaseCreature serp;
@ -395,7 +395,7 @@ namespace Server.Engines.Harvest
return true; // we don't want to give the item to the player, it's on the serpent return true; // we don't want to give the item to the player, it's on the serpent
} }
return base.Give(m, item, placeAtFeet || item is BigFish || item is WoodenChest || item is MetalGoldenChest); return base.Give(m, item, placeAtFeet || item is BigFish or WoodenChest or MetalGoldenChest);
} }
public override void SendSuccessTo(Mobile from, Item item, HarvestResource resource) public override void SendSuccessTo(Mobile from, Item item, HarvestResource resource)
@ -405,7 +405,7 @@ namespace Server.Engines.Harvest
from.SendLocalizedMessage(1042635); // Your fishing pole bends as you pull a big fish from the depths! from.SendLocalizedMessage(1042635); // Your fishing pole bends as you pull a big fish from the depths!
fish.Fisher = from; fish.Fisher = from;
} }
else if (item is WoodenChest || item is MetalGoldenChest) else if (item is WoodenChest or MetalGoldenChest)
{ {
from.SendLocalizedMessage(503175); // You pull up a heavy chest from the depths of the ocean! from.SendLocalizedMessage(503175); // You pull up a heavy chest from the depths of the ocean!
} }

View file

@ -169,7 +169,7 @@ namespace Server.Engines.Harvest
{ {
item.LabelTo(from, 500464); // Use this on corpses to carve away meat and hide item.LabelTo(from, 500464); // Use this on corpses to carve away meat and hide
} }
else if (toHarvest is StaticTarget || toHarvest is LandTarget) else if (toHarvest is StaticTarget or LandTarget)
{ {
from.SendLocalizedMessage(500489); // You can't use an axe on that. from.SendLocalizedMessage(500489); // You can't use an axe on that.
} }

View file

@ -128,7 +128,7 @@ namespace Server.Engines.Help
public static bool CheckAllowedToPage(Mobile from) public static bool CheckAllowedToPage(Mobile from)
{ {
if (!(from is PlayerMobile pm)) if (@from is not PlayerMobile pm)
{ {
return true; return true;
} }

View file

@ -90,7 +90,7 @@ namespace Server.Engines.Help
protected override void OnTarget(Mobile from, object targeted) protected override void OnTarget(Mobile from, object targeted)
{ {
if (!(targeted is PlayerMobile pm)) if (targeted is not PlayerMobile pm)
{ {
from.SendMessage("Speech logs aren't supported on that target."); from.SendMessage("Speech logs aren't supported on that target.");
} }

View file

@ -36,7 +36,7 @@ namespace Server.Engines.MLQuests.Gumps
public override void OnResponse(NetState sender, RelayInfo info) public override void OnResponse(NetState sender, RelayInfo info)
{ {
if (!(sender.Mobile is PlayerMobile pm)) if (sender.Mobile is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -202,7 +202,7 @@ namespace Server.Engines.MLQuests.Gumps
CloseCurrent(state); CloseCurrent(state);
if (!(state.Mobile is PlayerMobile pm)) if (state.Mobile is not PlayerMobile pm)
{ {
return; return;
} }
@ -325,7 +325,7 @@ namespace Server.Engines.MLQuests.Gumps
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (!(from is PlayerMobile pm)) if (@from is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -22,7 +22,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
if (!(from is PlayerMobile pm) || pm.Backpack == null) if (@from is not PlayerMobile pm || pm.Backpack == null)
{ {
return; return;
} }

View file

@ -55,7 +55,7 @@ namespace Server.Engines.MLQuests.Items
return true; return true;
} }
if (!(m is PlayerMobile pm)) if (m is not PlayerMobile pm)
{ {
return false; return false;
} }

View file

@ -210,7 +210,7 @@ namespace Server.Engines.MLQuests
{ {
var m = e.Mobile; var m = e.Mobile;
if (e.Length == 0 || e.Length > 2) if (e.Length is 0 or > 2)
{ {
m.SendMessage("Syntax: SaveQuest <id> [saveEnabled=true]"); m.SendMessage("Syntax: SaveQuest <id> [saveEnabled=true]");
return; return;
@ -638,7 +638,7 @@ namespace Server.Engines.MLQuests
public static void EventSink_QuestGumpRequest(Mobile m) public static void EventSink_QuestGumpRequest(Mobile m)
{ {
if (!Enabled || !(m is PlayerMobile pm)) if (!Enabled || m is not PlayerMobile pm)
{ {
return; return;
} }
@ -809,7 +809,7 @@ namespace Server.Engines.MLQuests
{ {
var from = e.Mobile; var from = e.Mobile;
if (!(obj is PlayerMobile pm)) if (obj is not PlayerMobile pm)
{ {
LogFailure("That is not a player."); LogFailure("That is not a player.");
return; return;
@ -840,7 +840,7 @@ namespace Server.Engines.MLQuests
public override void Execute(CommandEventArgs e, object obj) public override void Execute(CommandEventArgs e, object obj)
{ {
if (!(obj is PlayerMobile pm)) if (obj is not PlayerMobile pm)
{ {
LogFailure("They have no ML quest context."); LogFailure("They have no ML quest context.");
} }

View file

@ -16,7 +16,7 @@ namespace Server.Engines.MLQuests.Objectives
{ {
var itemid = LabelToItemID(name.Number); var itemid = LabelToItemID(name.Number);
if (itemid <= 0 || itemid > 0x4000) if (itemid is <= 0 or > 0x4000)
{ {
Console.WriteLine("Warning: cliloc {0} is likely giving the wrong item ID", name.Number); Console.WriteLine("Warning: cliloc {0} is likely giving the wrong item ID", name.Number);
} }

View file

@ -24,7 +24,7 @@ namespace Server.Engines.MLQuests.Objectives
{ {
var itemid = CollectObjective.LabelToItemID(name.Number); var itemid = CollectObjective.LabelToItemID(name.Number);
if (itemid <= 0 || itemid > 0x4000) if (itemid is <= 0 or > 0x4000)
{ {
logger.Warning("Cliloc {0} is likely giving the wrong item ID", name.Number); logger.Warning("Cliloc {0} is likely giving the wrong item ID", name.Number);
} }

View file

@ -24,7 +24,7 @@ namespace Server.PathAlgorithms
var y = yDest + 1 - ySource; var y = yDest + 1 - ySource;
var v = y * 3 + x; var v = y * 3 + x;
if (v < 0 || v >= 9) if (v is < 0 or >= 9)
{ {
return Direction.North; return Direction.North;
} }

View file

@ -101,7 +101,7 @@ namespace Server.Engines.Plants
AddItem(127, 112, 0xC62); AddItem(127, 112, 0xC62);
} }
if (status == PlantStatus.Stage3 || status == PlantStatus.Stage4) if (status is PlantStatus.Stage3 or PlantStatus.Stage4)
{ {
AddItem(129, 85, 0xC7E); AddItem(129, 85, 0xC7E);
} }
@ -134,7 +134,7 @@ namespace Server.Engines.Plants
var hueInfo = PlantHueInfo.GetInfo(m_Plant.PlantHue); var hueInfo = PlantHueInfo.GetInfo(m_Plant.PlantHue);
// The large images for these trees trigger a client crash, so use a smaller, generic tree. // The large images for these trees trigger a client crash, so use a smaller, generic tree.
if (m_Plant.PlantType == PlantType.CypressTwisted || m_Plant.PlantType == PlantType.CypressStraight) if (m_Plant.PlantType is PlantType.CypressTwisted or PlantType.CypressStraight)
{ {
AddItem(130 + typeInfo.OffsetX, 96 + typeInfo.OffsetY, 0x0CCA, hueInfo.Hue); AddItem(130 + typeInfo.OffsetX, 96 + typeInfo.OffsetY, 0x0CCA, hueInfo.Hue);
} }

View file

@ -99,7 +99,7 @@ namespace Server.Items
return; return;
} }
if (!(targeted is LandTarget land)) if (targeted is not LandTarget land)
{ {
from.LocalOverheadMessage( from.LocalOverheadMessage(
MessageType.Regular, MessageType.Regular,

View file

@ -65,11 +65,11 @@ namespace Server.Items
return; return;
} }
if (!(targeted is Item item) || !item.IsChildOf(from.Backpack)) if (targeted is not Item item || !item.IsChildOf(from.Backpack))
{ {
from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it. from.SendLocalizedMessage(1042664); // You must have the object in your backpack to use it.
} }
else if (!(item is BaseBook)) else if (item is not BaseBook)
{ {
item.LabelTo(from, 1061911); // You can only use red leaves to seal the ink into book pages! item.LabelTo(from, 1061911); // You can only use red leaves to seal the ink into book pages!
} }

View file

@ -108,7 +108,7 @@ namespace Server.Engines.Plants
public static PlantHue GetNotBright(PlantHue plantHue) => plantHue & ~PlantHue.Bright; public static PlantHue GetNotBright(PlantHue plantHue) => plantHue & ~PlantHue.Bright;
public static bool IsPrimary(PlantHue plantHue) => public static bool IsPrimary(PlantHue plantHue) =>
plantHue == PlantHue.Red || plantHue == PlantHue.Blue || plantHue == PlantHue.Yellow; plantHue is PlantHue.Red or PlantHue.Blue or PlantHue.Yellow;
public static PlantHue Cross(PlantHue first, PlantHue second) public static PlantHue Cross(PlantHue first, PlantHue second)
{ {

View file

@ -67,7 +67,7 @@ namespace Server.Engines.Plants
get => m_PlantStatus; get => m_PlantStatus;
set set
{ {
if (m_PlantStatus == value || value < PlantStatus.BowlOfDirt || value > PlantStatus.DeadTwigs) if (m_PlantStatus == value || value is < PlantStatus.BowlOfDirt or > PlantStatus.DeadTwigs)
{ {
return; return;
} }
@ -151,7 +151,7 @@ namespace Server.Engines.Plants
return true; return true;
} }
if (!(RootParent is Mobile owner)) if (RootParent is not Mobile owner)
{ {
return false; return false;
} }
@ -491,7 +491,7 @@ namespace Server.Engines.Plants
var full = false; var full = false;
if (effect == PotionEffect.PoisonGreater || effect == PotionEffect.PoisonDeadly) if (effect is PotionEffect.PoisonGreater or PotionEffect.PoisonDeadly)
{ {
if (PlantSystem.IsFullPoisonPotion) if (PlantSystem.IsFullPoisonPotion)
{ {
@ -535,9 +535,7 @@ namespace Server.Engines.Plants
PlantSystem.StrengthPotion++; PlantSystem.StrengthPotion++;
} }
} }
else if (effect == PotionEffect.PoisonLesser || effect == PotionEffect.Poison || else if (effect is PotionEffect.PoisonLesser or PotionEffect.Poison or PotionEffect.CureLesser or PotionEffect.Cure or PotionEffect.HealLesser or PotionEffect.Heal or PotionEffect.Strength)
effect == PotionEffect.CureLesser || effect == PotionEffect.Cure ||
effect == PotionEffect.HealLesser || effect == PotionEffect.Heal || effect == PotionEffect.Strength)
{ {
message = 1053068; // This potion is not powerful enough to use on a plant! message = 1053068; // This potion is not powerful enough to use on a plant!
return false; return false;

View file

@ -393,7 +393,7 @@ namespace Server.Engines.Plants
{ {
var plant = plants[i]; var plant = plants[i];
if (plant.IsGrowable && !(plant.RootParent is Mobile) && now >= plant.PlantSystem.NextGrowth) if (plant.IsGrowable && plant.RootParent is not Mobile && now >= plant.PlantSystem.NextGrowth)
{ {
plant.PlantSystem.DoGrowthCheck(); plant.PlantSystem.DoGrowthCheck();
} }

View file

@ -34,8 +34,7 @@ namespace Server.Engines.Plants
} }
else else
{ {
if (!(targeted is PlantItem targ) || targ.PlantStatus >= PlantStatus.DecorativePlant || if (targeted is not PlantItem targ || targ.PlantStatus is >= PlantStatus.DecorativePlant or <= PlantStatus.BowlOfDirt)
targ.PlantStatus <= PlantStatus.BowlOfDirt)
{ {
m_Plant.LabelTo(from, 1053070); // You can only pollinate other specially grown plants! m_Plant.LabelTo(from, 1053070); // You can only pollinate other specially grown plants!
} }

View file

@ -129,8 +129,7 @@ namespace Server.Engines.Plants
{ {
var from = sender.Mobile; var from = sender.Mobile;
if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus >= PlantStatus.DecorativePlant || if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus is >= PlantStatus.DecorativePlant or PlantStatus.BowlOfDirt)
m_Plant.PlantStatus == PlantStatus.BowlOfDirt)
{ {
return; return;
} }

View file

@ -152,7 +152,7 @@ namespace Server.Engines.Plants
public override void OnAfterDuped(Item newItem) public override void OnAfterDuped(Item newItem)
{ {
if (!(newItem is Seed newSeed)) if (newItem is not Seed newSeed)
{ {
return; return;
} }

View file

@ -17,7 +17,7 @@ namespace Server.Engines.Quests.Collector
{ {
} }
public override bool CanDrop(PlayerMobile player) => !(player.Quest is CollectorQuest); public override bool CanDrop(PlayerMobile player) => player.Quest is not CollectorQuest;
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
@ -75,7 +75,7 @@ namespace Server.Engines.Quests.Collector
{ {
var qs = player.Quest; var qs = player.Quest;
if (!(qs is CollectorQuest)) if (qs is not CollectorQuest)
{ {
return; return;
} }

View file

@ -255,7 +255,7 @@ namespace Server.Engines.Quests.Collector
protected override void OnTarget(Mobile from, object targeted) protected override void OnTarget(Mobile from, object targeted)
{ {
if (m_Obsidian.Deleted || m_Obsidian.Quantity >= m_Completed || !(targeted is Item targ)) if (m_Obsidian.Deleted || m_Obsidian.Quantity >= m_Completed || targeted is not Item targ)
{ {
return; return;
} }

View file

@ -53,7 +53,7 @@ namespace Server.Engines.Quests.Collector
{ {
var qs = player.Quest; var qs = player.Quest;
if (!(qs is CollectorQuest)) if (qs is not CollectorQuest)
{ {
return; return;
} }
@ -149,7 +149,7 @@ namespace Server.Engines.Quests.Collector
{ {
var qs = player.Quest; var qs = player.Quest;
if (!(qs is CollectorQuest)) if (qs is not CollectorQuest)
{ {
return; return;
} }

View file

@ -431,7 +431,7 @@ namespace Server.Engines.Quests
{ {
inRestartPeriod = false; inRestartPeriod = false;
if (!(check is PlayerMobile pm)) if (check is not PlayerMobile pm)
{ {
return false; return false;
} }

View file

@ -83,7 +83,7 @@ namespace Server.Engines.Quests.Necro
public static bool HasLostCallingScroll(Mobile from) public static bool HasLostCallingScroll(Mobile from)
{ {
if (!(from is PlayerMobile pm)) if (@from is not PlayerMobile pm)
{ {
return false; return false;
} }

View file

@ -25,7 +25,7 @@ namespace Server.Engines.Quests.Necro
mob = creature.ControlMaster; mob = creature.ControlMaster;
} }
if (!(mob is PlayerMobile pm)) if (mob is not PlayerMobile pm)
{ {
return false; return false;
} }

View file

@ -22,7 +22,7 @@ namespace Server.Engines.Quests.Necro
public override int LabelNumber => 1060149; // Calling of Kronus public override int LabelNumber => 1060149; // Calling of Kronus
public override bool CanDrop(PlayerMobile player) => !(player.Quest is DarkTidesQuest); public override bool CanDrop(PlayerMobile player) => player.Quest is not DarkTidesQuest;
public override void OnDoubleClick(Mobile from) public override void OnDoubleClick(Mobile from)
{ {
@ -31,7 +31,7 @@ namespace Server.Engines.Quests.Necro
return; return;
} }
if (!(from is PlayerMobile pm)) if (@from is not PlayerMobile pm)
{ {
return; return;
} }

View file

@ -14,7 +14,7 @@ namespace Server.Engines.Quests.Necro
public override int LabelNumber => 1028827; // Scroll of Abraxus public override int LabelNumber => 1028827; // Scroll of Abraxus
public override bool CanDrop(PlayerMobile player) => !(player.Quest is DarkTidesQuest); public override bool CanDrop(PlayerMobile player) => player.Quest is not DarkTidesQuest;
public override void OnAdded(IEntity parent) public override void OnAdded(IEntity parent)
{ {

View file

@ -86,7 +86,7 @@ namespace Server.Engines.Quests.Necro
public override bool CanTalkTo(PlayerMobile to) public override bool CanTalkTo(PlayerMobile to)
{ {
if (!(to.Quest is DarkTidesQuest qs)) if (to.Quest is not DarkTidesQuest qs)
{ {
return to.Quest == null && QuestSystem.CanOfferQuest(to, typeof(DarkTidesQuest)); return to.Quest == null && QuestSystem.CanOfferQuest(to, typeof(DarkTidesQuest));
} }

Some files were not shown because too many files have changed in this diff Show more