Formatting #2 (#59)

This commit is contained in:
Kamron Batman 2019-10-05 00:37:03 -07:00 committed by GitHub
parent 096d39609e
commit 8e9221bb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
400 changed files with 3688 additions and 5969 deletions

View file

@ -76,10 +76,6 @@ namespace Server.Items
Total += score;
Count += 1;
}
public ScoreEntry()
{
}
}
private Dictionary<Mobile, ScoreEntry> m_Entries;
@ -103,7 +99,7 @@ namespace Server.Items
return;
}
if ( DateTime.UtcNow < (LastUse + UseDelay) )
if ( DateTime.UtcNow < LastUse + UseDelay )
return;
Point3D worldLoc = GetWorldLocation();
@ -206,7 +202,7 @@ namespace Server.Items
splitScore = 5;
}
bool split = ( isKnown && ((Arrows + Bolts) * 0.02) > Utility.RandomDouble() );
bool split = isKnown && (Arrows + Bolts) * 0.02 > Utility.RandomDouble();
if ( split )
{

View file

@ -79,12 +79,11 @@ namespace Server.Items
int version = reader.ReadInt();
switch (version)
m_Resource = version switch
{
case 1:
m_Resource = (CraftResource)reader.ReadInt();
break;
}
1 => (CraftResource)reader.ReadInt(),
_ => m_Resource
};
}
public override void OnDoubleClick(Mobile from)

View file

@ -1,6 +1,5 @@
using System;
using System.Linq;
using Server.Commands;
using Server.Mobiles;
namespace Server.Items

View file

@ -316,8 +316,8 @@ namespace Server.Items
if (decorations > 0)
LabelTo(from, 1074249, (Items.Count - LiveCreatures - DeadCreatures).ToString()); // Decorations: ~1_NUM~
LabelTo(from, 1074250, "#" + FoodNumber()); // Food state: ~1_STATE~
LabelTo(from, 1074251, "#" + WaterNumber()); // Water state: ~1_STATE~
LabelTo(from, 1074250, $"#{FoodNumber()}"); // Food state: ~1_STATE~
LabelTo(from, 1074251, $"#{WaterNumber()}"); // Water state: ~1_STATE~
if (m_Food.State == (int)FoodState.Dead)
LabelTo(from, 1074577, $"{m_Food.Added}\t{m_Food.Improve}"); // Food Added: ~1_CUR~ Needed: ~2_NEED~

View file

@ -82,29 +82,29 @@ namespace Server.Items
if (max > 20)
max = 20;
switch (Utility.Random(max))
return Utility.Random(max) switch
{
case 0: return new MinocBlueFish();
case 1: return new Shrimp();
case 2: return new FandancerFish();
case 3: return new GoldenBroadtail();
case 4: return new RedDartFish();
case 5: return new AlbinoCourtesanFish();
case 6: return new MakotoCourtesanFish();
case 7: return new NujelmHoneyFish();
case 8: return new Jellyfish();
case 9: return new SpeckledCrab();
case 10: return new LongClawCrab();
case 11: return new AlbinoFrog();
case 12: return new KillerFrog();
case 13: return new VesperReefTiger();
case 14: return new PurpleFrog();
case 15: return new BritainCrownFish();
case 16: return new YellowFinBluebelly();
case 17: return new SpottedBuccaneer();
case 18: return new SpinedScratcherFish();
default: return new SmallMouthSuckerFin();
}
0 => (BaseFish)new MinocBlueFish(),
1 => new Shrimp(),
2 => new FandancerFish(),
3 => new GoldenBroadtail(),
4 => new RedDartFish(),
5 => new AlbinoCourtesanFish(),
6 => new MakotoCourtesanFish(),
7 => new NujelmHoneyFish(),
8 => new Jellyfish(),
9 => new SpeckledCrab(),
10 => new LongClawCrab(),
11 => new AlbinoFrog(),
12 => new KillerFrog(),
13 => new VesperReefTiger(),
14 => new PurpleFrog(),
15 => new BritainCrownFish(),
16 => new YellowFinBluebelly(),
17 => new SpottedBuccaneer(),
18 => new SpinedScratcherFish(),
_ => new SmallMouthSuckerFin()
};
}
return new MinocBlueFish();

View file

@ -440,23 +440,21 @@ namespace Server.Items
{
get
{
switch (Layer)
return Layer switch
{
default:
case Layer.Neck: return ArmorBodyType.Gorget;
case Layer.TwoHanded: return ArmorBodyType.Shield;
case Layer.Gloves: return ArmorBodyType.Gloves;
case Layer.Helm: return ArmorBodyType.Helmet;
case Layer.Arms: return ArmorBodyType.Arms;
case Layer.InnerLegs:
case Layer.OuterLegs:
case Layer.Pants: return ArmorBodyType.Legs;
case Layer.InnerTorso:
case Layer.OuterTorso:
case Layer.Shirt: return ArmorBodyType.Chest;
}
Layer.Neck => ArmorBodyType.Gorget,
Layer.TwoHanded => ArmorBodyType.Shield,
Layer.Gloves => ArmorBodyType.Gloves,
Layer.Helm => ArmorBodyType.Helmet,
Layer.Arms => ArmorBodyType.Arms,
Layer.InnerLegs => ArmorBodyType.Legs,
Layer.OuterLegs => ArmorBodyType.Legs,
Layer.Pants => ArmorBodyType.Legs,
Layer.InnerTorso => ArmorBodyType.Chest,
Layer.OuterTorso => ArmorBodyType.Chest,
Layer.Shirt => ArmorBodyType.Chest,
_ => ArmorBodyType.Gorget
};
}
}
@ -765,15 +763,14 @@ namespace Server.Items
public int GetProtOffset()
{
switch (m_Protection)
return m_Protection switch
{
case ArmorProtectionLevel.Guarding: return 1;
case ArmorProtectionLevel.Hardening: return 2;
case ArmorProtectionLevel.Fortification: return 3;
case ArmorProtectionLevel.Invulnerability: return 4;
}
return 0;
ArmorProtectionLevel.Guarding => 1,
ArmorProtectionLevel.Hardening => 2,
ArmorProtectionLevel.Fortification => 3,
ArmorProtectionLevel.Invulnerability => 4,
_ => 0
};
}
public int GetDurabilityBonus()
@ -1206,39 +1203,19 @@ namespace Server.Items
}
else
{
OreInfo info;
switch (reader.ReadInt())
var info = reader.ReadInt() switch
{
default:
case 0:
info = OreInfo.Iron;
break;
case 1:
info = OreInfo.DullCopper;
break;
case 2:
info = OreInfo.ShadowIron;
break;
case 3:
info = OreInfo.Copper;
break;
case 4:
info = OreInfo.Bronze;
break;
case 5:
info = OreInfo.Gold;
break;
case 6:
info = OreInfo.Agapite;
break;
case 7:
info = OreInfo.Verite;
break;
case 8:
info = OreInfo.Valorite;
break;
}
0 => OreInfo.Iron,
1 => OreInfo.DullCopper,
2 => OreInfo.ShadowIron,
3 => OreInfo.Copper,
4 => OreInfo.Bronze,
5 => OreInfo.Gold,
6 => OreInfo.Agapite,
7 => OreInfo.Verite,
8 => OreInfo.Valorite,
_ => OreInfo.Iron
};
m_Resource = CraftResources.GetFromOreInfo(info, mat);
}
@ -1311,13 +1288,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
m?.CheckStatTimers();
@ -1424,13 +1401,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
from.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
from.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
return base.OnEquip(from);
@ -1442,9 +1419,9 @@ namespace Server.Items
{
string modName = Serial.ToString();
m.RemoveStatMod(modName + "Str");
m.RemoveStatMod(modName + "Dex");
m.RemoveStatMod(modName + "Int");
m.RemoveStatMod($"{modName}Str");
m.RemoveStatMod($"{modName}Dex");
m.RemoveStatMod($"{modName}Int");
if (Core.AOS)
SkillBonuses.Remove();
@ -1460,65 +1437,27 @@ namespace Server.Items
public override void AddNameProperty(ObjectPropertyList list)
{
int oreType;
switch (m_Resource)
var oreType = m_Resource switch
{
case CraftResource.DullCopper:
oreType = 1053108;
break; // dull copper
case CraftResource.ShadowIron:
oreType = 1053107;
break; // shadow iron
case CraftResource.Copper:
oreType = 1053106;
break; // copper
case CraftResource.Bronze:
oreType = 1053105;
break; // bronze
case CraftResource.Gold:
oreType = 1053104;
break; // golden
case CraftResource.Agapite:
oreType = 1053103;
break; // agapite
case CraftResource.Verite:
oreType = 1053102;
break; // verite
case CraftResource.Valorite:
oreType = 1053101;
break; // valorite
case CraftResource.SpinedLeather:
oreType = 1061118;
break; // spined
case CraftResource.HornedLeather:
oreType = 1061117;
break; // horned
case CraftResource.BarbedLeather:
oreType = 1061116;
break; // barbed
case CraftResource.RedScales:
oreType = 1060814;
break; // red
case CraftResource.YellowScales:
oreType = 1060818;
break; // yellow
case CraftResource.BlackScales:
oreType = 1060820;
break; // black
case CraftResource.GreenScales:
oreType = 1060819;
break; // green
case CraftResource.WhiteScales:
oreType = 1060821;
break; // white
case CraftResource.BlueScales:
oreType = 1060815;
break; // blue
default:
oreType = 0;
break;
}
CraftResource.DullCopper => 1053108,
CraftResource.ShadowIron => 1053107,
CraftResource.Copper => 1053106,
CraftResource.Bronze => 1053105,
CraftResource.Gold => 1053104,
CraftResource.Agapite => 1053103,
CraftResource.Verite => 1053102,
CraftResource.Valorite => 1053101,
CraftResource.SpinedLeather => 1061118,
CraftResource.HornedLeather => 1061117,
CraftResource.BarbedLeather => 1061116,
CraftResource.RedScales => 1060814,
CraftResource.YellowScales => 1060818,
CraftResource.BlackScales => 1060820,
CraftResource.GreenScales => 1060819,
CraftResource.WhiteScales => 1060821,
CraftResource.BlueScales => 1060815,
_ => 0
};
if (m_Quality == ArmorQuality.Exceptional)
{
@ -1621,7 +1560,7 @@ namespace Server.Items
if ((prop = GetLuckBonus() + Attributes.Luck) != 0)
list.Add(1060436, prop.ToString()); // luck ~1_val~
if ((prop = ArmorAttributes.MageArmor) != 0)
if (ArmorAttributes.MageArmor != 0)
list.Add(1060437); // mage armor
if ((prop = Attributes.BonusMana) != 0)
@ -1630,7 +1569,7 @@ namespace Server.Items
if ((prop = Attributes.RegenMana) != 0)
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
if ((prop = Attributes.NightSight) != 0)
if (Attributes.NightSight != 0)
list.Add(1060441); // night sight
if ((prop = Attributes.ReflectPhysical) != 0)
@ -1645,7 +1584,7 @@ namespace Server.Items
if ((prop = ArmorAttributes.SelfRepair) != 0)
list.Add(1060450, prop.ToString()); // self repair ~1_val~
if ((prop = Attributes.SpellChanneling) != 0)
if (Attributes.SpellChanneling != 0)
list.Add(1060482); // spell channeling
if ((prop = Attributes.SpellDamage) != 0)

View file

@ -40,17 +40,12 @@ namespace Server.Items
if (PlayerName == null)
return base.DefaultName;
switch (HeadType)
return HeadType switch
{
default:
return $"the head of {PlayerName}";
case HeadType.Duel:
return $"the head of {PlayerName}, taken in a duel";
case HeadType.Tournament:
return $"the head of {PlayerName}, taken in a tournament";
}
HeadType.Duel => $"the head of {PlayerName}, taken in a duel",
HeadType.Tournament => $"the head of {PlayerName}, taken in a tournament",
_ => $"the head of {PlayerName}"
};
}
}

