chore: Cleans up pattern checks. (#892)
This commit is contained in:
parent
171df32257
commit
63e1b02d93
283 changed files with 587 additions and 702 deletions
|
|
@ -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!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,7 +318,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (info.IsSwitched(1))
|
||||
{
|
||||
if (!(mob is PlayerMobile pm))
|
||||
if (mob is not PlayerMobile pm)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
var copy = new List<TourneyParticipant>(participants);
|
||||
|
||||
if (groupType == GroupingType.Nearest || groupType == GroupingType.HighVsLow)
|
||||
if (groupType is GroupingType.Nearest or GroupingType.HighVsLow)
|
||||
{
|
||||
copy.Sort();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace Server.Engines.MLQuests.Items
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!(m is PlayerMobile pm))
|
||||
if (m is not PlayerMobile pm)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 <id> [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.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -99,7 +99,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
if (!(targeted is LandTarget land))
|
||||
if (targeted is not LandTarget land)
|
||||
{
|
||||
from.LocalOverheadMessage(
|
||||
MessageType.Regular,
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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!
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -431,7 +431,7 @@ namespace Server.Engines.Quests
|
|||
{
|
||||
inRestartPeriod = false;
|
||||
|
||||
if (!(check is PlayerMobile pm))
|
||||
if (check is not PlayerMobile pm)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ namespace Server.Engines.Quests.Samurai
|
|||
|
||||
if (!wasBurning && Burning)
|
||||
{
|
||||
if (!(from is PlayerMobile player))
|
||||
if (@from is not PlayerMobile player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue