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

@ -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;