View file

@ -165,7 +165,7 @@ namespace Server.Items
if (Writable)
flags |= SaveFlags.Writable;
if (content == null || !content.IsMatch(Pages))
if (content?.IsMatch(Pages) != true)
flags |= SaveFlags.Content;

View file

@ -14,22 +14,14 @@ namespace Server.Items
public void Flip()
{
switch (ItemID)
ItemID = ItemID switch
{
case 0x295C:
ItemID = 0x295D;
break;
case 0x295E:
ItemID = 0x295F;
break;
case 0x295D:
ItemID = 0x295C;
break;
case 0x295F:
ItemID = 0x295E;
break;
}
0x295C => 0x295D,
0x295E => 0x295F,
0x295D => 0x295C,
0x295F => 0x295E,
_ => ItemID
};
}
public override void Serialize(GenericWriter writer)

View file

@ -436,13 +436,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
parent.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
parent.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
parent.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
parent.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
parent.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
parent.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
public static void ValidateMobile(Mobile m)
@ -518,9 +518,9 @@ namespace Server.Items
string modName = Serial.ToString();
mob.RemoveStatMod(modName + "Str");
mob.RemoveStatMod(modName + "Dex");
mob.RemoveStatMod(modName + "Int");
mob.RemoveStatMod($"{modName}Str");
mob.RemoveStatMod($"{modName}Dex");
mob.RemoveStatMod($"{modName}Int");
mob.CheckStatTimers();
}
@ -565,65 +565,27 @@ namespace Server.Items
public override void AddNameProperty(ObjectPropertyList list)
{
int oreType;
switch (m_Resource)
var oreType = m_Resource switch
{
case CraftResource.DullCopper:
oreType = 1053108;
break; // dull copper
case CraftResource.ShadowIron:
oreType = 1053107;
break; // shadow iron
case CraftResource.Copper:
oreType = 1053106;
break; // copper
case CraftResource.Bronze:
oreType = 1053105;
break; // bronze
case CraftResource.Gold:
oreType = 1053104;
break; // golden
case CraftResource.Agapite:
oreType = 1053103;
break; // agapite
case CraftResource.Verite:
oreType = 1053102;
break; // verite
case CraftResource.Valorite:
oreType = 1053101;
break; // valorite
case CraftResource.SpinedLeather:
oreType = 1061118;
break; // spined
case CraftResource.HornedLeather:
oreType = 1061117;
break; // horned
case CraftResource.BarbedLeather:
oreType = 1061116;
break; // barbed
case CraftResource.RedScales:
oreType = 1060814;
break; // red
case CraftResource.YellowScales:
oreType = 1060818;
break; // yellow
case CraftResource.BlackScales:
oreType = 1060820;
break; // black
case CraftResource.GreenScales:
oreType = 1060819;
break; // green
case CraftResource.WhiteScales:
oreType = 1060821;
break; // white
case CraftResource.BlueScales:
oreType = 1060815;
break; // blue
default:
oreType = 0;
break;
}
CraftResource.DullCopper => 1053108,
CraftResource.ShadowIron => 1053107,
CraftResource.Copper => 1053106,
CraftResource.Bronze => 1053105,
CraftResource.Gold => 1053104,
CraftResource.Agapite => 1053103,
CraftResource.Verite => 1053102,
CraftResource.Valorite => 1053101,
CraftResource.SpinedLeather => 1061118,
CraftResource.HornedLeather => 1061117,
CraftResource.BarbedLeather => 1061116,
CraftResource.RedScales => 1060814,
CraftResource.YellowScales => 1060818,
CraftResource.BlackScales => 1060820,
CraftResource.GreenScales => 1060819,
CraftResource.WhiteScales => 1060821,
CraftResource.BlueScales => 1060815,
_ => 0
};
if (oreType != 0)
list.Add(1053099, "#{0}\t{1}", oreType, GetNameString()); // ~1_oretype~ ~2_armortype~

View file

@ -31,7 +31,7 @@ namespace Server.Items
{
m.SendLocalizedMessage(500446); // That is too far away.
}
else if (m.Map != null && m.Map.CanFit(m.Location, 16, false, false))
else if (m.Map?.CanFit(m.Location, 16, false, false) == true)
{
m.CloseGump<ResurrectGump>();
m.SendGump(new ResurrectGump(m, ResurrectMessage.VirtueShrine));

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Commands;
using Server.Network;
using Server.Targeting;

View file

@ -95,32 +95,16 @@ namespace Server.Items
protected virtual void SetLockLevel()
{
switch (Level)
RequiredSkill = Level switch
{
case TreasureLevel.Level1:
RequiredSkill = LockLevel = 5;
break;
case TreasureLevel.Level2:
RequiredSkill = LockLevel = 20;
break;
case TreasureLevel.Level3:
RequiredSkill = LockLevel = 50;
break;
case TreasureLevel.Level4:
RequiredSkill = LockLevel = 70;
break;
case TreasureLevel.Level5:
RequiredSkill = LockLevel = 90;
break;
case TreasureLevel.Level6:
RequiredSkill = LockLevel = 100;
break;
}
TreasureLevel.Level1 => (LockLevel = 5),
TreasureLevel.Level2 => (LockLevel = 20),
TreasureLevel.Level3 => (LockLevel = 50),
TreasureLevel.Level4 => (LockLevel = 70),
TreasureLevel.Level5 => (LockLevel = 90),
TreasureLevel.Level6 => (LockLevel = 100),
_ => RequiredSkill
};
}
private void StartResetTimer()

View file

@ -335,21 +335,14 @@ namespace Server.Items
t.Start();
m_Table[c] = t;
switch (c.ItemID)
c.ItemID = c.ItemID switch
{
case 0xA4D:
c.ItemID = 0xA4C;
break;
case 0xA4F:
c.ItemID = 0xA4E;
break;
case 0xA51:
c.ItemID = 0xA50;
break;
case 0xA53:
c.ItemID = 0xA52;
break;
}
0xA4D => 0xA4C,
0xA4F => 0xA4E,
0xA51 => 0xA50,
0xA53 => 0xA52,
_ => c.ItemID
};
}
return true;
@ -364,21 +357,14 @@ namespace Server.Items
}
if (c is Armoire || c is FancyArmoire)
switch (c.ItemID)
c.ItemID = c.ItemID switch
{
case 0xA4C:
c.ItemID = 0xA4D;
break;
case 0xA4E:
c.ItemID = 0xA4F;
break;
case 0xA50:
c.ItemID = 0xA51;
break;
case 0xA52:
c.ItemID = 0xA53;
break;
}
0xA4C => 0xA4D,
0xA4E => 0xA4F,
0xA50 => 0xA51,
0xA52 => 0xA53,
_ => c.ItemID
};
}
}

View file

@ -1,6 +1,5 @@
using System;
using System.Linq;
using Server.Commands;
namespace Server.Items
{
@ -115,7 +114,7 @@ namespace Server.Items
}
private static void CreateMalasPassage(int x, int y, int z, int xTarget, int yTarget, int zTarget, bool bone,
bool locked)
bool locked)
{
Point3D location = new Point3D(x, y, z);

View file

@ -79,22 +79,14 @@ namespace Server.Items
public void Flip()
{
switch (ItemID)
ItemID = ItemID switch
{
case 0x9AB:
ItemID = 0xE7C;
break;
case 0xE7C:
ItemID = 0x9AB;
break;
case 0xE40:
ItemID = 0xE41;
break;
case 0xE41:
ItemID = 0xE40;
break;
}
0x9AB => 0xE7C,
0xE7C => 0x9AB,
0xE40 => 0xE41,
0xE41 => 0xE40,
_ => ItemID
};
}
private void Fill(int level)
@ -104,24 +96,15 @@ namespace Server.Items
TrapLevel = level;
Locked = true;
switch (level)
RequiredSkill = level switch
{
case 1:
RequiredSkill = 36;
break;
case 2:
RequiredSkill = 76;
break;
case 3:
RequiredSkill = 84;
break;
case 4:
RequiredSkill = 92;
break;
case 5:
RequiredSkill = 100;
break;
}
1 => 36,
2 => 76,
3 => 84,
4 => 92,
5 => 100,
_ => RequiredSkill
};
LockLevel = RequiredSkill - 10;
MaxLockLevel = RequiredSkill + 40;

View file

@ -63,35 +63,18 @@ namespace Server.Items
if (craftResource.Amount < 2)
return false; // Not enough metal to resmelt
double difficulty = 0.0;
switch (resource)
var difficulty = resource switch
{
case CraftResource.DullCopper:
difficulty = 65.0;
break;
case CraftResource.ShadowIron:
difficulty = 70.0;
break;
case CraftResource.Copper:
difficulty = 75.0;
break;
case CraftResource.Bronze:
difficulty = 80.0;
break;
case CraftResource.Gold:
difficulty = 85.0;
break;
case CraftResource.Agapite:
difficulty = 90.0;
break;
case CraftResource.Verite:
difficulty = 95.0;
break;
case CraftResource.Valorite:
difficulty = 99.0;
break;
}
CraftResource.DullCopper => 65.0,
CraftResource.ShadowIron => 70.0,
CraftResource.Copper => 75.0,
CraftResource.Bronze => 80.0,
CraftResource.Gold => 85.0,
CraftResource.Agapite => 90.0,
CraftResource.Verite => 95.0,
CraftResource.Valorite => 99.0,
_ => 0.0
};
Type resourceType = info.ResourceTypes[0];
Item ingot = (Item)Activator.CreateInstance(resourceType);
@ -224,7 +207,7 @@ namespace Server.Items
private void SalvageCloth(Mobile from)
{
Scissors scissors = from.Backpack.FindItemByType<Scissors>();
if (scissors == null)
{
from.SendLocalizedMessage(1079823); // You need scissors in order to salvage cloth.
@ -253,16 +236,13 @@ namespace Server.Items
from.SendLocalizedMessage(1079974,
$"{salvaged}\t{salvaged + notSalvaged}"); // Salvaged: ~1_COUNT~/~2_NUM~ tailored items
Item[] items = FindItemsByType(new[]{
typeof(Leather), typeof(Cloth), typeof(SpinedLeather), typeof(HornedLeather), typeof(BarbedLeather),
typeof(Bandage), typeof(Bone)
});
for (int i = 0; i < items.Length; i++)
{
from.AddToBackpack(items[i]);
}
for (int i = 0; i < items.Length; i++) from.AddToBackpack(items[i]);
}
private void SalvageAll(Mobile from)
@ -376,4 +356,4 @@ namespace Server.Items
#endregion
}
}
}

View file

@ -159,27 +159,16 @@ namespace Server.Items
cont.TrapPower = level * 25;
cont.TrapLevel = level;
switch (level)
cont.RequiredSkill = level switch
{
case 1:
cont.RequiredSkill = 36;
break;
case 2:
cont.RequiredSkill = 76;
break;
case 3:
cont.RequiredSkill = 84;
break;
case 4:
cont.RequiredSkill = 92;
break;
case 5:
cont.RequiredSkill = 100;
break;
case 6:
cont.RequiredSkill = 100;
break;
}
1 => 36,
2 => 76,
3 => 84,
4 => 92,
5 => 100,
6 => 100,
_ => cont.RequiredSkill
};
cont.LockLevel = cont.RequiredSkill - 10;
cont.MaxLockLevel = cont.RequiredSkill + 40;
@ -195,32 +184,16 @@ namespace Server.Items
if (Core.SE)
{
switch (level)
numberItems = level switch
{
case 1:
numberItems = 5;
break;
case 2:
numberItems = 10;
break;
case 3:
numberItems = 15;
break;
case 4:
numberItems = 38;
break;
case 5:
numberItems = 50;
break;
case 6:
numberItems = 60;
break;
default:
numberItems = 0;
break;
}
;
1 => 5,
2 => 10,
3 => 15,
4 => 38,
5 => 50,
6 => 60,
_ => 0
};
}
else
{

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Commands;
namespace Server.Items
{

View file

@ -54,7 +54,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house == null || !house.IsOwner(from))
if (house?.IsOwner(from) != true)
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, false,
"You are not the full owner of this house.");
@ -90,4 +90,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -63,7 +63,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(loc, map, 20);
if (house == null || !house.IsFriend(from))
if (house?.IsFriend(from) != true)
{
from.SendLocalizedMessage(1005701); // The holiday tree can only be placed in your house.
return false;

View file

@ -149,7 +149,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house == null || !house.IsOwner(from))
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(
1062333); // You must be standing inside of a house that you own to make use of this contract.
@ -258,7 +258,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(pLocation, map, 0);
if (house == null || !house.IsOwner(from))
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(1062338); // The location being rented out must be inside of your house.
}
@ -340,4 +340,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -71,12 +71,11 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
switch (version)
m_Picked = version switch
{
case 0:
m_Picked = reader.ReadBool();
break;
}
0 => reader.ReadBool(),
_ => m_Picked
};
if (m_Picked)
{

View file

@ -298,17 +298,16 @@ namespace Server.Items
if (IsEmpty)
return ItemID >= 0x1F81 && ItemID <= 0x1F84 ? ItemID : 0x1F81;
switch (Content)
return Content switch
{
case BeverageType.Ale: return ItemID == 0x9EF ? 0x9EF : 0x9EE;
case BeverageType.Cider: return ItemID >= 0x1F7D && ItemID <= 0x1F80 ? ItemID : 0x1F7D;
case BeverageType.Liquor: return ItemID >= 0x1F85 && ItemID <= 0x1F88 ? ItemID : 0x1F85;
case BeverageType.Milk: return ItemID >= 0x1F89 && ItemID <= 0x1F8C ? ItemID : 0x1F89;
case BeverageType.Wine: return ItemID >= 0x1F8D && ItemID <= 0x1F90 ? ItemID : 0x1F8D;
case BeverageType.Water: return ItemID >= 0x1F91 && ItemID <= 0x1F94 ? ItemID : 0x1F91;
}
return 0;
BeverageType.Ale => (ItemID == 0x9EF ? 0x9EF : 0x9EE),
BeverageType.Cider => (ItemID >= 0x1F7D && ItemID <= 0x1F80 ? ItemID : 0x1F7D),
BeverageType.Liquor => (ItemID >= 0x1F85 && ItemID <= 0x1F88 ? ItemID : 0x1F85),
BeverageType.Milk => (ItemID >= 0x1F89 && ItemID <= 0x1F8C ? ItemID : 0x1F89),
BeverageType.Wine => (ItemID >= 0x1F8D && ItemID <= 0x1F90 ? ItemID : 0x1F8D),
BeverageType.Water => (ItemID >= 0x1F91 && ItemID <= 0x1F94 ? ItemID : 0x1F91),
_ => 0
};
}
public override void Serialize(GenericWriter writer)
@ -665,7 +664,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house == null || !house.HasLockedDownItem(this))
if (house?.HasLockedDownItem(this) != true)
{
if (message)
from.SendLocalizedMessage(502946, "", 0x59); // That belongs to someone else.
@ -846,23 +845,14 @@ namespace Server.Items
if (ContainsAlchohol)
{
int bac = 0;
switch (Content)
var bac = Content switch
{
case BeverageType.Ale:
bac = 1;
break;
case BeverageType.Wine:
bac = 2;
break;
case BeverageType.Cider:
bac = 3;
break;
case BeverageType.Liquor:
bac = 4;
break;
}
BeverageType.Ale => 1,
BeverageType.Wine => 2,
BeverageType.Cider => 3,
BeverageType.Liquor => 4,
_ => 0
};
from.BAC += bac;

View file

@ -7,17 +7,12 @@ namespace Server.Items
{
public static int RandomChoice(int itemID1, int itemID2)
{
int iRet = 0;
switch (Utility.Random(2))
var iRet = Utility.Random(2) switch
{
default:
case 0:
iRet = itemID1;
break;
case 1:
iRet = itemID2;
break;
}
0 => itemID1,
1 => itemID2,
_ => itemID1
};
return iRet;
}

View file

@ -122,24 +122,15 @@ namespace Server.Items
{
case 1:
{
switch (reader.ReadInt())
Poison = reader.ReadInt() switch
{
case 0:
Poison = null;
break;
case 1:
Poison = Poison.Lesser;
break;
case 2:
Poison = Poison.Regular;
break;
case 3:
Poison = Poison.Greater;
break;
case 4:
Poison = Poison.Deadly;
break;
}
0 => null,
1 => Poison.Lesser,
2 => Poison.Regular,
3 => Poison.Greater,
4 => Poison.Deadly,
_ => Poison
};
break;
}

View file

@ -58,24 +58,24 @@ namespace Server.Engines.Mahjong
private static MahjongPieceDirection GetDirection(int value)
{
switch (value)
return value switch
{
case 0: return MahjongPieceDirection.Up;
case 1: return MahjongPieceDirection.Left;
case 2: return MahjongPieceDirection.Down;
default: return MahjongPieceDirection.Right;
}
0 => MahjongPieceDirection.Up,
1 => MahjongPieceDirection.Left,
2 => MahjongPieceDirection.Down,
_ => MahjongPieceDirection.Right
};
}
private static MahjongWind GetWind(int value)
{
switch (value)
return value switch
{
case 0: return MahjongWind.North;
case 1: return MahjongWind.East;
case 2: return MahjongWind.South;
default: return MahjongWind.West;
}
0 => MahjongWind.North,
1 => MahjongWind.East,
2 => MahjongWind.South,
_ => MahjongWind.West
};
}
public static void ExitGame(MahjongGame game, NetState state, PacketReader pvSrc)
@ -90,7 +90,7 @@ namespace Server.Engines.Mahjong
public static void GivePoints(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
return;
int to = pvSrc.ReadByte();
@ -101,7 +101,7 @@ namespace Server.Engines.Mahjong
public static void RollDice(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
return;
game.Dices.RollDices(state.Mobile);
@ -109,7 +109,7 @@ namespace Server.Engines.Mahjong
public static void BuildWalls(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
game.ResetWalls(state.Mobile);
@ -117,7 +117,7 @@ namespace Server.Engines.Mahjong
public static void ResetScores(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
game.Players.ResetScores(MahjongGame.BaseScore);
@ -125,7 +125,7 @@ namespace Server.Engines.Mahjong
public static void AssignDealer(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
int position = pvSrc.ReadByte();
@ -135,7 +135,7 @@ namespace Server.Engines.Mahjong
public static void OpenSeat(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
int position = pvSrc.ReadByte();
@ -148,7 +148,7 @@ namespace Server.Engines.Mahjong
public static void ChangeOption(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
pvSrc.ReadInt16();
@ -162,7 +162,7 @@ namespace Server.Engines.Mahjong
public static void MoveWallBreakIndicator(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
int y = pvSrc.ReadInt16();
@ -173,7 +173,7 @@ namespace Server.Engines.Mahjong
public static void TogglePublicHand(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
return;
pvSrc.ReadInt16();
@ -186,7 +186,7 @@ namespace Server.Engines.Mahjong
public static void MoveTile(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGamePlayer(state.Mobile))
if (game?.Players.IsInGamePlayer(state.Mobile) != true)
return;
int number = pvSrc.ReadByte();
@ -217,7 +217,7 @@ namespace Server.Engines.Mahjong
public static void MoveDealerIndicator(MahjongGame game, NetState state, PacketReader pvSrc)
{
if (game == null || !game.Players.IsInGameDealer(state.Mobile))
if (game?.Players.IsInGameDealer(state.Mobile) != true)
return;
MahjongPieceDirection direction = GetDirection(pvSrc.ReadByte());

View file

@ -197,13 +197,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
from.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
from.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
from.CheckStatTimers();
@ -218,9 +218,9 @@ namespace Server.Items
string modName = Serial.ToString();
from.RemoveStatMod(modName + "Str");
from.RemoveStatMod(modName + "Dex");
from.RemoveStatMod(modName + "Int");
from.RemoveStatMod($"{modName}Str");
from.RemoveStatMod($"{modName}Dex");
from.RemoveStatMod($"{modName}Int");
from.CheckStatTimers();
}
@ -279,7 +279,7 @@ namespace Server.Items
if ((prop = Attributes.RegenMana) != 0)
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
if ((prop = Attributes.NightSight) != 0)
if (Attributes.NightSight != 0)
list.Add(1060441); // night sight
if ((prop = Attributes.ReflectPhysical) != 0)
@ -291,7 +291,7 @@ namespace Server.Items
if ((prop = Attributes.RegenHits) != 0)
list.Add(1060444, prop.ToString()); // hit point regeneration ~1_val~
if ((prop = Attributes.SpellChanneling) != 0)
if (Attributes.SpellChanneling != 0)
list.Add(1060482); // spell channeling
if ((prop = Attributes.SpellDamage) != 0)
@ -374,13 +374,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
m?.CheckStatTimers();

View file

@ -43,22 +43,14 @@ namespace Server.Items
{
Light = LightType.Circle300;
switch (ItemID)
ItemID = ItemID switch
{
case 0x24C2:
ItemID = 0x24C4;
break;
case 0x24C1:
ItemID = 0x24C3;
break;
case 0x24C4:
ItemID = 0x24C2;
break;
case 0x24C3:
ItemID = 0x24C1;
break;
}
0x24C2 => 0x24C4,
0x24C1 => 0x24C3,
0x24C4 => 0x24C2,
0x24C3 => 0x24C1,
_ => ItemID
};
}
public override void Serialize(GenericWriter writer)

View file

@ -46,22 +46,14 @@ namespace Server.Items
else if (Light == LightType.NorthBig)
Light = LightType.WestBig;
switch (ItemID)
ItemID = ItemID switch
{
case 0x9FB:
ItemID = 0xA00;
break;
case 0x9FD:
ItemID = 0xA02;
break;
case 0xA00:
ItemID = 0x9FB;
break;
case 0xA02:
ItemID = 0x9FD;
break;
}
0x9FB => 0xA00,
0x9FD => 0xA02,
0xA00 => 0x9FB,
0xA02 => 0x9FD,
_ => ItemID
};
}
public override void Serialize(GenericWriter writer)

View file

@ -46,22 +46,14 @@ namespace Server.Items
else if (Light == LightType.NorthBig)
Light = LightType.WestBig;
switch (ItemID)
ItemID = ItemID switch
{
case 0xA05:
ItemID = 0xA0A;
break;
case 0xA07:
ItemID = 0xA0C;
break;
case 0xA0A:
ItemID = 0xA05;
break;
case 0xA0C:
ItemID = 0xA07;
break;
}
0xA05 => 0xA0A,
0xA07 => 0xA0C,
0xA0A => 0xA05,
0xA0C => 0xA07,
_ => ItemID
};
}
public override void Serialize(GenericWriter writer)

View file

@ -43,22 +43,14 @@ namespace Server.Items
{
Light = LightType.Circle300;
switch (ItemID)
ItemID = ItemID switch
{
case 0x24C6:
ItemID = 0x24C8;
break;
case 0x24C5:
ItemID = 0x24C7;
break;
case 0x24C8:
ItemID = 0x24C6;
break;
case 0x24C7:
ItemID = 0x24C5;
break;
}
0x24C6 => 0x24C8,
0x24C5 => 0x24C7,
0x24C8 => 0x24C6,
0x24C7 => 0x24C5,
_ => ItemID
};
}
public override void Serialize(GenericWriter writer)

View file

@ -370,17 +370,16 @@ namespace Server.Items
private double GetMinSkillLevel()
{
switch (m_Level)
return m_Level switch
{
case 1: return -3.0;
case 2: return 41.0;
case 3: return 51.0;
case 4: return 61.0;
case 5: return 70.0;
case 6: return 70.0;
default: return 0.0;
}
1 => -3.0,
2 => 41.0,
3 => 51.0,
4 => 61.0,
5 => 70.0,
6 => 70.0,
_ => 0.0
};
}
private bool HasRequiredSkill(Mobile from) => from.Skills.Cartography.Value >= GetMinSkillLevel();
@ -652,34 +651,17 @@ namespace Server.Items
{
Direction dir = Utility.GetDirection(targ3D, chest3D0);
string sDir;
switch (dir)
var sDir = dir switch
{
case Direction.North:
sDir = "north";
break;
case Direction.Right:
sDir = "northeast";
break;
case Direction.East:
sDir = "east";
break;
case Direction.Down:
sDir = "southeast";
break;
case Direction.South:
sDir = "south";
break;
case Direction.Left:
sDir = "southwest";
break;
case Direction.West:
sDir = "west";
break;
default:
sDir = "northwest";
break;
}
Direction.North => "north",
Direction.Right => "northeast",
Direction.East => "east",
Direction.Down => "southeast",
Direction.South => "south",
Direction.Left => "southwest",
Direction.West => "west",
_ => "northwest"
};
from.SendAsciiMessage(0x44, "Try looking for the treasure chest more to the {0}.", sDir);
}
@ -818,19 +800,12 @@ namespace Server.Items
m_TreasureMap.Completed = true;
m_TreasureMap.CompletedBy = m_From;
int spawns;
switch (m_TreasureMap.Level)
var spawns = m_TreasureMap.Level switch
{
case 0:
spawns = 3;
break;
case 1:
spawns = 0;
break;
default:
spawns = 4;
break;
}
0 => 3,
1 => 0,
_ => 4
};
for (int i = 0; i < spawns; ++i)
{

View file

@ -36,7 +36,7 @@ namespace Server.Items
int version = reader.ReadInt();
if (version == 0 && (Protection == null || Protection.IsEmpty))
if (version == 0 && Protection?.IsEmpty != false)
Protection = GetRandomProtection(false);
}
}

View file

@ -40,7 +40,7 @@ namespace Server.Items
int version = reader.ReadInt();
if (version == 0 && (Protection == null || Protection.IsEmpty))
if (version == 0 && Protection?.IsEmpty != false)
Protection = GetRandomProtection(false);
}
}

View file

@ -117,7 +117,7 @@ namespace Server.Items
owner = box.Owner;
}
if (owner?.Account == null || !owner.Account.DepositGold(Worth)) return;
if (owner?.Account?.DepositGold(Worth) != true) return;
if (tradeInfo != null)
{
@ -151,7 +151,7 @@ namespace Server.Items
1041361,
"",
AffixType.Append,
string.Concat(" ", m_Worth.ToString()),
$" {m_Worth}",
"")); // A bank check:
}
@ -174,7 +174,7 @@ namespace Server.Items
int deposited = 0;
int toAdd = m_Worth;
if (AccountGold.Enabled && from.Account != null && from.Account.DepositGold(toAdd))
if (AccountGold.Enabled && from.Account?.DepositGold(toAdd) == true)
{
deposited = toAdd;
toAdd = 0;

View file

@ -342,9 +342,9 @@ namespace Server.Items
string text = $"{from.Name} says {message}";
if (RootParent is Mobile mobile)
mobile.SendMessage(0x2B2, "Crystal: " + text);
mobile.SendMessage(0x2B2, $"Crystal: {text}");
else if (RootParent is Item item)
item.PublicOverheadMessage(MessageType.Regular, 0x2B2, false, "Crystal: " + text);
item.PublicOverheadMessage(MessageType.Regular, 0x2B2, false, $"Crystal: {text}");
else
PublicOverheadMessage(MessageType.Regular, 0x2B2, false, text);
}

View file

@ -151,7 +151,7 @@ namespace Server.Items
if (NextSpawn < DateTime.UtcNow) // means we haven't spawned anything if the next spawn is below
if (Utility.InRange(m.Location, Location, 1) && !Utility.InRange(oldLocation, Location, 1) && m.Player &&
!(m.AccessLevel > AccessLevel.Player || m.Hidden))
if (m_Timer == null || !m_Timer.Running)
if (m_Timer?.Running != true)
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(2), HeedWarning);
base.OnMovement(m, oldLocation);

View file

@ -48,7 +48,7 @@ namespace Server.Items
return;
}
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
// to prevent exploiting for pvp
from.SendLocalizedMessage(1075857); // You cannot use that while paralyzed.

View file

@ -1,5 +1,4 @@
using System;
using Server.Commands;
using Server.Targeting;
namespace Server.Items

View file

@ -73,7 +73,7 @@ namespace Server.Items
owner = box.Owner;
}
if (owner?.Account == null || !owner.Account.DepositGold(Amount)) return;
if (owner?.Account?.DepositGold(Amount) != true) return;
if (tradeInfo != null)
{

View file

@ -117,20 +117,13 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
DecorateCommand command = DecorateCommand.None;
switch (info.ButtonID)
var command = info.ButtonID switch
{
case 1:
command = DecorateCommand.Turn;
break;
case 2:
command = DecorateCommand.Up;
break;
case 3:
command = DecorateCommand.Down;
break;
}
1 => DecorateCommand.Turn,
2 => DecorateCommand.Up,
3 => DecorateCommand.Down,
_ => DecorateCommand.None
};
if (command != DecorateCommand.None)
{
@ -203,7 +196,7 @@ namespace Server.Items
}
}
if (house == null || !house.IsCoOwner(from))
if (house?.IsCoOwner(from) != true)
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
}

View file

@ -23,29 +23,16 @@ namespace Server.Items
{
Delete();
Item i = null;
switch (Utility.Random(from.BAC >= 5 ? 6 : 5))
var i = Utility.Random(from.BAC >= 5 ? 6 : 5) switch
{
case 0:
i = new OrigamiButterfly();
break;
case 1:
i = new OrigamiSwan();
break;
case 2:
i = new OrigamiFrog();
break;
case 3:
i = new OrigamiShape();
break;
case 4:
i = new OrigamiSongbird();
break;
case 5:
i = new OrigamiFish();
break;
}
0 => (Item)new OrigamiButterfly(),
1 => new OrigamiSwan(),
2 => new OrigamiFrog(),
3 => new OrigamiShape(),
4 => new OrigamiSongbird(),
5 => new OrigamiFish(),
_ => null
};
if (i != null)
from.AddToBackpack(i);
@ -224,4 +211,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -162,7 +162,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt( this );
if ( house == null || !house.HasLockedDownItem( this ) )
if ( house?.HasLockedDownItem( this ) != true )
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
else if ( !from.InRange( GetWorldLocation(), 2 ) || !from.InLOS( this ) )
from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
@ -196,7 +196,7 @@ namespace Server.Items
BaseHouse house = m_House;
BasePlayerBB board = m_Board;
if ( house == null || !house.HasLockedDownItem( board ) )
if ( house?.HasLockedDownItem( board ) != true )
{
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
@ -212,10 +212,7 @@ namespace Server.Items
from.SendLocalizedMessage( 1062398 ); // You are not allowed to post to this bulletin board.
return;
}
if ( m_Greeting && !house.IsOwner( from ) )
{
return;
}
if ( m_Greeting && !house.IsOwner( from ) ) return;
text = text.Trim();
@ -272,7 +269,7 @@ namespace Server.Items
BaseHouse house = m_House;
BasePlayerBB board = m_Board;
if ( house == null || !house.HasLockedDownItem( board ) )
if ( house?.HasLockedDownItem( board ) != true )
{
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;
@ -363,7 +360,7 @@ namespace Server.Items
BaseHouse house = m_House;
BasePlayerBB board = m_Board;
if ( house == null || !house.HasLockedDownItem( board ) )
if ( house?.HasLockedDownItem( board ) != true )
{
from.SendLocalizedMessage( 1062396 ); // This bulletin board must be locked down in a house to be usable.
return;

View file

@ -48,7 +48,7 @@ namespace Server.Items
if ( age > m_Duration ) {
Delete();
} else {
if ( !m_Drying && age > (m_Duration - age) )
if ( !m_Drying && age > m_Duration - age )
{
m_Drying = true;
ItemID = 0x122B;
@ -57,12 +57,8 @@ namespace Server.Items
List<Mobile> toDamage = new List<Mobile>();
foreach( Mobile m in GetMobilesInRange( 0 ) )
{
if ( m.Alive && !m.IsDeadBondedPet && (!(m is BaseCreature bc) || bc.Controlled || bc.Summoned) )
{
toDamage.Add( m );
}
}
for ( int i = 0; i < toDamage.Count; i++ )
Damage( toDamage[i] );

View file

@ -132,21 +132,13 @@ namespace Server.Items
{
PathDirection dir = choices[Utility.Random(count)];
switch (dir)
current = dir switch
{
case PathDirection.Left:
current = new Node(current.X - 1, current.Y);
break;
case PathDirection.Up:
current = new Node(current.X, current.Y - 1);
break;
case PathDirection.Right:
current = new Node(current.X + 1, current.Y);
break;
default:
current = new Node(current.X, current.Y + 1);
break;
}
PathDirection.Left => new Node(current.X - 1, current.Y),
PathDirection.Up => new Node(current.X, current.Y - 1),
PathDirection.Right => new Node(current.X + 1, current.Y),
_ => new Node(current.X, current.Y + 1)
};
stack[stackSize++] = current;
@ -391,19 +383,12 @@ namespace Server.Items
private void AddNode(int x, int y, NodeHue hue)
{
int id;
switch (hue)
var id = hue switch
{
case NodeHue.Gray:
id = 0x25F8;
break;
case NodeHue.Blue:
id = 0x868;
break;
default:
id = 0x9A8;
break;
}
NodeHue.Gray => 0x25F8,
NodeHue.Blue => 0x868,
_ => 0x9A8
};
AddImage(x, y, id);
}

View file

@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Server.Commands;
using Server.Factions;
using Server.Gumps;
using Server.Mobiles;

View file

@ -85,48 +85,22 @@ namespace Server.Items
if (m_Item.Deleted)
return;
Mobile spawn;
switch (Utility.Random(12))
var spawn = Utility.Random(12) switch
{
default:
case 0:
spawn = new Skeleton();
break;
case 1:
spawn = new Zombie();
break;
case 2:
spawn = new Wraith();
break;
case 3:
spawn = new Spectre();
break;
case 4:
spawn = new Ghoul();
break;
case 5:
spawn = new Mummy();
break;
case 6:
spawn = new Bogle();
break;
case 7:
spawn = new RottingCorpse();
break;
case 8:
spawn = new BoneKnight();
break;
case 9:
spawn = new SkeletalKnight();
break;
case 10:
spawn = new Lich();
break;
case 11:
spawn = new LichLord();
break;
}
0 => (Mobile)new Skeleton(),
1 => new Zombie(),
2 => new Wraith(),
3 => new Spectre(),
4 => new Ghoul(),
5 => new Mummy(),
6 => new Bogle(),
7 => new RottingCorpse(),
8 => new BoneKnight(),
9 => new SkeletalKnight(),
10 => new Lich(),
11 => new LichLord(),
_ => new Skeleton()
};
spawn.MoveToWorld(m_Item.Location, m_Item.Map);

View file

@ -1,4 +1,3 @@
using Server.Commands;
using Server.Targeting;
namespace Server.Items

View file

@ -55,13 +55,9 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (IsOwner(from))
{
from.SendGump(new OnOffGump(this));
}
else
{
from.SendLocalizedMessage(502691); // You must be the owner to use this.
}
}
public override void Serialize(GenericWriter writer)

View file

@ -172,11 +172,9 @@ namespace Server.Items
public override bool CheckHold(Mobile m, Item item, bool message, bool checkItems, int plusItems, int plusWeight)
{
if (CheckType(item))
{
return Items.Count >= DefaultMaxItems && !checkItems && Ammo?.Deleted == false &&
Ammo.Amount + item.Amount <= m_Capacity || item.Amount <= m_Capacity &&
base.CheckHold(m, item, message, checkItems, plusItems, plusWeight);
}
if (message)
m.SendLocalizedMessage(1074836); // The container can not hold that type of object.

View file

@ -68,41 +68,19 @@ namespace Server.Items
}
case 0:
{
OreInfo info;
switch (reader.ReadInt())
var info = reader.ReadInt() switch
{
case 0:
info = OreInfo.Iron;
break;
case 1:
info = OreInfo.DullCopper;
break;
case 2:
info = OreInfo.ShadowIron;
break;
case 3:
info = OreInfo.Copper;
break;
case 4:
info = OreInfo.Bronze;
break;
case 5:
info = OreInfo.Gold;
break;
case 6:
info = OreInfo.Agapite;
break;
case 7:
info = OreInfo.Verite;
break;
case 8:
info = OreInfo.Valorite;
break;
default:
info = null;
break;
}
0 => OreInfo.Iron,
1 => OreInfo.DullCopper,
2 => OreInfo.ShadowIron,
3 => OreInfo.Copper,
4 => OreInfo.Bronze,
5 => OreInfo.Gold,
6 => OreInfo.Agapite,
7 => OreInfo.Verite,
8 => OreInfo.Valorite,
_ => null
};
m_Resource = CraftResources.GetFromOreInfo(info);
break;

View file

@ -69,41 +69,19 @@ namespace Server.Items
}
case 0:
{
OreInfo info;
switch (reader.ReadInt())
var info = reader.ReadInt() switch
{
case 0:
info = OreInfo.Iron;
break;
case 1:
info = OreInfo.DullCopper;
break;
case 2:
info = OreInfo.ShadowIron;
break;
case 3:
info = OreInfo.Copper;
break;
case 4:
info = OreInfo.Bronze;
break;
case 5:
info = OreInfo.Gold;
break;
case 6:
info = OreInfo.Agapite;
break;
case 7:
info = OreInfo.Verite;
break;
case 8:
info = OreInfo.Valorite;
break;
default:
info = null;
break;
}
0 => OreInfo.Iron,
1 => OreInfo.DullCopper,
2 => OreInfo.ShadowIron,
3 => OreInfo.Copper,
4 => OreInfo.Bronze,
5 => OreInfo.Gold,
6 => OreInfo.Agapite,
7 => OreInfo.Verite,
8 => OreInfo.Valorite,
_ => null
};
m_Resource = CraftResources.GetFromOreInfo(info);
break;
@ -297,38 +275,18 @@ namespace Server.Items
if (IsForge(targeted))
{
double difficulty;
switch (m_Ore.Resource)
var difficulty = m_Ore.Resource switch
{
default:
difficulty = 50.0;
break;
case CraftResource.DullCopper:
difficulty = 65.0;
break;
case CraftResource.ShadowIron:
difficulty = 70.0;
break;
case CraftResource.Copper:
difficulty = 75.0;
break;
case CraftResource.Bronze:
difficulty = 80.0;
break;
case CraftResource.Gold:
difficulty = 85.0;
break;
case CraftResource.Agapite:
difficulty = 90.0;
break;
case CraftResource.Verite:
difficulty = 95.0;
break;
case CraftResource.Valorite:
difficulty = 99.0;
break;
}
CraftResource.DullCopper => 65.0,
CraftResource.ShadowIron => 70.0,
CraftResource.Copper => 75.0,
CraftResource.Bronze => 80.0,
CraftResource.Gold => 85.0,
CraftResource.Agapite => 90.0,
CraftResource.Verite => 95.0,
CraftResource.Valorite => 99.0,
_ => 50.0
};
double minSkill = difficulty - 25.0;
double maxSkill = difficulty + 25.0;

