diff --git a/Projects/Server.Tests/Tests/Network/Packets/Outgoing/VendorBuyPackets.cs b/Projects/Server.Tests/Tests/Network/Packets/Outgoing/VendorBuyPackets.cs index 0573d3263..d7414ea4c 100644 --- a/Projects/Server.Tests/Tests/Network/Packets/Outgoing/VendorBuyPackets.cs +++ b/Projects/Server.Tests/Tests/Network/Packets/Outgoing/VendorBuyPackets.cs @@ -50,7 +50,7 @@ namespace Server.Network { 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); diff --git a/Projects/Server/Attributes.cs b/Projects/Server/Attributes.cs index e81a91bed..000e50bd7 100644 --- a/Projects/Server/Attributes.cs +++ b/Projects/Server/Attributes.cs @@ -71,7 +71,7 @@ namespace Server return 50; } - if (!(objs[0] is CallPriorityAttribute attr)) + if (objs[0] is not CallPriorityAttribute attr) { return 50; } diff --git a/Projects/Server/Collections/PooledRefQueue.cs b/Projects/Server/Collections/PooledRefQueue.cs index b3a1b3937..577e7f6f4 100644 --- a/Projects/Server/Collections/PooledRefQueue.cs +++ b/Projects/Server/Collections/PooledRefQueue.cs @@ -451,7 +451,7 @@ namespace Server.Collections 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); } diff --git a/Projects/Server/ContextMenus/ContextMenu.cs b/Projects/Server/ContextMenus/ContextMenu.cs index a58a4d0a5..c6493334d 100644 --- a/Projects/Server/ContextMenus/ContextMenu.cs +++ b/Projects/Server/ContextMenus/ContextMenu.cs @@ -70,7 +70,7 @@ namespace Server.ContextMenus for (var i = 0; i < Entries.Length; ++i) { var number = Entries[i].Number; - if (number < 3000000 || number > 3032767) + if (number is < 3000000 or > 3032767) { return true; } diff --git a/Projects/Server/Items/Container.cs b/Projects/Server/Items/Container.cs index 43a2ba939..1b8375553 100644 --- a/Projects/Server/Items/Container.cs +++ b/Projects/Server/Items/Container.cs @@ -231,7 +231,7 @@ namespace Server.Items return container.CheckHold(m, item, message, checkItems, plusItems, plusWeight); } - if (!(parent is Item parentItem)) + if (parent is not Item parentItem) { break; } @@ -504,7 +504,7 @@ namespace Server.Items { 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)) { return true; @@ -540,7 +540,7 @@ namespace Server.Items { 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)) { stackItems.Add(new ItemStackEntry(item, dropped)); diff --git a/Projects/Server/Items/Item.cs b/Projects/Server/Items/Item.cs index 0e49d5568..8531c5a86 100644 --- a/Projects/Server/Items/Item.cs +++ b/Projects/Server/Items/Item.cs @@ -443,7 +443,7 @@ namespace Server var weight = TileData.ItemTable[m_ItemID].Weight; - if (weight == 255 || weight == 0) + if (weight is 255 or 0) { weight = 1; } diff --git a/Projects/Server/Json/Converters/Rectangle3DConverter.cs b/Projects/Server/Json/Converters/Rectangle3DConverter.cs index 1401ad874..f957337e5 100644 --- a/Projects/Server/Json/Converters/Rectangle3DConverter.cs +++ b/Projects/Server/Json/Converters/Rectangle3DConverter.cs @@ -78,7 +78,7 @@ namespace Server.Json reader.Read(); - if (key == "start" || key == "end") + if (key is "start" or "end") { if (objType > -1 && objType != 2) { @@ -140,7 +140,7 @@ namespace Server.Json objType = 1; data[i - 10] = reader.GetInt32(); - if (i == 12 || i == 15) + if (i is 12 or 15) { hasZ = true; } diff --git a/Projects/Server/Maps/Map.cs b/Projects/Server/Maps/Map.cs index 8dfe26e66..5593ee918 100644 --- a/Projects/Server/Maps/Map.cs +++ b/Projects/Server/Maps/Map.cs @@ -520,7 +520,7 @@ namespace Server var eable = map.GetItemsInRange(new Point3D(x, y, 0), 0); 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) .Take(pool.Capacity) ); @@ -715,7 +715,7 @@ namespace Server { 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) { var id = item.ItemData; @@ -1145,7 +1145,7 @@ namespace Server { 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; surface = id.Surface; diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 5e259a849..0e1f21fd4 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -1888,7 +1888,7 @@ namespace Server item ??= FindItemOnLayer(Layer.Mount); - if (!(item is IMountItem mountItem)) + if (item is not IMountItem mountItem) { return null; } @@ -8397,7 +8397,7 @@ namespace Server var n = Notoriety.Compute(this, target); - return n == Notoriety.Criminal || n == Notoriety.Murderer; + return n is Notoriety.Criminal or Notoriety.Murderer; } /// diff --git a/Projects/Server/Network/NetState/NetState.cs b/Projects/Server/Network/NetState/NetState.cs index 46a9622aa..b1916bf7b 100755 --- a/Projects/Server/Network/NetState/NetState.cs +++ b/Projects/Server/Network/NetState/NetState.cs @@ -223,7 +223,7 @@ namespace Server.Network private void SetPacketTime(int packetID) { - if (packetID < 0 || packetID >= 0x100) + if (packetID is < 0 or >= 0x100) { return; } @@ -233,7 +233,7 @@ namespace Server.Network public long GetPacketDelay(int packetID) { - if (packetID < 0 || packetID >= 0x100) + if (packetID is < 0 or >= 0x100) { return 0; } @@ -243,7 +243,7 @@ namespace Server.Network private void UpdatePacketCount(int packetID) { - if (packetID < 0 || packetID >= 0x100) + if (packetID is < 0 or >= 0x100) { return; } @@ -728,7 +728,7 @@ namespace Server.Network { reader.Advance((uint)packetLength); } - else if (_parserState == ParserState.AwaitingPartialPacket || _parserState == ParserState.Throttled) + else if (_parserState is ParserState.AwaitingPartialPacket or ParserState.Throttled) { break; } diff --git a/Projects/Server/Network/Packets/IncomingMessagePackets.cs b/Projects/Server/Network/Packets/IncomingMessagePackets.cs index 249bf4ea5..a40355498 100644 --- a/Projects/Server/Network/Packets/IncomingMessagePackets.cs +++ b/Projects/Server/Network/Packets/IncomingMessagePackets.cs @@ -60,7 +60,7 @@ namespace Server.Network reader.ReadInt16(); // font var text = reader.ReadAsciiSafe().Trim(); - if (text.Length <= 0 || text.Length > 128) + if (text.Length is <= 0 or > 128) { return; } @@ -97,7 +97,7 @@ namespace Server.Network var count = (value & 0xFFF0) >> 4; var hold = value & 0xF; - if (count < 0 || count > 50) + if (count is < 0 or > 50) { return; } @@ -141,7 +141,7 @@ namespace Server.Network text = text.Trim(); - if (text.Length <= 0 || text.Length > 128) + if (text.Length is <= 0 or > 128) { return; } diff --git a/Projects/Server/Skills.cs b/Projects/Server/Skills.cs index 077205507..75bfaf0c9 100644 --- a/Projects/Server/Skills.cs +++ b/Projects/Server/Skills.cs @@ -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); Lock = SkillLock.Up; @@ -323,7 +323,7 @@ namespace Server public void SetLockNoRelay(SkillLock skillLock) { - if (skillLock < SkillLock.Up || skillLock > SkillLock.Locked) + if (skillLock is < SkillLock.Up or > SkillLock.Locked) { return; } diff --git a/Projects/Server/Utilities/Utility.cs b/Projects/Server/Utilities/Utility.cs index d3a780a4f..faba17ece 100644 --- a/Projects/Server/Utilities/Utility.cs +++ b/Projects/Server/Utilities/Utility.cs @@ -343,7 +343,7 @@ namespace Server if (endOfSection || i + 1 == end) { - if (number < 0 || number > 255) + if (number is < 0 or > 255) { valid = false; return false; diff --git a/Projects/UOContent/Accounting/Account.cs b/Projects/UOContent/Accounting/Account.cs index 43a1f8fb8..81538bf8b 100644 --- a/Projects/UOContent/Accounting/Account.cs +++ b/Projects/UOContent/Accounting/Account.cs @@ -758,7 +758,7 @@ namespace Server.Accounting private static void EventSink_Connected(Mobile m) { - if (!(m.Account is Account acc)) + if (m.Account is not Account acc) { return; } diff --git a/Projects/UOContent/Accounting/AccountHandler.cs b/Projects/UOContent/Accounting/AccountHandler.cs index a115d993a..55c6a7598 100644 --- a/Projects/UOContent/Accounting/AccountHandler.cs +++ b/Projects/UOContent/Accounting/AccountHandler.cs @@ -110,7 +110,7 @@ namespace Server.Misc { var from = e.Mobile; - if (!(from.Account is Account acct)) + if (@from.Account is not Account acct) { return; } @@ -217,7 +217,7 @@ namespace Server.Misc 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."); return; @@ -349,7 +349,7 @@ namespace Server.Misc 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 if (AutoAccountCreation && un.Trim().Length > 0) diff --git a/Projects/UOContent/Commands/BoundingBoxPicker.cs b/Projects/UOContent/Commands/BoundingBoxPicker.cs index 40566bb6e..fa6c1028b 100644 --- a/Projects/UOContent/Commands/BoundingBoxPicker.cs +++ b/Projects/UOContent/Commands/BoundingBoxPicker.cs @@ -37,7 +37,7 @@ namespace Server protected override void OnTarget(Mobile from, object targeted) { - if (!(targeted is IPoint3D p)) + if (targeted is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Commands/ExportWSC.cs b/Projects/UOContent/Commands/ExportWSC.cs index 2ab02bbe8..f032e80fd 100644 --- a/Projects/UOContent/Commands/ExportWSC.cs +++ b/Projects/UOContent/Commands/ExportWSC.cs @@ -24,7 +24,7 @@ namespace Server.Commands 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) { w.WriteLine("SECTION WORLDITEM {0}", count); diff --git a/Projects/UOContent/Commands/Generic/Commands/Commands.cs b/Projects/UOContent/Commands/Generic/Commands/Commands.cs index 752c2e116..944b267b1 100644 --- a/Projects/UOContent/Commands/Generic/Commands/Commands.cs +++ b/Projects/UOContent/Commands/Generic/Commands/Commands.cs @@ -347,9 +347,7 @@ namespace Server.Commands.Generic { var result = Properties.IncreaseValue(e.Mobile, obj, e.Arguments); - if (result == "The property has been increased." || result == "The properties have been increased." || - result == "The property has been decreased." || result == "The properties have been decreased." || - result == "The properties have been changed.") + 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.") { AddResponse(result); } @@ -556,7 +554,7 @@ namespace Server.Commands.Generic public override void Execute(CommandEventArgs e, object obj) { - if (!(obj is IPoint3D p)) + if (obj is not IPoint3D p) { return; } @@ -588,7 +586,7 @@ namespace Server.Commands.Generic public override void Execute(CommandEventArgs e, object obj) { - if (!(obj is IPoint3D p)) + if (obj is not IPoint3D p) { return; } @@ -787,8 +785,7 @@ namespace Server.Commands.Generic { var result = Properties.GetValue(e.Mobile, obj, e.GetString(i)); - if (result == "Property not found." || result == "Property is write only." || - result.StartsWithOrdinal("Getting this property")) + if (result is "Property not found." or "Property is write only." || result.StartsWithOrdinal("Getting this property")) { LogFailure(result); } @@ -1285,7 +1282,7 @@ namespace Server.Commands.Generic public override void Execute(CommandEventArgs e, object obj) { - if (!(obj is Item item)) + if (obj is not Item item) { return; } diff --git a/Projects/UOContent/Commands/Generic/Commands/DesignInsert.cs b/Projects/UOContent/Commands/Generic/Commands/DesignInsert.cs index 7b31e855f..0a048ef51 100644 --- a/Projects/UOContent/Commands/Generic/Commands/DesignInsert.cs +++ b/Projects/UOContent/Commands/Generic/Commands/DesignInsert.cs @@ -35,7 +35,7 @@ namespace Server.Commands.Generic { 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; } diff --git a/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs b/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs index 4343d359b..58ea93f35 100644 --- a/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs +++ b/Projects/UOContent/Commands/Generic/Extensions/Compilers/ConditionalCompiler.cs @@ -325,7 +325,7 @@ namespace Server.Commands.Generic 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( type.GetMethod( diff --git a/Projects/UOContent/Commands/Generic/Implementors/ContainedCommandImplementor.cs b/Projects/UOContent/Commands/Generic/Implementors/ContainedCommandImplementor.cs index f7598fb5a..bf0fcdb8b 100644 --- a/Projects/UOContent/Commands/Generic/Implementors/ContainedCommandImplementor.cs +++ b/Projects/UOContent/Commands/Generic/Implementors/ContainedCommandImplementor.cs @@ -44,7 +44,7 @@ namespace Server.Commands.Generic return; // sanity check } - if (!(targeted is Container cont)) + if (targeted is not Container cont) { from.SendMessage("That is not a container."); return; diff --git a/Projects/UOContent/Commands/Generic/Implementors/MultiCommandImplementor.cs b/Projects/UOContent/Commands/Generic/Implementors/MultiCommandImplementor.cs index 87a030a61..45558d8f7 100644 --- a/Projects/UOContent/Commands/Generic/Implementors/MultiCommandImplementor.cs +++ b/Projects/UOContent/Commands/Generic/Implementors/MultiCommandImplementor.cs @@ -46,7 +46,7 @@ namespace Server.Commands.Generic { 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."); return; @@ -56,7 +56,7 @@ namespace Server.Commands.Generic } case ObjectTypes.Items: { - if (!(targeted is Item)) + if (targeted is not Item) { from.SendMessage("This command only works on items."); return; @@ -66,7 +66,7 @@ namespace Server.Commands.Generic } case ObjectTypes.Mobiles: { - if (!(targeted is Mobile)) + if (targeted is not Mobile) { from.SendMessage("This command only works on mobiles."); return; diff --git a/Projects/UOContent/Commands/Generic/Implementors/SerialCommandImplementor.cs b/Projects/UOContent/Commands/Generic/Implementors/SerialCommandImplementor.cs index 6ee458ea4..fca4324dd 100644 --- a/Projects/UOContent/Commands/Generic/Implementors/SerialCommandImplementor.cs +++ b/Projects/UOContent/Commands/Generic/Implementors/SerialCommandImplementor.cs @@ -52,7 +52,7 @@ namespace Server.Commands.Generic { case ObjectTypes.Items: { - if (!(obj is Item)) + if (obj is not Item) { e.Mobile.SendMessage("This command only works on items."); return; @@ -62,7 +62,7 @@ namespace Server.Commands.Generic } case ObjectTypes.Mobiles: { - if (!(obj is Mobile)) + if (obj is not Mobile) { e.Mobile.SendMessage("This command only works on mobiles."); return; diff --git a/Projects/UOContent/Commands/Generic/Implementors/SingleCommandImplementor.cs b/Projects/UOContent/Commands/Generic/Implementors/SingleCommandImplementor.cs index 11aeb43bb..3220cd28b 100644 --- a/Projects/UOContent/Commands/Generic/Implementors/SingleCommandImplementor.cs +++ b/Projects/UOContent/Commands/Generic/Implementors/SingleCommandImplementor.cs @@ -68,7 +68,7 @@ namespace Server.Commands.Generic { 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."); return; @@ -78,7 +78,7 @@ namespace Server.Commands.Generic } case ObjectTypes.Items: { - if (!(targeted is Item)) + if (targeted is not Item) { from.SendMessage("This command only works on items."); return; @@ -88,7 +88,7 @@ namespace Server.Commands.Generic } case ObjectTypes.Mobiles: { - if (!(targeted is Mobile)) + if (targeted is not Mobile) { from.SendMessage("This command only works on mobiles."); return; diff --git a/Projects/UOContent/Commands/Handlers.cs b/Projects/UOContent/Commands/Handlers.cs index b289f9acd..94a7f9395 100644 --- a/Projects/UOContent/Commands/Handlers.cs +++ b/Projects/UOContent/Commands/Handlers.cs @@ -566,7 +566,7 @@ namespace Server.Commands { map = Map.AllMaps[i]; - if (map.MapIndex == 0x7F || map.MapIndex == 0xFF) + if (map.MapIndex is 0x7F or 0xFF) { continue; } @@ -595,7 +595,7 @@ namespace Server.Commands { 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; } @@ -629,7 +629,7 @@ namespace Server.Commands 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; diff --git a/Projects/UOContent/Commands/HelpInfo.cs b/Projects/UOContent/Commands/HelpInfo.cs index 80ee82720..b85ca8b05 100644 --- a/Projects/UOContent/Commands/HelpInfo.cs +++ b/Projects/UOContent/Commands/HelpInfo.cs @@ -76,7 +76,7 @@ namespace Server.Commands continue; } - if (usage == null || !(attrs[0] is DescriptionAttribute desc)) + if (usage == null || attrs[0] is not DescriptionAttribute desc) { continue; } diff --git a/Projects/UOContent/Commands/LocationCommand.cs b/Projects/UOContent/Commands/LocationCommand.cs index 271dbd233..d74108741 100644 --- a/Projects/UOContent/Commands/LocationCommand.cs +++ b/Projects/UOContent/Commands/LocationCommand.cs @@ -23,14 +23,14 @@ namespace Server.Commands public override void Execute(CommandEventArgs e, object obj) { - if (!(obj is IPoint3D point)) + if (obj is not IPoint3D point) { LogFailure("That cannot be located."); return; } 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 graphics; if (e.Arguments.Length == 0) diff --git a/Projects/UOContent/Commands/Logging.cs b/Projects/UOContent/Commands/Logging.cs index a1a5ab3d2..94f40d597 100644 --- a/Projects/UOContent/Commands/Logging.cs +++ b/Projects/UOContent/Commands/Logging.cs @@ -73,7 +73,7 @@ namespace Server.Commands 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, "Commands"); diff --git a/Projects/UOContent/Commands/Object Creation/Decorate.cs b/Projects/UOContent/Commands/Object Creation/Decorate.cs index 314bc011b..f8a14b4f2 100644 --- a/Projects/UOContent/Commands/Object Creation/Decorate.cs +++ b/Projects/UOContent/Commands/Object Creation/Decorate.cs @@ -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); diff --git a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs index a1300cef3..fdea8e992 100644 --- a/Projects/UOContent/Commands/Object Creation/DecorateMag.cs +++ b/Projects/UOContent/Commands/Object Creation/DecorateMag.cs @@ -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); diff --git a/Projects/UOContent/Commands/Object Creation/GenTeleporter.cs b/Projects/UOContent/Commands/Object Creation/GenTeleporter.cs index f2542a731..daa84d9b0 100644 --- a/Projects/UOContent/Commands/Object Creation/GenTeleporter.cs +++ b/Projects/UOContent/Commands/Object Creation/GenTeleporter.cs @@ -124,7 +124,7 @@ namespace Server.Commands var count = 0; 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++; item.Delete(); diff --git a/Projects/UOContent/Commands/Properties.cs b/Projects/UOContent/Commands/Properties.cs index 29d92e594..21a3e25b0 100644 --- a/Projects/UOContent/Commands/Properties.cs +++ b/Projects/UOContent/Commands/Properties.cs @@ -263,7 +263,7 @@ namespace Server.Commands { var obj = realProps[i].GetValue(realObjs[i], null); - if (!(obj is IConvertible)) + if (obj is not IConvertible) { return "Property is not IConvertable."; } diff --git a/Projects/UOContent/Commands/Statics.cs b/Projects/UOContent/Commands/Statics.cs index 015136f82..839bd0ec3 100644 --- a/Projects/UOContent/Commands/Statics.cs +++ b/Projects/UOContent/Commands/Statics.cs @@ -168,7 +168,7 @@ namespace Server continue; } - if (item is Static || item is BaseFloor || item is BaseWall) + if (item is Static or BaseFloor or BaseWall) { var itemMap = item.Map; @@ -212,7 +212,7 @@ namespace Server 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; @@ -306,7 +306,7 @@ namespace Server var xOffset = item.X - state.m_X * 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; } diff --git a/Projects/UOContent/Commands/Wipe.cs b/Projects/UOContent/Commands/Wipe.cs index 693f4f3f5..bc066fbde 100644 --- a/Projects/UOContent/Commands/Wipe.cs +++ b/Projects/UOContent/Commands/Wipe.cs @@ -85,7 +85,7 @@ namespace Server.Commands 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); } diff --git a/Projects/UOContent/Engines/Bulk Orders/Books/BOBGump.cs b/Projects/UOContent/Engines/Bulk Orders/Books/BOBGump.cs index 71b5d4c54..442c1a2f3 100644 --- a/Projects/UOContent/Engines/Bulk Orders/Books/BOBGump.cs +++ b/Projects/UOContent/Engines/Bulk Orders/Books/BOBGump.cs @@ -709,7 +709,7 @@ namespace Server.Engines.BulkOrders 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! } diff --git a/Projects/UOContent/Engines/Bulk Orders/Books/BODBuyGump.cs b/Projects/UOContent/Engines/Bulk Orders/Books/BODBuyGump.cs index a9c3dc3ce..4b8a13b5c 100644 --- a/Projects/UOContent/Engines/Bulk Orders/Books/BODBuyGump.cs +++ b/Projects/UOContent/Engines/Bulk Orders/Books/BODBuyGump.cs @@ -46,7 +46,7 @@ namespace Server.Engines.BulkOrders 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. return; diff --git a/Projects/UOContent/Engines/Bulk Orders/Rewards.cs b/Projects/UOContent/Engines/Bulk Orders/Rewards.cs index 4aaae3152..627682830 100644 --- a/Projects/UOContent/Engines/Bulk Orders/Rewards.cs +++ b/Projects/UOContent/Engines/Bulk Orders/Rewards.cs @@ -533,7 +533,7 @@ namespace Server.Engines.BulkOrders 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); } @@ -545,7 +545,7 @@ namespace Server.Engines.BulkOrders 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); } @@ -848,7 +848,7 @@ namespace Server.Engines.BulkOrders 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); } diff --git a/Projects/UOContent/Engines/Bulk Orders/SmallBOD.cs b/Projects/UOContent/Engines/Bulk Orders/SmallBOD.cs index 15cb5d622..8f0489aa1 100644 --- a/Projects/UOContent/Engines/Bulk Orders/SmallBOD.cs +++ b/Projects/UOContent/Engines/Bulk Orders/SmallBOD.cs @@ -132,7 +132,7 @@ namespace Server.Engines.BulkOrders from.SendLocalizedMessage(1045166); } 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. } diff --git a/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs b/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs index 50e6d845f..0203b4959 100644 --- a/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs +++ b/Projects/UOContent/Engines/ConPVP/AcceptDuelGump.cs @@ -186,7 +186,7 @@ namespace Server.Engines.ConPVP if (info.IsSwitched(1)) { - if (!(m_Challenged is PlayerMobile pm)) + if (m_Challenged is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/ConPVP/DuelContext.cs b/Projects/UOContent/Engines/ConPVP/DuelContext.cs index 162d8fa4f..b745ad9af 100644 --- a/Projects/UOContent/Engines/ConPVP/DuelContext.cs +++ b/Projects/UOContent/Engines/ConPVP/DuelContext.cs @@ -99,7 +99,7 @@ namespace Server.Engines.ConPVP 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; } @@ -257,7 +257,7 @@ namespace Server.Engines.ConPVP public static bool AllowSpecialAbility(Mobile from, string name, bool message) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return true; } @@ -345,7 +345,7 @@ namespace Server.Engines.ConPVP return false; } - if (!(weapon is BaseRanged) && !Ruleset.GetOption("Weapons", "Melee")) + if (weapon is not BaseRanged && !Ruleset.GetOption("Weapons", "Melee")) { return false; } @@ -411,7 +411,7 @@ namespace Server.Engines.ConPVP return true; } - if (!(item is BaseRefreshPotion)) + if (item is not BaseRefreshPotion) { if (CantDoAnything(from)) { @@ -513,7 +513,7 @@ namespace Server.Engines.ConPVP 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."); return false; @@ -655,7 +655,7 @@ namespace Server.Engines.ConPVP public void Requip(Mobile from, Container cont) { - if (!(cont is Corpse corpse)) + if (cont is not Corpse corpse) { return; } @@ -670,7 +670,7 @@ namespace Server.Engines.ConPVP { 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; } @@ -1295,7 +1295,7 @@ namespace Server.Engines.ConPVP private static void EventSink_Login(Mobile m) { - if (!(m is PlayerMobile pm)) + if (m is not PlayerMobile pm) { return; } @@ -1385,7 +1385,7 @@ namespace Server.Engines.ConPVP return; } - if (!(e.Mobile is PlayerMobile pm)) + if (e.Mobile is not PlayerMobile pm) { return; } @@ -2048,7 +2048,7 @@ namespace Server.Engines.ConPVP int number = item switch { 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~ }; @@ -2403,7 +2403,7 @@ namespace Server.Engines.ConPVP m_GateFacet = Initiator.Map; } - if (!(arena.Teleporter is ExitTeleporter tp)) + if (arena.Teleporter is not ExitTeleporter tp) { arena.Teleporter = tp = new ExitTeleporter(); tp.MoveToWorld(arena.GateOut == Point3D.Zero ? arena.Outside : arena.GateOut, arena.Facet); diff --git a/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs b/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs index 04921fc64..6d764eb62 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/BombingRun.cs @@ -210,7 +210,7 @@ namespace Server.Engines.ConPVP return false; } - if (!(obj is IPoint3D)) + if (obj is not IPoint3D) { return false; } @@ -1680,7 +1680,7 @@ namespace Server.Engines.ConPVP 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; } diff --git a/Projects/UOContent/Engines/ConPVP/Games/CTF.cs b/Projects/UOContent/Engines/ConPVP/Games/CTF.cs index ac45f1a4c..cd1a1fec8 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/CTF.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/CTF.cs @@ -953,7 +953,7 @@ namespace Server.Engines.ConPVP public int GetTeamID(Mobile mob) { - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return -1; } diff --git a/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs b/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs index e248a8487..e40af18e0 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/DoubleDom.cs @@ -553,7 +553,7 @@ namespace Server.Engines.ConPVP public int GetTeamID(Mobile mob) { - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return -1; } diff --git a/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs b/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs index 6d95d1630..3202e5b98 100644 --- a/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs +++ b/Projects/UOContent/Engines/ConPVP/Games/KingOfTheHill.cs @@ -924,7 +924,7 @@ namespace Server.Engines.ConPVP 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; } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs index d05be1836..28a6c2794 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/AcceptTeamGump.cs @@ -318,7 +318,7 @@ namespace Server.Engines.ConPVP if (info.IsSwitched(1)) { - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs index 40554a6b4..04e235ac6 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/ConfirmSignupGump.cs @@ -565,7 +565,7 @@ namespace Server.Engines.ConPVP 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)); @@ -604,7 +604,7 @@ namespace Server.Engines.ConPVP } else { - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/ParticipantGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/ParticipantGump.cs index 390a3a7f3..3c89caa3b 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/ParticipantGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/ParticipantGump.cs @@ -217,7 +217,7 @@ namespace Server.Engines.ConPVP return; } - if (!(targeted is Mobile mob)) + if (targeted is not Mobile mob) { from.SendMessage("That is not a player."); } @@ -238,7 +238,7 @@ namespace Server.Engines.ConPVP } else { - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/ReadyUpGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/ReadyUpGump.cs index afc9acd46..735379d2e 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/ReadyUpGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/ReadyUpGump.cs @@ -211,7 +211,7 @@ namespace Server.Engines.ConPVP { case 1: // okay { - if (!(m_From is PlayerMobile pm)) + if (m_From is not PlayerMobile pm) { break; } diff --git a/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs b/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs index 8da52acff..9dc149ce8 100644 --- a/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs +++ b/Projects/UOContent/Engines/ConPVP/Gumps/TournamentBracketGump.cs @@ -306,7 +306,7 @@ namespace Server.Engines.ConPVP } case TourneyBracketGumpType.Participant_Info: { - if (!(obj is TourneyParticipant part)) + if (obj is not TourneyParticipant part) { break; } @@ -380,7 +380,7 @@ namespace Server.Engines.ConPVP AddLeftArrow(25, 11, ToButtonID(0, 3)); AddHtml(25, 35, 250, 20, Center("Participants")); - if (!(obj is Mobile mob)) + if (obj is not Mobile mob) { break; } @@ -428,7 +428,7 @@ namespace Server.Engines.ConPVP AddLeftArrow(25, 11, ToButtonID(0, 2)); AddHtml(25, 35, 250, 20, Center("Rounds")); - if (!(m_Object is PyramidLevel level)) + if (m_Object is not PyramidLevel level) { break; } @@ -490,9 +490,7 @@ namespace Server.Engines.ConPVP } } else if (m_Tournament.EventController != null || - m_Tournament.TourneyType == TourneyType.RandomTeam || - m_Tournament.TourneyType == TourneyType.RedVsBlue || - m_Tournament.TourneyType == TourneyType.Faction) + m_Tournament.TourneyType is TourneyType.RandomTeam or TourneyType.RedVsBlue or TourneyType.Faction) { for (var j = 0; j < match.Participants.Count; ++j) { @@ -572,7 +570,7 @@ namespace Server.Engines.ConPVP } case TourneyBracketGumpType.Match_Info: { - if (!(obj is TourneyMatch match)) + if (obj is not TourneyMatch match) { break; } @@ -605,9 +603,7 @@ namespace Server.Engines.ConPVP } } else if (m_Tournament.EventController != null || - m_Tournament.TourneyType == TourneyType.RandomTeam || - m_Tournament.TourneyType == TourneyType.RedVsBlue || - m_Tournament.TourneyType == TourneyType.Faction) + m_Tournament.TourneyType is TourneyType.RandomTeam or TourneyType.RedVsBlue or TourneyType.Faction) { for (var i = 0; i < match.Participants.Count; ++i) { @@ -840,7 +836,7 @@ namespace Server.Engines.ConPVP } case 5: { - if (!(m_Object is TourneyMatch match)) + if (m_Object is not TourneyMatch match) { break; } @@ -990,7 +986,7 @@ namespace Server.Engines.ConPVP break; } - if (!(m_Object is PyramidLevel level)) + if (m_Object is not PyramidLevel level) { break; } diff --git a/Projects/UOContent/Engines/ConPVP/Ladder.cs b/Projects/UOContent/Engines/ConPVP/Ladder.cs index ca42ee278..5e76003e7 100644 --- a/Projects/UOContent/Engines/ConPVP/Ladder.cs +++ b/Projects/UOContent/Engines/ConPVP/Ladder.cs @@ -211,7 +211,7 @@ namespace Server.Engines.ConPVP { var x = ourLevel - theirLevel; - if (x < -6 || x > +6) + if (x is < -6 or > +6) { return 0; } diff --git a/Projects/UOContent/Engines/ConPVP/TournamentPyramid.cs b/Projects/UOContent/Engines/ConPVP/TournamentPyramid.cs index 8c73047d4..0f1e9d646 100644 --- a/Projects/UOContent/Engines/ConPVP/TournamentPyramid.cs +++ b/Projects/UOContent/Engines/ConPVP/TournamentPyramid.cs @@ -16,7 +16,7 @@ namespace Server.Engines.ConPVP { var copy = new List(participants); - if (groupType == GroupingType.Nearest || groupType == GroupingType.HighVsLow) + if (groupType is GroupingType.Nearest or GroupingType.HighVsLow) { copy.Sort(); } diff --git a/Projects/UOContent/Engines/Craft/Core/CraftItem.cs b/Projects/UOContent/Engines/Craft/Core/CraftItem.cs index f108acaa8..cece9b8dd 100644 --- a/Projects/UOContent/Engines/Craft/Core/CraftItem.cs +++ b/Projects/UOContent/Engines/Craft/Core/CraftItem.cs @@ -483,7 +483,7 @@ namespace Server.Engines.Craft 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; } @@ -512,7 +512,7 @@ namespace Server.Engines.Craft { var item = items[i][j]; - if (!(item is IHasQuantity hq)) + if (item is not IHasQuantity hq) { var theirAmount = item.Amount; @@ -561,7 +561,7 @@ namespace Server.Engines.Craft 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; } diff --git a/Projects/UOContent/Engines/Craft/Core/Enhance.cs b/Projects/UOContent/Engines/Craft/Core/Enhance.cs index a9a160098..c5a6c0377 100644 --- a/Projects/UOContent/Engines/Craft/Core/Enhance.cs +++ b/Projects/UOContent/Engines/Craft/Core/Enhance.cs @@ -35,7 +35,7 @@ namespace Server.Engines.Craft return EnhanceResult.NotInBackpack; } - if (!(item is BaseArmor) && !(item is BaseWeapon)) + if (item is not BaseArmor && item is not BaseWeapon) { return EnhanceResult.BadItem; } diff --git a/Projects/UOContent/Engines/Craft/Core/Repair.cs b/Projects/UOContent/Engines/Craft/Core/Repair.cs index a967556f2..391b76382 100644 --- a/Projects/UOContent/Engines/Craft/Core/Repair.cs +++ b/Projects/UOContent/Engines/Craft/Core/Repair.cs @@ -90,11 +90,7 @@ namespace Server.Engines.Craft if (m_CraftSystem is DefTailoring) { - return clothing is BearMask - || clothing is DeerMask - || clothing is TheMostKnowledgePerson - || clothing is TheRobeOfBritanniaAri - || clothing is EmbroideredOakLeafCloak; + return clothing is BearMask or DeerMask or TheMostKnowledgePerson or TheRobeOfBritanniaAri or EmbroideredOakLeafCloak; } return false; @@ -106,44 +102,23 @@ namespace Server.Engines.Craft if (m_CraftSystem is DefTinkering) { - return weapon is Cleaver - || weapon is Hatchet - || weapon is Pickaxe - || weapon is ButcherKnife - || weapon is SkinningKnife; + return weapon is Cleaver or Hatchet or Pickaxe or ButcherKnife or SkinningKnife; } if (m_CraftSystem is DefCarpentry) { - return weapon is Club - || weapon is BlackStaff - || weapon is MagicWand - - // TODO: Make these items craftable - || weapon is WildStaff; + return weapon is Club or BlackStaff or MagicWand or WildStaff; } if (m_CraftSystem is DefBlacksmithy) { - return weapon is Pitchfork - - // 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; + 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 if (m_CraftSystem is DefBowFletching) { - return weapon is ElvenCompositeLongbow - || weapon is MagicalShortbow; + return weapon is ElvenCompositeLongbow or MagicalShortbow; } return false; @@ -156,36 +131,17 @@ namespace Server.Engines.Craft // TODO: Make these items craftable if (m_CraftSystem is DefTailoring) { - return armor is LeafTonlet - || 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; + return armor is LeafTonlet or LeafArms or LeafChest or LeafGloves or LeafGorget or LeafLegs or HideChest or HideGloves or HideGorget or HidePants or HidePauldrons; } if (m_CraftSystem is DefCarpentry) { - return armor is WingedHelm - || armor is RavenHelm - || armor is VultureHelm - || armor is WoodlandArms - || armor is WoodlandChest - || armor is WoodlandGloves - || armor is WoodlandGorget - || armor is WoodlandLegs; + return armor is WingedHelm or RavenHelm or VultureHelm or WoodlandArms or WoodlandChest or WoodlandGloves or WoodlandGorget or WoodlandLegs; } if (m_CraftSystem is DefBlacksmithy) { - return armor is Circlet - || armor is RoyalCirclet - || armor is GemmedCirclet; + return armor is Circlet or RoyalCirclet or GemmedCirclet; } return false; @@ -448,7 +404,7 @@ namespace Server.Engines.Craft } 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 ? 1061136 diff --git a/Projects/UOContent/Engines/Craft/DefCarpentry.cs b/Projects/UOContent/Engines/Craft/DefCarpentry.cs index 23d303a68..95e1a76f6 100644 --- a/Projects/UOContent/Engines/Craft/DefCarpentry.cs +++ b/Projects/UOContent/Engines/Craft/DefCarpentry.cs @@ -87,7 +87,7 @@ namespace Server.Engines.Craft int index; // 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); SetUseAllRes(index, true); diff --git a/Projects/UOContent/Engines/Doom/GauntletSpawner.cs b/Projects/UOContent/Engines/Doom/GauntletSpawner.cs index 705a9ca67..76d27f205 100644 --- a/Projects/UOContent/Engines/Doom/GauntletSpawner.cs +++ b/Projects/UOContent/Engines/Doom/GauntletSpawner.cs @@ -235,7 +235,7 @@ namespace Server.Engines.Doom _ => new MushroomTrap() }; - if (trap is FireColumnTrap || trap is MushroomTrap) + if (trap is FireColumnTrap or MushroomTrap) { trap.Hue = 0x451; } diff --git a/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs b/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs index 781cf752d..37745ce61 100644 --- a/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs +++ b/Projects/UOContent/Engines/Doom/LeverPuzzle/LeverPuzzleRegions.cs @@ -31,7 +31,7 @@ namespace Server.Engines.Doom public override void OnEnter(Mobile m) { - if (m == null || m is WandererOfTheVoid) + if (m is null or WandererOfTheVoid) { return; } diff --git a/Projects/UOContent/Engines/Ethics/Core/Ethic.cs b/Projects/UOContent/Engines/Ethics/Core/Ethic.cs index e14ea51bf..59e2da0f5 100644 --- a/Projects/UOContent/Engines/Ethics/Core/Ethic.cs +++ b/Projects/UOContent/Engines/Ethics/Core/Ethic.cs @@ -160,7 +160,7 @@ namespace Server.Ethics foreach (var item in eable) { - if (item is AnkhNorth || item is AnkhWest) + if (item is AnkhNorth or AnkhWest) { found = true; break; diff --git a/Projects/UOContent/Engines/Ethics/Evil/Ethic.cs b/Projects/UOContent/Engines/Ethics/Evil/Ethic.cs index e895cad31..211cfa42a 100644 --- a/Projects/UOContent/Engines/Ethics/Evil/Ethic.cs +++ b/Projects/UOContent/Engines/Ethics/Evil/Ethic.cs @@ -29,7 +29,7 @@ namespace Server.Ethics.Evil { var fac = Faction.Find(mob); - return fac is Minax || fac is Shadowlords; + return fac is Minax or Shadowlords; } } } diff --git a/Projects/UOContent/Engines/Ethics/Evil/Powers/Blight.cs b/Projects/UOContent/Engines/Ethics/Evil/Powers/Blight.cs index 0d3cfc296..0dddf0575 100644 --- a/Projects/UOContent/Engines/Ethics/Evil/Powers/Blight.cs +++ b/Projects/UOContent/Engines/Ethics/Evil/Powers/Blight.cs @@ -23,7 +23,7 @@ namespace Server.Ethics.Evil private void Power_OnTarget(Mobile fromMobile, object obj, Player from) { - if (!(obj is IPoint3D p)) + if (obj is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Engines/Ethics/Evil/Powers/UnholyItem.cs b/Projects/UOContent/Engines/Ethics/Evil/Powers/UnholyItem.cs index 59259b19e..a46e3cbb0 100644 --- a/Projects/UOContent/Engines/Ethics/Evil/Powers/UnholyItem.cs +++ b/Projects/UOContent/Engines/Ethics/Evil/Powers/UnholyItem.cs @@ -22,7 +22,7 @@ namespace Server.Ethics.Evil 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."); return; @@ -45,7 +45,7 @@ namespace Server.Ethics.Evil 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; if (canImbue) diff --git a/Projects/UOContent/Engines/Ethics/Hero/Ethic.cs b/Projects/UOContent/Engines/Ethics/Hero/Ethic.cs index 0a8275be5..e473b00d9 100644 --- a/Projects/UOContent/Engines/Ethics/Hero/Ethic.cs +++ b/Projects/UOContent/Engines/Ethics/Hero/Ethic.cs @@ -34,7 +34,7 @@ namespace Server.Ethics.Hero var fac = Faction.Find(mob); - return fac is TrueBritannians || fac is CouncilOfMages; + return fac is TrueBritannians or CouncilOfMages; } } } diff --git a/Projects/UOContent/Engines/Ethics/Hero/Powers/Bless.cs b/Projects/UOContent/Engines/Ethics/Hero/Powers/Bless.cs index 2c341a2da..f0c23cb73 100644 --- a/Projects/UOContent/Engines/Ethics/Hero/Powers/Bless.cs +++ b/Projects/UOContent/Engines/Ethics/Hero/Powers/Bless.cs @@ -23,7 +23,7 @@ namespace Server.Ethics.Hero private void Power_OnTarget(Mobile fromMobile, object obj, Player from) { - if (!(obj is IPoint3D p)) + if (obj is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Engines/Ethics/Hero/Powers/HolyItem.cs b/Projects/UOContent/Engines/Ethics/Hero/Powers/HolyItem.cs index 9e85c4444..e927651ef 100644 --- a/Projects/UOContent/Engines/Ethics/Hero/Powers/HolyItem.cs +++ b/Projects/UOContent/Engines/Ethics/Hero/Powers/HolyItem.cs @@ -22,7 +22,7 @@ namespace Server.Ethics.Hero 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."); return; @@ -45,7 +45,7 @@ namespace Server.Ethics.Hero 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; if (canImbue) diff --git a/Projects/UOContent/Engines/Factions/Core/Faction.cs b/Projects/UOContent/Engines/Factions/Core/Faction.cs index 967951e57..43d67c6ca 100644 --- a/Projects/UOContent/Engines/Factions/Core/Faction.cs +++ b/Projects/UOContent/Engines/Factions/Core/Faction.cs @@ -502,7 +502,7 @@ namespace Server.Factions public static bool IsFactionBanned(Mobile mob) { - if (!(mob.Account is Account acct)) + if (mob.Account is not Account acct) { return false; } @@ -512,7 +512,7 @@ namespace Server.Factions public void OnJoinAccepted(Mobile mob) { - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return; // sanity } @@ -571,7 +571,7 @@ namespace Server.Factions for (var i = 0; i < members.Count; ++i) { - if (!(members[i] is PlayerMobile member)) + if (members[i] is not PlayerMobile member) { continue; } @@ -767,7 +767,7 @@ namespace Server.Factions 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); } diff --git a/Projects/UOContent/Engines/Factions/Core/FactionItem.cs b/Projects/UOContent/Engines/Factions/Core/FactionItem.cs index f84925ed2..6d02f0948 100644 --- a/Projects/UOContent/Engines/Factions/Core/FactionItem.cs +++ b/Projects/UOContent/Engines/Factions/Core/FactionItem.cs @@ -129,7 +129,7 @@ namespace Server.Factions public static Item Imbue(Item item, Faction faction, bool expire, int hue) { - if (!(item is IFactionItem)) + if (item is not IFactionItem) { return item; } diff --git a/Projects/UOContent/Engines/Factions/Gumps/LeaveFactionGump.cs b/Projects/UOContent/Engines/Factions/Gumps/LeaveFactionGump.cs index f13ffa4b8..9e3a5b667 100644 --- a/Projects/UOContent/Engines/Factions/Gumps/LeaveFactionGump.cs +++ b/Projects/UOContent/Engines/Factions/Gumps/LeaveFactionGump.cs @@ -50,7 +50,7 @@ namespace Server.Factions { case 1: // continue { - if (!(m_From.Guild is Guild guild)) + if (m_From.Guild is not Guild guild) { var pl = PlayerState.Find(m_From); diff --git a/Projects/UOContent/Engines/Factions/Items/Power Faction Items/StormsEye.cs b/Projects/UOContent/Engines/Factions/Items/Power Faction Items/StormsEye.cs index fef72f966..5d6d2729b 100644 --- a/Projects/UOContent/Engines/Factions/Items/Power Faction Items/StormsEye.cs +++ b/Projects/UOContent/Engines/Factions/Items/Power Faction Items/StormsEye.cs @@ -32,7 +32,7 @@ namespace Server TargetFlags.None, (from, obj, stormsEye) => { - if (!stormsEye.Movable || stormsEye.Deleted || !(obj is IPoint3D pt)) + if (!stormsEye.Movable || stormsEye.Deleted || obj is not IPoint3D pt) { return; } diff --git a/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs b/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs index 1b437d591..83ff2454b 100644 --- a/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs +++ b/Projects/UOContent/Engines/Factions/Mobiles/Guards/GuardAI.cs @@ -156,7 +156,7 @@ namespace Server.Factions 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); return true; diff --git a/Projects/UOContent/Engines/Harvest/Core/HarvestTarget.cs b/Projects/UOContent/Engines/Harvest/Core/HarvestTarget.cs index c5790a8ac..a5a8a4a80 100644 --- a/Projects/UOContent/Engines/Harvest/Core/HarvestTarget.cs +++ b/Projects/UOContent/Engines/Harvest/Core/HarvestTarget.cs @@ -25,13 +25,12 @@ namespace Server.Engines.Harvest var itemID = target.ItemID; // grave - if (itemID == 0xED3 || itemID == 0xEDF || itemID == 0xEE0 || itemID == 0xEE1 || itemID == 0xEE2 || - itemID == 0xEE8) + if (itemID is 0xED3 or 0xEDF or 0xEE0 or 0xEE1 or 0xEE2 or 0xEE8) { if (from is PlayerMobile player) { var qs = player.Quest; - if (!(qs is WitchApprenticeQuest)) + if (qs is not WitchApprenticeQuest) { return; } diff --git a/Projects/UOContent/Engines/Harvest/Fishing.cs b/Projects/UOContent/Engines/Harvest/Fishing.cs index a4847df90..035f21e4d 100644 --- a/Projects/UOContent/Engines/Harvest/Fishing.cs +++ b/Projects/UOContent/Engines/Harvest/Fishing.cs @@ -350,7 +350,7 @@ namespace Server.Engines.Harvest 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; @@ -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 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) @@ -405,7 +405,7 @@ namespace Server.Engines.Harvest from.SendLocalizedMessage(1042635); // Your fishing pole bends as you pull a big fish from the depths! 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! } diff --git a/Projects/UOContent/Engines/Harvest/Lumberjacking.cs b/Projects/UOContent/Engines/Harvest/Lumberjacking.cs index dd4c3c2a7..3e046f494 100644 --- a/Projects/UOContent/Engines/Harvest/Lumberjacking.cs +++ b/Projects/UOContent/Engines/Harvest/Lumberjacking.cs @@ -169,7 +169,7 @@ namespace Server.Engines.Harvest { 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. } diff --git a/Projects/UOContent/Engines/Help/PageQueue.cs b/Projects/UOContent/Engines/Help/PageQueue.cs index 176337323..dee5f13ad 100644 --- a/Projects/UOContent/Engines/Help/PageQueue.cs +++ b/Projects/UOContent/Engines/Help/PageQueue.cs @@ -128,7 +128,7 @@ namespace Server.Engines.Help public static bool CheckAllowedToPage(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return true; } diff --git a/Projects/UOContent/Engines/Help/SpeechLog.cs b/Projects/UOContent/Engines/Help/SpeechLog.cs index 15b3f7848..a83940620 100644 --- a/Projects/UOContent/Engines/Help/SpeechLog.cs +++ b/Projects/UOContent/Engines/Help/SpeechLog.cs @@ -90,7 +90,7 @@ namespace Server.Engines.Help 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."); } diff --git a/Projects/UOContent/Engines/ML Quests/Gumps/QuestOfferGump.cs b/Projects/UOContent/Engines/ML Quests/Gumps/QuestOfferGump.cs index 45ade8384..69e9e2376 100644 --- a/Projects/UOContent/Engines/ML Quests/Gumps/QuestOfferGump.cs +++ b/Projects/UOContent/Engines/ML Quests/Gumps/QuestOfferGump.cs @@ -36,7 +36,7 @@ namespace Server.Engines.MLQuests.Gumps public override void OnResponse(NetState sender, RelayInfo info) { - if (!(sender.Mobile is PlayerMobile pm)) + if (sender.Mobile is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs b/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs index 4bd855321..b6759c71c 100644 --- a/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs +++ b/Projects/UOContent/Engines/ML Quests/Gumps/RaceChangeGump.cs @@ -202,7 +202,7 @@ namespace Server.Engines.MLQuests.Gumps CloseCurrent(state); - if (!(state.Mobile is PlayerMobile pm)) + if (state.Mobile is not PlayerMobile pm) { return; } @@ -325,7 +325,7 @@ namespace Server.Engines.MLQuests.Gumps public override void OnDoubleClick(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/ML Quests/Items/PrismaticCrystal.cs b/Projects/UOContent/Engines/ML Quests/Items/PrismaticCrystal.cs index 791eb6dcf..64978b443 100644 --- a/Projects/UOContent/Engines/ML Quests/Items/PrismaticCrystal.cs +++ b/Projects/UOContent/Engines/ML Quests/Items/PrismaticCrystal.cs @@ -22,7 +22,7 @@ namespace Server.Items public override void OnDoubleClick(Mobile from) { - if (!(from is PlayerMobile pm) || pm.Backpack == null) + if (@from is not PlayerMobile pm || pm.Backpack == null) { return; } diff --git a/Projects/UOContent/Engines/ML Quests/Items/Teleporters.cs b/Projects/UOContent/Engines/ML Quests/Items/Teleporters.cs index a1dd82869..dc7262333 100644 --- a/Projects/UOContent/Engines/ML Quests/Items/Teleporters.cs +++ b/Projects/UOContent/Engines/ML Quests/Items/Teleporters.cs @@ -55,7 +55,7 @@ namespace Server.Engines.MLQuests.Items return true; } - if (!(m is PlayerMobile pm)) + if (m is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs b/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs index 658ac3a58..41b71a98a 100644 --- a/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs +++ b/Projects/UOContent/Engines/ML Quests/MLQuestSystem.cs @@ -210,7 +210,7 @@ namespace Server.Engines.MLQuests { var m = e.Mobile; - if (e.Length == 0 || e.Length > 2) + if (e.Length is 0 or > 2) { m.SendMessage("Syntax: SaveQuest [saveEnabled=true]"); return; @@ -638,7 +638,7 @@ namespace Server.Engines.MLQuests public static void EventSink_QuestGumpRequest(Mobile m) { - if (!Enabled || !(m is PlayerMobile pm)) + if (!Enabled || m is not PlayerMobile pm) { return; } @@ -809,7 +809,7 @@ namespace Server.Engines.MLQuests { var from = e.Mobile; - if (!(obj is PlayerMobile pm)) + if (obj is not PlayerMobile pm) { LogFailure("That is not a player."); return; @@ -840,7 +840,7 @@ namespace Server.Engines.MLQuests 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."); } diff --git a/Projects/UOContent/Engines/ML Quests/Objectives/CollectObjective.cs b/Projects/UOContent/Engines/ML Quests/Objectives/CollectObjective.cs index f6891a3c6..0ea76721b 100644 --- a/Projects/UOContent/Engines/ML Quests/Objectives/CollectObjective.cs +++ b/Projects/UOContent/Engines/ML Quests/Objectives/CollectObjective.cs @@ -16,7 +16,7 @@ namespace Server.Engines.MLQuests.Objectives { 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); } diff --git a/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs b/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs index 5aa9d7e43..25e9ef729 100644 --- a/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs +++ b/Projects/UOContent/Engines/ML Quests/Objectives/DeliverObjective.cs @@ -24,7 +24,7 @@ namespace Server.Engines.MLQuests.Objectives { 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); } diff --git a/Projects/UOContent/Engines/Pathing/PathAlgorithm.cs b/Projects/UOContent/Engines/Pathing/PathAlgorithm.cs index b655dcff3..40ec83fcd 100644 --- a/Projects/UOContent/Engines/Pathing/PathAlgorithm.cs +++ b/Projects/UOContent/Engines/Pathing/PathAlgorithm.cs @@ -24,7 +24,7 @@ namespace Server.PathAlgorithms var y = yDest + 1 - ySource; var v = y * 3 + x; - if (v < 0 || v >= 9) + if (v is < 0 or >= 9) { return Direction.North; } diff --git a/Projects/UOContent/Engines/Plants/MainPlantGump.cs b/Projects/UOContent/Engines/Plants/MainPlantGump.cs index 5593d3787..a1b730ee7 100644 --- a/Projects/UOContent/Engines/Plants/MainPlantGump.cs +++ b/Projects/UOContent/Engines/Plants/MainPlantGump.cs @@ -101,7 +101,7 @@ namespace Server.Engines.Plants AddItem(127, 112, 0xC62); } - if (status == PlantStatus.Stage3 || status == PlantStatus.Stage4) + if (status is PlantStatus.Stage3 or PlantStatus.Stage4) { AddItem(129, 85, 0xC7E); } @@ -134,7 +134,7 @@ namespace Server.Engines.Plants var hueInfo = PlantHueInfo.GetInfo(m_Plant.PlantHue); // 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); } diff --git a/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs b/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs index 4e75a1f2a..882545bb2 100644 --- a/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs +++ b/Projects/UOContent/Engines/Plants/MiscItems/GreenThorns.cs @@ -99,7 +99,7 @@ namespace Server.Items return; } - if (!(targeted is LandTarget land)) + if (targeted is not LandTarget land) { from.LocalOverheadMessage( MessageType.Regular, diff --git a/Projects/UOContent/Engines/Plants/MiscItems/RedLeaves.cs b/Projects/UOContent/Engines/Plants/MiscItems/RedLeaves.cs index 38a6666b4..75d161148 100644 --- a/Projects/UOContent/Engines/Plants/MiscItems/RedLeaves.cs +++ b/Projects/UOContent/Engines/Plants/MiscItems/RedLeaves.cs @@ -65,11 +65,11 @@ namespace Server.Items 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. } - 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! } diff --git a/Projects/UOContent/Engines/Plants/PlantHue.cs b/Projects/UOContent/Engines/Plants/PlantHue.cs index b3c3fb03d..0f5d899af 100644 --- a/Projects/UOContent/Engines/Plants/PlantHue.cs +++ b/Projects/UOContent/Engines/Plants/PlantHue.cs @@ -108,7 +108,7 @@ namespace Server.Engines.Plants public static PlantHue GetNotBright(PlantHue plantHue) => plantHue & ~PlantHue.Bright; 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) { diff --git a/Projects/UOContent/Engines/Plants/PlantItem.cs b/Projects/UOContent/Engines/Plants/PlantItem.cs index edf59eab2..b99a0f7c7 100644 --- a/Projects/UOContent/Engines/Plants/PlantItem.cs +++ b/Projects/UOContent/Engines/Plants/PlantItem.cs @@ -67,7 +67,7 @@ namespace Server.Engines.Plants get => m_PlantStatus; set { - if (m_PlantStatus == value || value < PlantStatus.BowlOfDirt || value > PlantStatus.DeadTwigs) + if (m_PlantStatus == value || value is < PlantStatus.BowlOfDirt or > PlantStatus.DeadTwigs) { return; } @@ -151,7 +151,7 @@ namespace Server.Engines.Plants return true; } - if (!(RootParent is Mobile owner)) + if (RootParent is not Mobile owner) { return false; } @@ -491,7 +491,7 @@ namespace Server.Engines.Plants var full = false; - if (effect == PotionEffect.PoisonGreater || effect == PotionEffect.PoisonDeadly) + if (effect is PotionEffect.PoisonGreater or PotionEffect.PoisonDeadly) { if (PlantSystem.IsFullPoisonPotion) { @@ -535,9 +535,7 @@ namespace Server.Engines.Plants PlantSystem.StrengthPotion++; } } - else if (effect == PotionEffect.PoisonLesser || effect == PotionEffect.Poison || - effect == PotionEffect.CureLesser || effect == PotionEffect.Cure || - effect == PotionEffect.HealLesser || effect == PotionEffect.Heal || effect == PotionEffect.Strength) + else if (effect is PotionEffect.PoisonLesser or PotionEffect.Poison or PotionEffect.CureLesser or PotionEffect.Cure or PotionEffect.HealLesser or PotionEffect.Heal or PotionEffect.Strength) { message = 1053068; // This potion is not powerful enough to use on a plant! return false; diff --git a/Projects/UOContent/Engines/Plants/PlantSystem.cs b/Projects/UOContent/Engines/Plants/PlantSystem.cs index abecd633c..a99b425d9 100644 --- a/Projects/UOContent/Engines/Plants/PlantSystem.cs +++ b/Projects/UOContent/Engines/Plants/PlantSystem.cs @@ -393,7 +393,7 @@ namespace Server.Engines.Plants { 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(); } diff --git a/Projects/UOContent/Engines/Plants/PollinateTarget.cs b/Projects/UOContent/Engines/Plants/PollinateTarget.cs index a63727f5a..2c383557a 100644 --- a/Projects/UOContent/Engines/Plants/PollinateTarget.cs +++ b/Projects/UOContent/Engines/Plants/PollinateTarget.cs @@ -34,8 +34,7 @@ namespace Server.Engines.Plants } else { - if (!(targeted is PlantItem targ) || targ.PlantStatus >= PlantStatus.DecorativePlant || - targ.PlantStatus <= PlantStatus.BowlOfDirt) + if (targeted is not PlantItem targ || targ.PlantStatus is >= PlantStatus.DecorativePlant or <= PlantStatus.BowlOfDirt) { m_Plant.LabelTo(from, 1053070); // You can only pollinate other specially grown plants! } diff --git a/Projects/UOContent/Engines/Plants/ReproductionGump.cs b/Projects/UOContent/Engines/Plants/ReproductionGump.cs index 63439407f..f5699bc4b 100644 --- a/Projects/UOContent/Engines/Plants/ReproductionGump.cs +++ b/Projects/UOContent/Engines/Plants/ReproductionGump.cs @@ -129,8 +129,7 @@ namespace Server.Engines.Plants { var from = sender.Mobile; - if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus >= PlantStatus.DecorativePlant || - m_Plant.PlantStatus == PlantStatus.BowlOfDirt) + if (info.ButtonID == 0 || m_Plant.Deleted || m_Plant.PlantStatus is >= PlantStatus.DecorativePlant or PlantStatus.BowlOfDirt) { return; } diff --git a/Projects/UOContent/Engines/Plants/Seed.cs b/Projects/UOContent/Engines/Plants/Seed.cs index 98727af42..bb67f9e4b 100644 --- a/Projects/UOContent/Engines/Plants/Seed.cs +++ b/Projects/UOContent/Engines/Plants/Seed.cs @@ -152,7 +152,7 @@ namespace Server.Engines.Plants public override void OnAfterDuped(Item newItem) { - if (!(newItem is Seed newSeed)) + if (newItem is not Seed newSeed) { return; } diff --git a/Projects/UOContent/Engines/Quests/Collector/Items/EnchantedPaints.cs b/Projects/UOContent/Engines/Quests/Collector/Items/EnchantedPaints.cs index 1a46f0360..aa5eeedb8 100644 --- a/Projects/UOContent/Engines/Quests/Collector/Items/EnchantedPaints.cs +++ b/Projects/UOContent/Engines/Quests/Collector/Items/EnchantedPaints.cs @@ -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) { @@ -75,7 +75,7 @@ namespace Server.Engines.Quests.Collector { var qs = player.Quest; - if (!(qs is CollectorQuest)) + if (qs is not CollectorQuest) { return; } diff --git a/Projects/UOContent/Engines/Quests/Collector/Items/Obsidian.cs b/Projects/UOContent/Engines/Quests/Collector/Items/Obsidian.cs index c59401bf6..7806d403d 100644 --- a/Projects/UOContent/Engines/Quests/Collector/Items/Obsidian.cs +++ b/Projects/UOContent/Engines/Quests/Collector/Items/Obsidian.cs @@ -255,7 +255,7 @@ namespace Server.Engines.Quests.Collector 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; } diff --git a/Projects/UOContent/Engines/Quests/Collector/Mobiles/Impresario.cs b/Projects/UOContent/Engines/Quests/Collector/Mobiles/Impresario.cs index 561bfadfc..b72ba2f39 100644 --- a/Projects/UOContent/Engines/Quests/Collector/Mobiles/Impresario.cs +++ b/Projects/UOContent/Engines/Quests/Collector/Mobiles/Impresario.cs @@ -53,7 +53,7 @@ namespace Server.Engines.Quests.Collector { var qs = player.Quest; - if (!(qs is CollectorQuest)) + if (qs is not CollectorQuest) { return; } @@ -149,7 +149,7 @@ namespace Server.Engines.Quests.Collector { var qs = player.Quest; - if (!(qs is CollectorQuest)) + if (qs is not CollectorQuest) { return; } diff --git a/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs b/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs index 3ea47a4c3..02d648734 100644 --- a/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs +++ b/Projects/UOContent/Engines/Quests/Core/QuestSystem.cs @@ -431,7 +431,7 @@ namespace Server.Engines.Quests { inRestartPeriod = false; - if (!(check is PlayerMobile pm)) + if (check is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/Quests/Dark Tides/DarkTidesQuest.cs b/Projects/UOContent/Engines/Quests/Dark Tides/DarkTidesQuest.cs index b6a490e08..5ce3407d6 100644 --- a/Projects/UOContent/Engines/Quests/Dark Tides/DarkTidesQuest.cs +++ b/Projects/UOContent/Engines/Quests/Dark Tides/DarkTidesQuest.cs @@ -83,7 +83,7 @@ namespace Server.Engines.Quests.Necro public static bool HasLostCallingScroll(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/Quests/Dark Tides/Items/CrystalCaveBarrier.cs b/Projects/UOContent/Engines/Quests/Dark Tides/Items/CrystalCaveBarrier.cs index c02bdb619..0097997fa 100644 --- a/Projects/UOContent/Engines/Quests/Dark Tides/Items/CrystalCaveBarrier.cs +++ b/Projects/UOContent/Engines/Quests/Dark Tides/Items/CrystalCaveBarrier.cs @@ -25,7 +25,7 @@ namespace Server.Engines.Quests.Necro mob = creature.ControlMaster; } - if (!(mob is PlayerMobile pm)) + if (mob is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/Quests/Dark Tides/Items/KronusScroll.cs b/Projects/UOContent/Engines/Quests/Dark Tides/Items/KronusScroll.cs index e893f2ff7..8c91b6a3f 100644 --- a/Projects/UOContent/Engines/Quests/Dark Tides/Items/KronusScroll.cs +++ b/Projects/UOContent/Engines/Quests/Dark Tides/Items/KronusScroll.cs @@ -22,7 +22,7 @@ namespace Server.Engines.Quests.Necro 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) { @@ -31,7 +31,7 @@ namespace Server.Engines.Quests.Necro return; } - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Engines/Quests/Dark Tides/Items/ScrollOfAbraxus.cs b/Projects/UOContent/Engines/Quests/Dark Tides/Items/ScrollOfAbraxus.cs index e372f9c17..01e24fbd7 100644 --- a/Projects/UOContent/Engines/Quests/Dark Tides/Items/ScrollOfAbraxus.cs +++ b/Projects/UOContent/Engines/Quests/Dark Tides/Items/ScrollOfAbraxus.cs @@ -14,7 +14,7 @@ namespace Server.Engines.Quests.Necro 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) { diff --git a/Projects/UOContent/Engines/Quests/Dark Tides/Mobiles/Mardoth.cs b/Projects/UOContent/Engines/Quests/Dark Tides/Mobiles/Mardoth.cs index 7cadf48bd..2af0da317 100644 --- a/Projects/UOContent/Engines/Quests/Dark Tides/Mobiles/Mardoth.cs +++ b/Projects/UOContent/Engines/Quests/Dark Tides/Mobiles/Mardoth.cs @@ -86,7 +86,7 @@ namespace Server.Engines.Quests.Necro 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)); } diff --git a/Projects/UOContent/Engines/Quests/Dark Tides/Objectives.cs b/Projects/UOContent/Engines/Quests/Dark Tides/Objectives.cs index 7719b2d7f..68a2241e9 100644 --- a/Projects/UOContent/Engines/Quests/Dark Tides/Objectives.cs +++ b/Projects/UOContent/Engines/Quests/Dark Tides/Objectives.cs @@ -127,7 +127,7 @@ namespace Server.Engines.Quests.Necro public override void CheckProgress() { if (System.From.Map != Map.Malas || !System.From.InRange(new Point3D(1076, 450, -84), 5) || - !SummonFamiliarSpell.Table.TryGetValue(System.From, out var bc) || !(bc is HordeMinionFamiliar hmf) || + !SummonFamiliarSpell.Table.TryGetValue(System.From, out var bc) || bc is not HordeMinionFamiliar hmf || !hmf.InRange(System.From, 5) || hmf.TargetLocation != null) { return; diff --git a/Projects/UOContent/Engines/Quests/Emino's Undertaking/EminosUndertakingQuest.cs b/Projects/UOContent/Engines/Quests/Emino's Undertaking/EminosUndertakingQuest.cs index 19e7930ed..bf03061c2 100644 --- a/Projects/UOContent/Engines/Quests/Emino's Undertaking/EminosUndertakingQuest.cs +++ b/Projects/UOContent/Engines/Quests/Emino's Undertaking/EminosUndertakingQuest.cs @@ -74,7 +74,7 @@ namespace Server.Engines.Quests.Ninja public override void Slice() { if (!m_SentRadarConversion && - (From.Map != Map.Malas || From.X < 407 || From.X > 431 || From.Y < 801 || From.Y > 830)) + (From.Map != Map.Malas || From.X is < 407 or > 431 || From.Y is < 801 or > 830)) { m_SentRadarConversion = true; AddConversation(new RadarConversation()); @@ -99,7 +99,7 @@ namespace Server.Engines.Quests.Ninja public static bool HasLostNoteForZoel(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } @@ -119,7 +119,7 @@ namespace Server.Engines.Quests.Ninja public static bool HasLostEminosKatana(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/EminosKatana.cs b/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/EminosKatana.cs index b3ae1d647..a1e5a6e17 100644 --- a/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/EminosKatana.cs +++ b/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/EminosKatana.cs @@ -13,7 +13,7 @@ namespace Server.Engines.Quests.Ninja public override int LabelNumber => 1063214; // Daimyo Emino's Katana - public override bool CanDrop(PlayerMobile player) => !(player.Quest is EminosUndertakingQuest); + public override bool CanDrop(PlayerMobile player) => player.Quest is not EminosUndertakingQuest; public override void Serialize(IGenericWriter writer) { diff --git a/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/NoteForZoel.cs b/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/NoteForZoel.cs index cd1d0dc6e..5aab1c067 100644 --- a/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/NoteForZoel.cs +++ b/Projects/UOContent/Engines/Quests/Emino's Undertaking/Items/NoteForZoel.cs @@ -17,7 +17,7 @@ namespace Server.Engines.Quests.Ninja public override int LabelNumber => 1063186; // A Note for Zoel - public override bool CanDrop(PlayerMobile player) => !(player.Quest is EminosUndertakingQuest); + public override bool CanDrop(PlayerMobile player) => player.Quest is not EminosUndertakingQuest; public override void Serialize(IGenericWriter writer) { diff --git a/Projects/UOContent/Engines/Quests/Haochi's Trials/HaochisTrialsQuest.cs b/Projects/UOContent/Engines/Quests/Haochi's Trials/HaochisTrialsQuest.cs index 38946c006..bc66e7b7c 100644 --- a/Projects/UOContent/Engines/Quests/Haochi's Trials/HaochisTrialsQuest.cs +++ b/Projects/UOContent/Engines/Quests/Haochi's Trials/HaochisTrialsQuest.cs @@ -77,7 +77,7 @@ namespace Server.Engines.Quests.Samurai public override void Slice() { if (!m_SentRadarConversion && - (From.Map != Map.Malas || From.X < 360 || From.X > 400 || From.Y < 760 || From.Y > 780)) + (From.Map != Map.Malas || From.X is < 360 or > 400 || From.Y is < 760 or > 780)) { m_SentRadarConversion = true; AddConversation(new RadarConversation()); @@ -102,7 +102,7 @@ namespace Server.Engines.Quests.Samurai public static bool HasLostHaochisKatana(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HaochisKatana.cs b/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HaochisKatana.cs index b9992bcde..810ad0182 100644 --- a/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HaochisKatana.cs +++ b/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HaochisKatana.cs @@ -13,7 +13,7 @@ namespace Server.Engines.Quests.Samurai public override int LabelNumber => 1063165; // Daimyo Haochi's Katana - public override bool CanDrop(PlayerMobile player) => !(player.Quest is HaochisTrialsQuest); + public override bool CanDrop(PlayerMobile player) => player.Quest is not HaochisTrialsQuest; public override void Serialize(IGenericWriter writer) { diff --git a/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HonorCandle.cs b/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HonorCandle.cs index 07e015e56..ce08640bb 100644 --- a/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HonorCandle.cs +++ b/Projects/UOContent/Engines/Quests/Haochi's Trials/Items/HonorCandle.cs @@ -30,7 +30,7 @@ namespace Server.Engines.Quests.Samurai if (!wasBurning && Burning) { - if (!(from is PlayerMobile player)) + if (@from is not PlayerMobile player) { return; } diff --git a/Projects/UOContent/Engines/Quests/Solen Matriarch/Objectives.cs b/Projects/UOContent/Engines/Quests/Solen Matriarch/Objectives.cs index e2140a2ca..dc889d0f4 100644 --- a/Projects/UOContent/Engines/Quests/Solen Matriarch/Objectives.cs +++ b/Projects/UOContent/Engines/Quests/Solen Matriarch/Objectives.cs @@ -43,10 +43,10 @@ namespace Server.Engines.Quests.Matriarch if (redSolen) { - return from is BlackSolenInfiltratorWarrior || from is BlackSolenInfiltratorQueen; + return @from is BlackSolenInfiltratorWarrior or BlackSolenInfiltratorQueen; } - return from is RedSolenInfiltratorWarrior || from is RedSolenInfiltratorQueen; + return @from is RedSolenInfiltratorWarrior or RedSolenInfiltratorQueen; } public override void OnKill(BaseCreature creature, Container corpse) @@ -55,14 +55,14 @@ namespace Server.Engines.Quests.Matriarch if (redSolen) { - if (creature is BlackSolenInfiltratorWarrior || creature is BlackSolenInfiltratorQueen) + if (creature is BlackSolenInfiltratorWarrior or BlackSolenInfiltratorQueen) { CurProgress++; } } else { - if (creature is RedSolenInfiltratorWarrior || creature is RedSolenInfiltratorQueen) + if (creature is RedSolenInfiltratorWarrior or RedSolenInfiltratorQueen) { CurProgress++; } diff --git a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBlood.cs b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBlood.cs index a1e7faaa7..f6bdda528 100644 --- a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBlood.cs +++ b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBlood.cs @@ -11,7 +11,7 @@ namespace Server.Engines.Quests.Haven { } - public override bool CanDrop(PlayerMobile player) => !(player.Quest is UzeraanTurmoilQuest); + public override bool CanDrop(PlayerMobile player) => player.Quest is not UzeraanTurmoilQuest; public override void Serialize(IGenericWriter writer) { diff --git a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBone.cs b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBone.cs index d1da95128..a4dfbf561 100644 --- a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBone.cs +++ b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestDaemonBone.cs @@ -11,7 +11,7 @@ namespace Server.Engines.Quests.Haven { } - public override bool CanDrop(PlayerMobile player) => !(player.Quest is UzeraanTurmoilQuest); + public override bool CanDrop(PlayerMobile player) => player.Quest is not UzeraanTurmoilQuest; public override void Serialize(IGenericWriter writer) { diff --git a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestFertileDirt.cs b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestFertileDirt.cs index c596f15cb..1f459e7c6 100644 --- a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestFertileDirt.cs +++ b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Items/QuestFertileDirt.cs @@ -11,7 +11,7 @@ namespace Server.Engines.Quests.Haven { } - public override bool CanDrop(PlayerMobile player) => !(player.Quest is UzeraanTurmoilQuest); + public override bool CanDrop(PlayerMobile player) => player.Quest is not UzeraanTurmoilQuest; public override void Serialize(IGenericWriter writer) { diff --git a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Objectives.cs b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Objectives.cs index f59e7b3cd..91d2997b4 100644 --- a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Objectives.cs +++ b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/Objectives.cs @@ -395,7 +395,7 @@ namespace Server.Engines.Quests.Haven public override bool IgnoreYoungProtection(Mobile from) { // This restriction continues until the end of the quest - if ((from is Zombie || from is Skeleton) && from.Map == Map.Trammel && from.X >= 3391 && from.X <= 3424 && + if (@from is Zombie or Skeleton && from.Map == Map.Trammel && from.X >= 3391 && from.X <= 3424 && from.Y >= 2639 && from.Y <= 2664) // Haven graveyard { return true; @@ -416,7 +416,7 @@ namespace Server.Engines.Quests.Haven public override void OnKill(BaseCreature creature, Container corpse) { - if ((creature is Zombie || creature is Skeleton) && corpse.Map == Map.Trammel && corpse.X >= 3391 && + if (creature is Zombie or Skeleton && corpse.Map == Map.Trammel && corpse.X >= 3391 && corpse.X <= 3424 && corpse.Y >= 2639 && corpse.Y <= 2664) // Haven graveyard { if (Utility.RandomDouble() < 0.25) diff --git a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/UzeraanTurmoilQuest.cs b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/UzeraanTurmoilQuest.cs index a0cd9ba56..28b56908f 100644 --- a/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/UzeraanTurmoilQuest.cs +++ b/Projects/UOContent/Engines/Quests/Uzeraan Turmoil/UzeraanTurmoilQuest.cs @@ -78,7 +78,7 @@ namespace Server.Engines.Quests.Haven public override void Slice() { if (!m_HasLeftTheMansion && - (From.Map != Map.Trammel || From.X < 3573 || From.X > 3611 || From.Y < 2568 || From.Y > 2606)) + (From.Map != Map.Trammel || From.X is < 3573 or > 3611 || From.Y is < 2568 or > 2606)) { m_HasLeftTheMansion = true; AddConversation(new RadarConversation()); @@ -110,7 +110,7 @@ namespace Server.Engines.Quests.Haven public static bool HasLostScrollOfPower(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } @@ -130,7 +130,7 @@ namespace Server.Engines.Quests.Haven public static bool HasLostFertileDirt(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } @@ -150,7 +150,7 @@ namespace Server.Engines.Quests.Haven public static bool HasLostDaemonBlood(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } @@ -170,7 +170,7 @@ namespace Server.Engines.Quests.Haven public static bool HasLostDaemonBone(Mobile from) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return false; } diff --git a/Projects/UOContent/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs b/Projects/UOContent/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs index 916bab5f1..2051ab96c 100644 --- a/Projects/UOContent/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs +++ b/Projects/UOContent/Engines/Treasures of Tokuno/BasePigmentsOfTokuno.cs @@ -145,7 +145,7 @@ namespace Server.Items return; } - if (!(targeted is Item i)) + if (targeted is not Item i) { from.SendLocalizedMessage(1070931); // You can only dye artifacts and enhanced magic items with this tub. } diff --git a/Projects/UOContent/Engines/Treasures of Tokuno/GreaterArtifacts.cs b/Projects/UOContent/Engines/Treasures of Tokuno/GreaterArtifacts.cs index 57f412128..7603968e8 100644 --- a/Projects/UOContent/Engines/Treasures of Tokuno/GreaterArtifacts.cs +++ b/Projects/UOContent/Engines/Treasures of Tokuno/GreaterArtifacts.cs @@ -487,7 +487,7 @@ namespace Server.Items [Constructible] public PigmentsOfTokuno(PigmentType type = PigmentType.None) : this( type, - type == PigmentType.None || type >= PigmentType.FadedCoal ? 10 : 50 + type is PigmentType.None or >= PigmentType.FadedCoal ? 10 : 50 ) { } diff --git a/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs b/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs index 676d4dd06..a4d2ede01 100644 --- a/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs +++ b/Projects/UOContent/Engines/Treasures of Tokuno/TreasuresOfTokuno.cs @@ -135,7 +135,7 @@ namespace Server.Misc public static void HandleKill(Mobile victim, Mobile killer) { - if (DropEra == TreasuresOfTokunoEra.None || !(killer is PlayerMobile pm) || !(victim is BaseCreature bc) || + if (DropEra == TreasuresOfTokunoEra.None || killer is not PlayerMobile pm || victim is not BaseCreature bc || !CheckLocation(bc) || !CheckLocation(pm) || !killer.InRange(victim, 18)) { return; @@ -433,7 +433,7 @@ namespace Server.Gumps public override void HandleCancel(NetState sender) { - if (!(sender.Mobile is PlayerMobile pm) || !pm.InRange(m_Collector.Location, 7)) + if (sender.Mobile is not PlayerMobile pm || !pm.InRange(m_Collector.Location, 7)) { return; } @@ -565,7 +565,7 @@ namespace Server.Gumps public override void HandleButtonResponse(NetState sender, int adjustedButton, ImageTileButtonInfo buttonInfo) { - if (!(sender.Mobile is PlayerMobile pm) || !pm.InRange(m_Collector.Location, 7) || + if (sender.Mobile is not PlayerMobile pm || !pm.InRange(m_Collector.Location, 7) || !(pm.ToTItemsTurnedIn >= TreasuresOfTokuno.ItemsPerReward)) { return; @@ -627,7 +627,7 @@ namespace Server.Gumps public override void HandleCancel(NetState sender) { - if (!(sender.Mobile is PlayerMobile pm) || !pm.InRange(m_Collector.Location, 7)) + if (sender.Mobile is not PlayerMobile pm || !pm.InRange(m_Collector.Location, 7)) { return; } diff --git a/Projects/UOContent/Engines/Veteran Rewards/Character Statue Maker/CharacterStatue.cs b/Projects/UOContent/Engines/Veteran Rewards/Character Statue Maker/CharacterStatue.cs index eeb92baa8..1ce3132cb 100644 --- a/Projects/UOContent/Engines/Veteran Rewards/Character Statue Maker/CharacterStatue.cs +++ b/Projects/UOContent/Engines/Veteran Rewards/Character Statue Maker/CharacterStatue.cs @@ -613,7 +613,7 @@ namespace Server.Mobiles BaseHouse house = null; var loc = new Point3D(p); - if (targeted is Item item && !item.IsLockedDown && !item.IsSecure && !(item is AddonComponent)) + if (targeted is Item item && !item.IsLockedDown && !item.IsSecure && item is not AddonComponent) { from.SendLocalizedMessage(1076191); // Statues can only be placed in houses. return; diff --git a/Projects/UOContent/Engines/Veteran Rewards/RewardDemolitionGump.cs b/Projects/UOContent/Engines/Veteran Rewards/RewardDemolitionGump.cs index 39de782c7..d88dbf38f 100644 --- a/Projects/UOContent/Engines/Veteran Rewards/RewardDemolitionGump.cs +++ b/Projects/UOContent/Engines/Veteran Rewards/RewardDemolitionGump.cs @@ -31,7 +31,7 @@ namespace Server.Gumps public override void OnResponse(NetState sender, RelayInfo info) { - if (!(m_Addon is Item item) || item.Deleted) + if (m_Addon is not Item item || item.Deleted) { return; } diff --git a/Projects/UOContent/Engines/Veteran Rewards/RewardSystem.cs b/Projects/UOContent/Engines/Veteran Rewards/RewardSystem.cs index 504de1247..3b6045386 100644 --- a/Projects/UOContent/Engines/Veteran Rewards/RewardSystem.cs +++ b/Projects/UOContent/Engines/Veteran Rewards/RewardSystem.cs @@ -83,7 +83,7 @@ namespace Server.Engines.VeteranRewards public static int GetRewardLevel(Mobile mob) { - if (!(mob.Account is Account acct)) + if (mob.Account is not Account acct) { return 0; } @@ -96,7 +96,7 @@ namespace Server.Engines.VeteranRewards public static bool HasHalfLevel(Mobile mob) { - if (!(mob.Account is Account acct)) + if (mob.Account is not Account acct) { return false; } @@ -115,7 +115,7 @@ namespace Server.Engines.VeteranRewards return false; } - if (!(mob.Account is Account acct)) + if (mob.Account is not Account acct) { return false; } @@ -133,7 +133,7 @@ namespace Server.Engines.VeteranRewards public static void ComputeRewardInfo(Mobile mob, out int cur, out int max, out int level) { - if (!(mob.Account is Account acct)) + if (mob.Account is not Account acct) { cur = max = level = 0; return; @@ -170,7 +170,7 @@ namespace Server.Engines.VeteranRewards public static bool CheckIsUsableBy(Mobile from, Item item, object[] args = null) { - var isRelaxedRules = item is DyeTub || item is MonsterStatuette; + var isRelaxedRules = item is DyeTub or MonsterStatuette; var type = item.GetType(); @@ -578,8 +578,7 @@ namespace Server.Engines.VeteranRewards ComputeRewardInfo(m, out var cur, out var max, out var level); - if (m.SkillsCap == 7000 || m.SkillsCap == 7050 || m.SkillsCap == 7100 || - m.SkillsCap == 7150 || m.SkillsCap == 7200) + if (m.SkillsCap is 7000 or 7050 or 7100 or 7150 or 7200) { level = Math.Clamp(level, 0, 4); diff --git a/Projects/UOContent/Engines/Virtues/Sacrifice.cs b/Projects/UOContent/Engines/Virtues/Sacrifice.cs index 9ce3c9be8..8679a0b06 100644 --- a/Projects/UOContent/Engines/Virtues/Sacrifice.cs +++ b/Projects/UOContent/Engines/Virtues/Sacrifice.cs @@ -190,8 +190,7 @@ namespace Server return false; } - return m is Lich || m is Succubus || m is Daemon || m is EvilMage || m is EnslavedGargoyle || - m is GargoyleEnforcer; + return m is Lich or Succubus or Daemon or EvilMage or EnslavedGargoyle or GargoyleEnforcer; } private class InternalTarget : Target diff --git a/Projects/UOContent/Gumps/AdminGump.cs b/Projects/UOContent/Gumps/AdminGump.cs index 25777e491..7f1b1deb6 100644 --- a/Projects/UOContent/Gumps/AdminGump.cs +++ b/Projects/UOContent/Gumps/AdminGump.cs @@ -476,7 +476,7 @@ namespace Server.Gumps for (int i = 0, index = listPage * 12; i < 12 && index >= 0 && index < m_List.Count; ++i, ++index) { - if (!(m_List[index] is NetState ns)) + if (m_List[index] is not NetState ns) { continue; } @@ -517,7 +517,7 @@ namespace Server.Gumps } case AdminGumpPage.ClientInfo: { - if (!(state is Mobile m)) + if (state is not Mobile m) { break; } @@ -738,7 +738,7 @@ namespace Server.Gumps for (int i = 0, index = listPage * 12; i < 12 && index >= 0 && index < m_List.Count; ++i, ++index) { - if (!(m_List[index] is Account a)) + if (m_List[index] is not Account a) { continue; } @@ -804,7 +804,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_ChangePassword: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -826,7 +826,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_ChangeAccess: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -863,7 +863,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Information: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -948,7 +948,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Access: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -974,7 +974,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Access_ClientIPs: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -1046,7 +1046,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Access_Restrictions: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -1120,7 +1120,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Characters: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -1170,7 +1170,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Comments: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -1209,7 +1209,7 @@ namespace Server.Gumps } case AdminGumpPage.AccountDetails_Tags: { - if (!(state is Account a)) + if (state is not Account a) { break; } @@ -1308,7 +1308,7 @@ namespace Server.Gumps { AddFirewallHeader(); - if (!(state is Firewall.IFirewallEntry firewallEntry)) + if (state is not Firewall.IFirewallEntry firewallEntry) { break; } @@ -2657,7 +2657,7 @@ namespace Server.Gumps if (m_List != null && index >= 0 && index < m_List.Count) { - if (!(m_List[index] is NetState ns)) + if (m_List[index] is not NetState ns) { break; } @@ -2926,7 +2926,7 @@ namespace Server.Gumps case 10: case 11: { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -2961,7 +2961,7 @@ namespace Server.Gumps } case 12: { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3004,7 +3004,7 @@ namespace Server.Gumps } case 16: // view shared { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3055,7 +3055,7 @@ namespace Server.Gumps } case 17: // ban shared { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3119,7 +3119,7 @@ namespace Server.Gumps } case 18: // firewall all { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3156,7 +3156,7 @@ namespace Server.Gumps } case 19: // add { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3220,7 +3220,7 @@ namespace Server.Gumps case 23: case 24: { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3264,7 +3264,7 @@ namespace Server.Gumps } case 25: { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3291,7 +3291,7 @@ namespace Server.Gumps { var list = m_List; - if (list == null || !(m_State is List rads)) + if (list == null || m_State is not List rads) { break; } @@ -3331,7 +3331,7 @@ namespace Server.Gumps { var list = m_List; - if (list == null || !(m_State is List rads)) + if (list == null || m_State is not List rads) { break; } @@ -3373,7 +3373,7 @@ namespace Server.Gumps } case 29: // Mark all { - if (m_List == null || !(m_State is List)) + if (m_List == null || m_State is not List) { break; } @@ -3564,7 +3564,7 @@ namespace Server.Gumps } case 36: // Clear login addresses { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -3844,7 +3844,7 @@ namespace Server.Gumps } case 7: { - if (!(m_State is Mobile m)) + if (m_State is not Mobile m) { break; } @@ -4039,7 +4039,7 @@ namespace Server.Gumps { if (index < m_List?.Count) { - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -4087,12 +4087,12 @@ namespace Server.Gumps { var obj = m_List[index]; - if (!(obj is IPAddress ip)) + if (obj is not IPAddress ip) { break; } - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } @@ -4143,7 +4143,7 @@ namespace Server.Gumps break; } - if (!(m_State is Account a)) + if (m_State is not Account a) { break; } diff --git a/Projects/UOContent/Gumps/CommentsGump.cs b/Projects/UOContent/Gumps/CommentsGump.cs index 1a31e3ecc..24504383c 100644 --- a/Projects/UOContent/Gumps/CommentsGump.cs +++ b/Projects/UOContent/Gumps/CommentsGump.cs @@ -71,7 +71,7 @@ namespace Server.Gumps private static void OnTarget(Mobile from, object target) { - if (!(target is Mobile m) || !m.Player) + if (target is not Mobile m || !m.Player) { from.SendMessage("You must target a player."); return; diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs index e3ef78fac..7c8052025 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildGump.cs @@ -40,7 +40,7 @@ namespace Server.Guilds public override void OnResponse(NetState sender, RelayInfo info) { - if (!(sender.Mobile is PlayerMobile pm)) + if (sender.Mobile is not PlayerMobile pm) { return; } @@ -71,11 +71,11 @@ namespace Server.Guilds } public static bool IsLeader(Mobile m, Guild g) => - !(m.Deleted || g.Disbanded || !(m is PlayerMobile) || + !(m.Deleted || g.Disbanded || m is not PlayerMobile || m.AccessLevel < AccessLevel.GameMaster && g.Leader != m); public static bool IsMember(Mobile m, Guild g) => - !(m.Deleted || g.Disbanded || !(m is PlayerMobile) || + !(m.Deleted || g.Disbanded || m is not PlayerMobile || m.AccessLevel < AccessLevel.GameMaster && !g.IsMember(m)); public static bool CheckProfanity(string s, int maxLength = 50) @@ -96,7 +96,7 @@ namespace Server.Guilds { var c = s[i]; - if ((c < 'a' || c > 'z') && (c < '0' || c > '9')) + if (c is < 'a' or > 'z' && c is < '0' or > '9') { var except = false; diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildListGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildListGump.cs index 7271b31ab..8b09c06b2 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildListGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/BaseGuildListGump.cs @@ -164,7 +164,7 @@ namespace Server.Guilds { base.OnResponse(sender, info); - if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild)) + if (sender.Mobile is not PlayerMobile pm || !IsMember(pm, guild)) { return; } diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/Create Guild Gump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/Create Guild Gump.cs index 55368bca9..022ba2651 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/Create Guild Gump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/Create Guild Gump.cs @@ -48,7 +48,7 @@ namespace Server.Guilds public override void OnResponse(NetState sender, RelayInfo info) { - if (!(sender.Mobile is PlayerMobile pm) || pm.Guild != null) + if (sender.Mobile is not PlayerMobile pm || pm.Guild != null) { return; // Sanity } diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs index 18f16b1d7..79e11341d 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/DiplomacyGump.cs @@ -208,15 +208,8 @@ namespace Server.Guilds { case GuildDisplayType.Relations: { - // if (!( guild.IsWar( g ) || guild.IsAlly( g ) )) - - if (!(guild.FindActiveWar(g) != null || guild.IsAlly(g)) - ) // As per OSI, only the guild leader wars show up under the sorting by relation - { - return true; - } - - return false; + // As per OSI, only the guild leader wars show up under the sorting by relation + return !(guild.FindActiveWar(g) != null || guild.IsAlly(g)); } case GuildDisplayType.AwaitingAction: { @@ -247,7 +240,7 @@ namespace Server.Guilds { base.OnResponse(sender, info); - if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild)) + if (sender.Mobile is not PlayerMobile pm || !IsMember(pm, guild)) { return; } diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs index a23357827..c5bf35787 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/GuildMemberInfoGump.cs @@ -68,7 +68,7 @@ namespace Server.Guilds public override void OnResponse(NetState sender, RelayInfo info) { - if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild) || !IsMember(m_Member, guild)) + if (sender.Mobile is not PlayerMobile pm || !IsMember(pm, guild) || !IsMember(m_Member, guild)) { return; } @@ -244,12 +244,12 @@ namespace Server.Guilds public void SetTitle_Callback(Mobile from, string text) { - if (!(from is PlayerMobile pm) || m_Member == null) + if (@from is not PlayerMobile pm || m_Member == null) { return; } - if (!(m_Member.Guild is Guild g) || !IsMember(pm, g) || + if (m_Member.Guild is not Guild g || !IsMember(pm, g) || !(pm.GuildRank.GetFlag(RankFlags.CanSetGuildTitle) && (pm.GuildRank.Rank > m_Member.GuildRank.Rank || pm == m_Member))) { diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs index c31e443db..eedea7a6b 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/GuildRosterGump.cs @@ -101,7 +101,7 @@ namespace Server.Guilds { base.OnResponse(sender, info); - if (!(sender.Mobile is PlayerMobile pm) || !IsMember(pm, guild)) + if (sender.Mobile is not PlayerMobile pm || !IsMember(pm, guild)) { return; } diff --git a/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs b/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs index 9e5dca714..b92cd52aa 100644 --- a/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs +++ b/Projects/UOContent/Gumps/Guilds/New Guild System/OtherGuildInfo.cs @@ -715,7 +715,7 @@ namespace Server.Guilds public void CreateAlliance_Callback(Mobile from, string text) { - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Gumps/PlayerVendorGumps.cs b/Projects/UOContent/Gumps/PlayerVendorGumps.cs index c12a8589d..b525b59d6 100644 --- a/Projects/UOContent/Gumps/PlayerVendorGumps.cs +++ b/Projects/UOContent/Gumps/PlayerVendorGumps.cs @@ -258,7 +258,7 @@ namespace Server.Gumps { var from = sender.Mobile; - if (info.ButtonID == 1 || info.ButtonID == 2) // See goods or Customize + if (info.ButtonID is 1 or 2) // See goods or Customize { m_Vendor.CheckTeleport(from); } diff --git a/Projects/UOContent/Gumps/Props/PropsGump.cs b/Projects/UOContent/Gumps/Props/PropsGump.cs index b0be1bdfb..e7b43f0fc 100644 --- a/Projects/UOContent/Gumps/Props/PropsGump.cs +++ b/Projects/UOContent/Gumps/Props/PropsGump.cs @@ -458,7 +458,7 @@ namespace Server.Gumps return Array.Empty(); } - if (!(attrs[0] is CustomEnumAttribute ce)) + if (attrs[0] is not CustomEnumAttribute ce) { return Array.Empty(); } diff --git a/Projects/UOContent/Gumps/ReportMurderer.cs b/Projects/UOContent/Gumps/ReportMurderer.cs index 1a96ca70f..6394a76bd 100644 --- a/Projects/UOContent/Gumps/ReportMurderer.cs +++ b/Projects/UOContent/Gumps/ReportMurderer.cs @@ -63,7 +63,7 @@ namespace Server.Gumps var ourKarma = g.Karma; var innocent = n == Notoriety.Innocent; - var criminal = n == Notoriety.Criminal || n == Notoriety.Murderer; + var criminal = n is Notoriety.Criminal or Notoriety.Murderer; var fameAward = m.Fame / 200; var karmaAward = 0; diff --git a/Projects/UOContent/Gumps/VendorRentalGumps.cs b/Projects/UOContent/Gumps/VendorRentalGumps.cs index 84872e6a0..255bb1ce9 100644 --- a/Projects/UOContent/Gumps/VendorRentalGumps.cs +++ b/Projects/UOContent/Gumps/VendorRentalGumps.cs @@ -45,7 +45,7 @@ namespace Server.Gumps AddImageTiled(70, 80, 230, 2, 0x23C5); } - if (type == GumpType.UnlockedContract || type == GumpType.LockedContract) + if (type is GumpType.UnlockedContract or GumpType.LockedContract) { AddButton(30, 96, 0x15E1, 0x15E5, 0, GumpButtonType.Page, 2); } @@ -53,7 +53,7 @@ namespace Server.Gumps AddHtmlLocalized(50, 95, 150, 20, 1062354, 0x1); // Contract Length AddHtmlLocalized(230, 95, 270, 20, duration.Name, 0x1); - if (type == GumpType.UnlockedContract || type == GumpType.LockedContract) + if (type is GumpType.UnlockedContract or GumpType.LockedContract) { AddButton(30, 116, 0x15E1, 0x15E5, 1); } @@ -76,7 +76,7 @@ namespace Server.Gumps AddImage(49, 170, 0x61); AddHtmlLocalized(60, 170, 250, 20, 1062355, 0x1); // Renew On Expiration? - if (type == GumpType.LockedContract || type == GumpType.UnlockedContract || type == GumpType.VendorLandlord) + if (type is GumpType.LockedContract or GumpType.UnlockedContract or GumpType.VendorLandlord) { AddButton(30, 192, 0x15E1, 0x15E5, 3); } @@ -113,7 +113,7 @@ namespace Server.Gumps AddButton(67, 295, 0x15E1, 0x15E5, 5); AddHtmlLocalized(85, 294, 270, 20, 1062358, 0x28); // Offer Contract To Someone } - else if (type == GumpType.VendorLandlord || type == GumpType.VendorRenter) + else if (type is GumpType.VendorLandlord or GumpType.VendorRenter) { if (type == GumpType.VendorLandlord) { @@ -127,7 +127,7 @@ namespace Server.Gumps AddLabel(120, 293, 0x64, renter != null ? renter.Name : ""); } - if (type == GumpType.UnlockedContract || type == GumpType.LockedContract) + if (type is GumpType.UnlockedContract or GumpType.LockedContract) { AddPage(2); @@ -348,7 +348,7 @@ namespace Server.Gumps return; } - if (!(targeted is Mobile mob) || !mob.Player || !mob.Alive || mob == from) + if (targeted is not Mobile mob || !mob.Player || !mob.Alive || mob == from) { from.SendLocalizedMessage(1071984); // That is not a valid target for a rental contract! } diff --git a/Projects/UOContent/Gumps/ViewHousesGump.cs b/Projects/UOContent/Gumps/ViewHousesGump.cs index b140102de..09078026a 100644 --- a/Projects/UOContent/Gumps/ViewHousesGump.cs +++ b/Projects/UOContent/Gumps/ViewHousesGump.cs @@ -180,7 +180,7 @@ namespace Server.Gumps { var list = new List(); - if (!(owner.Account is Account acct)) + if (owner.Account is not Account acct) { list.AddRange(BaseHouse.GetHouses(owner)); } diff --git a/Projects/UOContent/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs b/Projects/UOContent/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs index 8841ab65e..3384eec0f 100644 --- a/Projects/UOContent/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs +++ b/Projects/UOContent/Holiday Stuff/Halloween/2006/Engines/TrickOrTreat.cs @@ -153,7 +153,7 @@ namespace Server.Engines.Events return; } - if (!(targ is Mobile)) + if (targ is not Mobile) { from.SendLocalizedMessage(1076781); /* There is little chance of getting candy from that! */ return; diff --git a/Projects/UOContent/Holiday Stuff/Halloween/2006/Items/HalloweenPumpkin.cs b/Projects/UOContent/Holiday Stuff/Halloween/2006/Items/HalloweenPumpkin.cs index 8acec3394..7197c531e 100644 --- a/Projects/UOContent/Holiday Stuff/Halloween/2006/Items/HalloweenPumpkin.cs +++ b/Projects/UOContent/Holiday Stuff/Halloween/2006/Items/HalloweenPumpkin.cs @@ -62,7 +62,7 @@ namespace Server.Items public override bool OnDragLift(Mobile from) { - if (Name == null && (ItemID == 0x4694 || ItemID == 0x4691 || ItemID == 0x4698 || ItemID == 0x4695)) + if (Name == null && ItemID is 0x4694 or 0x4691 or 0x4698 or 0x4695) { if (Utility.RandomBool()) { diff --git a/Projects/UOContent/Items/Addons/DartBoard.cs b/Projects/UOContent/Items/Addons/DartBoard.cs index 52c4cbd55..967b27fd8 100644 --- a/Projects/UOContent/Items/Addons/DartBoard.cs +++ b/Projects/UOContent/Items/Addons/DartBoard.cs @@ -41,11 +41,11 @@ namespace Server.Items } else if (East) { - canThrow = dir == Direction.Left || dir == Direction.West || dir == Direction.Up; + canThrow = dir is Direction.Left or Direction.West or Direction.Up; } else { - canThrow = dir == Direction.Up || dir == Direction.North || dir == Direction.Right; + canThrow = dir is Direction.Up or Direction.North or Direction.Right; } if (canThrow) @@ -60,7 +60,7 @@ namespace Server.Items public void Throw(Mobile from) { - if (!(from.Weapon is BaseKnife knife)) + if (@from.Weapon is not BaseKnife knife) { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 500751); // Try holding a knife... return; diff --git a/Projects/UOContent/Items/Armor/BaseArmor.cs b/Projects/UOContent/Items/Armor/BaseArmor.cs index 55bbe8a65..dd79ac923 100644 --- a/Projects/UOContent/Items/Armor/BaseArmor.cs +++ b/Projects/UOContent/Items/Armor/BaseArmor.cs @@ -598,7 +598,7 @@ namespace Server.Items ); // Not sure since when, but right now 15 points are added, not 14. } - if (Core.ML && !(this is BaseShield)) + if (Core.ML && this is not BaseShield) { var bonus = (int)(from.Skills.ArmsLore.Value / 20); @@ -820,7 +820,7 @@ namespace Server.Items public override void OnAfterDuped(Item newItem) { - if (!(newItem is BaseArmor armor)) + if (newItem is not BaseArmor armor) { return; } diff --git a/Projects/UOContent/Items/Books/BookPackets.cs b/Projects/UOContent/Items/Books/BookPackets.cs index 303bb34e0..6eee9c451 100644 --- a/Projects/UOContent/Items/Books/BookPackets.cs +++ b/Projects/UOContent/Items/Books/BookPackets.cs @@ -33,7 +33,7 @@ namespace Server.Items { var from = state.Mobile; - if (!(World.FindItem((Serial)reader.ReadUInt32()) is BaseBook book) || !book.Writable || + if (World.FindItem((Serial)reader.ReadUInt32()) is not BaseBook book || !book.Writable || !from.InRange(book.GetWorldLocation(), 1) || !book.IsAccessibleTo(from)) { return; @@ -52,7 +52,7 @@ namespace Server.Items { var from = state.Mobile; - if (!(World.FindItem((Serial)reader.ReadUInt32()) is BaseBook book) || !book.Writable || + if (World.FindItem((Serial)reader.ReadUInt32()) is not BaseBook book || !book.Writable || !from.InRange(book.GetWorldLocation(), 1) || !book.IsAccessibleTo(from)) { return; @@ -88,7 +88,7 @@ namespace Server.Items { var from = state.Mobile; - if (!(World.FindItem((Serial)reader.ReadUInt32()) is BaseBook book) || !book.Writable || + if (World.FindItem((Serial)reader.ReadUInt32()) is not BaseBook book || !book.Writable || !from.InRange(book.GetWorldLocation(), 1) || !book.IsAccessibleTo(from)) { return; diff --git a/Projects/UOContent/Items/Construction/Doors/BaseDoor.cs b/Projects/UOContent/Items/Construction/Doors/BaseDoor.cs index 1992b7c68..bd44f0a7f 100644 --- a/Projects/UOContent/Items/Construction/Doors/BaseDoor.cs +++ b/Projects/UOContent/Items/Construction/Doors/BaseDoor.cs @@ -144,7 +144,7 @@ namespace Server.Items private static void Link_OnFirstTarget(Mobile from, object targeted) { - if (!(targeted is BaseDoor door)) + if (targeted is not BaseDoor door) { from.BeginTarget(-1, false, TargetFlags.None, Link_OnFirstTarget); from.SendMessage("That is not a door. Try again."); @@ -158,7 +158,7 @@ namespace Server.Items private static void Link_OnSecondTarget(Mobile from, object targeted, BaseDoor first) { - if (!(targeted is BaseDoor second)) + if (targeted is not BaseDoor second) { from.BeginTarget(-1, false, TargetFlags.None, Link_OnSecondTarget, first); from.SendMessage("That is not a door. Try again."); @@ -180,7 +180,7 @@ namespace Server.Items private static void ChainLink_OnTarget(Mobile from, object targeted, List list) { - if (!(targeted is BaseDoor door)) + if (targeted is not BaseDoor door) { from.BeginTarget(-1, false, TargetFlags.None, ChainLink_OnTarget, list); from.SendMessage("That is not a door. Try again."); @@ -328,8 +328,8 @@ namespace Server.Items { var item = items[i]; - if (!(item is BaseMulti) && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y) && - !(item is BaseDoor)) + if (item is not BaseMulti && item.ItemID <= TileData.MaxItemValue && item.AtWorldPoint(x, y) && + item is not BaseDoor) { var id = item.ItemData; var surface = id.Surface; diff --git a/Projects/UOContent/Items/Construction/Misc/Vines.cs b/Projects/UOContent/Items/Construction/Misc/Vines.cs index e45923ebd..f561050c2 100644 --- a/Projects/UOContent/Items/Construction/Misc/Vines.cs +++ b/Projects/UOContent/Items/Construction/Misc/Vines.cs @@ -10,7 +10,7 @@ namespace Server.Items [Constructible] public Vines(int v) : base(0xCEB) { - if (v < 0 || v > 7) + if (v is < 0 or > 7) { v = 0; } diff --git a/Projects/UOContent/Items/Containers/Container.cs b/Projects/UOContent/Items/Containers/Container.cs index f9c92bbcc..1fce1751a 100644 --- a/Projects/UOContent/Items/Containers/Container.cs +++ b/Projects/UOContent/Items/Containers/Container.cs @@ -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; } diff --git a/Projects/UOContent/Items/Containers/FillableContainers.cs b/Projects/UOContent/Items/Containers/FillableContainers.cs index 72d371803..54ccdd410 100644 --- a/Projects/UOContent/Items/Containers/FillableContainers.cs +++ b/Projects/UOContent/Items/Containers/FillableContainers.cs @@ -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); } diff --git a/Projects/UOContent/Items/Containers/FurnitureContainer.cs b/Projects/UOContent/Items/Containers/FurnitureContainer.cs index ea41f73d3..07dbe1597 100644 --- a/Projects/UOContent/Items/Containers/FurnitureContainer.cs +++ b/Projects/UOContent/Items/Containers/FurnitureContainer.cs @@ -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 { diff --git a/Projects/UOContent/Items/Containers/SalvageBag.cs b/Projects/UOContent/Items/Containers/SalvageBag.cs index da47e9740..3d8be35dc 100644 --- a/Projects/UOContent/Items/Containers/SalvageBag.cs +++ b/Projects/UOContent/Items/Containers/SalvageBag.cs @@ -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; } diff --git a/Projects/UOContent/Items/Deeds/DragonBardingDeed.cs b/Projects/UOContent/Items/Deeds/DragonBardingDeed.cs index acd638366..cf3e814a4 100644 --- a/Projects/UOContent/Items/Deeds/DragonBardingDeed.cs +++ b/Projects/UOContent/Items/Deeds/DragonBardingDeed.cs @@ -110,7 +110,7 @@ namespace Server.Items return; } - if (!(obj is SwampDragon pet) || pet.HasBarding) + if (obj is not SwampDragon pet || pet.HasBarding) { from.SendLocalizedMessage(1053025); // That is not an unarmored swamp dragon. } diff --git a/Projects/UOContent/Items/Deeds/HairRestylingDeed.cs b/Projects/UOContent/Items/Deeds/HairRestylingDeed.cs index a6b999b71..847536294 100644 --- a/Projects/UOContent/Items/Deeds/HairRestylingDeed.cs +++ b/Projects/UOContent/Items/Deeds/HairRestylingDeed.cs @@ -146,7 +146,7 @@ namespace Server.Items return; } - if (info.ButtonID < 1 || info.ButtonID > 10) + if (info.ButtonID is < 1 or > 10) { return; } diff --git a/Projects/UOContent/Items/Deeds/HolidayTreeDeed.cs b/Projects/UOContent/Items/Deeds/HolidayTreeDeed.cs index ea3fec3b1..9f3eb7962 100644 --- a/Projects/UOContent/Items/Deeds/HolidayTreeDeed.cs +++ b/Projects/UOContent/Items/Deeds/HolidayTreeDeed.cs @@ -89,7 +89,7 @@ namespace Server.Items public void Placement_OnTarget(Mobile from, object targeted, HolidayTreeType type) { - if (!(targeted is IPoint3D p)) + if (targeted is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Items/Deeds/VendorRentalContract.cs b/Projects/UOContent/Items/Deeds/VendorRentalContract.cs index 437d4d0f4..6c37f9f55 100644 --- a/Projects/UOContent/Items/Deeds/VendorRentalContract.cs +++ b/Projects/UOContent/Items/Deeds/VendorRentalContract.cs @@ -274,7 +274,7 @@ namespace Server.Items return; } - if (!(targeted is IPoint3D location)) + if (targeted is not IPoint3D location) { return; } diff --git a/Projects/UOContent/Items/Food/Beverage.cs b/Projects/UOContent/Items/Food/Beverage.cs index b3c02eb83..91edd8426 100644 --- a/Projects/UOContent/Items/Food/Beverage.cs +++ b/Projects/UOContent/Items/Food/Beverage.cs @@ -262,7 +262,7 @@ namespace Server.Items public override int ComputeItemID() { - if (ItemID == 0x99A || ItemID == 0x9B3 || ItemID == 0x9BF || ItemID == 0x9CB) + if (ItemID is 0x99A or 0x9B3 or 0x9BF or 0x9CB) { return ItemID; } @@ -420,7 +420,7 @@ namespace Server.Items { if (IsEmpty) { - if (ItemID == 0x9A7 || ItemID == 0xFF7) + if (ItemID is 0x9A7 or 0xFF7) { return ItemID; } @@ -477,7 +477,7 @@ namespace Server.Items } case BeverageType.Water: { - if (ItemID == 0xFF8 || ItemID == 0xFF9 || ItemID == 0x1F9E) + if (ItemID is 0xFF8 or 0xFF9 or 0x1F9E) { return ItemID; } @@ -854,7 +854,7 @@ namespace Server.Items { var qs = player.Quest; - if (!(qs is WitchApprenticeQuest)) + if (qs is not WitchApprenticeQuest) { return; } @@ -986,7 +986,7 @@ namespace Server.Items item.Pour(from, this); } else if (targ is AddonComponent component && - (component.Addon is WaterVatEast || component.Addon is WaterVatSouth) && + component.Addon is WaterVatEast or WaterVatSouth && Content == BeverageType.Water) { if (from is PlayerMobile player) @@ -1070,7 +1070,7 @@ namespace Server.Items for (var i = 0; i < items.Length; ++i) { - if (!(items[i] is BaseBeverage bev) || bev.Content != content || bev.IsEmpty) + if (items[i] is not BaseBeverage bev || bev.Content != content || bev.IsEmpty) { continue; } diff --git a/Projects/UOContent/Items/Food/Cooking.cs b/Projects/UOContent/Items/Food/Cooking.cs index 8b17e5a8f..1d74d028c 100644 --- a/Projects/UOContent/Items/Food/Cooking.cs +++ b/Projects/UOContent/Items/Food/Cooking.cs @@ -44,7 +44,7 @@ namespace Server.Items return; } - if (!(targeted is Item targetItem) || targetItem.Deleted) + if (targeted is not Item targetItem || targetItem.Deleted) { return; } @@ -390,7 +390,7 @@ namespace Server.Items { Delete(); } - else if (m_Quantity < 20 && (ItemID == 0x1039 || ItemID == 0x1045)) + else if (m_Quantity < 20 && ItemID is 0x1039 or 0x1045) { ++ItemID; } @@ -440,7 +440,7 @@ namespace Server.Items return; } - if (ItemID == 0x1039 || ItemID == 0x1045) + if (ItemID is 0x1039 or 0x1045) { ++ItemID; } diff --git a/Projects/UOContent/Items/Games/BaseBoard.cs b/Projects/UOContent/Items/Games/BaseBoard.cs index f9f75c2a5..8426bcb84 100644 --- a/Projects/UOContent/Items/Games/BaseBoard.cs +++ b/Projects/UOContent/Items/Games/BaseBoard.cs @@ -116,7 +116,7 @@ namespace Server.Items public static bool ValidateDefault(Mobile from, BaseBoard board) => !board.Deleted && (from.AccessLevel >= AccessLevel.GameMaster || from.Alive && - (board.IsChildOf(from.Backpack) || !(board.RootParent is Mobile) && + (board.IsChildOf(from.Backpack) || board.RootParent is not Mobile && board.Map == from.Map && from.InRange(board.GetWorldLocation(), 1) && BaseHouse.FindHouseAt(board)?.IsOwner(from) == true)); diff --git a/Projects/UOContent/Items/Games/Mahjong/MahjongDealerIndicator.cs b/Projects/UOContent/Items/Games/Mahjong/MahjongDealerIndicator.cs index 9f022e998..2d9d694be 100644 --- a/Projects/UOContent/Items/Games/Mahjong/MahjongDealerIndicator.cs +++ b/Projects/UOContent/Items/Games/Mahjong/MahjongDealerIndicator.cs @@ -33,7 +33,7 @@ namespace Server.Engines.Mahjong public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) { - if (direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down) + if (direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down) { return new MahjongPieceDim(position, 40, 20); } diff --git a/Projects/UOContent/Items/Games/Mahjong/MahjongTile.cs b/Projects/UOContent/Items/Games/Mahjong/MahjongTile.cs index ddc373d55..e9d3bf628 100644 --- a/Projects/UOContent/Items/Games/Mahjong/MahjongTile.cs +++ b/Projects/UOContent/Items/Games/Mahjong/MahjongTile.cs @@ -51,7 +51,7 @@ namespace Server.Engines.Mahjong public static MahjongPieceDim GetDimensions(Point2D position, MahjongPieceDirection direction) { - if (direction == MahjongPieceDirection.Up || direction == MahjongPieceDirection.Down) + if (direction is MahjongPieceDirection.Up or MahjongPieceDirection.Down) { return new MahjongPieceDim(position, 20, 30); } diff --git a/Projects/UOContent/Items/Guilds/Guildstone.cs b/Projects/UOContent/Items/Guilds/Guildstone.cs index 8191d8505..f002a89b2 100644 --- a/Projects/UOContent/Items/Guilds/Guildstone.cs +++ b/Projects/UOContent/Items/Guilds/Guildstone.cs @@ -431,7 +431,7 @@ namespace Server.Items public void Placement_OnTarget(Mobile from, object targeted) { - if (!(targeted is IPoint3D p) || Deleted) + if (targeted is not IPoint3D p || Deleted) { return; } diff --git a/Projects/UOContent/Items/Jewels/BaseJewel.cs b/Projects/UOContent/Items/Jewels/BaseJewel.cs index b049b8876..ac7503be4 100644 --- a/Projects/UOContent/Items/Jewels/BaseJewel.cs +++ b/Projects/UOContent/Items/Jewels/BaseJewel.cs @@ -195,7 +195,7 @@ namespace Server.Items public override void OnAfterDuped(Item newItem) { - if (!(newItem is BaseJewel jewel)) + if (newItem is not BaseJewel jewel) { return; } diff --git a/Projects/UOContent/Items/Lights/BaseEquippableLight.cs b/Projects/UOContent/Items/Lights/BaseEquippableLight.cs index 3894733cd..5310b457c 100644 --- a/Projects/UOContent/Items/Lights/BaseEquippableLight.cs +++ b/Projects/UOContent/Items/Lights/BaseEquippableLight.cs @@ -11,7 +11,7 @@ namespace Server.Items public override void Ignite() { - if (!(Parent is Mobile) && RootParent is Mobile holder) + if (Parent is not Mobile && RootParent is Mobile holder) { if (holder.EquipItem(this)) { diff --git a/Projects/UOContent/Items/Lights/CandleSkull.cs b/Projects/UOContent/Items/Lights/CandleSkull.cs index f82c6fb0f..049a426a3 100644 --- a/Projects/UOContent/Items/Lights/CandleSkull.cs +++ b/Projects/UOContent/Items/Lights/CandleSkull.cs @@ -29,7 +29,7 @@ namespace Server.Items { get { - if (ItemID == 0x1583 || ItemID == 0x1854) + if (ItemID is 0x1583 or 0x1854) { return 0x1854; } @@ -42,7 +42,7 @@ namespace Server.Items { get { - if (ItemID == 0x1853 || ItemID == 0x1584) + if (ItemID is 0x1853 or 0x1584) { return 0x1853; } diff --git a/Projects/UOContent/Items/Lights/Lantern.cs b/Projects/UOContent/Items/Lights/Lantern.cs index a925cf884..50635bda3 100644 --- a/Projects/UOContent/Items/Lights/Lantern.cs +++ b/Projects/UOContent/Items/Lights/Lantern.cs @@ -29,7 +29,7 @@ namespace Server.Items { get { - if (ItemID == 0xA15 || ItemID == 0xA17) + if (ItemID is 0xA15 or 0xA17) { return ItemID; } diff --git a/Projects/UOContent/Items/Maps/MapItemPackets.cs b/Projects/UOContent/Items/Maps/MapItemPackets.cs index a413e6213..08229830c 100644 --- a/Projects/UOContent/Items/Maps/MapItemPackets.cs +++ b/Projects/UOContent/Items/Maps/MapItemPackets.cs @@ -29,7 +29,7 @@ namespace Server.Network { var from = state.Mobile; - if (!(World.FindItem((Serial)reader.ReadUInt32()) is MapItem map)) + if (World.FindItem((Serial)reader.ReadUInt32()) is not MapItem map) { return; } diff --git a/Projects/UOContent/Items/Misc/Bola.cs b/Projects/UOContent/Items/Misc/Bola.cs index 67bac32f3..69ab24beb 100644 --- a/Projects/UOContent/Items/Misc/Bola.cs +++ b/Projects/UOContent/Items/Misc/Bola.cs @@ -68,13 +68,13 @@ namespace Server.Items new Bola().MoveToWorld(to.Location, to.Map); } - if (to is ChaosDragoon || to is ChaosDragoonElite) + if (to is ChaosDragoon or ChaosDragoonElite) { from.SendLocalizedMessage(1042047); // You fail to knock the rider from its mount. } var mt = to.Mount; - if (mt != null && !(to is ChaosDragoon || to is ChaosDragoonElite)) + if (mt != null && !(to is ChaosDragoon or ChaosDragoonElite)) { mt.Rider = null; } diff --git a/Projects/UOContent/Items/Misc/CommunicationCrystals.cs b/Projects/UOContent/Items/Misc/CommunicationCrystals.cs index a8605de49..357720994 100644 --- a/Projects/UOContent/Items/Misc/CommunicationCrystals.cs +++ b/Projects/UOContent/Items/Misc/CommunicationCrystals.cs @@ -121,7 +121,7 @@ namespace Server.Items public override void OnSpeech(SpeechEventArgs e) { - if (!Active || Receivers.Count == 0 || RootParent != null && !(RootParent is Mobile)) + if (!Active || Receivers.Count == 0 || RootParent != null && RootParent is not Mobile) { return; } diff --git a/Projects/UOContent/Items/Misc/Corpses/Corpse.cs b/Projects/UOContent/Items/Misc/Corpses/Corpse.cs index 3960d6383..766b5989e 100644 --- a/Projects/UOContent/Items/Misc/Corpses/Corpse.cs +++ b/Projects/UOContent/Items/Misc/Corpses/Corpse.cs @@ -789,7 +789,7 @@ namespace Server.Items public bool DevourCorpse() { - if (Devoured || Deleted || Killer?.Deleted != false || !Killer.Alive || !(Killer is IDevourer devourer) || + if (Devoured || Deleted || Killer?.Deleted != false || !Killer.Alive || Killer is not IDevourer devourer || Owner?.Deleted != false) { return false; @@ -1003,8 +1003,7 @@ namespace Server.Items var item = items[i]; var loc = item.Location; - if (item.Layer == Layer.Hair || item.Layer == Layer.FacialHair || !item.Movable || - !GetRestoreInfo(item, ref loc)) + if (item.Layer is Layer.Hair or Layer.FacialHair || !item.Movable || !GetRestoreInfo(item, ref loc)) { continue; } @@ -1055,7 +1054,7 @@ namespace Server.Items return; } - if (!(from is PlayerMobile player)) + if (@from is not PlayerMobile player) { return; } diff --git a/Projects/UOContent/Items/Misc/Guillotine.cs b/Projects/UOContent/Items/Misc/Guillotine.cs index b1195cb88..3b65f5a63 100644 --- a/Projects/UOContent/Items/Misc/Guillotine.cs +++ b/Projects/UOContent/Items/Misc/Guillotine.cs @@ -24,7 +24,7 @@ namespace Server.Items { from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that } - else if (Visible && (ItemID == 4656 || ItemID == 4702) && Core.Now >= m_NextUse) + else if (Visible && ItemID is 4656 or 4702 && Core.Now >= m_NextUse) { var p = GetWorldLocation(); @@ -89,11 +89,11 @@ namespace Server.Items private void BackUp() { - if (ItemID == 4678 || ItemID == 4679) + if (ItemID is 4678 or 4679) { ItemID = 4656; } - else if (ItemID == 4712 || ItemID == 4713) + else if (ItemID is 4712 or 4713) { ItemID = 4702; } @@ -112,11 +112,11 @@ namespace Server.Items int version = reader.ReadByte(); - if (ItemID == 4678 || ItemID == 4679) + if (ItemID is 4678 or 4679) { ItemID = 4656; } - else if (ItemID == 4712 || ItemID == 4713) + else if (ItemID is 4712 or 4713) { ItemID = 4702; } diff --git a/Projects/UOContent/Items/Misc/KeyRing.cs b/Projects/UOContent/Items/Misc/KeyRing.cs index 3ea0e1502..9260e7f26 100644 --- a/Projects/UOContent/Items/Misc/KeyRing.cs +++ b/Projects/UOContent/Items/Misc/KeyRing.cs @@ -29,7 +29,7 @@ namespace Server.Items return false; } - if (!(dropped is Key key) || key.KeyValue == 0) + if (dropped is not Key key || key.KeyValue == 0) { from.SendLocalizedMessage(501689); // Only non-blank keys can be put on a keyring. return false; @@ -80,7 +80,7 @@ namespace Server.Items public void Open(Mobile from) { - if (!(Parent is Container cont)) + if (Parent is not Container cont) { return; } diff --git a/Projects/UOContent/Items/Misc/PoolOfAcid.cs b/Projects/UOContent/Items/Misc/PoolOfAcid.cs index c5ceb1d96..db2511df9 100644 --- a/Projects/UOContent/Items/Misc/PoolOfAcid.cs +++ b/Projects/UOContent/Items/Misc/PoolOfAcid.cs @@ -66,7 +66,7 @@ namespace Server.Items foreach (var m in GetMobilesInRange(0)) { - if (m.Alive && !m.IsDeadBondedPet && (!(m is BaseCreature bc) || bc.Controlled || bc.Summoned)) + if (m.Alive && !m.IsDeadBondedPet && (m is not BaseCreature bc || bc.Controlled || bc.Summoned)) { toDamage.Add(m); } diff --git a/Projects/UOContent/Items/Quivers/BaseQuiver.cs b/Projects/UOContent/Items/Quivers/BaseQuiver.cs index 02a832003..6234087bd 100644 --- a/Projects/UOContent/Items/Quivers/BaseQuiver.cs +++ b/Projects/UOContent/Items/Quivers/BaseQuiver.cs @@ -126,7 +126,7 @@ namespace Server.Items public override void OnAfterDuped(Item newItem) { - if (!(newItem is BaseQuiver quiver)) + if (newItem is not BaseQuiver quiver) { return; } diff --git a/Projects/UOContent/Items/Shields/ChaosShield.cs b/Projects/UOContent/Items/Shields/ChaosShield.cs index 055b1a245..bbc80947c 100644 --- a/Projects/UOContent/Items/Shields/ChaosShield.cs +++ b/Projects/UOContent/Items/Shields/ChaosShield.cs @@ -63,7 +63,7 @@ namespace Server.Items return true; } - if (!(m.Guild is Guild g) || g.Type != GuildType.Chaos) + if (m.Guild is not Guild g || g.Type != GuildType.Chaos) { m.FixedEffect(0x3728, 10, 13); Delete(); diff --git a/Projects/UOContent/Items/Shields/OrderShield.cs b/Projects/UOContent/Items/Shields/OrderShield.cs index 7d5307737..1547c85aa 100644 --- a/Projects/UOContent/Items/Shields/OrderShield.cs +++ b/Projects/UOContent/Items/Shields/OrderShield.cs @@ -68,7 +68,7 @@ namespace Server.Items return true; } - if (!(m.Guild is Guild g) || g.Type != GuildType.Order) + if (m.Guild is not Guild g || g.Type != GuildType.Order) { m.FixedEffect(0x3728, 10, 13); Delete(); diff --git a/Projects/UOContent/Items/Skill Items/Camping/Bedroll.cs b/Projects/UOContent/Items/Skill Items/Camping/Bedroll.cs index 53bc96d55..78fcbe3eb 100644 --- a/Projects/UOContent/Items/Skill Items/Camping/Bedroll.cs +++ b/Projects/UOContent/Items/Skill Items/Camping/Bedroll.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs b/Projects/UOContent/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs index 741864073..8d3f3e515 100644 --- a/Projects/UOContent/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs +++ b/Projects/UOContent/Items/Skill Items/Fishing/Misc/SpecialFishingNet.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Harvest Tools/BaseHarvestTool.cs b/Projects/UOContent/Items/Skill Items/Harvest Tools/BaseHarvestTool.cs index 264147b2c..8fffda490 100644 --- a/Projects/UOContent/Items/Skill Items/Harvest Tools/BaseHarvestTool.cs +++ b/Projects/UOContent/Items/Skill Items/Harvest Tools/BaseHarvestTool.cs @@ -168,7 +168,7 @@ namespace Server.Items return; } - if (!(from is PlayerMobile pm)) + if (@from is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Items/Skill Items/Magical/Misc/PotionKeg.cs b/Projects/UOContent/Items/Skill Items/Magical/Misc/PotionKeg.cs index 3f352c762..e8a633fab 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Misc/PotionKeg.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Misc/PotionKeg.cs @@ -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; diff --git a/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs b/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs index 030a86745..e6f2bb93a 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Potions/BasePotion.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs b/Projects/UOContent/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs index 63909ee5c..f65db4499 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Potions/Confusion Blast Potions/BaseConfusionBlastPotion.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Magical/Runebook.cs b/Projects/UOContent/Items/Skill Items/Magical/Runebook.cs index 97e16e150..2088180cb 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Runebook.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Runebook.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Magical/Spellbook.cs b/Projects/UOContent/Items/Skill Items/Magical/Spellbook.cs index f4d3f636d..18d0dc042 100644 --- a/Projects/UOContent/Items/Skill Items/Magical/Spellbook.cs +++ b/Projects/UOContent/Items/Skill Items/Magical/Spellbook.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Misc/Bandage.cs b/Projects/UOContent/Items/Skill Items/Misc/Bandage.cs index 058cfa1b1..aaab0407f 100644 --- a/Projects/UOContent/Items/Skill Items/Misc/Bandage.cs +++ b/Projects/UOContent/Items/Skill Items/Misc/Bandage.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs b/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs index 52fc69dd1..d0faa631e 100644 --- a/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs +++ b/Projects/UOContent/Items/Skill Items/Musical Instruments/BaseInstrument.cs @@ -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; } diff --git a/Projects/UOContent/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs b/Projects/UOContent/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs index 1f422cd94..be13e0150 100644 --- a/Projects/UOContent/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs +++ b/Projects/UOContent/Items/Skill Items/Tailor Items/Dyetubs/DyeTub.cs @@ -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)) { diff --git a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs index 4a8c962e4..756505c08 100644 --- a/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs +++ b/Projects/UOContent/Items/Skill Items/Tailor Items/Misc/Scissors.cs @@ -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)) { diff --git a/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs b/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs index e72c7f7cb..e94194e44 100644 --- a/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs +++ b/Projects/UOContent/Items/Skill Items/Thief/LockPick.cs @@ -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 diff --git a/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs b/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs index 46b5004a5..45881715f 100644 --- a/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs +++ b/Projects/UOContent/Items/Skill Items/Tinkering/Spyglass.cs @@ -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 diff --git a/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs b/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs index 271899878..e484fc193 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/BaseTool.cs @@ -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) diff --git a/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs b/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs index ae5d9449b..f980d2391 100644 --- a/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs +++ b/Projects/UOContent/Items/Skill Items/Tools/RunicSewingKit.cs @@ -79,7 +79,7 @@ namespace Server.Items var version = reader.ReadInt(); - if (ItemID == 0x13E4 || ItemID == 0x13E3) + if (ItemID is 0x13E4 or 0x13E3) { ItemID = 0xF9D; } diff --git a/Projects/UOContent/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs b/Projects/UOContent/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs index 3e89229a0..bff115f2b 100644 --- a/Projects/UOContent/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs +++ b/Projects/UOContent/Items/Special/8th Anniversary Items/Dawn's Music Box/DawnsMusicBox.cs @@ -132,7 +132,7 @@ namespace Server.Items public override void OnAfterDuped(Item newItem) { - if (!(newItem is DawnsMusicBox box)) + if (newItem is not DawnsMusicBox box) { return; } diff --git a/Projects/UOContent/Items/Special/Evil Home Decor Collection/AwesomeDisturbingPortrait.cs b/Projects/UOContent/Items/Special/Evil Home Decor Collection/AwesomeDisturbingPortrait.cs index ad870ab43..4d311bd72 100644 --- a/Projects/UOContent/Items/Special/Evil Home Decor Collection/AwesomeDisturbingPortrait.cs +++ b/Projects/UOContent/Items/Special/Evil Home Decor Collection/AwesomeDisturbingPortrait.cs @@ -27,7 +27,7 @@ namespace Server.Items { Clock.GetTime(Map, X, Y, out var hours, out int _); - if (hours < 4 || hours > 20) + if (hours is < 4 or > 20) { Effects.PlaySound(Location, Map, 0x569); } diff --git a/Projects/UOContent/Items/Special/Evil Home Decor Collection/CreepyPortrait.cs b/Projects/UOContent/Items/Special/Evil Home Decor Collection/CreepyPortrait.cs index a8f1a198e..294e8dd00 100644 --- a/Projects/UOContent/Items/Special/Evil Home Decor Collection/CreepyPortrait.cs +++ b/Projects/UOContent/Items/Special/Evil Home Decor Collection/CreepyPortrait.cs @@ -35,7 +35,7 @@ namespace Server.Items { if (!Utility.InRange(old, Location, 2) && Utility.InRange(m.Location, Location, 2)) { - if (ItemID == 0x2A69 || ItemID == 0x2A6D) + if (ItemID is 0x2A69 or 0x2A6D) { Up(); Timer.StartTimer(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 2, Up); @@ -43,7 +43,7 @@ namespace Server.Items } else if (Utility.InRange(old, Location, 2) && !Utility.InRange(m.Location, Location, 2)) { - if (ItemID == 0x2A6C || ItemID == 0x2A70) + if (ItemID is 0x2A6C or 0x2A70) { Down(); Timer.StartTimer(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5), 2, Down); diff --git a/Projects/UOContent/Items/Special/Evil Home Decor Collection/HauntedMirror.cs b/Projects/UOContent/Items/Special/Evil Home Decor Collection/HauntedMirror.cs index f43857563..f77ca1d8f 100644 --- a/Projects/UOContent/Items/Special/Evil Home Decor Collection/HauntedMirror.cs +++ b/Projects/UOContent/Items/Special/Evil Home Decor Collection/HauntedMirror.cs @@ -22,7 +22,7 @@ namespace Server.Items { if (!Utility.InRange(old, Location, 2) && Utility.InRange(m.Location, Location, 2)) { - if (ItemID == 0x2A7B || ItemID == 0x2A7D) + if (ItemID is 0x2A7B or 0x2A7D) { Effects.PlaySound(Location, Map, Utility.RandomMinMax(0x551, 0x553)); ItemID += 1; @@ -30,7 +30,7 @@ namespace Server.Items } else if (Utility.InRange(old, Location, 2) && !Utility.InRange(m.Location, Location, 2)) { - if (ItemID == 0x2A7C || ItemID == 0x2A7E) + if (ItemID is 0x2A7C or 0x2A7E) { ItemID -= 1; } diff --git a/Projects/UOContent/Items/Special/Heritage Items/Guillotine.cs b/Projects/UOContent/Items/Special/Heritage Items/Guillotine.cs index 9612bb558..914ecba4a 100644 --- a/Projects/UOContent/Items/Special/Heritage Items/Guillotine.cs +++ b/Projects/UOContent/Items/Special/Heritage Items/Guillotine.cs @@ -87,7 +87,7 @@ namespace Server.Items public virtual void Activate(AddonComponent c, Mobile from) { - if (c.ItemID == 0x125E || c.ItemID == 0x1269 || c.ItemID == 0x1260) + if (c.ItemID is 0x125E or 0x1269 or 0x1260) { c.ItemID = 0x1269; } diff --git a/Projects/UOContent/Items/Special/Heritage Items/HouseLadder.cs b/Projects/UOContent/Items/Special/Heritage Items/HouseLadder.cs index bb610e8d8..da1364a98 100644 --- a/Projects/UOContent/Items/Special/Heritage Items/HouseLadder.cs +++ b/Projects/UOContent/Items/Special/Heritage Items/HouseLadder.cs @@ -160,7 +160,7 @@ namespace Server.Items public override void OnResponse(NetState sender, RelayInfo info) { - if (m_Deed?.Deleted != false || info.ButtonID == 0 || info.ButtonID < 1 || info.ButtonID > 8) + if (m_Deed?.Deleted != false || info.ButtonID is 0 or < 1 or > 8) { return; } diff --git a/Projects/UOContent/Items/Special/Holiday/Wreath.cs b/Projects/UOContent/Items/Special/Holiday/Wreath.cs index ebc3cad6c..14e5a9e7b 100644 --- a/Projects/UOContent/Items/Special/Holiday/Wreath.cs +++ b/Projects/UOContent/Items/Special/Holiday/Wreath.cs @@ -227,7 +227,7 @@ namespace Server.Items public void Placement_OnTarget(Mobile from, object targeted) { - if (!(targeted is IPoint3D p)) + if (targeted is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Items/Special/House Raffle/HouseRaffleStone.cs b/Projects/UOContent/Items/Special/House Raffle/HouseRaffleStone.cs index 8e6f99915..deb7f74a5 100644 --- a/Projects/UOContent/Items/Special/House Raffle/HouseRaffleStone.cs +++ b/Projects/UOContent/Items/Special/House Raffle/HouseRaffleStone.cs @@ -299,7 +299,7 @@ namespace Server.Items private bool HasEntered(Mobile from) { - if (!(from.Account is Account acc)) + if (@from.Account is not Account acc) { return false; } @@ -509,7 +509,7 @@ namespace Server.Items return; } - if (!(from.Account is Account)) + if (@from.Account is not Account) { return; } diff --git a/Projects/UOContent/Items/Special/Mutation Core/PlagueBeastBackpack.cs b/Projects/UOContent/Items/Special/Mutation Core/PlagueBeastBackpack.cs index 672285179..a52de68c3 100644 --- a/Projects/UOContent/Items/Special/Mutation Core/PlagueBeastBackpack.cs +++ b/Projects/UOContent/Items/Special/Mutation Core/PlagueBeastBackpack.cs @@ -113,7 +113,7 @@ namespace Server.Items public override bool TryDropItem(Mobile from, Item dropped, bool sendFullMessage) { - if (dropped is PlagueBeastInnard || dropped is PlagueBeastGland) + if (dropped is PlagueBeastInnard or PlagueBeastGland) { return base.TryDropItem(from, dropped, sendFullMessage); } @@ -123,7 +123,7 @@ namespace Server.Items public override bool OnDragDropInto(Mobile from, Item item, Point3D p) { - if (IsAccessibleTo(from) && (item is PlagueBeastInnard || item is PlagueBeastGland)) + if (IsAccessibleTo(from) && item is PlagueBeastInnard or PlagueBeastGland) { var ir = ItemBounds.Table[item.ItemID]; int x, y; diff --git a/Projects/UOContent/Items/Special/Solen Items/BagOfSending.cs b/Projects/UOContent/Items/Special/Solen Items/BagOfSending.cs index e4af5f581..6deb51f52 100644 --- a/Projects/UOContent/Items/Special/Solen Items/BagOfSending.cs +++ b/Projects/UOContent/Items/Special/Solen Items/BagOfSending.cs @@ -258,7 +258,7 @@ namespace Server.Items 0x59 ); // You may only send items from your backpack to your bank box. } - else if (item is BagOfSending || item is Container) + else if (item is BagOfSending or Container) { from.NetState.SendMessage( m_Bag.Serial, diff --git a/Projects/UOContent/Items/Special/Solen Items/BraceletOfBinding.cs b/Projects/UOContent/Items/Special/Solen Items/BraceletOfBinding.cs index 3fdf40e66..8cd5832cf 100644 --- a/Projects/UOContent/Items/Special/Solen Items/BraceletOfBinding.cs +++ b/Projects/UOContent/Items/Special/Solen Items/BraceletOfBinding.cs @@ -412,7 +412,7 @@ namespace Server.Items if (m_Bracelet.Deleted || m_From.Deleted || !m_Bracelet.CheckUse(m_From, false) || - !(m_Bracelet.Bound.RootParent is Mobile boundRoot)) + m_Bracelet.Bound.RootParent is not Mobile boundRoot) { return; } diff --git a/Projects/UOContent/Items/Special/SoulStone.cs b/Projects/UOContent/Items/Special/SoulStone.cs index 7bba3a90a..e170157f7 100644 --- a/Projects/UOContent/Items/Special/SoulStone.cs +++ b/Projects/UOContent/Items/Special/SoulStone.cs @@ -167,7 +167,7 @@ namespace Server.Items return false; } - if (Account != null && (!(from.Account is Account) || from.Account.Username != Account)) + if (Account != null && (@from.Account is not Accounting.Account || from.Account.Username != Account)) { from.SendLocalizedMessage( 1070714 @@ -993,7 +993,7 @@ namespace Server.Items if (version <= 1) { - if (ItemID == 0x2A93 || ItemID == 0x2A94) + if (ItemID is 0x2A93 or 0x2A94) { ActiveItemID = Utility.Random(0x2AA1, 9); } diff --git a/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs b/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs index 50273d2ff..1dd35b8f3 100644 --- a/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs +++ b/Projects/UOContent/Items/Special/Special Scrolls/PowerScroll.cs @@ -72,7 +72,7 @@ namespace Server.Items { Hue = 0x481; - if (Value == 105.0 || skill == SkillName.Blacksmith || skill == SkillName.Tailoring) + if (Value == 105.0 || skill is SkillName.Blacksmith or SkillName.Tailoring) { LootType = LootType.Regular; } @@ -155,7 +155,7 @@ namespace Server.Items do { skillName = Skills.RandomElement(); - } while (skillName == SkillName.Blacksmith || skillName == SkillName.Tailoring); + } while (skillName is SkillName.Blacksmith or SkillName.Tailoring); return new PowerScroll(skillName, 100 + Utility.RandomMinMax(min, max) * 5); } @@ -312,7 +312,7 @@ namespace Server.Items var version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion - if (Value == 105.0 || Skill == SkillName.Blacksmith || Skill == SkillName.Tailoring) + if (Value == 105.0 || Skill is SkillName.Blacksmith or SkillName.Tailoring) { LootType = LootType.Regular; } diff --git a/Projects/UOContent/Items/Special/Special Scrolls/SpecialScroll.cs b/Projects/UOContent/Items/Special/Special Scrolls/SpecialScroll.cs index 52416304c..77073a835 100644 --- a/Projects/UOContent/Items/Special/Special Scrolls/SpecialScroll.cs +++ b/Projects/UOContent/Items/Special/Special Scrolls/SpecialScroll.cs @@ -106,7 +106,7 @@ namespace Server.Items { InheritsItem = true; - if (!(this is StatCapScroll)) + if (this is not StatCapScroll) { Skill = (SkillName)reader.ReadInt(); } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs b/Projects/UOContent/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs index 6d451fa81..1bd7ce1bc 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/AnkhOfSacrifice.cs @@ -157,7 +157,7 @@ namespace Server.Items { var from = state.Mobile; - if (info.ButtonID == 1 || info.ButtonID == 2) + if (info.ButtonID is 1 or 2) { if (from.Map?.CanFit(from.Location, 16, false, false) != true) { diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/Banner.cs b/Projects/UOContent/Items/Special/Veteran Rewards/Banner.cs index e20d52477..f102d7441 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/Banner.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/Banner.cs @@ -264,7 +264,7 @@ namespace Server.Items var m = sender.Mobile; - if (info.ButtonID < Start || info.ButtonID > End || (info.ButtonID & 0x1) != 0) + if (info.ButtonID is < Start or > End || (info.ButtonID & 0x1) != 0) { return; } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/Cannon.cs b/Projects/UOContent/Items/Special/Veteran Rewards/Cannon.cs index 37246e4f6..4f55b12a1 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/Cannon.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/Cannon.cs @@ -273,7 +273,7 @@ namespace Server.Items return; } - if (!(targeted is IPoint3D p)) + if (targeted is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/CommodityDeedBox.cs b/Projects/UOContent/Items/Special/Veteran Rewards/CommodityDeedBox.cs index 9c8224e06..a9d99e5a0 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/CommodityDeedBox.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/CommodityDeedBox.cs @@ -64,7 +64,7 @@ namespace Server.Items { var parent = deed; - while (parent != null && !(parent is CommodityDeedBox)) + while (parent != null && parent is not CommodityDeedBox) { parent = parent.Parent as Item; } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/DecorativeShield.cs b/Projects/UOContent/Items/Special/Veteran Rewards/DecorativeShield.cs index 08670eb85..71f5da8f8 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/DecorativeShield.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/DecorativeShield.cs @@ -255,9 +255,8 @@ namespace Server.Items public override void OnResponse(NetState sender, RelayInfo info) { - if (m_Shield?.Deleted != false || info.ButtonID < Start || info.ButtonID > End || - ((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) && - (info.ButtonID < 0x1582 || info.ButtonID > 0x1585)) + if (m_Shield?.Deleted != false || info.ButtonID is < Start or > End || ((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) && + info.ButtonID is < 0x1582 or > 0x1585) { return; } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/HangingSkeleton.cs b/Projects/UOContent/Items/Special/Veteran Rewards/HangingSkeleton.cs index 4ac2c0228..b46114ff2 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/HangingSkeleton.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/HangingSkeleton.cs @@ -27,8 +27,7 @@ namespace Server.Items { get { - if (ItemID == 0x1A03 || ItemID == 0x1A05 || ItemID == 0x1A09 || - ItemID == 0x1B1E || ItemID == 0x1B7F) + if (ItemID is 0x1A03 or 0x1A05 or 0x1A09 or 0x1B1E or 0x1B7F) { return true; } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/PottedCactus.cs b/Projects/UOContent/Items/Special/Veteran Rewards/PottedCactus.cs index c933063b5..80647576c 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/PottedCactus.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/PottedCactus.cs @@ -170,7 +170,7 @@ namespace Server.Items public override void OnResponse(NetState sender, RelayInfo info) { - if (m_Cactus?.Deleted != false || info.ButtonID < 0x1E0F || info.ButtonID > 0x1E14) + if (m_Cactus?.Deleted != false || info.ButtonID is < 0x1E0F or > 0x1E14) { return; } diff --git a/Projects/UOContent/Items/Special/Veteran Rewards/WallBanner.cs b/Projects/UOContent/Items/Special/Veteran Rewards/WallBanner.cs index 17503ade3..cced8f9cb 100644 --- a/Projects/UOContent/Items/Special/Veteran Rewards/WallBanner.cs +++ b/Projects/UOContent/Items/Special/Veteran Rewards/WallBanner.cs @@ -503,7 +503,7 @@ namespace Server.Items public override void OnResponse(NetState sender, RelayInfo info) { - if (m_WallBanner?.Deleted != false || info.ButtonID <= 0 || info.ButtonID >= 31) + if (m_WallBanner?.Deleted != false || info.ButtonID is <= 0 or >= 31) { return; } diff --git a/Projects/UOContent/Items/Suits/BaseSuit.cs b/Projects/UOContent/Items/Suits/BaseSuit.cs index 8e0475f59..19976269c 100644 --- a/Projects/UOContent/Items/Suits/BaseSuit.cs +++ b/Projects/UOContent/Items/Suits/BaseSuit.cs @@ -47,7 +47,7 @@ namespace Server.Items public bool Validate() { - if (!(RootParent is Mobile mobile) || mobile.AccessLevel >= AccessLevel) + if (RootParent is not Mobile mobile || mobile.AccessLevel >= AccessLevel) { return true; } diff --git a/Projects/UOContent/Items/Talismans/BaseTalisman.cs b/Projects/UOContent/Items/Talismans/BaseTalisman.cs index 84f159dc1..fe338037f 100644 --- a/Projects/UOContent/Items/Talismans/BaseTalisman.cs +++ b/Projects/UOContent/Items/Talismans/BaseTalisman.cs @@ -345,7 +345,7 @@ namespace Server.Items public override void OnAfterDuped(Item newItem) { - if (!(newItem is BaseTalisman talisman)) + if (newItem is not BaseTalisman talisman) { return; } @@ -1190,7 +1190,7 @@ namespace Server.Items return; } - if (!(o is Mobile target)) + if (o is not Mobile target) { from.SendLocalizedMessage(1046439); // That is not a valid target. return; diff --git a/Projects/UOContent/Items/Wands/BaseWand.cs b/Projects/UOContent/Items/Wands/BaseWand.cs index 448985af1..3e030dcd8 100644 --- a/Projects/UOContent/Items/Wands/BaseWand.cs +++ b/Projects/UOContent/Items/Wands/BaseWand.cs @@ -244,7 +244,7 @@ namespace Server.Items public virtual void DoWandTarget(Mobile from, object o) { - if (Deleted || _charges <= 0 || Parent != from || o is StaticTarget || o is LandTarget) + if (Deleted || _charges <= 0 || Parent != @from || o is StaticTarget or LandTarget) { return; } diff --git a/Projects/UOContent/Items/Weapons/Abilities/Dismount.cs b/Projects/UOContent/Items/Weapons/Abilities/Dismount.cs index 903803d19..069b5b3a0 100644 --- a/Projects/UOContent/Items/Weapons/Abilities/Dismount.cs +++ b/Projects/UOContent/Items/Weapons/Abilities/Dismount.cs @@ -39,7 +39,7 @@ namespace Server.Items return; } - if (defender is ChaosDragoon || defender is ChaosDragoonElite) + if (defender is ChaosDragoon or ChaosDragoonElite) { return; } diff --git a/Projects/UOContent/Items/Weapons/Axes/BaseAxe.cs b/Projects/UOContent/Items/Weapons/Axes/BaseAxe.cs index 595ec181c..05087567e 100644 --- a/Projects/UOContent/Items/Weapons/Axes/BaseAxe.cs +++ b/Projects/UOContent/Items/Weapons/Axes/BaseAxe.cs @@ -87,7 +87,7 @@ namespace Server.Items return; } - if (!(HarvestSystem is Mining)) + if (HarvestSystem is not Mining) { from.SendLocalizedMessage(1010018); // What do you want to use this item on? } diff --git a/Projects/UOContent/Items/Weapons/Fists.cs b/Projects/UOContent/Items/Weapons/Fists.cs index b2fe3fc93..e20c66c77 100644 --- a/Projects/UOContent/Items/Weapons/Fists.cs +++ b/Projects/UOContent/Items/Weapons/Fists.cs @@ -199,7 +199,7 @@ namespace Server.Items { var item = m.FindItemOnLayer(Layer.OneHanded); - return (item == null || item is Spellbook) && m.FindItemOnLayer(Layer.TwoHanded) == null; + return item is null or Spellbook && m.FindItemOnLayer(Layer.TwoHanded) == null; } private static void EventSink_DisarmRequest(Mobile m) diff --git a/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs b/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs index a3a393a33..05f3bf3da 100644 --- a/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs +++ b/Projects/UOContent/Items/Weapons/Ranged/BaseRanged.cs @@ -53,7 +53,7 @@ namespace Server.Items if (canSwing) { - canSwing = !(attacker.Spell is Spell sp) || !sp.IsCasting || !sp.BlocksMovement; + canSwing = attacker.Spell is not Spell sp || !sp.IsCasting || !sp.BlocksMovement; } } diff --git a/Projects/UOContent/Items/Weapons/Ranged/JukaBow.cs b/Projects/UOContent/Items/Weapons/Ranged/JukaBow.cs index 09c372c7e..658c9d39c 100644 --- a/Projects/UOContent/Items/Weapons/Ranged/JukaBow.cs +++ b/Projects/UOContent/Items/Weapons/Ranged/JukaBow.cs @@ -43,7 +43,7 @@ namespace Server.Items public void OnTargetGears(Mobile from, object targ) { - if (!(targ is Gears g) || !g.IsChildOf(from.Backpack)) + if (targ is not Gears g || !g.IsChildOf(from.Backpack)) { from.SendMessage( "Those are not gears." diff --git a/Projects/UOContent/Misc/AccountPrompt.cs b/Projects/UOContent/Misc/AccountPrompt.cs index 12c6f39de..0e537c0d5 100644 --- a/Projects/UOContent/Misc/AccountPrompt.cs +++ b/Projects/UOContent/Misc/AccountPrompt.cs @@ -13,7 +13,7 @@ namespace Server.Misc Console.Write("Do you want to create the owner account now? (y/n): "); var answer = Console.ReadLine(); - if (answer == "y" || answer == "Y") + if (answer is "y" or "Y") { Console.WriteLine(); diff --git a/Projects/UOContent/Misc/Geometry.cs b/Projects/UOContent/Misc/Geometry.cs index 5af881d2b..d6a20b883 100644 --- a/Projects/UOContent/Misc/Geometry.cs +++ b/Projects/UOContent/Misc/Geometry.cs @@ -36,12 +36,12 @@ namespace Server.Misc public static void Circle2D(Point3D loc, Map map, int radius, DoEffect_Callback effect, int angleStart, int angleEnd) { - if (angleStart < 0 || angleStart > 360) + if (angleStart is < 0 or > 360) { angleStart = 0; } - if (angleEnd > 360 || angleEnd < 0) + if (angleEnd is > 360 or < 0) { angleEnd = 360; } diff --git a/Projects/UOContent/Misc/Gifts/Winter2004/Mistletoe.cs b/Projects/UOContent/Misc/Gifts/Winter2004/Mistletoe.cs index 6edd5a673..004f2fb43 100644 --- a/Projects/UOContent/Misc/Gifts/Winter2004/Mistletoe.cs +++ b/Projects/UOContent/Misc/Gifts/Winter2004/Mistletoe.cs @@ -233,7 +233,7 @@ namespace Server.Items public void Placement_OnTarget(Mobile from, object targeted) { - if (!(targeted is IPoint3D p)) + if (targeted is not IPoint3D p) { return; } diff --git a/Projects/UOContent/Misc/Guild.cs b/Projects/UOContent/Misc/Guild.cs index bccad8bb9..89e1ce4c5 100644 --- a/Projects/UOContent/Misc/Guild.cs +++ b/Projects/UOContent/Misc/Guild.cs @@ -937,7 +937,7 @@ namespace Server.Guilds public static void EventSink_GuildGumpRequest(Mobile m) { - if (!NewGuildSystem || !(m is PlayerMobile pm)) + if (!NewGuildSystem || m is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Misc/LootPack.cs b/Projects/UOContent/Misc/LootPack.cs index 027e1ffb7..4e71aa7d9 100644 --- a/Projects/UOContent/Misc/LootPack.cs +++ b/Projects/UOContent/Misc/LootPack.cs @@ -750,7 +750,7 @@ namespace Server return item; } - if (item is BaseWeapon || item is BaseArmor || item is BaseJewel || item is BaseHat) + if (item is BaseWeapon or BaseArmor or BaseJewel or BaseHat) { if (Core.AOS) { diff --git a/Projects/UOContent/Misc/Notoriety.cs b/Projects/UOContent/Misc/Notoriety.cs index 33e2a8169..3579e988b 100644 --- a/Projects/UOContent/Misc/Notoriety.cs +++ b/Projects/UOContent/Misc/Notoriety.cs @@ -278,8 +278,7 @@ namespace Server.Misc { c.DisplayGuildTitle = false; - if (c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder == OrderType.Attack || - c.ControlOrder == OrderType.Guard)) + if (c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder is OrderType.Attack or OrderType.Guard)) { g = (Guild)(c.Guild = c.ControlMaster.Guild); } @@ -385,7 +384,7 @@ namespace Server.Misc return Notoriety.CanBeAttacked; } - if (!(target.Owner is PlayerMobile)) + if (target.Owner is not PlayerMobile) { return Notoriety.CanBeAttacked; } @@ -406,8 +405,7 @@ namespace Server.Misc { var bcTarg = target as BaseCreature; - if (Core.AOS && (target.Blessed || bcTarg?.IsInvulnerable == true || target is PlayerVendor || - target is TownCrier)) + if (Core.AOS && (target.Blessed || bcTarg?.IsInvulnerable == true || target is PlayerVendor or TownCrier)) { return Notoriety.Invulnerable; } @@ -458,8 +456,8 @@ namespace Server.Misc } if (target.Kills >= 5 || - target.Body.IsMonster && IsSummoned(bcTarg) && !(target is BaseFamiliar) && !(target is ArcaneFey) && - !(target is Golem) || bcTarg?.AlwaysMurderer == true || bcTarg?.IsAnimatedDead == true) + target.Body.IsMonster && IsSummoned(bcTarg) && target is not BaseFamiliar && target is not ArcaneFey && + target is not Golem || bcTarg?.AlwaysMurderer == true || bcTarg?.IsAnimatedDead == true) { return Notoriety.Murderer; } @@ -561,7 +559,7 @@ namespace Server.Misc return false; } - return !(m is BaseCreature c) || c.Deleted || !c.Controlled || c.ControlMaster == null || + return m is not BaseCreature c || c.Deleted || !c.Controlled || c.ControlMaster == null || !house.IsFriend(c.ControlMaster); } diff --git a/Projects/UOContent/Misc/PacketThrottles.cs b/Projects/UOContent/Misc/PacketThrottles.cs index b0459647b..d2b666ed9 100644 --- a/Projects/UOContent/Misc/PacketThrottles.cs +++ b/Projects/UOContent/Misc/PacketThrottles.cs @@ -66,7 +66,7 @@ namespace Server.Network int packetID = e.GetInt32(0); - if (packetID < 0 || packetID > 0x100) + if (packetID is < 0 or > 0x100) { e.Mobile.SendMessage("Invalid Command Format. PacketID must be between 0 and 0x100."); return; @@ -88,7 +88,7 @@ namespace Server.Network int packetID = e.GetInt32(0); int delay = e.GetInt32(1); - if (packetID < 0 || packetID > 0x100) + if (packetID is < 0 or > 0x100) { e.Mobile.SendMessage("Invalid Command Format. PacketID must be between 0 and 0x100."); return; diff --git a/Projects/UOContent/Misc/Profile.cs b/Projects/UOContent/Misc/Profile.cs index 04ceddea5..674ae7b81 100644 --- a/Projects/UOContent/Misc/Profile.cs +++ b/Projects/UOContent/Misc/Profile.cs @@ -64,7 +64,7 @@ namespace Server.Misc private static string GetAccountDuration(Mobile m) { - if (!(m.Account is Account a)) + if (m.Account is not Account a) { return ""; } diff --git a/Projects/UOContent/Misc/ResourceInfo.cs b/Projects/UOContent/Misc/ResourceInfo.cs index 778de771e..601436d56 100644 --- a/Projects/UOContent/Misc/ResourceInfo.cs +++ b/Projects/UOContent/Misc/ResourceInfo.cs @@ -713,10 +713,8 @@ namespace Server.Items /// /// Returns true if '' is None, Iron, RegularLeather or RegularWood. False if otherwise. /// - public static bool IsStandard(CraftResource resource) => resource == CraftResource.None || - resource == CraftResource.Iron || - resource == CraftResource.RegularLeather || - resource == CraftResource.RegularWood; + public static bool IsStandard(CraftResource resource) => + resource is CraftResource.None or CraftResource.Iron or CraftResource.RegularLeather or CraftResource.RegularWood; /// /// Registers that '' uses '' so that it can later be queried by diff --git a/Projects/UOContent/Mobiles/AI/BaseAI.cs b/Projects/UOContent/Mobiles/AI/BaseAI.cs index 42f74c24f..af010e7c4 100644 --- a/Projects/UOContent/Mobiles/AI/BaseAI.cs +++ b/Projects/UOContent/Mobiles/AI/BaseAI.cs @@ -178,7 +178,7 @@ namespace Server.Mobiles list.Add(new InternalEntry(from, 6112, 14, m_Mobile, this, OrderType.Stop)); // Command: Stop list.Add(new InternalEntry(from, 6114, 14, m_Mobile, this, OrderType.Stay)); // Command: Stay - if (!m_Mobile.Summoned && !(m_Mobile is GrizzledMare)) + if (!m_Mobile.Summoned && m_Mobile is not GrizzledMare) { list.Add(new InternalEntry(from, 6110, 14, m_Mobile, this, OrderType.Friend)); // Add Friend list.Add(new InternalEntry(from, 6099, 14, m_Mobile, this, OrderType.Unfriend)); // Remove Friend @@ -283,17 +283,9 @@ namespace Server.Mobiles } if (SolenHelper.CheckRedFriendship(from) && - (target is RedSolenInfiltratorQueen - || target is RedSolenInfiltratorWarrior - || target is RedSolenQueen - || target is RedSolenWarrior - || target is RedSolenWorker) + target is RedSolenInfiltratorQueen or RedSolenInfiltratorWarrior or RedSolenQueen or RedSolenWarrior or RedSolenWorker || SolenHelper.CheckBlackFriendship(from) && - (target is BlackSolenInfiltratorQueen - || target is BlackSolenInfiltratorWarrior - || target is BlackSolenQueen - || target is BlackSolenWarrior - || target is BlackSolenWorker)) + target is BlackSolenInfiltratorQueen or BlackSolenInfiltratorWarrior or BlackSolenQueen or BlackSolenWarrior or BlackSolenWorker) { from.SendAsciiMessage("You can not force your pet to attack a creature you are protected from."); return; @@ -1256,7 +1248,7 @@ namespace Server.Mobiles var distance = m_Mobile.GetDistanceToSqrt(target); - if (!(distance < 1 || distance > 15)) + if (!(distance is < 1 or > 15)) { DoMove(m_Mobile.GetDirectionTo(target)); return true; @@ -1550,7 +1542,7 @@ namespace Server.Mobiles m_Mobile.ControlOrder = OrderType.None; } - if (m_Mobile.FightMode == FightMode.Closest || m_Mobile.FightMode == FightMode.Aggressor) + if (m_Mobile.FightMode is FightMode.Closest or FightMode.Aggressor) { Mobile newCombatant = null; var newScore = 0.0; @@ -1962,8 +1954,7 @@ namespace Server.Mobiles { var res = DoMoveImpl(d); - return res == MoveResult.Success || res == MoveResult.SuccessAutoTurn || - badStateOk && res == MoveResult.BadState; + return res is MoveResult.Success or MoveResult.SuccessAutoTurn || badStateOk && res == MoveResult.BadState; } public virtual MoveResult DoMoveImpl(Direction d) @@ -2540,7 +2531,7 @@ namespace Server.Mobiles continue; } - if (acqType == FightMode.Aggressor || acqType == FightMode.Evil) + if (acqType is FightMode.Aggressor or FightMode.Evil) { var bValid = IsHostile(m); @@ -2741,8 +2732,7 @@ namespace Server.Mobiles m_AI = ai; m_Order = order; - if (mobile.IsDeadPet && (order == OrderType.Guard || order == OrderType.Attack || - order == OrderType.Transfer || order == OrderType.Drop)) + if (mobile.IsDeadPet && order is OrderType.Guard or OrderType.Attack or OrderType.Transfer or OrderType.Drop) { Enabled = false; } @@ -2752,8 +2742,7 @@ namespace Server.Mobiles { if (!m_Mobile.Deleted && m_Mobile.Controlled && m_From.CheckAlive()) { - if (m_Mobile.IsDeadPet && (m_Order == OrderType.Guard || m_Order == OrderType.Attack || - m_Order == OrderType.Transfer || m_Order == OrderType.Drop)) + if (m_Mobile.IsDeadPet && m_Order is OrderType.Guard or OrderType.Attack or OrderType.Transfer or OrderType.Drop) { return; } diff --git a/Projects/UOContent/Mobiles/AI/MageAI.cs b/Projects/UOContent/Mobiles/AI/MageAI.cs index 8fe1f2c7a..9088e27f3 100644 --- a/Projects/UOContent/Mobiles/AI/MageAI.cs +++ b/Projects/UOContent/Mobiles/AI/MageAI.cs @@ -61,7 +61,7 @@ namespace Server.Mobiles { } - public virtual bool SmartAI => m_Mobile is BaseVendor || m_Mobile is BaseEscortable || m_Mobile is Changeling; + public virtual bool SmartAI => m_Mobile is BaseVendor or BaseEscortable or Changeling; public virtual bool IsNecromancer => Core.AOS && m_Mobile.Skills.Necromancy.Value > 50; @@ -792,7 +792,7 @@ namespace Server.Mobiles { spell = DoCombo(c); } - else if (SmartAI && (c.Spell is HealSpell || c.Spell is GreaterHealSpell) && !c.Poisoned + else if (SmartAI && c.Spell is HealSpell or GreaterHealSpell && !c.Poisoned ) // They have a heal spell out { spell = new PoisonSpell(m_Mobile); diff --git a/Projects/UOContent/Mobiles/Animals/Mounts/Ethereals.cs b/Projects/UOContent/Mobiles/Animals/Mounts/Ethereals.cs index 98f8be9b1..d97216fce 100644 --- a/Projects/UOContent/Mobiles/Animals/Mounts/Ethereals.cs +++ b/Projects/UOContent/Mobiles/Animals/Mounts/Ethereals.cs @@ -389,7 +389,7 @@ namespace Server.Mobiles public override bool CheckDisturb(DisturbType type, bool checkFirst, bool resistable) { - if (type == DisturbType.EquipRequest || type == DisturbType.UseRequest /* || type == DisturbType.Hurt*/) + if (type is DisturbType.EquipRequest or DisturbType.UseRequest /* || type == DisturbType.Hurt*/) { return false; } diff --git a/Projects/UOContent/Mobiles/BaseCreature.cs b/Projects/UOContent/Mobiles/BaseCreature.cs index 1debdd3cd..1c0b91b4e 100644 --- a/Projects/UOContent/Mobiles/BaseCreature.cs +++ b/Projects/UOContent/Mobiles/BaseCreature.cs @@ -2436,8 +2436,7 @@ namespace Server.Mobiles } if (aggressor.ChangingCombatant && (m_Controlled || _summoned) && - (ct == OrderType.Come || !Core.ML && ct == OrderType.Stay || ct == OrderType.Stop || ct == OrderType.None || - ct == OrderType.Follow)) + (ct == OrderType.Come || !Core.ML && ct == OrderType.Stay || ct is OrderType.Stop or OrderType.None or OrderType.Follow)) { ControlTarget = aggressor; ControlOrder = OrderType.Attack; @@ -3384,7 +3383,7 @@ namespace Server.Mobiles return false; } - if (target is BaseCreature creature && creature.IsInvulnerable || target is PlayerVendor || target is TownCrier) + if (target is BaseCreature creature && creature.IsInvulnerable || target is PlayerVendor or TownCrier) { if (message) { diff --git a/Projects/UOContent/Mobiles/Healers/EvilHealer.cs b/Projects/UOContent/Mobiles/Healers/EvilHealer.cs index 0fd51e5e8..02fcbeb7d 100644 --- a/Projects/UOContent/Mobiles/Healers/EvilHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/EvilHealer.cs @@ -30,10 +30,7 @@ namespace Server.Mobiles return false; } - return skill == SkillName.Forensics - || skill == SkillName.Healing - || skill == SkillName.SpiritSpeak - || skill == SkillName.Swords; + return skill is SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak or SkillName.Swords; } public override void InitSBInfo() diff --git a/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs b/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs index 20be43369..ff5a4454b 100644 --- a/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/EvilWanderingHealer.cs @@ -33,11 +33,7 @@ namespace Server.Mobiles return false; } - return skill == SkillName.Anatomy - || skill == SkillName.Camping - || skill == SkillName.Forensics - || skill == SkillName.Healing - || skill == SkillName.SpiritSpeak; + return skill is SkillName.Anatomy or SkillName.Camping or SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak; } public override bool CheckResurrect(Mobile m) diff --git a/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs b/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs index fcc41d01f..fbd3a3fed 100644 --- a/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs +++ b/Projects/UOContent/Mobiles/Healers/FortuneTeller.cs @@ -31,10 +31,7 @@ namespace Server.Mobiles return false; } - return skill == SkillName.Anatomy - || skill == SkillName.Healing - || skill == SkillName.Forensics - || skill == SkillName.SpiritSpeak; + return skill is SkillName.Anatomy or SkillName.Healing or SkillName.Forensics or SkillName.SpiritSpeak; } public override void InitSBInfo() diff --git a/Projects/UOContent/Mobiles/Healers/Healer.cs b/Projects/UOContent/Mobiles/Healers/Healer.cs index 88b135812..47eecff5c 100644 --- a/Projects/UOContent/Mobiles/Healers/Healer.cs +++ b/Projects/UOContent/Mobiles/Healers/Healer.cs @@ -33,10 +33,7 @@ namespace Server.Mobiles return false; } - return skill == SkillName.Forensics - || skill == SkillName.Healing - || skill == SkillName.SpiritSpeak - || skill == SkillName.Swords; + return skill is SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak or SkillName.Swords; } public override void InitSBInfo() diff --git a/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs b/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs index cad541e0e..036b8741c 100644 --- a/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs +++ b/Projects/UOContent/Mobiles/Healers/WanderingHealer.cs @@ -31,11 +31,7 @@ namespace Server.Mobiles return false; } - return skill == SkillName.Anatomy - || skill == SkillName.Camping - || skill == SkillName.Forensics - || skill == SkillName.Healing - || skill == SkillName.SpiritSpeak; + return skill is SkillName.Anatomy or SkillName.Camping or SkillName.Forensics or SkillName.Healing or SkillName.SpiritSpeak; } public override bool CheckResurrect(Mobile m) diff --git a/Projects/UOContent/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs b/Projects/UOContent/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs index d7ad5c249..29904bf35 100644 --- a/Projects/UOContent/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs +++ b/Projects/UOContent/Mobiles/Monsters/Humanoid/Magic/SavageShaman.cs @@ -110,8 +110,7 @@ namespace Server.Mobiles public override void AlterMeleeDamageTo(Mobile to, ref int damage) { - if (to is Dragon || to is WhiteWyrm || to is SwampDragon || to is Drake || to is Nightmare || to is Hiryu || - to is LesserHiryu || to is Daemon) + if (to is Dragon or WhiteWyrm or SwampDragon or Drake or Nightmare or Hiryu or LesserHiryu or Daemon) { damage *= 3; } @@ -184,7 +183,7 @@ namespace Server.Mobiles { foreach (var m in eable) { - var isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback; + var isFriendly = m is Savage or SavageRider or SavageShaman or SavageRidgeback; if (!isFriendly) { @@ -215,7 +214,7 @@ namespace Server.Mobiles { foreach (var m in eable) { - var isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback; + var isFriendly = m is Savage or SavageRider or SavageShaman or SavageRidgeback; if (isFriendly) { @@ -253,7 +252,7 @@ namespace Server.Mobiles { foreach (var m in eable) { - var isFriendly = m is Savage || m is SavageRider || m is SavageShaman || m is SavageRidgeback; + var isFriendly = m is Savage or SavageRider or SavageShaman or SavageRidgeback; if (isFriendly) { diff --git a/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/Savage.cs b/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/Savage.cs index 100dc84e7..54e899533 100644 --- a/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/Savage.cs +++ b/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/Savage.cs @@ -111,8 +111,7 @@ namespace Server.Mobiles public override void AlterMeleeDamageTo(Mobile to, ref int damage) { - if (to is Dragon || to is WhiteWyrm || to is SwampDragon || to is Drake || to is Nightmare || to is Hiryu || - to is LesserHiryu || to is Daemon) + if (to is Dragon or WhiteWyrm or SwampDragon or Drake or Nightmare or Hiryu or LesserHiryu or Daemon) { damage *= 3; } diff --git a/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/SavageRider.cs b/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/SavageRider.cs index bfa2b98b1..ad74f08ae 100644 --- a/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/SavageRider.cs +++ b/Projects/UOContent/Mobiles/Monsters/Humanoid/Melee/SavageRider.cs @@ -119,8 +119,7 @@ namespace Server.Mobiles public override void AlterMeleeDamageTo(Mobile to, ref int damage) { - if (to is Dragon || to is WhiteWyrm || to is SwampDragon || to is Drake || to is Nightmare || to is Hiryu || - to is LesserHiryu || to is Daemon) + if (to is Dragon or WhiteWyrm or SwampDragon or Drake or Nightmare or Hiryu or LesserHiryu or Daemon) { damage *= 3; } diff --git a/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoon.cs b/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoon.cs index d64dc7a4f..c139720cb 100644 --- a/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoon.cs +++ b/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoon.cs @@ -129,8 +129,7 @@ namespace Server.Mobiles public override void AlterMeleeDamageTo(Mobile to, ref int damage) { - if (to is Dragon || to is WhiteWyrm || to is SwampDragon || to is Drake || to is Nightmare || to is Hiryu || - to is LesserHiryu || to is Daemon) + if (to is Dragon or WhiteWyrm or SwampDragon or Drake or Nightmare or Hiryu or LesserHiryu or Daemon) { damage *= 3; } diff --git a/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoonElite.cs b/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoonElite.cs index 9e1aab189..839f9b117 100644 --- a/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoonElite.cs +++ b/Projects/UOContent/Mobiles/Monsters/LBR/Jukas/ChaosDragoonElite.cs @@ -151,8 +151,7 @@ namespace Server.Mobiles public override void AlterMeleeDamageTo(Mobile to, ref int damage) { - if (to is Dragon || to is WhiteWyrm || to is SwampDragon || to is Drake || to is Nightmare || to is Hiryu || - to is LesserHiryu || to is Daemon) + if (to is Dragon or WhiteWyrm or SwampDragon or Drake or Nightmare or Hiryu or LesserHiryu or Daemon) { damage *= 3; } diff --git a/Projects/UOContent/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs b/Projects/UOContent/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs index 24cbc389d..0cbe3214b 100644 --- a/Projects/UOContent/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs +++ b/Projects/UOContent/Mobiles/Monsters/LBR/Meers/MeerCaptain.cs @@ -124,7 +124,7 @@ namespace Server.Mobiles foreach (var m in eable) { - if (!(m is MeerWarrior) || !IsFriend(m) || !CanBeBeneficial(m) || m.Hits >= m.HitsMax || m.Poisoned || + if (m is not MeerWarrior || !IsFriend(m) || !CanBeBeneficial(m) || m.Hits >= m.HitsMax || m.Poisoned || MortalStrike.IsWounded(m)) { continue; diff --git a/Projects/UOContent/Mobiles/Monsters/Misc/Melee/BladeSpirits.cs b/Projects/UOContent/Mobiles/Monsters/Misc/Melee/BladeSpirits.cs index d0c70f67f..bcd9ed8ba 100644 --- a/Projects/UOContent/Mobiles/Monsters/Misc/Melee/BladeSpirits.cs +++ b/Projects/UOContent/Mobiles/Monsters/Misc/Melee/BladeSpirits.cs @@ -73,7 +73,7 @@ namespace Server.Mobiles { var eable = GetMobilesInRange(5); var spiritsOrVortexes = eable - .Where(m => (m is EnergyVortex || m is BladeSpirits) && ((BaseCreature)m).Summoned) + .Where(m => m is EnergyVortex or BladeSpirits && ((BaseCreature)m).Summoned) .ToList(); eable.Free(); diff --git a/Projects/UOContent/Mobiles/Monsters/Misc/Melee/EnergyVortex.cs b/Projects/UOContent/Mobiles/Monsters/Misc/Melee/EnergyVortex.cs index a1505e2a0..a69586bc3 100644 --- a/Projects/UOContent/Mobiles/Monsters/Misc/Melee/EnergyVortex.cs +++ b/Projects/UOContent/Mobiles/Monsters/Misc/Melee/EnergyVortex.cs @@ -80,7 +80,7 @@ namespace Server.Mobiles { var eable = GetMobilesInRange(5); var spiritsOrVortexes = eable - .Where(m => (m is EnergyVortex || m is BladeSpirits) && ((BaseCreature)m).Summoned) + .Where(m => m is EnergyVortex or BladeSpirits && ((BaseCreature)m).Summoned) .ToList(); eable.Free(); diff --git a/Projects/UOContent/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs b/Projects/UOContent/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs index a96c23de2..0e69a4bb1 100644 --- a/Projects/UOContent/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs +++ b/Projects/UOContent/Mobiles/Monsters/Misc/Melee/PlagueBeastLord.cs @@ -156,7 +156,7 @@ namespace Server.Mobiles public override bool OnDragDrop(Mobile from, Item dropped) { - if (IsAccessibleTo(from) && (dropped is PlagueBeastInnard || dropped is PlagueBeastGland)) + if (IsAccessibleTo(from) && dropped is PlagueBeastInnard or PlagueBeastGland) { return base.OnDragDrop(from, dropped); } diff --git a/Projects/UOContent/Mobiles/Monsters/SE/Yamandon.cs b/Projects/UOContent/Mobiles/Monsters/SE/Yamandon.cs index af50366b0..7e7856efb 100644 --- a/Projects/UOContent/Mobiles/Monsters/SE/Yamandon.cs +++ b/Projects/UOContent/Mobiles/Monsters/SE/Yamandon.cs @@ -131,7 +131,7 @@ namespace Server.Mobiles continue; } - if (!(m is BaseCreature bc) || !(bc.Controlled || bc.Summoned || bc.Team != Team)) + if (m is not BaseCreature bc || !(bc.Controlled || bc.Summoned || bc.Team != Team)) { continue; } diff --git a/Projects/UOContent/Mobiles/PlayerMobile.cs b/Projects/UOContent/Mobiles/PlayerMobile.cs index 17e7da183..59a605d5b 100644 --- a/Projects/UOContent/Mobiles/PlayerMobile.cs +++ b/Projects/UOContent/Mobiles/PlayerMobile.cs @@ -1252,7 +1252,7 @@ namespace Server.Mobiles { string notice; - if (!(from.Account is Account acct) || !acct.HasAccess(from.NetState)) + if (@from.Account is not Account acct || !acct.HasAccess(from.NetState)) { if (from.AccessLevel == AccessLevel.Player) { @@ -1665,7 +1665,7 @@ namespace Server.Mobiles return false; } - if (target is BaseCreature creature && creature.IsInvulnerable || target is PlayerVendor || target is TownCrier) + if (target is BaseCreature creature && creature.IsInvulnerable || target is PlayerVendor or TownCrier) { if (message) { @@ -1701,7 +1701,7 @@ namespace Server.Mobiles { base.OnItemAdded(item); - if (item is BaseArmor || item is BaseWeapon) + if (item is BaseArmor or BaseWeapon) { CheckStatTimers(); } @@ -1716,7 +1716,7 @@ namespace Server.Mobiles { base.OnItemRemoved(item); - if (item is BaseArmor || item is BaseWeapon) + if (item is BaseArmor or BaseWeapon) { CheckStatTimers(); } @@ -2763,9 +2763,9 @@ namespace Server.Mobiles public override void DoSpeech(string text, int[] keywords, MessageType type, int hue) { - if (Guilds.Guild.NewGuildSystem && (type == MessageType.Guild || type == MessageType.Alliance)) + if (Guilds.Guild.NewGuildSystem && type is MessageType.Guild or MessageType.Alliance) { - if (!(Guild is Guild g)) + if (Guild is not Guild g) { SendLocalizedMessage(1063142); // You are not in a guild! } @@ -3662,7 +3662,7 @@ namespace Server.Mobiles { for (var i = m_AllFollowers.Count - 1; i >= 0; --i) { - if (!(AllFollowers[i] is BaseCreature pet) || pet.ControlMaster == null) + if (AllFollowers[i] is not BaseCreature pet || pet.ControlMaster == null) { continue; } @@ -3683,7 +3683,7 @@ namespace Server.Mobiles continue; } - if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && pet.Backpack?.Items.Count > 0) + if (pet is PackLlama or PackHorse or Beetle && pet.Backpack?.Items.Count > 0) { continue; } @@ -3728,7 +3728,7 @@ namespace Server.Mobiles for (var i = AutoStabled.Count - 1; i >= 0; --i) { - if (!(AutoStabled[i] is BaseCreature pet)) + if (AutoStabled[i] is not BaseCreature pet) { continue; } @@ -3841,8 +3841,7 @@ namespace Server.Mobiles private bool CanInsure(Item item) { - if (item is Container && !(item is BaseQuiver) || item is BagOfSending || item is KeyRing || item is PotionKeg || - item is Sigil) + if (item is Container && item is not BaseQuiver || item is BagOfSending or KeyRing or PotionKeg or Sigil) { return false; } @@ -4068,7 +4067,7 @@ namespace Server.Mobiles return; } - if (!(obj is Item item)) + if (obj is not Item item) { return; } diff --git a/Projects/UOContent/Mobiles/Special/Barracoon.cs b/Projects/UOContent/Mobiles/Special/Barracoon.cs index 71cba9da7..53e88897c 100644 --- a/Projects/UOContent/Mobiles/Special/Barracoon.cs +++ b/Projects/UOContent/Mobiles/Special/Barracoon.cs @@ -145,7 +145,7 @@ namespace Server.Mobiles foreach (var m in eable) { - if (m is Ratman || m is RatmanArcher || m is RatmanMage) + if (m is Ratman or RatmanArcher or RatmanMage) { rats++; if (rats >= 16) diff --git a/Projects/UOContent/Mobiles/Special/BaseChampion.cs b/Projects/UOContent/Mobiles/Special/BaseChampion.cs index b387c7eff..732016313 100644 --- a/Projects/UOContent/Mobiles/Special/BaseChampion.cs +++ b/Projects/UOContent/Mobiles/Special/BaseChampion.cs @@ -132,7 +132,7 @@ namespace Server.Mobiles { var m = toGive[i]; - if (!(m is PlayerMobile)) + if (m is not PlayerMobile) { continue; } @@ -194,7 +194,7 @@ namespace Server.Mobiles } } - if (!(m is PlayerMobile pm)) + if (m is not PlayerMobile pm) { return; } diff --git a/Projects/UOContent/Mobiles/Special/BaseShieldGuard.cs b/Projects/UOContent/Mobiles/Special/BaseShieldGuard.cs index 908d47c1a..7c1cb745c 100644 --- a/Projects/UOContent/Mobiles/Special/BaseShieldGuard.cs +++ b/Projects/UOContent/Mobiles/Special/BaseShieldGuard.cs @@ -116,7 +116,7 @@ namespace Server.Mobiles var from = e.Mobile; - if (!(from.Guild is Guild g) || g.Type != Type) + if (@from.Guild is not Guild g || g.Type != Type) { Say(SignupNumber); } diff --git a/Projects/UOContent/Mobiles/Special/HarrowerTentacles.cs b/Projects/UOContent/Mobiles/Special/HarrowerTentacles.cs index c86bf35e2..d0521bb08 100644 --- a/Projects/UOContent/Mobiles/Special/HarrowerTentacles.cs +++ b/Projects/UOContent/Mobiles/Special/HarrowerTentacles.cs @@ -151,7 +151,7 @@ namespace Server.Mobiles continue; } - if (!(m is BaseCreature bc) || !(bc.Controlled || bc.Summoned || bc.Team != m_Owner.Team)) + if (m is not BaseCreature bc || !(bc.Controlled || bc.Summoned || bc.Team != m_Owner.Team)) { continue; } diff --git a/Projects/UOContent/Mobiles/Special/Paragon.cs b/Projects/UOContent/Mobiles/Special/Paragon.cs index 784c32d61..feb1c4b84 100644 --- a/Projects/UOContent/Mobiles/Special/Paragon.cs +++ b/Projects/UOContent/Mobiles/Special/Paragon.cs @@ -174,8 +174,7 @@ namespace Server.Mobiles return false; } - if (bc is BaseChampion || bc is Harrower || bc is BaseVendor || bc is BaseEscortable || bc is Clone || - bc.IsParagon) + if (bc is BaseChampion or Harrower or BaseVendor or BaseEscortable or Clone || bc.IsParagon) { return false; } diff --git a/Projects/UOContent/Mobiles/Special/Rikktor.cs b/Projects/UOContent/Mobiles/Special/Rikktor.cs index dc00a7381..47a8327fe 100644 --- a/Projects/UOContent/Mobiles/Special/Rikktor.cs +++ b/Projects/UOContent/Mobiles/Special/Rikktor.cs @@ -109,7 +109,7 @@ namespace Server.Mobiles continue; } - if (!(m is BaseCreature bc) || !(bc.Controlled || bc.Summoned || bc.Team != Team)) + if (m is not BaseCreature bc || !(bc.Controlled || bc.Summoned || bc.Team != Team)) { continue; } diff --git a/Projects/UOContent/Mobiles/Special/Semidar.cs b/Projects/UOContent/Mobiles/Special/Semidar.cs index b14259708..e6092bd43 100644 --- a/Projects/UOContent/Mobiles/Special/Semidar.cs +++ b/Projects/UOContent/Mobiles/Special/Semidar.cs @@ -101,7 +101,7 @@ namespace Server.Mobiles continue; } - if (!(m is BaseCreature bc) || !(bc.Controlled || bc.Summoned || bc.Team != Team)) + if (m is not BaseCreature bc || !(bc.Controlled || bc.Summoned || bc.Team != Team)) { continue; } diff --git a/Projects/UOContent/Mobiles/Special/Serado.cs b/Projects/UOContent/Mobiles/Special/Serado.cs index 20c680008..39d204493 100644 --- a/Projects/UOContent/Mobiles/Special/Serado.cs +++ b/Projects/UOContent/Mobiles/Special/Serado.cs @@ -163,7 +163,7 @@ namespace Server.Mobiles continue; } - if (!(m is BaseCreature bc) || !(bc.Controlled || bc.Summoned || bc.Team != Team)) + if (m is not BaseCreature bc || !(bc.Controlled || bc.Summoned || bc.Team != Team)) { continue; } diff --git a/Projects/UOContent/Mobiles/Townfolk/BaseEscortable.cs b/Projects/UOContent/Mobiles/Townfolk/BaseEscortable.cs index b6e60df77..21dbb152b 100644 --- a/Projects/UOContent/Mobiles/Townfolk/BaseEscortable.cs +++ b/Projects/UOContent/Mobiles/Townfolk/BaseEscortable.cs @@ -746,7 +746,7 @@ namespace Server.Mobiles foreach (Region r in list) { - if (r.Name != null && (r is DungeonRegion || r is TownRegion)) + if (r.Name != null && r is DungeonRegion or TownRegion) { m_Table[r.Name] = new EscortDestinationInfo(r.Name, r); } diff --git a/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs b/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs index aaeb542aa..8cb8eb5c2 100644 --- a/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs +++ b/Projects/UOContent/Mobiles/Vendors/BaseVendor.cs @@ -757,7 +757,7 @@ namespace Server.Mobiles for (var i = 0; i < Items.Count; ++i) { var item = Items[i]; - if (item is BaseClothing || item is BaseWeapon || item is BaseArmor || item is BaseTool) + if (item is BaseClothing or BaseWeapon or BaseArmor or BaseTool) { item.Hue = GetRandomNecromancerHue(); } diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs index 844645099..a1f8af86a 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/AnimalTrainer.cs @@ -230,7 +230,7 @@ namespace Server.Mobiles SayTo( from, 1048053 ); // You can't stable that! } */ - else if ((pet is PackLlama || pet is PackHorse || pet is Beetle) && pet.Backpack?.Items.Count > 0) + else if (pet is PackLlama or PackHorse or Beetle && pet.Backpack?.Items.Count > 0) { SayTo(from, 1042563); // You need to unload your pet. } diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/Blacksmith.cs b/Projects/UOContent/Mobiles/Vendors/NPC/Blacksmith.cs index fc643c672..74641de39 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/Blacksmith.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/Blacksmith.cs @@ -126,7 +126,7 @@ namespace Server.Mobiles return null; } - public override bool IsValidBulkOrder(Item item) => item is SmallSmithBOD || item is LargeSmithBOD; + public override bool IsValidBulkOrder(Item item) => item is SmallSmithBOD or LargeSmithBOD; public override bool SupportsBulkOrders(Mobile from) => from is PlayerMobile && from.Skills.Blacksmith.Base > 0; diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/Tailor.cs b/Projects/UOContent/Mobiles/Vendors/NPC/Tailor.cs index 6b9e90375..5cb0c9214 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/Tailor.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/Tailor.cs @@ -68,7 +68,7 @@ namespace Server.Mobiles return null; } - public override bool IsValidBulkOrder(Item item) => item is SmallTailorBOD || item is LargeTailorBOD; + public override bool IsValidBulkOrder(Item item) => item is SmallTailorBOD or LargeTailorBOD; public override bool SupportsBulkOrders(Mobile from) => from is PlayerMobile && from.Skills.Tailoring.Base > 0; diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/Weaponsmith.cs b/Projects/UOContent/Mobiles/Vendors/NPC/Weaponsmith.cs index 3f3bed4ca..635877993 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/Weaponsmith.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/Weaponsmith.cs @@ -92,7 +92,7 @@ namespace Server.Mobiles return null; } - public override bool IsValidBulkOrder(Item item) => item is SmallSmithBOD || item is LargeSmithBOD; + public override bool IsValidBulkOrder(Item item) => item is SmallSmithBOD or LargeSmithBOD; public override bool SupportsBulkOrders(Mobile from) => from is PlayerMobile && Core.AOS && from.Skills.Blacksmith.Base > 0; diff --git a/Projects/UOContent/Mobiles/Vendors/NPC/Weaver.cs b/Projects/UOContent/Mobiles/Vendors/NPC/Weaver.cs index 6a6a82c9e..bda5cf958 100644 --- a/Projects/UOContent/Mobiles/Vendors/NPC/Weaver.cs +++ b/Projects/UOContent/Mobiles/Vendors/NPC/Weaver.cs @@ -74,7 +74,7 @@ namespace Server.Mobiles return null; } - public override bool IsValidBulkOrder(Item item) => item is SmallTailorBOD || item is LargeTailorBOD; + public override bool IsValidBulkOrder(Item item) => item is SmallTailorBOD or LargeTailorBOD; public override bool SupportsBulkOrders(Mobile from) => from is PlayerMobile && from.Skills.Tailoring.Base > 0; diff --git a/Projects/UOContent/Mobiles/Vendors/PlayerBarkeeper.cs b/Projects/UOContent/Mobiles/Vendors/PlayerBarkeeper.cs index 8f31ed70f..c2f12b988 100644 --- a/Projects/UOContent/Mobiles/Vendors/PlayerBarkeeper.cs +++ b/Projects/UOContent/Mobiles/Vendors/PlayerBarkeeper.cs @@ -315,7 +315,7 @@ namespace Server.Mobiles public override bool CheckGold(Mobile from, Item dropped) { - if (!(dropped is Gold g)) + if (dropped is not Gold g) { return false; } @@ -541,8 +541,7 @@ namespace Server.Mobiles public override void InitSBInfo() { - if (Title == "the waiter" || Title == "the barkeeper" || Title == "the baker" || Title == "the innkeeper" || - Title == "the chef") + if (Title is "the waiter" or "the barkeeper" or "the baker" or "the innkeeper" or "the chef") { if (m_SBInfos.Count == 0) { diff --git a/Projects/UOContent/Mobiles/Vendors/PlayerVendor.cs b/Projects/UOContent/Mobiles/Vendors/PlayerVendor.cs index 8bb6fdcb7..11c3e340d 100644 --- a/Projects/UOContent/Mobiles/Vendors/PlayerVendor.cs +++ b/Projects/UOContent/Mobiles/Vendors/PlayerVendor.cs @@ -124,7 +124,7 @@ namespace Server.Mobiles return false; } - if (item is Container || item is BulkOrderBook) + if (item is Container or BulkOrderBook) { return true; } @@ -142,7 +142,7 @@ namespace Server.Mobiles { base.GetChildContextMenuEntries(from, list, item); - if (!(RootParent is PlayerVendor pv) || pv.IsOwner(from)) + if (RootParent is not PlayerVendor pv || pv.IsOwner(from)) { return; } @@ -1043,7 +1043,7 @@ namespace Server.Mobiles public static void TryToBuy(Item item, Mobile from) { - if (!(item.RootParent is PlayerVendor vendor) || !vendor.CanInteractWith(from, false)) + if (item.RootParent is not PlayerVendor vendor || !vendor.CanInteractWith(from, false)) { return; } @@ -1493,7 +1493,7 @@ namespace Server.Mobiles setPrice = true; } } - else if (item is BaseBook || item is BulkOrderBook) + else if (item is BaseBook or BulkOrderBook) { setPrice = true; } diff --git a/Projects/UOContent/Multis/Boats/BaseBoat.cs b/Projects/UOContent/Multis/Boats/BaseBoat.cs index ff86aa515..409d7e31f 100644 --- a/Projects/UOContent/Multis/Boats/BaseBoat.cs +++ b/Projects/UOContent/Multis/Boats/BaseBoat.cs @@ -1749,7 +1749,7 @@ namespace Server.Multis { item.NoMoveHS = true; - if (!(item is TillerMan || item is Hold || item is Plank)) + if (!(item is Server.Items.TillerMan or Server.Items.Hold or Plank)) { item.Location = new Point3D(item.X + xOffset, item.Y + yOffset, item.Z); } diff --git a/Projects/UOContent/Multis/Boats/Plank.cs b/Projects/UOContent/Multis/Boats/Plank.cs index e6c0811e4..7c838fab4 100644 --- a/Projects/UOContent/Multis/Boats/Plank.cs +++ b/Projects/UOContent/Multis/Boats/Plank.cs @@ -37,7 +37,7 @@ namespace Server.Items public PlankSide Side { get; set; } [CommandProperty(AccessLevel.GameMaster)] - public bool IsOpen => ItemID == 0x3ED5 || ItemID == 0x3ED4 || ItemID == 0x3E84 || ItemID == 0x3E89; + public bool IsOpen => ItemID is 0x3ED5 or 0x3ED4 or 0x3E84 or 0x3E89; [CommandProperty(AccessLevel.GameMaster)] public bool Starboard => Side == PlankSide.Starboard; diff --git a/Projects/UOContent/Multis/Houses/BaseHouse.cs b/Projects/UOContent/Multis/Houses/BaseHouse.cs index eef3a3b15..66cef968e 100644 --- a/Projects/UOContent/Multis/Houses/BaseHouse.cs +++ b/Projects/UOContent/Multis/Houses/BaseHouse.cs @@ -116,7 +116,7 @@ namespace Server.Multis return Core.AOS ? DecayType.Condemned : DecayType.ManualRefresh; } - if (!(m_Owner.Account is Account acct)) + if (m_Owner.Account is not Account acct) { return Core.AOS ? DecayType.Condemned : DecayType.ManualRefresh; } @@ -185,7 +185,7 @@ namespace Server.Multis { var type = DecayType; - return type == DecayType.Condemned || type == DecayType.ManualRefresh; + return type is DecayType.Condemned or DecayType.ManualRefresh; } } @@ -258,7 +258,7 @@ namespace Server.Multis { foreach (var vendor in PlayerVendors) { - if (!(vendor is RentedVendor)) + if (vendor is not RentedVendor) { return true; } @@ -463,7 +463,7 @@ namespace Server.Multis continue; } - if (!(info.Item is StrongBox)) + if (info.Item is not StrongBox) { count += 1; } @@ -756,7 +756,7 @@ namespace Server.Multis { if ((location.Z - entity.Z).Abs() <= 16) { - if (entity is PlayerVendor || entity is PlayerBarkeeper || entity is PlayerVendorPlaceholder) + if (entity is PlayerVendor or PlayerBarkeeper or PlayerVendorPlaceholder) { vendor = true; break; @@ -1495,7 +1495,7 @@ namespace Server.Multis public SecureAccessResult CheckSecureAccess(Mobile m, Item item) { - if (Secures == null || !(item is Container)) + if (Secures == null || item is not Container) { return SecureAccessResult.Insecure; } @@ -1770,7 +1770,7 @@ namespace Server.Multis { door = new GenericHouseDoor(DoorFacing.NorthCW, 0x2D46, 0xEA, 0xF1, false); } - else if (itemID == 0x2D48 || itemID == 0x2FE2) + else if (itemID is 0x2D48 or 0x2FE2) { door = new GenericHouseDoor(DoorFacing.SouthCCW, itemID, 0xEA, 0xF1, false); } @@ -1783,7 +1783,7 @@ namespace Server.Multis door = new GenericHouseDoor(facing, 0x2D63 + 4 * type + mod * 2, 0xEA, 0xF1, false); } - else if (itemID == 0x2FE4 || itemID == 0x31AE) + else if (itemID is 0x2FE4 or 0x31AE) { door = new GenericHouseDoor(DoorFacing.WestCCW, itemID, 0xEA, 0xF1, false); } @@ -2057,7 +2057,7 @@ namespace Server.Multis i.SetLastMoved(); } - if (i is Container && (!locked || !(i is BaseBoard || i is Aquarium || i is FishBowl))) + if (i is Container && (!locked || !(i is BaseBoard or Aquarium or FishBowl))) { foreach (var c in i.Items) { @@ -2102,7 +2102,7 @@ namespace Server.Multis { m.SendLocalizedMessage(501736); // You must lockdown the container first! } - else if (!(item is VendorRentalContract) && (IsAosRules + else if (item is not VendorRentalContract && (IsAosRules ? !CheckAosLockdowns(amt) || !CheckAosStorage(amt) : LockDownCount + amt > MaxLockDowns)) { @@ -2119,7 +2119,7 @@ namespace Server.Multis m.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1005526); // That is already locked down return true; } - else if (item is HouseSign || item is Static) + else if (item is HouseSign or Static) { m.LocalOverheadMessage(MessageType.Regular, 0x3E9, 1005526); // This is already locked down. } @@ -2363,7 +2363,7 @@ namespace Server.Multis { m.SendLocalizedMessage(1010550); // This is already locked down and cannot be secured. } - else if (!(item is Container)) + else if (item is not Container) { LockDown(m, item); } @@ -2389,7 +2389,7 @@ namespace Server.Multis m.SendLocalizedMessage(1010423); // You cannot secure this, place it on the ground first. } // Mondain's Legacy mod - else if (!(item is BaseAddonContainer) && !item.Movable) + else if (item is not BaseAddonContainer && !item.Movable) { m.SendLocalizedMessage(1010424); // You cannot secure this. } @@ -2437,7 +2437,7 @@ namespace Server.Multis if (info.Defender.Player && info.Defender.Alive && Core.Now - info.LastCombatTime < HouseRegion.CombatHeatDelay && - (!(m.Guild is Guild attackerGuild) || !(info.Defender.Guild is Guild defenderGuild) || + (m.Guild is not Guild attackerGuild || info.Defender.Guild is not Guild defenderGuild || defenderGuild != attackerGuild && !defenderGuild.IsEnemy(attackerGuild))) { return true; @@ -2946,7 +2946,7 @@ namespace Server.Multis { var item = LockDowns[i]; - if (item is Container cont && !(cont is BaseBoard || cont is Aquarium || cont is FishBowl)) + if (item is Container cont && !(cont is BaseBoard or Aquarium or FishBowl)) { var children = cont.Items; @@ -3290,7 +3290,7 @@ namespace Server.Multis { var item = LockDowns[i]; - if (!(item is Container)) + if (item is not Container) { count += item.TotalItems; } @@ -3486,7 +3486,7 @@ namespace Server.Multis public static bool HasAccountHouse(Mobile m) { - if (!(m.Account is Account a)) + if (m.Account is not Account a) { return false; } @@ -3596,7 +3596,7 @@ namespace Server.Multis return true; } - if (!(m is BaseCreature bc)) + if (m is not BaseCreature bc) { return false; } diff --git a/Projects/UOContent/Multis/Houses/HouseFoundation.cs b/Projects/UOContent/Multis/Houses/HouseFoundation.cs index 45a1a5925..bd63938ec 100644 --- a/Projects/UOContent/Multis/Houses/HouseFoundation.cs +++ b/Projects/UOContent/Multis/Houses/HouseFoundation.cs @@ -430,7 +430,7 @@ namespace Server.Multis { door = new GenericHouseDoor(DoorFacing.NorthCW, 0x2D46, 0xEA, 0xF1, false); } - else if (itemID == 0x2D48 || itemID == 0x2FE2) + else if (itemID is 0x2D48 or 0x2FE2) { door = new GenericHouseDoor(DoorFacing.SouthCCW, itemID, 0xEA, 0xF1, false); } @@ -443,7 +443,7 @@ namespace Server.Multis door = new GenericHouseDoor(facing, 0x2D63 + 4 * type + mod * 2, 0xEA, 0xF1, false); } - else if (itemID == 0x2FE4 || itemID == 0x31AE) + else if (itemID is 0x2FE4 or 0x31AE) { door = new GenericHouseDoor(DoorFacing.WestCCW, itemID, 0xEA, 0xF1, false); } @@ -453,11 +453,11 @@ namespace Server.Multis var mod = (itemID - 0x319C) / 2 % 2; - var specialCase = itemID == 0x31AA || itemID == 0x31A8; + var specialCase = itemID is 0x31AA or 0x31A8; DoorFacing facing; - if (itemID == 0x31AA || itemID == 0x31A8) + if (itemID is 0x31AA or 0x31A8) { facing = mod == 0 ? DoorFacing.NorthCW : DoorFacing.EastCW; } @@ -1809,7 +1809,7 @@ namespace Server.Multis var mcl = design.Components; - if (z < -3 || z > 12 || z % 3 != 0) + if (z is < -3 or > 12 || z % 3 != 0) { z = -3; } @@ -2082,7 +2082,7 @@ namespace Server.Multis } // ML doors - if (itemID == 0x2D46 || itemID == 0x2D48 || itemID == 0x2FE2 || itemID == 0x2FE4) + if (itemID is 0x2D46 or 0x2D48 or 0x2FE2 or 0x2FE4) { return true; } diff --git a/Projects/UOContent/Multis/Houses/HousePlacement.cs b/Projects/UOContent/Multis/Houses/HousePlacement.cs index 3f452ad67..5a5640bb9 100644 --- a/Projects/UOContent/Multis/Houses/HousePlacement.cs +++ b/Projects/UOContent/Multis/Houses/HousePlacement.cs @@ -58,7 +58,7 @@ namespace Server.Multis return HousePlacementResult.BadRegion; // No houses in Ilshenar/T2A } - if (map == Map.Malas && (multiID == 0x007C || multiID == 0x007E)) + if (map == Map.Malas && multiID is 0x007C or 0x007E) { return HousePlacementResult.InvalidCastleKeep; } diff --git a/Projects/UOContent/Multis/Houses/MovingCrate.cs b/Projects/UOContent/Multis/Houses/MovingCrate.cs index 6ef37c309..7388323fd 100644 --- a/Projects/UOContent/Multis/Houses/MovingCrate.cs +++ b/Projects/UOContent/Multis/Houses/MovingCrate.cs @@ -59,7 +59,7 @@ namespace Server.Multis { var subItem = subItems[i]; - if (!(subItem is Container) && subItem.StackWith(null, dropped, false)) + if (subItem is not Container && subItem.StackWith(null, dropped, false)) { return; } diff --git a/Projects/UOContent/Regions/GuardedRegion.cs b/Projects/UOContent/Regions/GuardedRegion.cs index 09af983db..d714c1719 100644 --- a/Projects/UOContent/Regions/GuardedRegion.cs +++ b/Projects/UOContent/Regions/GuardedRegion.cs @@ -245,7 +245,7 @@ namespace Server.Regions var noto = Notoriety.Compute(helper, helped); - if (helper != helped && (noto == Notoriety.Criminal || noto == Notoriety.Murderer)) + if (helper != helped && noto is Notoriety.Criminal or Notoriety.Murderer) { CheckGuardCandidate(helper); } @@ -358,8 +358,8 @@ namespace Server.Regions } public bool IsGuardCandidate(Mobile m) => - !(m is BaseGuard) && m.Alive && m.AccessLevel <= AccessLevel.Player && !m.Blessed && - (!(m is BaseCreature creature) || !creature.IsInvulnerable) && !IsDisabled() && + m is not BaseGuard && m.Alive && m.AccessLevel <= AccessLevel.Player && !m.Blessed && + (m is not BaseCreature creature || !creature.IsInvulnerable) && !IsDisabled() && (!AllowReds && m.Kills >= 5 || m.Criminal); private class GuardTimer : Timer diff --git a/Projects/UOContent/Skills/Inscribe.cs b/Projects/UOContent/Skills/Inscribe.cs index dbcca17e8..84c47de5f 100644 --- a/Projects/UOContent/Skills/Inscribe.cs +++ b/Projects/UOContent/Skills/Inscribe.cs @@ -86,7 +86,7 @@ namespace Server.SkillHandlers protected override void OnTarget(Mobile from, object targeted) { - if (!(targeted is BaseBook book)) + if (targeted is not BaseBook book) { from.SendLocalizedMessage(1046296); // That is not a book } @@ -131,7 +131,7 @@ namespace Server.SkillHandlers return; } - if (!(targeted is BaseBook bookDst)) + if (targeted is not BaseBook bookDst) { from.SendLocalizedMessage(1046296); // That is not a book } diff --git a/Projects/UOContent/Skills/Peacemaking.cs b/Projects/UOContent/Skills/Peacemaking.cs index 1101c7b21..d6f479a1e 100644 --- a/Projects/UOContent/Skills/Peacemaking.cs +++ b/Projects/UOContent/Skills/Peacemaking.cs @@ -54,7 +54,7 @@ namespace Server.SkillHandlers { from.RevealingAction(); - if (!(targeted is Mobile targ)) + if (targeted is not Mobile targ) { from.SendLocalizedMessage(1049528); // You cannot calm that! } diff --git a/Projects/UOContent/Skills/Poisoning.cs b/Projects/UOContent/Skills/Poisoning.cs index 1c8d0ead2..6e920360b 100644 --- a/Projects/UOContent/Skills/Poisoning.cs +++ b/Projects/UOContent/Skills/Poisoning.cs @@ -56,7 +56,7 @@ namespace Server.SkillHandlers var startTimer = false; - if (targeted is Food || targeted is FukiyaDarts || targeted is Shuriken) + if (targeted is Food or FukiyaDarts or Shuriken) { startTimer = true; } @@ -69,7 +69,7 @@ namespace Server.SkillHandlers } else if (weapon.Layer == Layer.OneHanded) { - startTimer = weapon.Type == WeaponType.Slashing || weapon.Type == WeaponType.Piercing; + startTimer = weapon.Type is WeaponType.Slashing or WeaponType.Piercing; } } diff --git a/Projects/UOContent/Skills/Provocation.cs b/Projects/UOContent/Skills/Provocation.cs index 7078aef11..ad5571005 100644 --- a/Projects/UOContent/Skills/Provocation.cs +++ b/Projects/UOContent/Skills/Provocation.cs @@ -107,7 +107,7 @@ namespace Server.SkillHandlers { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } - else if (creature.Unprovokable && !(creature is DemonKnight)) + else if (creature.Unprovokable && creature is not DemonKnight) { from.SendLocalizedMessage(1049446); // You have no chance of provoking those creatures. } diff --git a/Projects/UOContent/Skills/Snooping.cs b/Projects/UOContent/Skills/Snooping.cs index 43f894fe3..73b03bffc 100644 --- a/Projects/UOContent/Skills/Snooping.cs +++ b/Projects/UOContent/Skills/Snooping.cs @@ -38,77 +38,76 @@ namespace Server.SkillHandlers public static void Container_Snoop(Container cont, Mobile from) { - if (from.AccessLevel > AccessLevel.Player || from.InRange(cont.GetWorldLocation(), 1)) + if (from.AccessLevel <= AccessLevel.Player && !from.InRange(cont.GetWorldLocation(), 1)) { - var root = cont.RootParent as Mobile; + from.SendLocalizedMessage(500446); // That is too far away. + return; + } - if (root?.Alive == false) + var root = cont.RootParent as Mobile; + + if (root?.Alive == false) + { + return; + } + + if (root?.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player) + { + from.SendLocalizedMessage(500209); // You can not peek into the container. + return; + } + + if (root?.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed(from, root)) + { + from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target. + return; + } + + if (root?.AccessLevel == AccessLevel.Player && + from.Skills.Snooping.Value < Utility.Random(100)) + { + var map = from.Map; + + if (map != null) { - return; - } + var message = $"You notice {from.Name} attempting to peek into {root.Name}'s belongings."; - if (root?.AccessLevel > AccessLevel.Player && from.AccessLevel == AccessLevel.Player) - { - from.SendLocalizedMessage(500209); // You can not peek into the container. - return; - } + var eable = map.GetClientsInRange(from.Location, 8); - if (root?.AccessLevel == AccessLevel.Player && !CheckSnoopAllowed(from, root)) - { - from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target. - return; - } - - if (root?.AccessLevel == AccessLevel.Player && - from.Skills.Snooping.Value < Utility.Random(100)) - { - var map = from.Map; - - if (map != null) + foreach (var ns in eable) { - var message = $"You notice {from.Name} attempting to peek into {root.Name}'s belongings."; - - var eable = map.GetClientsInRange(from.Location, 8); - - foreach (var ns in eable) + if (ns.Mobile != from) { - if (ns.Mobile != from) - { - ns.Mobile.SendMessage(message); - } + ns.Mobile.SendMessage(message); } - - eable.Free(); - } - } - - if (from.AccessLevel == AccessLevel.Player) - { - Titles.AwardKarma(from, -4, true); - } - - if (from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0)) - { - if (cont is TrappableContainer container && container.ExecuteTrap(from)) - { - return; } - cont.DisplayTo(from); + eable.Free(); } - else - { - from.SendLocalizedMessage(500210); // You failed to peek into the container. + } - if (from.Skills.Hiding.Value / 2 < Utility.Random(100)) - { - from.RevealingAction(); - } + if (from.AccessLevel == AccessLevel.Player) + { + Titles.AwardKarma(from, -4, true); + } + + if (from.AccessLevel > AccessLevel.Player || from.CheckTargetSkill(SkillName.Snooping, cont, 0.0, 100.0)) + { + if (cont is TrappableContainer container && container.ExecuteTrap(from)) + { + return; } + + cont.DisplayTo(from); } else { - from.SendLocalizedMessage(500446); // That is too far away. + from.SendLocalizedMessage(500210); // You failed to peek into the container. + + if (from.Skills.Hiding.Value / 2 < Utility.Random(100)) + { + from.RevealingAction(); + } } } } diff --git a/Projects/UOContent/Skills/SpiritSpeak.cs b/Projects/UOContent/Skills/SpiritSpeak.cs index 7bc04ddab..69b40fcf8 100644 --- a/Projects/UOContent/Skills/SpiritSpeak.cs +++ b/Projects/UOContent/Skills/SpiritSpeak.cs @@ -116,7 +116,7 @@ namespace Server.SkillHandlers public override bool CheckDisturb(DisturbType type, bool checkFirst, bool resistable) { - if (type == DisturbType.EquipRequest || type == DisturbType.UseRequest) + if (type is DisturbType.EquipRequest or DisturbType.UseRequest) { return false; } diff --git a/Projects/UOContent/Special Systems/Engines/GiftGiving.cs b/Projects/UOContent/Special Systems/Engines/GiftGiving.cs index 14634063b..5cfc1a06a 100644 --- a/Projects/UOContent/Special Systems/Engines/GiftGiving.cs +++ b/Projects/UOContent/Special Systems/Engines/GiftGiving.cs @@ -26,7 +26,7 @@ namespace Server.Misc private static void EventSink_Login(Mobile m) { - if (!(m.Account is Account acct)) + if (m.Account is not Account acct) { return; } diff --git a/Projects/UOContent/Spells/Base/SpellHelper.cs b/Projects/UOContent/Spells/Base/SpellHelper.cs index 383228b49..ea9ec4131 100644 --- a/Projects/UOContent/Spells/Base/SpellHelper.cs +++ b/Projects/UOContent/Spells/Base/SpellHelper.cs @@ -623,7 +623,7 @@ namespace Server.Spells public static void SendInvalidMessage(Mobile caster, TravelCheckType type) { - if (type == TravelCheckType.RecallTo || type == TravelCheckType.GateTo) + if (type is TravelCheckType.RecallTo or TravelCheckType.GateTo) { caster.SendLocalizedMessage(1019004); // You are not allowed to travel there. } @@ -754,7 +754,7 @@ namespace Server.Spells public static bool IsSafeZone(Map map, Point3D loc) => Region.Find(loc, map).IsPartOf() && - (m_TravelType == TravelCheckType.TeleportTo || m_TravelType == TravelCheckType.TeleportFrom) + m_TravelType is TravelCheckType.TeleportTo or TravelCheckType.TeleportFrom && (m_TravelCaster as PlayerMobile)?.DuelPlayer?.Eliminated == false; public static bool IsFactionStronghold(Map map, Point3D loc) => Region.Find(loc, map).IsPartOf(); diff --git a/Projects/UOContent/Spells/Ninjitsu/FocusAttack.cs b/Projects/UOContent/Spells/Ninjitsu/FocusAttack.cs index ec88fd711..658eee2e6 100644 --- a/Projects/UOContent/Spells/Ninjitsu/FocusAttack.cs +++ b/Projects/UOContent/Spells/Ninjitsu/FocusAttack.cs @@ -20,14 +20,14 @@ namespace Server.Spells.Ninjitsu Item handOne = from.FindItemOnLayer(Layer.OneHanded) as BaseWeapon; - if (handOne != null && !(handOne is BaseRanged)) + if (handOne != null && handOne is not BaseRanged) { return base.Validate(from); } Item handTwo = from.FindItemOnLayer(Layer.TwoHanded) as BaseWeapon; - if (handTwo != null && !(handTwo is BaseRanged)) + if (handTwo != null && handTwo is not BaseRanged) { return base.Validate(from); } diff --git a/Projects/UOContent/Spells/Seventh/GateTravel.cs b/Projects/UOContent/Spells/Seventh/GateTravel.cs index 258dce8a3..13a171c04 100644 --- a/Projects/UOContent/Spells/Seventh/GateTravel.cs +++ b/Projects/UOContent/Spells/Seventh/GateTravel.cs @@ -129,7 +129,7 @@ namespace Server.Spells.Seventh foreach (var item in eable) { - if (item is Moongate || item is PublicMoongate) + if (item is Moongate or PublicMoongate) { return true; } diff --git a/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs b/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs index 5399efdec..de4e854ee 100644 --- a/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs +++ b/Projects/UOContent/Spells/Spellweaving/ArcaneCircle.cs @@ -118,9 +118,7 @@ namespace Server.Spells.Spellweaving } public static bool IsValidTile(int itemID) => - itemID == 0xFEA || itemID == 0x1216 || itemID == 0x307F || itemID == 0x1D10 || itemID == 0x1D0F || - itemID == 0x1D1F || - itemID == 0x1D12; + itemID is 0xFEA or 0x1216 or 0x307F or 0x1D10 or 0x1D0F or 0x1D1F or 0x1D12; private List GetArcanists() { diff --git a/Projects/UOContent/Spells/Spellweaving/ArcanistSpell.cs b/Projects/UOContent/Spells/Spellweaving/ArcanistSpell.cs index 919abb461..4ebe0f2aa 100644 --- a/Projects/UOContent/Spells/Spellweaving/ArcanistSpell.cs +++ b/Projects/UOContent/Spells/Spellweaving/ArcanistSpell.cs @@ -34,7 +34,7 @@ namespace Server.Spells.Spellweaving from.Holding as ArcaneFocus ?? from.Backpack?.FindItemByType(); public static bool CheckExpansion(Mobile from) => - !(from is PlayerMobile) || from.NetState?.SupportsExpansion(Expansion.ML) == true; + @from is not PlayerMobile || from.NetState?.SupportsExpansion(Expansion.ML) == true; public override bool CheckCast() { diff --git a/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs b/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs index 33b1a58cc..f1b6059d8 100644 --- a/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs +++ b/Projects/UOContent/Spells/Spellweaving/ImmolatingWeapon.cs @@ -26,7 +26,7 @@ namespace Server.Spells.Spellweaving public override bool CheckCast() { - if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists || weapon is BaseRanged) + if (Caster.Weapon is not BaseWeapon weapon || weapon is Fists or BaseRanged) { Caster.SendLocalizedMessage(1060179); // You must be wielding a weapon to use this ability! return false; @@ -37,7 +37,7 @@ namespace Server.Spells.Spellweaving public override void OnCast() { - if (!(Caster.Weapon is BaseWeapon weapon) || weapon is Fists || weapon is BaseRanged) + if (Caster.Weapon is not BaseWeapon weapon || weapon is Fists or BaseRanged) { Caster.SendLocalizedMessage(1060179); // You must be wielding a weapon to use this ability! } diff --git a/Projects/UOContent/Targets/BladedItemTarget.cs b/Projects/UOContent/Targets/BladedItemTarget.cs index fd2dba71c..8cef72166 100644 --- a/Projects/UOContent/Targets/BladedItemTarget.cs +++ b/Projects/UOContent/Targets/BladedItemTarget.cs @@ -52,7 +52,7 @@ namespace Server.Targets { var itemID = target.ItemID; - if (itemID == 0xD15 || itemID == 0xD16) // red mushroom + if (itemID is 0xD15 or 0xD16) // red mushroom { var player = from as PlayerMobile; diff --git a/Projects/UOContent/Targets/PickMoveTarget.cs b/Projects/UOContent/Targets/PickMoveTarget.cs index 433eb5652..595f1ffd1 100644 --- a/Projects/UOContent/Targets/PickMoveTarget.cs +++ b/Projects/UOContent/Targets/PickMoveTarget.cs @@ -17,7 +17,7 @@ namespace Server.Targets return; } - if (o is Item || o is Mobile) + if (o is Item or Mobile) { from.Target = new MoveTarget(o); }