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

@ -17,7 +17,6 @@ namespace Server.Items
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => Core.ML;
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);

View file

@ -11,10 +11,8 @@ namespace Server.Items
[DispellableField]
public class Moongate : Item
{
[Constructible]
public Moongate(bool dispellable = true) :
this(Point3D.Zero, null, dispellable)
[Constructible]
public Moongate(bool dispellable = true) : this(Point3D.Zero, null, dispellable)
{
}
@ -34,13 +32,13 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Target{ get; set; }
public Point3D Target { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Map TargetMap{ get; set; }
public Map TargetMap { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool Dispellable{ get; set; }
public bool Dispellable { get; set; }
public virtual bool ShowFeluccaWarning => false;
@ -65,13 +63,9 @@ namespace Server.Items
public virtual void CheckGate(Mobile m, int range)
{
#region Mondain's Legacy
if (m.Hidden && m.AccessLevel == AccessLevel.Player && Core.ML)
m.RevealingAction();
#endregion
new DelayTimer(m, this, range).Start();
}
@ -91,10 +85,10 @@ namespace Server.Items
{
mobile.SendLocalizedMessage(1049543); // You decide against traveling to Felucca while you are still young.
}
else if (m.Kills >= 5 && TargetMap != Map.Felucca ||
TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0 ||
TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0 ||
TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0)
else if ((m.Kills >= 5 && TargetMap != Map.Felucca) ||
(TargetMap == Map.Tokuno && (flags & ClientFlags.Tokuno) == 0) ||
(TargetMap == Map.Malas && (flags & ClientFlags.Malas) == 0) ||
(TargetMap == Map.Ilshenar && (flags & ClientFlags.Ilshenar) == 0))
{
m.SendLocalizedMessage(1019004); // You are not allowed to travel there.
}
@ -163,8 +157,8 @@ namespace Server.Items
public virtual void BeginConfirmation(Mobile from)
{
if (IsInTown(from.Location, from.Map) && !IsInTown(Target, TargetMap) ||
from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning)
if ((IsInTown(from.Location, from.Map) && !IsInTown(Target, TargetMap)) ||
(from.Map != Map.Felucca && TargetMap == Map.Felucca && ShowFeluccaWarning))
{
if (from.AccessLevel == AccessLevel.Player || !from.Hidden)
from.Send(new PlaySound(0x20E, from.Location));
@ -200,9 +194,9 @@ namespace Server.Items
private class DelayTimer : Timer
{
private Mobile m_From;
private Moongate m_Gate;
private int m_Range;
private readonly Mobile m_From;
private readonly Moongate m_Gate;
private readonly int m_Range;
public DelayTimer(Mobile from, Moongate gate, int range) : base(TimeSpan.FromSeconds(1.0))
{
@ -235,25 +229,25 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int GumpWidth{ get; set; }
public int GumpWidth { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int GumpHeight{ get; set; }
public int GumpHeight { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int TitleColor{ get; set; }
public int TitleColor { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int MessageColor{ get; set; }
public int MessageColor { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int TitleNumber{ get; set; }
public int TitleNumber { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int MessageNumber{ get; set; }
public int MessageNumber { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string MessageString{ get; set; }
public string MessageString { get; set; }
public virtual void Warning_Callback(Mobile from, bool okay)
{
@ -267,7 +261,7 @@ namespace Server.Items
{
from.CloseGump<WarningGump>();
from.SendGump(new WarningGump(TitleNumber, TitleColor,
MessageString == null ? MessageNumber : (object)MessageString, MessageColor, GumpWidth, GumpHeight,
MessageString ?? (object)MessageNumber, MessageColor, GumpWidth, GumpHeight,
okay => Warning_Callback(from, okay)));
}
else
@ -303,28 +297,28 @@ namespace Server.Items
switch (version)
{
case 0:
{
GumpWidth = reader.ReadEncodedInt();
GumpHeight = reader.ReadEncodedInt();
{
GumpWidth = reader.ReadEncodedInt();
GumpHeight = reader.ReadEncodedInt();
TitleColor = reader.ReadEncodedInt();
MessageColor = reader.ReadEncodedInt();
TitleColor = reader.ReadEncodedInt();
MessageColor = reader.ReadEncodedInt();
TitleNumber = reader.ReadEncodedInt();
MessageNumber = reader.ReadEncodedInt();
TitleNumber = reader.ReadEncodedInt();
MessageNumber = reader.ReadEncodedInt();
MessageString = reader.ReadString();
MessageString = reader.ReadString();
break;
}
break;
}
}
}
}
public class MoongateConfirmGump : Gump
{
private Mobile m_From;
private Moongate m_Gate;
private readonly Mobile m_From;
private readonly Moongate m_Gate;
public MoongateConfirmGump(Mobile from, Moongate gate) : base(Core.AOS ? 110 : 20, Core.AOS ? 100 : 30)
{

View file

@ -82,12 +82,12 @@ namespace Server.Items
{
case 1:
case 0:
{
m_Type = (PotionEffect)reader.ReadInt();
m_Held = reader.ReadInt();
{
m_Type = (PotionEffect)reader.ReadInt();
m_Held = reader.ReadInt();
break;
}
break;
}
}
if (version < 1)
@ -220,16 +220,12 @@ namespace Server.Items
if (m_Held == 0)
{
#region Mondain's Legacy
if ((int)pot.PotionEffect >= (int)PotionEffect.Invisibility)
{
from.SendLocalizedMessage(502232); // The keg is not designed to hold that type of object.
return false;
}
#endregion
if (GiveBottle(from, toHold))
{
m_Type = pot.PotionEffect;

View file

@ -69,7 +69,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public Point3D Target{ get; set; }
public Point3D Target { get; set; }
[CommandProperty(AccessLevel.Counselor, AccessLevel.GameMaster)]
public Map TargetMap
@ -116,21 +116,21 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_House = reader.ReadItem() as BaseHouse;
goto case 0;
}
{
m_House = reader.ReadItem() as BaseHouse;
goto case 0;
}
case 0:
{
m_Description = reader.ReadString();
m_Marked = reader.ReadBool();
Target = reader.ReadPoint3D();
m_TargetMap = reader.ReadMap();
{
m_Description = reader.ReadString();
m_Marked = reader.ReadBool();
Target = reader.ReadPoint3D();
m_TargetMap = reader.ReadMap();
CalculateHue();
CalculateHue();
break;
}
break;
}
}
}
@ -288,7 +288,7 @@ namespace Server.Items
private class RenamePrompt : Prompt
{
private RecallRune m_Rune;
private readonly RecallRune m_Rune;
public RenamePrompt(RecallRune rune) => m_Rune = rune;

View file

@ -14,8 +14,8 @@ namespace Server.Items
{
}
public abstract int DexOffset{ get; }
public abstract TimeSpan Duration{ get; }
public abstract int DexOffset { get; }
public abstract TimeSpan Duration { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -72,8 +72,6 @@ namespace Server.Items
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => Core.ML;
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -93,8 +91,8 @@ namespace Server.Items
PotionKeg keg = kegs[i];
// Should never happen
// if (keg == null)
// continue;
// if (keg == null)
// continue;
if (keg.Held <= 0 || keg.Held >= 100)
continue;
@ -115,8 +113,6 @@ namespace Server.Items
return 1;
}
#endregion
public static bool HasFreeHand(Mobile m)
{
Item handOne = m.FindItemOnLayer(Layer.OneHanded);
@ -187,10 +183,10 @@ namespace Server.Items
{
case 1:
case 0:
{
m_PotionEffect = (PotionEffect)reader.ReadInt();
break;
}
{
m_PotionEffect = (PotionEffect)reader.ReadInt();
break;
}
}
if (version == 0)
@ -205,13 +201,9 @@ namespace Server.Items
m.PlaySound(0x2D6);
#region Dueling
if (!DuelContext.IsFreeConsume(m))
m.AddToBackpack(new Bottle());
#endregion
if (m.Body.IsHuman && !m.Mounted)
m.Animate(34, 5, 1, true, false, 0);
}

View file

@ -7,7 +7,7 @@ namespace Server.Items
{
public abstract class BaseConflagrationPotion : BasePotion
{
private List<Mobile> m_Users = new List<Mobile>();
private readonly List<Mobile> m_Users = new List<Mobile>();
public BaseConflagrationPotion(PotionEffect effect) : base(0xF06, effect) => Hue = 0x489;
@ -15,8 +15,8 @@ namespace Server.Items
{
}
public abstract int MinDamage{ get; }
public abstract int MaxDamage{ get; }
public abstract int MinDamage { get; }
public abstract int MaxDamage { get; }
public override bool RequireFreeHand => false;
@ -78,20 +78,20 @@ namespace Server.Items
Effects.PlaySound(loc, map, 0x20C);
for (int i = -2; i <= 2; i++)
for (int j = -2; j <= 2; j++)
{
Point3D p = new Point3D(loc.X + i, loc.Y + j, loc.Z);
for (int j = -2; j <= 2; j++)
{
Point3D p = new Point3D(loc.X + i, loc.Y + j, loc.Z);
if (map.CanFit(p, 12, true, false) && from.InLOS(p))
new InternalItem(from, p, map, MinDamage, MaxDamage);
}
if (map.CanFit(p, 12, true, false) && from.InLOS(p))
new InternalItem(from, p, map, MinDamage, MaxDamage);
}
}
private class ThrowTarget : Target
{
public ThrowTarget(BaseConflagrationPotion potion) : base(12, true, TargetFlags.None) => Potion = potion;
public BaseConflagrationPotion Potion{ get; }
public BaseConflagrationPotion Potion { get; }
protected override void OnTarget(Mobile from, object targeted)
{
@ -147,7 +147,7 @@ namespace Server.Items
{
}
public Mobile From{ get; private set; }
public Mobile From { get; private set; }
public override bool BlocksFit => true;
@ -222,8 +222,8 @@ namespace Server.Items
private class InternalTimer : Timer
{
private DateTime m_End;
private InternalItem m_Item;
private readonly DateTime m_End;
private readonly InternalItem m_Item;
public InternalTimer(InternalItem item, DateTime end) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
{
@ -263,9 +263,7 @@ namespace Server.Items
}
}
#region Delay
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
public static void AddDelay(Mobile m)
{
@ -290,7 +288,5 @@ namespace Server.Items
m_Delay.Remove(m);
}
}
#endregion
}
}

View file

@ -9,7 +9,7 @@ namespace Server.Items
{
public abstract class BaseConfusionBlastPotion : BasePotion
{
private List<Mobile> m_Users = new List<Mobile>();
private readonly List<Mobile> m_Users = new List<Mobile>();
public BaseConfusionBlastPotion(PotionEffect effect) : base(0xF06, effect) => Hue = 0x48D;
@ -17,7 +17,7 @@ namespace Server.Items
{
}
public abstract int Radius{ get; }
public abstract int Radius { get; }
public override bool RequireFreeHand => false;
@ -96,7 +96,7 @@ namespace Server.Items
{
public ThrowTarget(BaseConfusionBlastPotion potion) : base(12, true, TargetFlags.None) => Potion = potion;
public BaseConfusionBlastPotion Potion{ get; }
public BaseConfusionBlastPotion Potion { get; }
protected override void OnTarget(Mobile from, object targeted)
{
@ -125,8 +125,6 @@ namespace Server.Items
}
}
#region Effects
public virtual void BlastEffect(Point3D p, Map map)
{
if (map.CanFit(p, 12, true, false))
@ -138,11 +136,7 @@ namespace Server.Items
Geometry.Circle2D(p, m, Radius, BlastEffect, 90, 270);
}
#endregion
#region Delay
private static Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Delay = new Dictionary<Mobile, Timer>();
public static void AddDelay(Mobile m)
{
@ -167,7 +161,5 @@ namespace Server.Items
m_Delay.Remove(m);
}
}
#endregion
}
}

View file

@ -12,9 +12,9 @@ namespace Server.Items
Chance = chance;
}
public Poison Poison{ get; }
public Poison Poison { get; }
public double Chance{ get; }
public double Chance { get; }
}
public abstract class BaseCurePotion : BasePotion
@ -27,7 +27,7 @@ namespace Server.Items
{
}
public abstract CureLevelInfo[] LevelInfo{ get; }
public abstract CureLevelInfo[] LevelInfo { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public class CurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo =
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 0.75), // 75% chance to cure regular poison
@ -10,7 +10,7 @@ namespace Server.Items
new CureLevelInfo(Poison.Deadly, 0.15) // 15% chance to cure deadly poison
};
private static CureLevelInfo[] m_AosLevelInfo =
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00),
new CureLevelInfo(Poison.Regular, 0.95),

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public class GreaterCurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo =
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00), // 100% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 1.00), // 100% chance to cure regular poison
@ -11,7 +11,7 @@ namespace Server.Items
new CureLevelInfo(Poison.Lethal, 0.25) // 25% chance to cure lethal poison
};
private static CureLevelInfo[] m_AosLevelInfo =
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 1.00),
new CureLevelInfo(Poison.Regular, 1.00),

View file

@ -2,14 +2,14 @@ namespace Server.Items
{
public class LesserCurePotion : BaseCurePotion
{
private static CureLevelInfo[] m_OldLevelInfo =
private static readonly CureLevelInfo[] m_OldLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 0.75), // 75% chance to cure lesser poison
new CureLevelInfo(Poison.Regular, 0.50), // 50% chance to cure regular poison
new CureLevelInfo(Poison.Greater, 0.15) // 15% chance to cure greater poison
};
private static CureLevelInfo[] m_AosLevelInfo =
private static readonly CureLevelInfo[] m_AosLevelInfo =
{
new CureLevelInfo(Poison.Lesser, 0.75),
new CureLevelInfo(Poison.Regular, 0.50),

View file

@ -11,9 +11,9 @@ namespace Server.Items
{
private const int ExplosionRange = 2; // How long is the blast radius?
private static bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
private static bool InstantExplosion = false; // Should explosion potions explode on impact?
private static bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
private static readonly bool LeveledExplosion = false; // Should explosion potions explode other nearby potions?
private static readonly bool InstantExplosion = false; // Should explosion potions explode on impact?
private static readonly bool RelativeLocation = false; // Is the explosion target location relative for mobiles?
private Timer m_Timer;
@ -25,12 +25,12 @@ namespace Server.Items
{
}
public abstract int MinDamage{ get; }
public abstract int MaxDamage{ get; }
public abstract int MinDamage { get; }
public abstract int MaxDamage { get; }
public override bool RequireFreeHand => false;
public List<Mobile> Users{ get; private set; }
public List<Mobile> Users { get; private set; }
public override void Serialize(IGenericWriter writer)
{
@ -179,8 +179,8 @@ namespace Server.Items
List<IEntity> toExplode = eable.Where(o =>
{
if (!(o is Mobile mobile) || from != null &&
(!SpellHelper.ValidIndirectTarget(from, mobile) || !from.CanBeHarmful(mobile, false)))
if (!(o is Mobile mobile) || (from != null &&
(!SpellHelper.ValidIndirectTarget(from, mobile) || !from.CanBeHarmful(mobile, false))))
return o is BaseExplosionPotion && o != this;
++toDamage;
@ -222,7 +222,7 @@ namespace Server.Items
{
public ThrowTarget(BaseExplosionPotion potion) : base(12, true, TargetFlags.None) => Potion = potion;
public BaseExplosionPotion Potion{ get; }
public BaseExplosionPotion Potion { get; }
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -14,9 +14,9 @@ namespace Server.Items
{
}
public abstract int MinHeal{ get; }
public abstract int MaxHeal{ get; }
public abstract double Delay{ get; }
public abstract int MinHeal { get; }
public abstract int MaxHeal { get; }
public abstract double Delay { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -5,7 +5,7 @@ namespace Server.Items
{
public class InvisibilityPotion : BasePotion
{
private static Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
private static readonly Dictionary<Mobile, Timer> m_Table = new Dictionary<Mobile, Timer>();
[Constructible]
public InvisibilityPotion() : base(0xF0A, PotionEffect.Invisibility) => Hue = 0x48D;
@ -44,7 +44,7 @@ namespace Server.Items
m.Hidden = true;
BuffInfo.RemoveBuff(m, BuffIcon.HidingAndOrStealth);
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825)); //Invisibility/Invisible
BuffInfo.AddBuff(m, new BuffInfo(BuffIcon.Invisibility, 1075825)); // Invisibility/Invisible
RemoveTimer(m);

View file

@ -12,10 +12,10 @@ namespace Server.Items
{
}
public abstract Poison Poison{ get; }
public abstract Poison Poison { get; }
public abstract double MinPoisoningSkill{ get; }
public abstract double MaxPoisoningSkill{ get; }
public abstract double MinPoisoningSkill { get; }
public abstract double MaxPoisoningSkill { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -12,7 +12,7 @@ namespace Server.Items
{
}
public abstract double Refresh{ get; }
public abstract double Refresh { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -14,8 +14,8 @@ namespace Server.Items
{
}
public abstract int StrOffset{ get; }
public abstract TimeSpan Duration{ get; }
public abstract int StrOffset { get; }
public abstract TimeSpan Duration { get; }
public override void Serialize(IGenericWriter writer)
{

View file

@ -58,7 +58,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public DateTime NextUse{ get; set; }
public DateTime NextUse { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Crafter
@ -83,16 +83,16 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int CurCharges{ get; set; }
public int CurCharges { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int MaxCharges{ get; set; }
public int MaxCharges { get; set; }
public List<Mobile> Openers{ get; set; } = new List<Mobile>();
public List<Mobile> Openers { get; set; } = new List<Mobile>();
public override int LabelNumber => 1041267; // runebook
public List<RunebookEntry> Entries{ get; private set; }
public List<RunebookEntry> Entries { get; private set; }
public RunebookEntry Default
{
@ -114,8 +114,6 @@ namespace Server.Items
public override bool DisplayLootType => Core.AOS;
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -134,10 +132,8 @@ namespace Server.Items
return quality;
}
#endregion
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override bool AllowEquippedCast(Mobile from) => true;
@ -184,36 +180,36 @@ namespace Server.Items
switch (version)
{
case 3:
{
m_Quality = (BookQuality)reader.ReadByte();
goto case 2;
}
{
m_Quality = (BookQuality)reader.ReadByte();
goto case 2;
}
case 2:
{
m_Crafter = reader.ReadMobile();
goto case 1;
}
{
m_Crafter = reader.ReadMobile();
goto case 1;
}
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
int count = reader.ReadInt();
{
int count = reader.ReadInt();
Entries = new List<RunebookEntry>(count);
Entries = new List<RunebookEntry>(count);
for (int i = 0; i < count; ++i)
Entries.Add(new RunebookEntry(reader));
for (int i = 0; i < count; ++i)
Entries.Add(new RunebookEntry(reader));
m_Description = reader.ReadString();
CurCharges = reader.ReadInt();
MaxCharges = reader.ReadInt();
m_DefaultIndex = reader.ReadInt();
m_Description = reader.ReadString();
CurCharges = reader.ReadInt();
MaxCharges = reader.ReadInt();
m_DefaultIndex = reader.ReadInt();
break;
}
break;
}
}
}
@ -346,7 +342,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(this);
return (house?.IsAosRules != true || house.Public && !house.IsBanned(m) || house.HasAccess(m)) &&
return (house?.IsAosRules != true || (house.Public && !house.IsBanned(m)) || house.HasAccess(m)) &&
house?.HasSecureAccess(m, Level) == true;
}
@ -437,28 +433,28 @@ namespace Server.Items
switch (version)
{
case 1:
{
House = reader.ReadItem() as BaseHouse;
goto case 0;
}
{
House = reader.ReadItem() as BaseHouse;
goto case 0;
}
case 0:
{
Location = reader.ReadPoint3D();
Map = reader.ReadMap();
Description = reader.ReadString();
{
Location = reader.ReadPoint3D();
Map = reader.ReadMap();
Description = reader.ReadString();
break;
}
break;
}
}
}
public Point3D Location{ get; }
public Point3D Location { get; }
public Map Map{ get; }
public Map Map { get; }
public string Description{ get; }
public string Description { get; }
public BaseHouse House{ get; }
public BaseHouse House { get; }
public void Serialize(IGenericWriter writer)
{

View file

@ -21,7 +21,7 @@ namespace Server.Items
{
}
public int SpellID{ get; private set; }
public int SpellID { get; private set; }
int ICommodity.DescriptionNumber => LabelNumber;
bool ICommodity.IsDeedable => Core.ML;
@ -44,11 +44,11 @@ namespace Server.Items
switch (version)
{
case 0:
{
SpellID = reader.ReadInt();
{
SpellID = reader.ReadInt();
break;
}
break;
}
}
}

View file

@ -30,9 +30,9 @@ namespace Server.Items
public class Spellbook : Item, ICraftable, ISlayer
{
private static Dictionary<Mobile, List<Spellbook>> m_Table = new Dictionary<Mobile, List<Spellbook>>();
private static readonly Dictionary<Mobile, List<Spellbook>> m_Table = new Dictionary<Mobile, List<Spellbook>>();
private static int[] m_LegendPropertyCounts =
private static readonly int[] m_LegendPropertyCounts =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 properties : 21/52 : 40%
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 property : 15/52 : 29%
@ -40,7 +40,7 @@ namespace Server.Items
3, 3, 3, 3, 3, 3 // 3 properties : 6/52 : 12%
};
private static int[] m_ElderPropertyCounts =
private static readonly int[] m_ElderPropertyCounts =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 properties : 15/34 : 44%
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 1 property : 10/34 : 29%
@ -48,7 +48,7 @@ namespace Server.Items
3, 3, 3 // 3 properties : 3/34 : 9%
};
private static int[] m_GrandPropertyCounts =
private static readonly int[] m_GrandPropertyCounts =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 properties : 10/20 : 50%
1, 1, 1, 1, 1, 1, // 1 property : 6/20 : 30%
@ -56,14 +56,14 @@ namespace Server.Items
3 // 3 properties : 1/20 : 5%
};
private static int[] m_MasterPropertyCounts =
private static readonly int[] m_MasterPropertyCounts =
{
0, 0, 0, 0, 0, 0, // 0 properties : 6/10 : 60%
1, 1, 1, // 1 property : 3/10 : 30%
2 // 2 properties : 1/10 : 10%
};
private static int[] m_AdeptPropertyCounts =
private static readonly int[] m_AdeptPropertyCounts =
{
0, 0, 0, // 0 properties : 3/4 : 75%
1 // 1 property : 1/4 : 25%
@ -75,7 +75,6 @@ namespace Server.Items
private string m_EngravedText;
private BookQuality m_Quality;
private SlayerName m_Slayer;
private SlayerName m_Slayer2;
@ -121,10 +120,10 @@ namespace Server.Items
public override bool DisplayWeight => false;
[CommandProperty(AccessLevel.GameMaster)]
public AosAttributes Attributes{ get; private set; }
public AosAttributes Attributes { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public AosSkillBonuses SkillBonuses{ get; private set; }
public AosSkillBonuses SkillBonuses { get; private set; }
public virtual SpellbookType SpellbookType => SpellbookType.Regular;
public virtual int BookOffset => 0;
@ -154,7 +153,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int SpellCount{ get; private set; }
public int SpellCount { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Crafter
@ -217,7 +216,7 @@ namespace Server.Items
return quality;
}
//Currently though there are no dual slayer spellbooks, OSI has a habit of putting dual slayer stuff in later
// Currently though there are no dual slayer spellbooks, OSI has a habit of putting dual slayer stuff in later
[CommandProperty(AccessLevel.GameMaster)]
public SlayerName Slayer
@ -318,7 +317,7 @@ namespace Server.Items
if (move != null)
SpecialMove.SetCurrentMove(from, move);
else
SpellRegistry.NewSpell(spellId, @from, null)?.Cast();
SpellRegistry.NewSpell(spellId, from, null)?.Cast();
}
private static void EventSink_CastSpellRequest(Mobile from, int spellID, Item item)
@ -432,7 +431,7 @@ namespace Server.Items
Spellbook book = list[i];
if (!book.Deleted && (book.Parent == from || pack != null && book.Parent == pack) &&
if (!book.Deleted && (book.Parent == from || (pack != null && book.Parent == pack)) &&
ValidateSpellbook(book, spellID, type))
return book;
@ -704,7 +703,7 @@ namespace Server.Items
if ((prop = Attributes.RegenMana) != 0)
list.Add(1060440, prop.ToString()); // mana regeneration ~1_val~
if ((Attributes.NightSight) != 0)
if (Attributes.NightSight != 0)
list.Add(1060441); // night sight
if ((prop = Attributes.ReflectPhysical) != 0)
@ -716,7 +715,7 @@ namespace Server.Items
if ((prop = Attributes.RegenHits) != 0)
list.Add(1060444, prop.ToString()); // hit point regeneration ~1_val~
if ((Attributes.SpellChanneling) != 0)
if (Attributes.SpellChanneling != 0)
list.Add(1060482); // spell channeling
if ((prop = Attributes.SpellDamage) != 0)
@ -751,7 +750,7 @@ namespace Server.Items
{
Container pack = from.Backpack;
if (Parent == from || pack != null && Parent == pack)
if (Parent == from || (pack != null && Parent == pack))
DisplayTo(from);
else
from.SendLocalizedMessage(
@ -789,42 +788,42 @@ namespace Server.Items
switch (version)
{
case 5:
{
m_Quality = (BookQuality)reader.ReadByte();
{
m_Quality = (BookQuality)reader.ReadByte();
goto case 4;
}
goto case 4;
}
case 4:
{
m_EngravedText = reader.ReadString();
{
m_EngravedText = reader.ReadString();
goto case 3;
}
goto case 3;
}
case 3:
{
m_Crafter = reader.ReadMobile();
goto case 2;
}
{
m_Crafter = reader.ReadMobile();
goto case 2;
}
case 2:
{
m_Slayer = (SlayerName)reader.ReadInt();
m_Slayer2 = (SlayerName)reader.ReadInt();
goto case 1;
}
{
m_Slayer = (SlayerName)reader.ReadInt();
m_Slayer2 = (SlayerName)reader.ReadInt();
goto case 1;
}
case 1:
{
Attributes = new AosAttributes(this, reader);
SkillBonuses = new AosSkillBonuses(this, reader);
{
Attributes = new AosAttributes(this, reader);
SkillBonuses = new AosSkillBonuses(this, reader);
goto case 0;
}
goto case 0;
}
case 0:
{
m_Content = reader.ReadULong();
SpellCount = reader.ReadInt();
{
m_Content = reader.ReadULong();
SpellCount = reader.ReadInt();
break;
}
break;
}
}
Attributes ??= new AosAttributes(this);