View file

@ -54,7 +54,7 @@ namespace Server.Items
public virtual bool Validate(Mobile m)
{
if (m == null || !m.Player || m.AccessLevel != AccessLevel.Player || Core.AOS)
if (m?.Player != true || m.AccessLevel != AccessLevel.Player || Core.AOS)
return true;
if (!(m.Guild is Guild g) || g.Type != GuildType.Chaos)

View file

@ -57,7 +57,7 @@ namespace Server.Items
public virtual bool Validate(Mobile m)
{
if (Core.AOS || m == null || !m.Player || m.AccessLevel != AccessLevel.Player)
if (Core.AOS || m?.Player != true || m.AccessLevel != AccessLevel.Player)
return true;
if (!(m.Guild is Guild g) || g.Type != GuildType.Order)

View file

@ -46,17 +46,12 @@ namespace Server.Items
{
get
{
switch (ItemID)
return ItemID switch
{
case 0xDE3:
return CampfireStatus.Burning;
case 0xDE9:
return CampfireStatus.Extinguishing;
default:
return CampfireStatus.Off;
}
0xDE3 => CampfireStatus.Burning,
0xDE9 => CampfireStatus.Extinguishing,
_ => CampfireStatus.Off
};
}
set
{

View file

@ -45,14 +45,13 @@ namespace Server.Items
if (m_Resource >= CraftResource.OakWood && m_Resource <= CraftResource.YewWood)
return 1075052 + ((int)m_Resource - (int)CraftResource.OakWood);
switch (m_Resource)
return m_Resource switch
{
case CraftResource.Bloodwood: return 1075055;
case CraftResource.Frostwood: return 1075056;
case CraftResource.Heartwood: return 1075062; //WHY Osi. Why?
}
return LabelNumber;
CraftResource.Bloodwood => 1075055,
CraftResource.Frostwood => 1075056,
CraftResource.Heartwood => 1075062, //WHY Osi. Why?
_ => LabelNumber
};
}
}

View file

@ -299,24 +299,14 @@ namespace Server.Items
for (int i = 0; map != null && i < count; ++i)
{
BaseCreature spawn;
switch (Utility.Random(4))
var spawn = Utility.Random(4) switch
{
default:
case 0:
spawn = new SeaSerpent();
break;
case 1:
spawn = new DeepSeaSerpent();
break;
case 2:
spawn = new WaterElemental();
break;
case 3:
spawn = new Kraken();
break;
}
0 => (BaseCreature)new SeaSerpent(),
1 => new DeepSeaSerpent(),
2 => new WaterElemental(),
3 => new Kraken(),
_ => new SeaSerpent()
};
Spawn(p, map, spawn);

View file

@ -123,7 +123,7 @@ namespace Server.Items
public virtual void DisplayDurabilityTo(Mobile m)
{
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining); // Durability
LabelToAffix(m, 1017323, AffixType.Append, $": {m_UsesRemaining}"); // Durability
}
public override void OnSingleClick(Mobile from)

View file

@ -295,43 +295,34 @@ namespace Server.Items
public BasePotion FillBottle()
{
switch (m_Type)
return m_Type switch
{
default:
case PotionEffect.Nightsight: return new NightSightPotion();
case PotionEffect.CureLesser: return new LesserCurePotion();
case PotionEffect.Cure: return new CurePotion();
case PotionEffect.CureGreater: return new GreaterCurePotion();
case PotionEffect.Agility: return new AgilityPotion();
case PotionEffect.AgilityGreater: return new GreaterAgilityPotion();
case PotionEffect.Strength: return new StrengthPotion();
case PotionEffect.StrengthGreater: return new GreaterStrengthPotion();
case PotionEffect.PoisonLesser: return new LesserPoisonPotion();
case PotionEffect.Poison: return new PoisonPotion();
case PotionEffect.PoisonGreater: return new GreaterPoisonPotion();
case PotionEffect.PoisonDeadly: return new DeadlyPoisonPotion();
case PotionEffect.Refresh: return new RefreshPotion();
case PotionEffect.RefreshTotal: return new TotalRefreshPotion();
case PotionEffect.HealLesser: return new LesserHealPotion();
case PotionEffect.Heal: return new HealPotion();
case PotionEffect.HealGreater: return new GreaterHealPotion();
case PotionEffect.ExplosionLesser: return new LesserExplosionPotion();
case PotionEffect.Explosion: return new ExplosionPotion();
case PotionEffect.ExplosionGreater: return new GreaterExplosionPotion();
case PotionEffect.Conflagration: return new ConflagrationPotion();
case PotionEffect.ConflagrationGreater: return new GreaterConflagrationPotion();
case PotionEffect.ConfusionBlast: return new ConfusionBlastPotion();
case PotionEffect.ConfusionBlastGreater: return new GreaterConfusionBlastPotion();
}
PotionEffect.Nightsight => (BasePotion)new NightSightPotion(),
PotionEffect.CureLesser => new LesserCurePotion(),
PotionEffect.Cure => new CurePotion(),
PotionEffect.CureGreater => new GreaterCurePotion(),
PotionEffect.Agility => new AgilityPotion(),
PotionEffect.AgilityGreater => new GreaterAgilityPotion(),
PotionEffect.Strength => new StrengthPotion(),
PotionEffect.StrengthGreater => new GreaterStrengthPotion(),
PotionEffect.PoisonLesser => new LesserPoisonPotion(),
PotionEffect.Poison => new PoisonPotion(),
PotionEffect.PoisonGreater => new GreaterPoisonPotion(),
PotionEffect.PoisonDeadly => new DeadlyPoisonPotion(),
PotionEffect.Refresh => new RefreshPotion(),
PotionEffect.RefreshTotal => new TotalRefreshPotion(),
PotionEffect.HealLesser => new LesserHealPotion(),
PotionEffect.Heal => new HealPotion(),
PotionEffect.HealGreater => new GreaterHealPotion(),
PotionEffect.ExplosionLesser => new LesserExplosionPotion(),
PotionEffect.Explosion => new ExplosionPotion(),
PotionEffect.ExplosionGreater => new GreaterExplosionPotion(),
PotionEffect.Conflagration => new ConflagrationPotion(),
PotionEffect.ConflagrationGreater => new GreaterConflagrationPotion(),
PotionEffect.ConfusionBlast => new ConfusionBlastPotion(),
PotionEffect.ConfusionBlastGreater => new GreaterConfusionBlastPotion(),
_ => new NightSightPotion()
};
}
public static void Initialize()

View file

@ -22,7 +22,7 @@ namespace Server.Items
public override void Drink(Mobile from)
{
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
return;
@ -251,7 +251,6 @@ namespace Server.Items
return;
foreach (Mobile m in m_Item.GetMobilesInRange(0))
{
if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && (!Core.AOS || m != from) &&
SpellHelper.ValidIndirectTarget(from, m) && from.CanBeHarmful(m, false))
{
@ -260,7 +259,6 @@ namespace Server.Items
AOS.Damage(m, from, m_Item.GetDamage(), 0, 100, 0, 0, 0);
m.PlaySound(0x208);
}
}
}
}
}

View file

