chore: Cleans up pattern checks. (#892)
This commit is contained in:
parent
171df32257
commit
63e1b02d93
283 changed files with 587 additions and 702 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -713,10 +713,8 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns true if '<paramref name="resource" />' is None, Iron, RegularLeather or RegularWood. False if otherwise.
|
||||
/// </summary>
|
||||
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;
|
||||
|
||||
/// <summary>
|
||||
/// Registers that '<paramref name="resourceType" />' uses '<paramref name="resource" />' so that it can later be queried by
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue