Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -5,7 +5,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Anatomy
public static class Anatomy
{
public static void Initialize()
{
@ -88,4 +88,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class AnimalLore
public static class AnimalLore
{
public static void Initialize()
{
@ -102,9 +102,6 @@ namespace Server.SkillHandlers
int pages = Core.AOS ? 5 : 3;
int page = 0;
#region Attributes
AddPage(++page);
AddImage(128, 152, 2086);
@ -163,10 +160,6 @@ namespace Server.SkillHandlers
AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, pages);
#endregion
#region Resistances
if (Core.AOS)
{
AddPage(++page);
@ -193,10 +186,6 @@ namespace Server.SkillHandlers
AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
}
#endregion
#region Damage
if (Core.AOS)
{
AddPage(++page);
@ -219,24 +208,16 @@ namespace Server.SkillHandlers
AddHtmlLocalized(153, 240, 160, 18, 1061650, LabelColor); // Energy
AddHtml(320, 240, 35, 18, FormatElement(c.EnergyDamage));
#region Mondain's Legacy
if (Core.ML)
{
AddHtmlLocalized(153, 258, 160, 18, 1076750, LabelColor); // Base Damage
AddHtml(300, 258, 55, 18, FormatDamage(c.DamageMin, c.DamageMax));
}
#endregion
AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
}
#endregion
#region Skills
AddPage(++page);
AddImage(128, 152, 2086);
@ -254,8 +235,6 @@ namespace Server.SkillHandlers
AddHtmlLocalized(153, 222, 160, 18, 1044061, LabelColor); // Anatomy
AddHtml(320, 222, 35, 18, FormatSkill(c, SkillName.Anatomy));
#region Mondain's Legacy
if (c is CuSidhe)
{
AddHtmlLocalized(153, 240, 160, 18, 1044077, LabelColor); // Healing
@ -267,8 +246,6 @@ namespace Server.SkillHandlers
AddHtml(320, 240, 35, 18, FormatSkill(c, SkillName.Poisoning));
}
#endregion
AddImage(128, 260, 2086);
AddHtmlLocalized(147, 258, 160, 18, 3001032, 200); // Lore & Knowledge
@ -284,10 +261,6 @@ namespace Server.SkillHandlers
AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, page + 1);
AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
#endregion
#region Misc
AddPage(++page);
AddImage(128, 152, 2086);
@ -343,8 +316,6 @@ namespace Server.SkillHandlers
AddButton(340, 358, 5601, 5605, 0, GumpButtonType.Page, 1);
AddButton(317, 358, 5603, 5607, 0, GumpButtonType.Page, page - 1);
#endregion
}
private static string FormatSkill(BaseCreature c, SkillName name)
@ -389,8 +360,6 @@ namespace Server.SkillHandlers
return $"<div align=right>{val}%</div>";
}
#region Mondain's Legacy
private static string FormatDamage(int min, int max)
{
if (min <= 0 || max <= 0)
@ -398,7 +367,5 @@ namespace Server.SkillHandlers
return $"<div align=right>{min}-{max}</div>";
}
#endregion
}
}

View file

@ -10,11 +10,11 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class AnimalTaming
public static class AnimalTaming
{
private static HashSet<Mobile> m_BeingTamed = new HashSet<Mobile>();
private static readonly HashSet<Mobile> m_BeingTamed = new HashSet<Mobile>();
public static bool DisableMessage{ get; set; }
public static bool DisableMessage { get; set; }
public static void Initialize()
{
@ -191,7 +191,7 @@ namespace Server.SkillHandlers
creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502802,
from.NetState); // Someone else is already taming this.
}
else if (creature.CanAngerOnTame && 0.95 >= Utility.RandomDouble())
else if (creature.CanAngerOnTame && Utility.RandomDouble() <= 0.95)
{
creature.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 502805,
from.NetState); // You seem to anger the beast!
@ -230,11 +230,11 @@ namespace Server.SkillHandlers
private class InternalTimer : Timer
{
private int m_Count;
private BaseCreature m_Creature;
private int m_MaxCount;
private readonly BaseCreature m_Creature;
private readonly int m_MaxCount;
private bool m_Paralyzed;
private DateTime m_StartTime;
private Mobile m_Tamer;
private readonly DateTime m_StartTime;
private readonly Mobile m_Tamer;
public InternalTimer(Mobile tamer, BaseCreature creature, int count) : base(TimeSpan.FromSeconds(3.0),
TimeSpan.FromSeconds(3.0), count)

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class ArmsLore
public static class ArmsLore
{
public static void Initialize()
{
@ -53,15 +53,15 @@ namespace Server.SkillHandlers
else
damage = (int)Math.Ceiling(Math.Min(damage, 30) / 5.0);
/*
else if ( damage < 6 )
else if (damage < 6)
damage = 1;
else if ( damage < 11 )
else if (damage < 11)
damage = 2;
else if ( damage < 16 )
else if (damage < 16)
damage = 3;
else if ( damage < 21 )
else if (damage < 21)
damage = 4;
else if ( damage < 26 )
else if (damage < 26)
damage = 5;
else
damage = 6;
@ -104,22 +104,21 @@ namespace Server.SkillHandlers
from.SendLocalizedMessage(1038285 + hp);
}
from.SendLocalizedMessage(1038295 + (int)Math.Ceiling(Math.Min(arm.ArmorRating, 35) / 5.0));
/*
if ( arm.ArmorRating < 1 )
if (arm.ArmorRating < 1)
from.SendLocalizedMessage( 1038295 ); // This armor offers no defense against attackers.
else if ( arm.ArmorRating < 6 )
else if (arm.ArmorRating < 6)
from.SendLocalizedMessage( 1038296 ); // This armor provides almost no protection.
else if ( arm.ArmorRating < 11 )
else if (arm.ArmorRating < 11)
from.SendLocalizedMessage( 1038297 ); // This armor provides very little protection.
else if ( arm.ArmorRating < 16 )
else if (arm.ArmorRating < 16)
from.SendLocalizedMessage( 1038298 ); // This armor offers some protection against blows.
else if ( arm.ArmorRating < 21 )
else if (arm.ArmorRating < 21)
from.SendLocalizedMessage( 1038299 ); // This armor serves as sturdy protection.
else if ( arm.ArmorRating < 26 )
else if (arm.ArmorRating < 26)
from.SendLocalizedMessage( 1038300 ); // This armor is a superior defense against attack.
else if ( arm.ArmorRating < 31 )
else if (arm.ArmorRating < 31)
from.SendLocalizedMessage( 1038301 ); // This armor offers excellent protection.
else
from.SendLocalizedMessage( 1038302 ); // This armor is superbly crafted to provide maximum protection.
@ -155,4 +154,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Begging
public static class Begging
{
public static void Initialize()
{
@ -62,8 +62,7 @@ namespace Server.SkillHandlers
else
number = 500402; // You are too far away to beg from her.
}
else if (!Core.ML && from.Mounted
) // If we're on a mount, who would give us money? TODO: guessed it's removed since ML
else if (!Core.ML && from.Mounted) // If we're on a mount, who would give us money? TODO: guessed it's removed since ML
{
number = 500404; // They seem unwilling to give you any money.
}
@ -91,7 +90,8 @@ namespace Server.SkillHandlers
private class InternalTimer : Timer
{
private Mobile m_From, m_Target;
private readonly Mobile m_From;
private readonly Mobile m_Target;
public InternalTimer(Mobile from, Mobile target) : base(TimeSpan.FromSeconds(2.0))
{
@ -174,4 +174,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class DetectHidden
public static class DetectHidden
{
public static void Initialize()
{
@ -15,7 +15,7 @@ namespace Server.SkillHandlers
public static TimeSpan OnUse(Mobile src)
{
src.SendLocalizedMessage(500819); //Where will you search?
src.SendLocalizedMessage(500819); // Where will you search?
src.Target = new InternalTarget();
return TimeSpan.FromSeconds(6.0);
@ -64,7 +64,7 @@ namespace Server.SkillHandlers
double ss = srcSkill + Utility.Random(21) - 10;
double ts = trg.Skills.Hiding.Value + Utility.Random(21) - 10;
if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || inHouse && house.IsInside(trg)))
if (src.AccessLevel >= trg.AccessLevel && (ss >= ts || (inHouse && house.IsInside(trg))))
{
if (trg is ShadowKnight && (trg.X != p.X || trg.Y != p.Y))
continue;

View file

@ -6,9 +6,9 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Discordance
public static class Discordance
{
private static Dictionary<Mobile, DiscordanceInfo> m_Table = new Dictionary<Mobile, DiscordanceInfo>();
private static readonly Dictionary<Mobile, DiscordanceInfo> m_Table = new Dictionary<Mobile, DiscordanceInfo>();
public static void Initialize()
{
@ -88,12 +88,12 @@ namespace Server.SkillHandlers
private class DiscordanceInfo
{
public Mobile m_Creature;
public int m_Effect;
public readonly Mobile m_Creature;
public readonly int m_Effect;
public bool m_Ending;
public DateTime m_EndTime;
public Mobile m_From;
public List<object> m_Mods;
public readonly Mobile m_From;
public readonly List<object> m_Mods;
public Timer m_Timer;
public DiscordanceInfo(Mobile from, Mobile creature, int effect, List<object> mods)
@ -141,7 +141,7 @@ namespace Server.SkillHandlers
public class DiscordanceTarget : Target
{
private BaseInstrument m_Instrument;
private readonly BaseInstrument m_Instrument;
public DiscordanceTarget(Mobile from, BaseInstrument inst) : base(
BaseInstrument.GetBardRange(from, SkillName.Discordance), false, TargetFlags.None) =>
@ -159,13 +159,13 @@ namespace Server.SkillHandlers
}
else if (target is Mobile targ)
{
if (targ == from || targ is BaseCreature bc &&
if (targ == from || (targ is BaseCreature bc &&
(bc.BardImmune || !from.CanBeHarmful(bc, false)) &&
bc.ControlMaster != from)
bc.ControlMaster != from))
{
from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that.
}
else if (m_Table.ContainsKey(targ)) //Already discorded
else if (m_Table.ContainsKey(targ)) // Already discorded
{
from.SendLocalizedMessage(1049537); // Your target is already in discord.
}

View file

@ -5,7 +5,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class EvalInt
public static class EvalInt
{
public static void Initialize()
{
@ -90,4 +90,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class ForensicEvaluation
public static class ForensicEvaluation
{
public static void Initialize()
{
@ -36,13 +36,13 @@ namespace Server.SkillHandlers
if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0))
{
if (target is PlayerMobile pm && pm.NpcGuild == NpcGuild.ThievesGuild)
from.SendLocalizedMessage(501004); //That individual is a thief!
from.SendLocalizedMessage(501004); // That individual is a thief!
else
from.SendLocalizedMessage(501003); //You notice nothing unusual.
from.SendLocalizedMessage(501003); // You notice nothing unusual.
}
else
{
from.SendLocalizedMessage(501001); //You cannot determain anything useful.
from.SendLocalizedMessage(501001); // You cannot determain anything useful.
}
}
else if (target is Corpse c)
@ -57,7 +57,7 @@ namespace Server.SkillHandlers
if (((Body)c.Amount).IsHuman)
from.SendLocalizedMessage(1042751,
c.Killer == null ? "no one" : c.Killer.Name); //This person was killed by ~1_KILLER_NAME~
c.Killer == null ? "no one" : c.Killer.Name); // This person was killed by ~1_KILLER_NAME~
if (c.Looters.Count > 0)
{
@ -70,26 +70,26 @@ namespace Server.SkillHandlers
}
from.SendLocalizedMessage(1042752,
sb.ToString()); //This body has been distrubed by ~1_PLAYER_NAMES~
sb.ToString()); // This body has been distrubed by ~1_PLAYER_NAMES~
}
else
{
from.SendLocalizedMessage(501002); //The corpse has not be desecrated.
from.SendLocalizedMessage(501002); // The corpse has not be desecrated.
}
}
else
{
from.SendLocalizedMessage(501001); //You cannot determain anything useful.
from.SendLocalizedMessage(501001); // You cannot determain anything useful.
}
}
else if (target is ILockpickable p)
{
if (p.Picker != null)
from.SendLocalizedMessage(1042749, p.Picker.Name); //This lock was opened by ~1_PICKER_NAME~
from.SendLocalizedMessage(1042749, p.Picker.Name); // This lock was opened by ~1_PICKER_NAME~
else
from.SendLocalizedMessage(501003); //You notice nothing unusual.
from.SendLocalizedMessage(501003); // You notice nothing unusual.
}
}
}
}
}
}

View file

@ -6,9 +6,9 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Hiding
public static class Hiding
{
public static bool CombatOverride{ get; set; }
public static bool CombatOverride { get; set; }
public static void Initialize()
{
@ -42,9 +42,9 @@ namespace Server.SkillHandlers
bonus = 50.0;
}
//int range = 18 - (int)(m.Skills.Hiding.Value / 10);
// int range = 18 - (int)(m.Skills.Hiding.Value / 10);
int range = Math.Min((int)((100 - m.Skills.Hiding.Value) / 2) + 8,
18); //Cap of 18 not OSI-exact, intentional difference
18); // Cap of 18 not OSI-exact, intentional difference
bool badCombat = !CombatOverride && m.Combatant != null && m.InRange(m.Combatant.Location, range) &&
m.Combatant.InLOS(m);

View file

@ -6,9 +6,9 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Inscribe
public static class Inscribe
{
private static Dictionary<BaseBook, Mobile> m_UseTable = new Dictionary<BaseBook, Mobile>();
private static readonly Dictionary<BaseBook, Mobile> m_UseTable = new Dictionary<BaseBook, Mobile>();
public static void Initialize()
{
@ -106,7 +106,7 @@ namespace Server.SkillHandlers
private class InternalTargetDst : Target
{
private BaseBook m_BookSrc;
private readonly BaseBook m_BookSrc;
public InternalTargetDst(BaseBook bookSrc) : base(3, false, TargetFlags.None) => m_BookSrc = bookSrc;

View file

@ -4,7 +4,7 @@ using Server.Targeting;
namespace Server.Items
{
public class ItemIdentification
public static class ItemIdentification
{
public static void Initialize()
{
@ -54,4 +54,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -4,7 +4,7 @@ using Server.Misc;
namespace Server.SkillHandlers
{
internal class Meditation
internal static class Meditation
{
public static void Initialize()
{
@ -100,4 +100,4 @@ namespace Server.SkillHandlers
return TimeSpan.FromSeconds(10.0);
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Peacemaking
public static class Peacemaking
{
public static void Initialize()
{
@ -32,7 +32,7 @@ namespace Server.SkillHandlers
private class InternalTarget : Target
{
private BaseInstrument m_Instrument;
private readonly BaseInstrument m_Instrument;
private bool m_SetSkillTime = true;
public InternalTarget(Mobile from, BaseInstrument instrument) : base(
@ -176,7 +176,7 @@ namespace Server.SkillHandlers
from.NextSkillTime = Core.TickCount + 5000;
targ.Combatant = null;
targ.Warmode = false;
if (bc != null)
{
from.SendLocalizedMessage(1049532); // You play hypnotic music, calming your target.
@ -204,4 +204,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Poisoning
public static class Poisoning
{
public static void Initialize()
{
@ -43,7 +43,7 @@ namespace Server.SkillHandlers
private class InternalTarget : Target
{
private BasePoisonPotion m_Potion;
private readonly BasePoisonPotion m_Potion;
public InternalTarget(BasePoisonPotion potion) : base(2, false, TargetFlags.None) => m_Potion = potion;
@ -92,10 +92,11 @@ namespace Server.SkillHandlers
private class InternalTimer : Timer
{
private Mobile m_From;
private double m_MinSkill, m_MaxSkill;
private Poison m_Poison;
private Item m_Target;
private readonly Mobile m_From;
private readonly double m_MinSkill;
private readonly double m_MaxSkill;
private readonly Poison m_Poison;
private readonly Item m_Target;
public InternalTimer(Mobile from, Item target, BasePoisonPotion potion) : base(TimeSpan.FromSeconds(2.0))
{

View file

@ -5,7 +5,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Provocation
public static class Provocation
{
public static void Initialize()
{
@ -30,7 +30,7 @@ namespace Server.SkillHandlers
private class InternalFirstTarget : Target
{
private BaseInstrument m_Instrument;
private readonly BaseInstrument m_Instrument;
public InternalFirstTarget(Mobile from, BaseInstrument instrument) : base(
BaseInstrument.GetBardRange(from, SkillName.Provocation), false, TargetFlags.None) =>
@ -73,8 +73,8 @@ namespace Server.SkillHandlers
private class InternalSecondTarget : Target
{
private BaseCreature m_Creature;
private BaseInstrument m_Instrument;
private readonly BaseCreature m_Creature;
private readonly BaseInstrument m_Instrument;
public InternalSecondTarget(Mobile from, BaseInstrument instrument, BaseCreature creature) : base(
BaseInstrument.GetBardRange(from, SkillName.Provocation), false, TargetFlags.None)
@ -130,8 +130,8 @@ namespace Server.SkillHandlers
}
else
{
//from.DoHarmful( m_Creature );
//from.DoHarmful( creature );
// from.DoHarmful( m_Creature );
// from.DoHarmful( creature );
if (!from.CheckTargetSkill(SkillName.Provocation, creature, diff - 25.0, diff + 25.0))
{
@ -162,4 +162,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -6,7 +6,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class RemoveTrap
public static class RemoveTrap
{
public static void Initialize()
{
@ -92,8 +92,8 @@ namespace Server.SkillHandlers
}
else
{
if (Core.ML && isOwner || from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) &&
from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0))
if ((Core.ML && isOwner) || (from.CheckTargetSkill(SkillName.RemoveTrap, trap, 80.0, 100.0) &&
from.CheckTargetSkill(SkillName.Tinkering, trap, 80.0, 100.0)))
{
from.PrivateOverheadMessage(MessageType.Regular, trap.MessageHue, trap.DisarmMessage,
from.NetState);

View file

@ -6,7 +6,7 @@ using Server.Regions;
namespace Server.SkillHandlers
{
public class Snooping
public static class Snooping
{
public static void Configure()
{
@ -28,7 +28,7 @@ namespace Server.SkillHandlers
if (reg?.IsDisabled() != true)
return true; // not in town? we can snoop any npc
return !to.Body.IsHuman || to is BaseCreature cret && (cret.AlwaysAttackable || cret.AlwaysMurderer);
return !to.Body.IsHuman || (to is BaseCreature cret && (cret.AlwaysAttackable || cret.AlwaysMurderer));
}
public static void Container_Snoop(Container cont, Mobile from)

View file

@ -6,7 +6,7 @@ using Server.Spells;
namespace Server.SkillHandlers
{
internal class SpiritSpeak
public static class SpiritSpeak
{
public static void Initialize()
{
@ -39,17 +39,17 @@ namespace Server.SkillHandlers
if (secs < 15)
secs = 15;
t.Delay = TimeSpan.FromSeconds(secs); //15seconds to 3 minutes
t.Delay = TimeSpan.FromSeconds(secs); // 15seconds to 3 minutes
t.Start();
m.CanHearGhosts = true;
}
m.PlaySound(0x24A);
m.SendLocalizedMessage(502444); //You contact the neitherworld.
m.SendLocalizedMessage(502444); // You contact the neitherworld.
}
else
{
m.SendLocalizedMessage(502443); //You fail to contact the neitherworld.
m.SendLocalizedMessage(502443); // You fail to contact the neitherworld.
m.CanHearGhosts = false;
}
@ -58,7 +58,7 @@ namespace Server.SkillHandlers
private class SpiritSpeakTimer : Timer
{
private Mobile m_Owner;
private readonly Mobile m_Owner;
public SpiritSpeakTimer(Mobile m) : base(TimeSpan.FromMinutes(2.0))
{
@ -69,13 +69,13 @@ namespace Server.SkillHandlers
protected override void OnTick()
{
m_Owner.CanHearGhosts = false;
m_Owner.SendLocalizedMessage(502445); //You feel your contact with the neitherworld fading.
m_Owner.SendLocalizedMessage(502445); // You feel your contact with the neitherworld fading.
}
}
private class SpiritSpeakSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo("Spirit Speak", "", 269);
private static readonly SpellInfo m_Info = new SpellInfo("Spirit Speak", "", 269);
public SpiritSpeakSpell(Mobile caster) : base(caster, null, m_Info)
{

View file

@ -13,7 +13,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class Stealing
public static class Stealing
{
public static readonly bool ClassicMode = false;
public static readonly bool SuspendOnMurder = false;
@ -61,7 +61,7 @@ namespace Server.SkillHandlers
private class StealingTarget : Target
{
private Mobile m_Thief;
private readonly Mobile m_Thief;
public StealingTarget(Mobile thief) : base(1, false, TargetFlags.None)
{
@ -113,9 +113,6 @@ namespace Server.SkillHandlers
{
m_Thief.SendLocalizedMessage(1048147); // Your backpack can't hold anything else.
}
#region Sigils
else if (toSteal is Sigil sig)
{
PlayerState pl = PlayerState.Find(m_Thief);
@ -133,15 +130,15 @@ namespace Server.SkillHandlers
{
if (!m_Thief.CanBeginAction<IncognitoSpell>())
{
m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito
m_Thief.SendLocalizedMessage(1010581); // You cannot steal the sigil when you are incognito
}
else if (DisguiseTimers.IsDisguised(m_Thief))
{
m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised
m_Thief.SendLocalizedMessage(1010583); // You cannot steal the sigil while disguised
}
else if (!m_Thief.CanBeginAction<PolymorphSpell>())
{
m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed
m_Thief.SendLocalizedMessage(1010582); // You cannot steal the sigil while polymorphed
}
else if (TransformationSpellHelper.UnderTransformation(m_Thief))
{
@ -158,7 +155,7 @@ namespace Server.SkillHandlers
}
else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction)
{
m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil
m_Thief.SendLocalizedMessage(1005590); // You cannot steal your own sigil
}
else if (sig.IsPurifying)
{
@ -169,12 +166,12 @@ namespace Server.SkillHandlers
if (Sigil.ExistsOn(m_Thief))
{
m_Thief.SendLocalizedMessage(
1010258); // The sigil has gone back to its home location because you already have a sigil.
1010258); // The sigil has gone back to its home location because you already have a sigil.
}
else if (m_Thief?.Backpack.CheckHold(m_Thief, sig, false, true) != true)
{
m_Thief.SendLocalizedMessage(
1010259); // The sigil has gone home because your backpack is full
1010259); // The sigil has gone home because your backpack is full
}
else
{
@ -194,17 +191,14 @@ namespace Server.SkillHandlers
}
else
{
m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil
m_Thief.SendLocalizedMessage(1005594); // You do not have enough skill to steal the sigil
}
}
else
{
m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that
m_Thief.SendLocalizedMessage(1005588); // You must join a faction to do that
}
}
#endregion
else if (si == null && (toSteal.Parent == null || !toSteal.Movable))
{
m_Thief.SendLocalizedMessage(502710); // You can't steal that!
@ -395,7 +389,7 @@ namespace Server.SkillHandlers
{
public static readonly TimeSpan StealTime = TimeSpan.FromMinutes(2.0);
private static Queue<StolenItem> m_Queue = new Queue<StolenItem>();
private static readonly Queue<StolenItem> m_Queue = new Queue<StolenItem>();
public StolenItem(Item stolen, Mobile thief, Mobile victim)
{
@ -406,13 +400,13 @@ namespace Server.SkillHandlers
Expires = DateTime.UtcNow + StealTime;
}
public Item Stolen{ get; }
public Item Stolen { get; }
public Mobile Thief{ get; }
public Mobile Thief { get; }
public Mobile Victim{ get; }
public Mobile Victim { get; }
public DateTime Expires{ get; private set; }
public DateTime Expires { get; private set; }
public bool IsExpired => DateTime.UtcNow >= Expires;

View file

@ -4,24 +4,27 @@ using Server.Mobiles;
namespace Server.SkillHandlers
{
// Stealth cannot be static because its used as a generic for CanBeginAction.
#pragma warning disable CA1052 // Static holder types should be Static or NotInheritable
public class Stealth
{
public static double HidingRequirement => Core.ML ? 30.0 : Core.SE ? 50.0 : 80.0;
public static int[,] ArmorTable{ get; } =
// TODO: Move to configuration
public static int[,] ArmorTable { get; } =
{
// Gorget Gloves Helmet Arms Legs Chest Shield
/* Cloth */ { 0, 0, 0, 0, 0, 0, 0 },
/* Leather */ { 0, 0, 0, 0, 0, 0, 0 },
/* Studded */ { 2, 2, 0, 4, 6, 10, 0 },
/* Bone */ { 0, 5, 10, 10, 15, 25, 0 },
/* Spined */ { 0, 0, 0, 0, 0, 0, 0 },
/* Horned */ { 0, 0, 0, 0, 0, 0, 0 },
/* Barbed */ { 0, 0, 0, 0, 0, 0, 0 },
/* Ring */ { 0, 5, 0, 10, 15, 25, 0 },
/* Chain */ { 0, 0, 10, 0, 15, 25, 0 },
/* Plate */ { 5, 5, 10, 10, 15, 25, 0 },
/* Dragon */ { 0, 5, 10, 10, 15, 25, 0 }
// Gorget Glove Helmet Arms Legs Chest Shield
/* Cloth */ { 0, 0, 0, 0, 0, 0, 0 },
/* Leather */ { 0, 0, 0, 0, 0, 0, 0 },
/* Studded */ { 2, 2, 0, 4, 6, 10, 0 },
/* Bone */ { 0, 5, 10, 10, 15, 25, 0 },
/* Spined */ { 0, 0, 0, 0, 0, 0, 0 },
/* Horned */ { 0, 0, 0, 0, 0, 0, 0 },
/* Barbed */ { 0, 0, 0, 0, 0, 0, 0 },
/* Ring */ { 0, 5, 0, 10, 15, 25, 0 },
/* Chain */ { 0, 0, 10, 0, 15, 25, 0 },
/* Plate */ { 5, 5, 10, 10, 15, 25, 0 },
/* Dragon */ { 0, 5, 10, 10, 15, 25, 0 }
};
public static void Initialize()
@ -74,7 +77,7 @@ namespace Server.SkillHandlers
{
int armorRating = GetArmorRating(m);
if (armorRating >= (Core.AOS ? 42 : 26)) //I have a hunch '42' was chosen cause someone's a fan of DNA
if (armorRating >= (Core.AOS ? 42 : 26)) // I have a hunch '42' was chosen cause someone's a fan of DNA
{
m.SendLocalizedMessage(502727); // You could not hope to move quietly wearing this much armor.
m.RevealingAction();
@ -106,4 +109,5 @@ namespace Server.SkillHandlers
return TimeSpan.FromSeconds(10.0);
}
}
}
#pragma warning restore CA1052 // Static holder types should be Static or NotInheritable
}