@ -23,7 +23,7 @@ namespace Server.Items
public override void Drink(Mobile from)
{
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use that potion while paralyzed.
return;

View file

@ -62,7 +62,7 @@ namespace Server.Items
public override void Drink(Mobile from)
{
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell != null && from.Spell.IsCasting))
if (Core.AOS && (from.Paralyzed || from.Frozen || from.Spell?.IsCasting == true))
{
from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed.
return;

View file

@ -284,33 +284,17 @@ namespace Server.Items
if (!DesignContext.Check(from))
return; // They are customizing
SpellbookType type;
switch (e.Type)
var type = e.Type switch
{
default:
case 1:
type = SpellbookType.Regular;
break;
case 2:
type = SpellbookType.Necromancer;
break;
case 3:
type = SpellbookType.Paladin;
break;
case 4:
type = SpellbookType.Ninja;
break;
case 5:
type = SpellbookType.Samurai;
break;
case 6:
type = SpellbookType.Arcanist;
break;
case 7:
type = SpellbookType.Mystic;
break;
}
1 => SpellbookType.Regular,
2 => SpellbookType.Necromancer,
3 => SpellbookType.Paladin,
4 => SpellbookType.Ninja,
5 => SpellbookType.Samurai,
6 => SpellbookType.Arcanist,
7 => SpellbookType.Mystic,
_ => SpellbookType.Regular
};
Spellbook book = Find(from, -1, type);
@ -453,10 +437,8 @@ namespace Server.Items
Container pack = from.Backpack;
for (int i = 0; i < pack?.Items.Count; ++i)
{
if (pack.Items[i] is Spellbook sp)
list.Add(sp);
}
return list;
}
@ -541,13 +523,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
from.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
from.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
from.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
from.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
from.CheckStatTimers();
@ -562,9 +544,9 @@ namespace Server.Items
string modName = Serial.ToString();
from.RemoveStatMod(modName + "Str");
from.RemoveStatMod(modName + "Dex");
from.RemoveStatMod(modName + "Int");
from.RemoveStatMod($"{modName}Str");
from.RemoveStatMod($"{modName}Dex");
from.RemoveStatMod($"{modName}Int");
from.CheckStatTimers();
}
@ -574,7 +556,7 @@ namespace Server.Items
{
spellID -= BookOffset;
return spellID >= 0 && spellID < BookCount && (m_Content & ((ulong)1 << spellID)) != 0;
return spellID >= 0 && spellID < BookCount && (m_Content & (ulong)1 << spellID) != 0;
}
public void DisplayTo(Mobile to)
@ -848,13 +830,13 @@ namespace Server.Items
string modName = Serial.ToString();
if (strBonus != 0)
m.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
if (dexBonus != 0)
m.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
if (intBonus != 0)
m.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
m.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
}
m.CheckStatTimers();

View file

@ -234,7 +234,7 @@ namespace Server.Items
|| Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == Healer
) //TODO: Dbl check doesn't check for faction of the horse here?
{
if (Patient.Map == null || !Patient.Map.CanFit(Patient.Location, 16, false, false))
if (Patient.Map?.CanFit(Patient.Location, 16, false, false) != true)
{
healerNumber = 501042; // Target can not be resurrected at that location.
patientNumber = 502391; // Thou can not be resurrected there!
@ -442,7 +442,7 @@ namespace Server.Items
{
healer.SendLocalizedMessage(500955); // That being is not damaged!
}
else if (!patient.Alive && (patient.Map == null || !patient.Map.CanFit(patient.Location, 16, false, false)))
else if (!patient.Alive && patient.Map?.CanFit(patient.Location, 16, false, false) != true)
{
healer.SendLocalizedMessage(501042); // Target cannot be resurrected at that location.
}

View file

@ -118,15 +118,12 @@ namespace Server.Items
if (skill >= 5)
return 1061123 + skill - 5;
switch (skill)
return skill switch
{
case 4:
return "a Novice";
case 3:
return "a Neophyte";
default:
return "a Newbie"; //On OSI, it shouldn't go below 50, but, this is for 'custom' support.
}
4 => "a Novice",
3 => "a Neophyte",
_ => "a Newbie"
};
}
public static RepairSkillType GetTypeFor(CraftSystem s)

View file

@ -128,7 +128,7 @@ namespace Server.Items
public virtual void DisplayDurabilityTo(Mobile m)
{
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining); // Durability
LabelToAffix(m, 1017323, AffixType.Append, $": {m_UsesRemaining}"); // Durability
}
public static bool CheckAccessible(Item tool, Mobile m) => tool.IsChildOf(m) || tool.Parent == m;

View file

@ -83,28 +83,27 @@
public static AosElementAttribute GetTypes(int value)
{
switch (value)
return value switch
{
case 0: return AosElementAttribute.Physical;
case 1: return AosElementAttribute.Fire;
case 2: return AosElementAttribute.Cold;
case 3: return AosElementAttribute.Poison;
default: return AosElementAttribute.Energy;
}
0 => AosElementAttribute.Physical,
1 => AosElementAttribute.Fire,
2 => AosElementAttribute.Cold,
3 => AosElementAttribute.Poison,
_ => AosElementAttribute.Energy
};
}
public static int GetItemData(AosElementAttribute element, bool label)
{
switch (element)
return element switch
{
case AosElementAttribute.Physical: return label ? 1071091 : 0; // Earring of Protection (Physical) 1071091
case AosElementAttribute.Fire: return label ? 1071092 : 0x4ec; // Earring of Protection (Fire) 1071092
case AosElementAttribute.Cold: return label ? 1071093 : 0x4f2; // Earring of Protection (Cold) 1071093
case AosElementAttribute.Poison: return label ? 1071094 : 0x4f8; // Earring of Protection (Poison) 1071094
case AosElementAttribute.Energy: return label ? 1071095 : 0x4fe; // Earring of Protection (Energy) 1071095
default: return -1;
}
AosElementAttribute.Physical => (label ? 1071091 : 0), // Earring of Protection (Physical) 1071091
AosElementAttribute.Fire => (label ? 1071092 : 0x4ec), // Earring of Protection (Fire) 1071092
AosElementAttribute.Cold => (label ? 1071093 : 0x4f2), // Earring of Protection (Cold) 1071093
AosElementAttribute.Poison => (label ? 1071094 : 0x4f8), // Earring of Protection (Poison) 1071094
AosElementAttribute.Energy => (label ? 1071095 : 0x4fe), // Earring of Protection (Energy) 1071095
_ => -1
};
}
}
}
}

View file

@ -294,21 +294,13 @@ namespace Server.Items
public static MusicName RandomTrack(DawnsMusicRarity rarity)
{
MusicName[] list;
switch (rarity)
var list = rarity switch
{
default:
case DawnsMusicRarity.Common:
list = m_CommonTracks;
break;
case DawnsMusicRarity.Uncommon:
list = m_UncommonTracks;
break;
case DawnsMusicRarity.Rare:
list = m_RareTracks;
break;
}
DawnsMusicRarity.Common => m_CommonTracks,
DawnsMusicRarity.Uncommon => m_UncommonTracks,
DawnsMusicRarity.Rare => m_RareTracks,
_ => m_CommonTracks
};
return list[Utility.Random(list.Length)];
}

View file

@ -71,7 +71,7 @@ namespace Server.Items
public virtual void DisplayDurabilityTo(Mobile m)
{
LabelToAffix(m, 1017323, AffixType.Append, ": " + m_UsesRemaining); // Durability
LabelToAffix(m, 1017323, AffixType.Append, $": {m_UsesRemaining}"); // Durability
}
public override void OnSingleClick(Mobile from)

View file

@ -74,7 +74,7 @@ namespace Server.Items
Effects.PlaySound(Location, Map, Utility.RandomMinMax(0x53E, 0x540));
}
if (m_Timer == null || !m_Timer.Running)
if (m_Timer?.Running != true)
(m_Timer = new InternalTimer(m)).Start();
}

View file

@ -19,21 +19,14 @@ namespace Server.Items
{
if (from.InRange(Location, 2))
{
switch (ItemID)
ItemID = ItemID switch
{
case 0x3D98:
ItemID = 0x3D9B;
break;
case 0x3D9B:
ItemID = 0x3D98;
break;
case 0x3D94:
ItemID = 0x3D97;
break;
case 0x3D97:
ItemID = 0x3D94;
break;
}
0x3D98 => 0x3D9B,
0x3D9B => 0x3D98,
0x3D94 => 0x3D97,
0x3D97 => 0x3D94,
_ => ItemID
};
Effects.PlaySound(Location, Map, 0x3BE);
}

View file

@ -247,7 +247,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);
if (house == null || !house.IsCoOwner(from))
if (house?.IsCoOwner(from) != true)
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
return;

View file

@ -187,24 +187,14 @@ namespace Server.Items
return string.Empty;
if (deed.IsExpired)
return "<bodytextblack>" +
"This deed once entitled the bearer to build a house on the plot of land " +
$"located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>" +
"The deed has expired, and now the indicated plot of land " +
"is subject to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents." +
"</bodytextblack>";
return
$"<bodytextblack>This deed once entitled the bearer to build a house on the plot of land located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>The deed has expired, and now the indicated plot of land is subject to normal house construction rules.<br><br>This deed functions as a recall rune marked for the location of the plot it represents.</bodytextblack>";
int daysLeft = (int)Math.Ceiling((deed.Stone.Started + deed.Stone.Duration +
HouseRaffleStone.ExpirationTime - DateTime.UtcNow).TotalDays);
return "<bodytextblack>" + "This deed entitles the bearer to build a house on the plot of land " +
$"located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>" +
$"The deed will expire after {daysLeft} more day{(daysLeft == 1 ? "" : "s")} have passed, and at that time the right to place " +
"a house reverts to normal house construction rules.<br><br>" +
"This deed functions as a recall rune marked for the location of the plot it represents.<br><br>" +
"To place a house on the deeded plot, you must simply have this deed in your backpack " +
"or bank box when using a House Placement Tool there." + "</bodytextblack>";
return
$"<bodytextblack>This deed entitles the bearer to build a house on the plot of land located at {HouseRaffleStone.FormatLocation(deed.PlotLocation, deed.PlotFacet, false)} on the {deed.PlotFacet} facet.<br><br>The deed will expire after {daysLeft} more day{(daysLeft == 1 ? "" : "s")} have passed, and at that time the right to place a house reverts to normal house construction rules.<br><br>This deed functions as a recall rune marked for the location of the plot it represents.<br><br>To place a house on the deeded plot, you must simply have this deed in your backpack or bank box when using a House Placement Tool there.</bodytextblack>";
}
}
}

View file

@ -81,19 +81,13 @@ namespace Server.Items
if (i == 5)
random = 0;
switch (random)
organ = random switch
{
default:
case 0:
organ = new PlagueBeastRockOrgan();
break;
case 1:
organ = new PlagueBeastMaidenOrgan();
break;
case 2:
organ = new PlagueBeastRubbleOrgan();
break;
}
0 => (PlagueBeastOrgan)new PlagueBeastRockOrgan(),
1 => new PlagueBeastMaidenOrgan(),
2 => new PlagueBeastRubbleOrgan(),
_ => new PlagueBeastRockOrgan()
};
organs.Add(organ);
AddInnard(organ, m_Positions[random, i, 0], m_Positions[random, i, 1]);

View file

@ -63,7 +63,7 @@ namespace Server.Items
PlagueBeastLord owner = Owner;
if (owner == null || !owner.Alive)
if (owner?.Alive != true)
Delete();
}
}

View file