View file

@ -5,7 +5,7 @@ using Server.Targeting;
namespace Server.SkillHandlers
{
public class TasteID
public static class TasteID
{
public static void Initialize()
{
@ -77,4 +77,4 @@ namespace Server.SkillHandlers
}
}
}
}
}

View file

@ -8,9 +8,9 @@ using Server.Spells.Necromancy;
namespace Server.SkillHandlers
{
public class Tracking
public static class Tracking
{
private static Dictionary<Mobile, TrackingInfo> m_Table = new Dictionary<Mobile, TrackingInfo>();
private static readonly Dictionary<Mobile, TrackingInfo> m_Table = new Dictionary<Mobile, TrackingInfo>();
public static void Initialize()
{
@ -44,12 +44,11 @@ namespace Server.SkillHandlers
double bonus = Math.Sqrt(xDelta * xDelta + yDelta * yDelta);
m_Table.Remove(tracker); //Reset as of Pub 40, counting it as bug for Core.SE.
m_Table.Remove(tracker); // Reset as of Pub 40, counting it as bug for Core.SE.
return Core.ML ? Math.Min(bonus, 10 + tracker.Skills.Tracking.Value / 10) : bonus;
}
public static void ClearTrackingInfo(Mobile tracker)
{
m_Table.Remove(tracker);
@ -74,8 +73,8 @@ namespace Server.SkillHandlers
public class TrackWhatGump : Gump
{
private Mobile m_From;
private bool m_Success;
private readonly Mobile m_From;
private readonly bool m_Success;
public TrackWhatGump(Mobile from) : base(20, 30)
{
@ -117,7 +116,7 @@ namespace Server.SkillHandlers
public class TrackWhoGump : Gump
{
private static TrackTypeDelegate[] m_Delegates =
private static readonly TrackTypeDelegate[] m_Delegates =
{
IsAnimal,
IsMonster,
@ -125,10 +124,10 @@ namespace Server.SkillHandlers
IsPlayer
};
private Mobile m_From;
private readonly Mobile m_From;
private List<Mobile> m_List;
private int m_Range;
private readonly List<Mobile> m_List;
private readonly int m_Range;
private TrackWhoGump(Mobile from, List<Mobile> list, int range) : base(20, 30)
{
@ -218,12 +217,11 @@ namespace Server.SkillHandlers
if (!Core.AOS || !m.Player)
return true;
int tracking = from.Skills.Tracking.Fixed;
int detectHidden = from.Skills.DetectHidden.Fixed;
if (Core.ML && m.Race == Race.Elf)
tracking /= 2; //The 'Guide' says that it requires twice as Much tracking SKILL to track an elf. Not the total difficulty to track.
tracking /= 2; // The 'Guide' says that it requires twice as Much tracking SKILL to track an elf. Not the total difficulty to track.
int hiding = m.Skills.Hiding.Fixed;
int stealth = m.Skills.Stealth.Fixed;
@ -278,7 +276,7 @@ namespace Server.SkillHandlers
private class InternalSorter : IComparer<Mobile>
{
private Mobile m_From;
private readonly Mobile m_From;
public InternalSorter(Mobile from) => m_From = from;
@ -299,7 +297,7 @@ namespace Server.SkillHandlers
public class TrackArrow : QuestArrow
{
private Mobile m_From;
private Timer m_Timer;
private readonly Timer m_Timer;
public TrackArrow(Mobile from, Mobile target, int range) : base(from, target)
{
@ -335,10 +333,11 @@ namespace Server.SkillHandlers
public class TrackTimer : Timer
{
private QuestArrow m_Arrow;
private Mobile m_From, m_Target;
private readonly QuestArrow m_Arrow;
private readonly Mobile m_From;
private readonly Mobile m_Target;
private int m_LastX, m_LastY;
private int m_Range;
private readonly int m_Range;
public TrackTimer(Mobile from, Mobile target, int range, QuestArrow arrow) : base(TimeSpan.FromSeconds(0.25),
TimeSpan.FromSeconds(2.5))
@ -359,7 +358,7 @@ namespace Server.SkillHandlers
}
if (m_From.NetState == null || m_From.Deleted || m_Target.Deleted || m_From.Map != m_Target.Map ||
!m_From.InRange(m_Target, m_Range) || m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel)
!m_From.InRange(m_Target, m_Range) || (m_Target.Hidden && m_Target.AccessLevel > m_From.AccessLevel))
{
m_Arrow.Stop();
Stop();