@ -52,18 +52,13 @@ namespace Server.Items
{
m_BagOfSendingHue = value;
switch (value)
Hue = value switch
{
case BagOfSendingHue.Yellow:
Hue = 0x8A5;
break;
case BagOfSendingHue.Blue:
Hue = 0x8AD;
break;
case BagOfSendingHue.Red:
Hue = 0x89B;
break;
}
BagOfSendingHue.Yellow => 0x8A5,
BagOfSendingHue.Blue => 0x8AD,
BagOfSendingHue.Red => 0x89B,
_ => Hue
};
}
}
@ -111,12 +106,12 @@ namespace Server.Items
public static BagOfSendingHue RandomHue()
{
switch (Utility.Random(3))
return Utility.Random(3) switch
{
case 0: return BagOfSendingHue.Yellow;
case 1: return BagOfSendingHue.Blue;
default: return BagOfSendingHue.Red;
}
0 => BagOfSendingHue.Yellow,
1 => BagOfSendingHue.Blue,
_ => BagOfSendingHue.Red
};
}
public override void GetProperties(ObjectPropertyList list)

View file

@ -102,7 +102,7 @@ namespace Server.Items
list.Add(1054131,
m_Charges + (PetName.Length == 0
? "\t "
: "\t" + PetName)); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~]
: $"\t{PetName}")); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~]
}
public override void OnSingleClick(Mobile from)
@ -110,7 +110,7 @@ namespace Server.Items
LabelTo(from, 1054131,
m_Charges + (PetName.Length == 0
? "\t "
: "\t" + PetName)); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~]
: $"\t{PetName}")); // a crystal ball of pet summoning: [charges: ~1_charges~] : [linked pet: ~2_petName~]
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)

View file

@ -104,7 +104,7 @@ namespace Server.Items
list.Add(1054000,
m_Charges + (m_Inscription.Length == 0
? "\t "
: " :\t" + m_Inscription)); // a bracelet of binding : ~1_val~ ~2_val~
: $" :\t{m_Inscription}")); // a bracelet of binding : ~1_val~ ~2_val~
}
public override void OnSingleClick(Mobile from)
@ -112,7 +112,7 @@ namespace Server.Items
LabelTo(from, 1054000,
m_Charges + (m_Inscription.Length == 0
? "\t "
: " :\t" + m_Inscription)); // a bracelet of binding : ~1_val~ ~2_val~
: $" :\t{m_Inscription}")); // a bracelet of binding : ~1_val~ ~2_val~
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)

View file

@ -192,7 +192,7 @@ namespace Server.Items
return false;
}
if (from.Spell != null && from.Spell.IsCasting)
if (from.Spell?.IsCasting == true)
{
from.SendLocalizedMessage(1070733); // You may not use a Soulstone while your character is casting a spell.
return false;
@ -914,21 +914,14 @@ namespace Server.Items
public void Flip()
{
switch (ItemID)
ItemID = ItemID switch
{
case 0x2ADC:
ItemID = 0x2AEC;
break;
case 0x2ADD:
ItemID = 0x2AED;
break;
case 0x2AEC:
ItemID = 0x2ADC;
break;
case 0x2AED:
ItemID = 0x2ADD;
break;
}
0x2ADC => 0x2AEC,
0x2ADD => 0x2AED,
0x2AEC => 0x2ADC,
0x2AED => 0x2ADD,
_ => ItemID
};
}
public override void Serialize(GenericWriter writer)

View file

@ -43,20 +43,15 @@ namespace Server.Items
MLQuestContext context = MLQuestSystem.GetContext(pm);
if (context != null)
{
foreach (MLQuestInstance instance in context.QuestInstances)
{
foreach (BaseObjectiveInstance objective in instance.Objectives)
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
#endregion
if (pm.AcceleratedStart > DateTime.UtcNow)

View file

@ -54,20 +54,15 @@ namespace Server.Items
MLQuestContext context = MLQuestSystem.GetContext(pm);
if (context != null)
{
foreach (MLQuestInstance instance in context.QuestInstances)
{
foreach (BaseObjectiveInstance objective in instance.Objectives)
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
}
}
#endregion
if (pm.AcceleratedStart > DateTime.UtcNow)

View file

@ -36,7 +36,7 @@ namespace Server.Items
[CommandProperty(AccessLevel.GameMaster)]
public double Value{ get; set; }
public virtual string GetNameLocalized() => string.Concat("#", AosSkillBonuses.GetLabel(Skill).ToString());
public virtual string GetNameLocalized() => $"#{AosSkillBonuses.GetLabel(Skill)}";
public virtual string GetName()
{

View file

@ -284,15 +284,12 @@ namespace Server.Items
public void OnOptionSelected(Mobile from, int option)
{
switch (option)
m_East = option switch
{
case 1:
m_East = false;
break;
case 2:
m_East = true;
break;
}
1 => false,
2 => true,
_ => m_East
};
if (!Deleted)
base.OnDoubleClick(from);

View file

@ -38,7 +38,7 @@ namespace Server.Items
public bool CouldFit(IPoint3D p, Map map)
{
if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
if (map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) != true)
return false;
if (FacingSouth)

View file

@ -175,17 +175,13 @@ namespace Server.Items
if (keg?.Deleted != false || keg.Held != 100)
return 0;
switch (keg.Type)
return keg.Type switch
{
case PotionEffect.ExplosionLesser:
return 5;
case PotionEffect.Explosion:
return 10;
case PotionEffect.ExplosionGreater:
return 15;
default:
return 0;
}
PotionEffect.ExplosionLesser => 5,
PotionEffect.Explosion => 10,
PotionEffect.ExplosionGreater => 15,
_ => 0
};
}
public void Fill(Mobile from, PotionKeg keg)

View file

@ -179,14 +179,14 @@ namespace Server.Items
public static int GetWestItemID(int east)
{
switch (east)
return east switch
{
case 0x1582: return 0x1635;
case 0x1583: return 0x1634;
case 0x1584: return 0x1637;
case 0x1585: return 0x1636;
default: return east + 1;
}
0x1582 => 0x1635,
0x1583 => 0x1634,
0x1584 => 0x1637,
0x1585 => 0x1636,
_ => (east + 1)
};
}
private class InternalGump : Gump

View file

@ -38,7 +38,7 @@ namespace Server.Items
public bool CouldFit(IPoint3D p, Map map)
{
if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
if (map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) != true)
return false;
if (Type == StoneFaceTrapType.NorthWestWall)

View file

@ -48,7 +48,7 @@ namespace Server.Items
public bool CouldFit(IPoint3D p, Map map)
{
if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
if (map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) != true)
return false;
if (FacingSouth)
@ -198,12 +198,12 @@ namespace Server.Items
public static int GetWestItemID(int south)
{
switch (south)
return south switch
{
case 0x1B1E: return 0x1B1D;
case 0x1B7F: return 0x1B7C;
default: return south + 1;
}
0x1B1E => 0x1B1D,
0x1B7F => 0x1B7C,
_ => (south + 1)
};
}
private class InternalGump : Gump

View file

@ -146,38 +146,19 @@ namespace Server.Items
case MiningCartType.OreEast:
if (Ore > 0)
{
Item ingots = null;
switch (Utility.Random(9))
var ingots = Utility.Random(9) switch
{
case 0:
ingots = new IronIngot();
break;
case 1:
ingots = new DullCopperIngot();
break;
case 2:
ingots = new ShadowIronIngot();
break;
case 3:
ingots = new CopperIngot();
break;
case 4:
ingots = new BronzeIngot();
break;
case 5:
ingots = new GoldIngot();
break;
case 6:
ingots = new AgapiteIngot();
break;
case 7:
ingots = new VeriteIngot();
break;
case 8:
ingots = new ValoriteIngot();
break;
}
0 => (Item)new IronIngot(),
1 => new DullCopperIngot(),
2 => new ShadowIronIngot(),
3 => new CopperIngot(),
4 => new BronzeIngot(),
5 => new GoldIngot(),
6 => new AgapiteIngot(),
7 => new VeriteIngot(),
8 => new ValoriteIngot(),
_ => null
};
int amount = Math.Min(10, Ore);
ingots.Amount = amount;
@ -203,58 +184,26 @@ namespace Server.Items
case MiningCartType.GemEast:
if (Gems > 0)
{
Item gems = null;
switch (Utility.Random(15))
var gems = Utility.Random(15) switch
{
case 0:
gems = new Amber();
break;
case 1:
gems = new Amethyst();
break;
case 2:
gems = new Citrine();
break;
case 3:
gems = new Diamond();
break;
case 4:
gems = new Emerald();
break;
case 5:
gems = new Ruby();
break;
case 6:
gems = new Sapphire();
break;
case 7:
gems = new StarSapphire();
break;
case 8:
gems = new Tourmaline();
break;
0 => (Item)new Amber(),
1 => new Amethyst(),
2 => new Citrine(),
3 => new Diamond(),
4 => new Emerald(),
5 => new Ruby(),
6 => new Sapphire(),
7 => new StarSapphire(),
8 => new Tourmaline(),
// Mondain's Legacy gems
case 9:
gems = new PerfectEmerald();
break;
case 10:
gems = new DarkSapphire();
break;
case 11:
gems = new Turquoise();
break;
case 12:
gems = new EcruCitrine();
break;
case 13:
gems = new FireRuby();
break;
case 14:
gems = new BlueDiamond();
break;
}
9 => new PerfectEmerald(),
10 => new DarkSapphire(),
11 => new Turquoise(),
12 => new EcruCitrine(),
13 => new FireRuby(),
14 => new BlueDiamond(),
_ => null
};
int amount = Math.Min(5, Gems);
gems.Amount = amount;

View file

@ -48,12 +48,11 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
switch (version)
m_IsRewardItem = version switch
{
case 1:
m_IsRewardItem = reader.ReadBool();
break;
}
1 => reader.ReadBool(),
_ => m_IsRewardItem
};
}
}

View file

@ -96,32 +96,17 @@ namespace Server.Items
{
if (m_Logs > 0)
{
Item logs = null;
switch (Utility.Random(7))
var logs = Utility.Random(7) switch
{
case 0:
logs = new Log();
break;
case 1:
logs = new AshLog();
break;
case 2:
logs = new OakLog();
break;
case 3:
logs = new YewLog();
break;
case 4:
logs = new HeartwoodLog();
break;
case 5:
logs = new BloodwoodLog();
break;
case 6:
logs = new FrostwoodLog();
break;
}
0 => new Log(),
1 => new AshLog(),
2 => new OakLog(),
3 => new YewLog(),
4 => new HeartwoodLog(),
5 => new BloodwoodLog(),
6 => new FrostwoodLog(),
_ => null
};
int amount = Math.Min(10, m_Logs);
logs.Amount = amount;
@ -242,21 +227,14 @@ namespace Server.Items
public void OnOptionSelected(Mobile from, int option)
{
switch (option)
m_ItemID = option switch
{
case 1:
m_ItemID = 0xE56;
break;
case 2:
m_ItemID = 0xE58;
break;
case 3:
m_ItemID = 0xE57;
break;
case 4:
m_ItemID = 0xE59;
break;
}
1 => 0xE56,
2 => 0xE58,
3 => 0xE57,
4 => 0xE59,
_ => m_ItemID
};
if (!Deleted)
base.OnDoubleClick(from);

View file

@ -245,34 +245,34 @@ namespace Server.Items
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Tool?.Deleted != false || m_Target?.Deleted != false)
if (m_Tool?.Deleted != false || m_Target?.Deleted != false)
return;
if (info.ButtonID != (int)Buttons.Okay)
{
state.Mobile.SendLocalizedMessage(1072363); // The object was not engraved.
return;
}
if (info.ButtonID != (int)Buttons.Okay)
{
state.Mobile.SendLocalizedMessage(1072363); // The object was not engraved.
return;
}
TextRelay relay = info.GetTextEntry((int)Buttons.Text);
TextRelay relay = info.GetTextEntry((int)Buttons.Text);
if (relay == null)
return;
if (relay == null)
return;
if (string.IsNullOrEmpty(relay.Text))
{
m_Target.EngravedText = null;
state.Mobile.SendLocalizedMessage(1072362); // You remove the engraving from the object.
}
else
{
m_Target.EngravedText = Utility.FixHtml(relay.Text.Length > 64 ?
relay.Text.Substring(0, 64) : relay.Text);
state.Mobile.SendLocalizedMessage(1072361); // You engraved the object.
m_Target.InvalidateProperties();
m_Tool.UsesRemaining -= 1;
m_Tool.InvalidateProperties();
}
if (string.IsNullOrEmpty(relay.Text))
{
m_Target.EngravedText = null;
state.Mobile.SendLocalizedMessage(1072362); // You remove the engraving from the object.
}
else
{
m_Target.EngravedText = Utility.FixHtml(relay.Text.Length > 64 ?
relay.Text.Substring(0, 64) : relay.Text);
state.Mobile.SendLocalizedMessage(1072361); // You engraved the object.
m_Target.InvalidateProperties();
m_Tool.UsesRemaining -= 1;
m_Tool.InvalidateProperties();
}
}
private enum Buttons

View file

@ -1,5 +1,4 @@
using System;
using Server.Commands;
using Server.Mobiles;
using Server.Spells.Fifth;
using Server.Spells.First;
@ -307,7 +306,7 @@ namespace Server.Items
list.Add(1072400,
m_Summoner?.Name ?? "Unknown"); // Talisman of ~1_name~ Summoning
else if (m_Removal != TalismanRemoval.None)
list.Add(1072389, "#" + (1072000 + (int)m_Removal)); // Talisman of ~1_name~
list.Add(1072389, $"#{1072000 + (int)m_Removal}"); // Talisman of ~1_name~
else
base.AddNameProperty(list);
}
@ -336,11 +335,11 @@ namespace Server.Items
list.Add(1075085); // Requirement: Mondain's Legacy
if (m_Killer?.IsEmpty == false && m_Killer.Amount > 0)
list.Add(1072388, "{0}\t{1}", m_Killer.Name != null ? m_Killer.Name.ToString() : "Unknown",
list.Add(1072388, "{0}\t{1}", m_Killer.Name?.ToString() ?? "Unknown",
m_Killer.Amount); // ~1_NAME~ Killer: +~2_val~%
if (m_Protection != null && !m_Protection.IsEmpty && m_Protection.Amount > 0)
list.Add(1072387, "{0}\t{1}", m_Protection.Name != null ? m_Protection.Name.ToString() : "Unknown",
if (m_Protection?.IsEmpty == false && m_Protection.Amount > 0)
list.Add(1072387, "{0}\t{1}", m_Protection.Name?.ToString() ?? "Unknown",
m_Protection.Amount); // ~1_NAME~ Protection: +~2_val~%
if (m_ExceptionalBonus != 0)
@ -397,7 +396,7 @@ namespace Server.Items
if ((prop = Attributes.RegenMana) != 0)
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
if ((prop = Attributes.NightSight) != 0)
if (Attributes.NightSight != 0)
list.Add(1060441); // night sight
if ((prop = Attributes.ReflectPhysical) != 0)
@ -409,7 +408,7 @@ namespace Server.Items
if ((prop = Attributes.RegenHits) != 0)
list.Add(1060444, prop.ToString()); // hit point regeneration ~1_val~
if ((prop = Attributes.SpellChanneling) != 0)
if (Attributes.SpellChanneling != 0)
list.Add(1060482); // spell channeling
if ((prop = Attributes.SpellDamage) != 0)
@ -894,7 +893,7 @@ namespace Server.Items
public virtual void StartTimer()
{
if (m_Timer == null || !m_Timer.Running)
if (m_Timer?.Running != true)
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(10), Slice);
}

View file

@ -37,14 +37,13 @@ namespace Server.Items
{
get
{
switch (ItemID)
return ItemID switch
{
case 0x113C: return GasTrapType.NorthWall;
case 0x1147: return GasTrapType.WestWall;
case 0x11A8: return GasTrapType.Floor;
}
return GasTrapType.WestWall;
0x113C => GasTrapType.NorthWall,
0x1147 => GasTrapType.WestWall,
0x11A8 => GasTrapType.Floor,
_ => GasTrapType.WestWall
};
}
set => ItemID = GetBaseID(value);
}
@ -56,14 +55,13 @@ namespace Server.Items
public static int GetBaseID(GasTrapType type)
{
switch (type)
return type switch
{
case GasTrapType.NorthWall: return 0x113C;
case GasTrapType.WestWall: return 0x1147;
case GasTrapType.Floor: return 0x11A8;
}
return 0;
GasTrapType.NorthWall => 0x113C,
GasTrapType.WestWall => 0x1147,
GasTrapType.Floor => 0x11A8,
_ => 0
};
}
public override void OnTrigger(Mobile from)

View file

@ -28,15 +28,14 @@ namespace Server.Items
{
get
{
switch (ItemID)
return ItemID switch
{
case 0x1103: return SawTrapType.NorthWall;
case 0x1116: return SawTrapType.WestWall;
case 0x11AC: return SawTrapType.NorthFloor;
case 0x11B1: return SawTrapType.WestFloor;
}
return SawTrapType.NorthWall;
0x1103 => SawTrapType.NorthWall,
0x1116 => SawTrapType.WestWall,
0x11AC => SawTrapType.NorthFloor,
0x11B1 => SawTrapType.WestFloor,
_ => SawTrapType.NorthWall
};
}
set => ItemID = GetBaseID(value);
}
@ -48,15 +47,14 @@ namespace Server.Items
public static int GetBaseID(SawTrapType type)
{
switch (type)
return type switch
{
case SawTrapType.NorthWall: return 0x1103;
case SawTrapType.WestWall: return 0x1116;
case SawTrapType.NorthFloor: return 0x11AC;
case SawTrapType.WestFloor: return 0x11B1;
}
return 0;
SawTrapType.NorthWall => 0x1103,
SawTrapType.WestWall => 0x1116,
SawTrapType.NorthFloor => 0x11AC,
SawTrapType.WestFloor => 0x11B1,
_ => 0
};
}
public override void OnTrigger(Mobile from)

View file

@ -28,23 +28,22 @@ namespace Server.Items
{
get
{
switch (ItemID)
return ItemID switch
{
case 4360:
case 4361:
case 4366: return SpikeTrapType.WestWall;
case 4379:
case 4380:
case 4385: return SpikeTrapType.NorthWall;
case 4506:
case 4507:
case 4511: return SpikeTrapType.WestFloor;
case 4512:
case 4513:
case 4517: return SpikeTrapType.NorthFloor;
}
return SpikeTrapType.WestWall;
4360 => SpikeTrapType.WestWall,
4361 => SpikeTrapType.WestWall,
4366 => SpikeTrapType.WestWall,
4379 => SpikeTrapType.NorthWall,
4380 => SpikeTrapType.NorthWall,
4385 => SpikeTrapType.NorthWall,
4506 => SpikeTrapType.WestFloor,
4507 => SpikeTrapType.WestFloor,
4511 => SpikeTrapType.WestFloor,
4512 => SpikeTrapType.NorthFloor,
4513 => SpikeTrapType.NorthFloor,
4517 => SpikeTrapType.NorthFloor,
_ => SpikeTrapType.WestWall
};
}
set
{
@ -73,31 +72,28 @@ namespace Server.Items
public static int GetBaseID(SpikeTrapType type)
{
switch (type)
return type switch
{
case SpikeTrapType.WestWall: return 4360;
case SpikeTrapType.NorthWall: return 4379;
case SpikeTrapType.WestFloor: return 4506;
case SpikeTrapType.NorthFloor: return 4512;
}
return 0;
SpikeTrapType.WestWall => 4360,
SpikeTrapType.NorthWall => 4379,
SpikeTrapType.WestFloor => 4506,
SpikeTrapType.NorthFloor => 4512,
_ => 0
};
}
public static int GetExtendedID(SpikeTrapType type) => GetBaseID(type) + GetExtendedOffset(type);
public static int GetExtendedOffset(SpikeTrapType type)
{
switch (type)
return type switch
{
case SpikeTrapType.WestWall: return 6;
case SpikeTrapType.NorthWall: return 6;
case SpikeTrapType.WestFloor: return 5;
case SpikeTrapType.NorthFloor: return 5;
}
return 0;
SpikeTrapType.WestWall => 6,
SpikeTrapType.NorthWall => 6,
SpikeTrapType.WestFloor => 5,
SpikeTrapType.NorthFloor => 5,
_ => 0
};
}
public override void OnTrigger(Mobile from)

View file

@ -24,20 +24,19 @@ namespace Server.Items
{
get
{
switch (ItemID)
return ItemID switch
{
case 0x10F5:
case 0x10F6:
case 0x10F7: return StoneFaceTrapType.NorthWestWall;
case 0x10FC:
case 0x10FD:
case 0x10FE: return StoneFaceTrapType.NorthWall;
case 0x110F:
case 0x1110:
case 0x1111: return StoneFaceTrapType.WestWall;
}
return StoneFaceTrapType.NorthWestWall;
0x10F5 => StoneFaceTrapType.NorthWestWall,
0x10F6 => StoneFaceTrapType.NorthWestWall,
0x10F7 => StoneFaceTrapType.NorthWestWall,
0x10FC => StoneFaceTrapType.NorthWall,
0x10FD => StoneFaceTrapType.NorthWall,
0x10FE => StoneFaceTrapType.NorthWall,
0x110F => StoneFaceTrapType.WestWall,
0x1110 => StoneFaceTrapType.WestWall,
0x1111 => StoneFaceTrapType.WestWall,
_ => StoneFaceTrapType.NorthWestWall
};
}
set
{
@ -66,26 +65,24 @@ namespace Server.Items
public static int GetBaseID(StoneFaceTrapType type)
{
switch (type)
return type switch
{
case StoneFaceTrapType.NorthWestWall: return 0x10F5;
case StoneFaceTrapType.NorthWall: return 0x10FC;
case StoneFaceTrapType.WestWall: return 0x110F;
}
return 0;
StoneFaceTrapType.NorthWestWall => 0x10F5,
StoneFaceTrapType.NorthWall => 0x10FC,
StoneFaceTrapType.WestWall => 0x110F,
_ => 0
};
}
public static int GetFireID(StoneFaceTrapType type)
{
switch (type)
return type switch
{
case StoneFaceTrapType.NorthWestWall: return 0x10F7;
case StoneFaceTrapType.NorthWall: return 0x10FE;
case StoneFaceTrapType.WestWall: return 0x1111;
}
return 0;
StoneFaceTrapType.NorthWestWall => 0x10F7,
StoneFaceTrapType.NorthWall => 0x10FE,
StoneFaceTrapType.WestWall => 0x1111,
_ => 0
};
}
public override void OnTrigger(Mobile from)

View file

@ -20,7 +20,6 @@ namespace Server.Items
RequiredSkill = 72;
LockLevel = RequiredSkill - Utility.Random(1, 10);
MaxLockLevel = RequiredSkill + Utility.Random(1, 10);
;
// According to OSI, loot in level 2 chest is:
// Gold 80 - 150
@ -122,12 +121,12 @@ namespace Server.Items
break;
case 6: // Keg
ItemID = UseFirstItemId ? 0xe7f : 0xe7f;
ItemID = 0xe7f;
GumpID = 0x3e;
break;
case 7: // Barrel
ItemID = UseFirstItemId ? 0xe77 : 0xe77;
ItemID = 0xe77;
GumpID = 0x3e;
break;
}
@ -145,4 +144,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -20,7 +20,6 @@ namespace Server.Items
RequiredSkill = 84;
LockLevel = RequiredSkill - Utility.Random(1, 10);
MaxLockLevel = RequiredSkill + Utility.Random(1, 10);
;
// According to OSI, loot in level 3 chest is:
// Gold 250 - 350
@ -158,4 +157,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

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