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

@ -65,10 +65,10 @@ namespace Server.Items
private class LogoutGump : Gump
{
private Bedroll m_Bedroll;
private Timer m_CloseTimer;
private readonly Bedroll m_Bedroll;
private readonly Timer m_CloseTimer;
private CampfireEntry m_Entry;
private readonly CampfireEntry m_Entry;
public LogoutGump(CampfireEntry entry, Bedroll bedroll) : base(100, 0)
{

View file

@ -19,9 +19,9 @@ namespace Server.Items
private static readonly Dictionary<Mobile, CampfireEntry> m_Table = new Dictionary<Mobile, CampfireEntry>();
private List<CampfireEntry> m_Entries;
private readonly List<CampfireEntry> m_Entries;
private Timer m_Timer;
private readonly Timer m_Timer;
public Campfire() : base(0xDE3)
{
@ -39,7 +39,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public DateTime Created{ get; }
public DateTime Created { get; }
[CommandProperty(AccessLevel.GameMaster)]
public CampfireStatus Status
@ -176,11 +176,11 @@ namespace Server.Items
m_Safe = false;
}
public PlayerMobile Player{ get; }
public PlayerMobile Player { get; }
public Campfire Fire{ get; }
public Campfire Fire { get; }
public DateTime Start{ get; }
public DateTime Start { get; }
public bool Valid => !Fire.Deleted && Fire.Status != CampfireStatus.Off && Player.Map == Fire.Map &&
Player.InRange(Fire, Campfire.SecureRange);

View file

@ -18,7 +18,6 @@ namespace Server.Items
{
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);

View file

@ -49,7 +49,7 @@ namespace Server.Items
{
CraftResource.Bloodwood => 1075055,
CraftResource.Frostwood => 1075056,
CraftResource.Heartwood => 1075062, //WHY Osi. Why?
CraftResource.Heartwood => 1075062, // WHY Osi. Why?
_ => LabelNumber
};
}
@ -72,7 +72,6 @@ namespace Server.Items
}
}
public override void Serialize(IGenericWriter writer)
{
base.Serialize(writer);
@ -92,13 +91,13 @@ namespace Server.Items
{
case 3:
case 2:
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
if (version == 0 && Weight == 0.1 || version <= 2 && Weight == 2)
if ((version == 0 && Weight == 0.1) || (version <= 2 && Weight == 2))
Weight = -1;
if (version <= 1)
@ -106,7 +105,6 @@ namespace Server.Items
}
}
public class HeartwoodBoard : Board
{
[Constructible]

View file

@ -8,7 +8,7 @@ namespace Server.Items
[Flippable(0x1EBA, 0x1EBB)]
public class TaxidermyKit : Item
{
private static TrophyInfo[] m_Table =
private static readonly TrophyInfo[] m_Table =
{
new TrophyInfo(typeof(BrownBear), 0x1E60, 1041093, 1041107),
new TrophyInfo(typeof(GreatHart), 0x1E61, 1041095, 1041109),
@ -69,19 +69,18 @@ namespace Server.Items
AddonNumber = addonNum;
}
public Type CreatureType{ get; }
public Type CreatureType { get; }
public int NorthID{ get; }
public int NorthID { get; }
public int DeedNumber{ get; }
public int DeedNumber { get; }
public int AddonNumber{ get; }
public int AddonNumber { get; }
}
private class CorpseTarget : Target
{
private TaxidermyKit m_Kit;
private readonly TaxidermyKit m_Kit;
public CorpseTarget(TaxidermyKit kit) : base(3, false, TargetFlags.None) => m_Kit = kit;
@ -136,7 +135,6 @@ namespace Server.Items
fish.Consume();
}
from.AddToBackpack(new TrophyDeed(t, hunter, weight));
if (corpse != null)
@ -186,13 +184,13 @@ namespace Server.Items
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
[CommandProperty(AccessLevel.GameMaster)]
public int WestID{ get; set; }
public int WestID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int NorthID{ get; set; }
public int NorthID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int DeedNumber{ get; set; }
public int DeedNumber { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int AddonNumber
@ -278,19 +276,19 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Hunter = reader.ReadMobile();
m_AnimalWeight = reader.ReadInt();
goto case 0;
}
{
m_Hunter = reader.ReadMobile();
m_AnimalWeight = reader.ReadInt();
goto case 0;
}
case 0:
{
WestID = reader.ReadInt();
NorthID = reader.ReadInt();
DeedNumber = reader.ReadInt();
m_AddonNumber = reader.ReadInt();
break;
}
{
WestID = reader.ReadInt();
NorthID = reader.ReadInt();
DeedNumber = reader.ReadInt();
m_AddonNumber = reader.ReadInt();
break;
}
}
Timer.DelayCall(TimeSpan.Zero, FixMovingCrate);
@ -367,10 +365,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int WestID{ get; set; }
public int WestID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int NorthID{ get; set; }
public int NorthID { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int DeedNumber
@ -384,7 +382,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int AddonNumber{ get; set; }
public int AddonNumber { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Hunter
@ -447,19 +445,19 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Hunter = reader.ReadMobile();
m_AnimalWeight = reader.ReadInt();
goto case 0;
}
{
m_Hunter = reader.ReadMobile();
m_AnimalWeight = reader.ReadInt();
goto case 0;
}
case 0:
{
WestID = reader.ReadInt();
NorthID = reader.ReadInt();
m_DeedNumber = reader.ReadInt();
AddonNumber = reader.ReadInt();
break;
}
{
WestID = reader.ReadInt();
NorthID = reader.ReadInt();
m_DeedNumber = reader.ReadInt();
AddonNumber = reader.ReadInt();
break;
}
}
}

View file

@ -27,7 +27,7 @@ namespace Server.Items
public override int LabelNumber => 1041080; // a message in a bottle
[CommandProperty(AccessLevel.GameMaster)]
public Map TargetMap{ get; set; }
public Map TargetMap { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Level
@ -38,7 +38,7 @@ namespace Server.Items
public static int GetRandomLevel()
{
if (Core.AOS && 1 > Utility.Random(25))
if (Core.AOS && Utility.Random(25) < 1)
return 4; // ancient
return Utility.RandomMinMax(1, 3);
@ -65,20 +65,20 @@ namespace Server.Items
{
case 3:
case 2:
{
m_Level = reader.ReadInt();
goto case 1;
}
{
m_Level = reader.ReadInt();
goto case 1;
}
case 1:
{
TargetMap = reader.ReadMap();
break;
}
{
TargetMap = reader.ReadMap();
break;
}
case 0:
{
TargetMap = Map.Trammel;
break;
}
{
TargetMap = Map.Trammel;
break;
}
}
if (version < 2)

View file

@ -35,13 +35,13 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Map TargetMap{ get; set; }
public Map TargetMap { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D TargetLocation{ get; set; }
public Point3D TargetLocation { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int MessageIndex{ get; set; }
public int MessageIndex { get; set; }
public void UpdateHue()
{
@ -97,30 +97,30 @@ namespace Server.Items
case 4:
case 3:
case 2:
{
m_Level = reader.ReadInt();
goto case 1;
}
{
m_Level = reader.ReadInt();
goto case 1;
}
case 1:
{
TargetMap = reader.ReadMap();
TargetLocation = reader.ReadPoint3D();
MessageIndex = reader.ReadInt();
{
TargetMap = reader.ReadMap();
TargetLocation = reader.ReadPoint3D();
MessageIndex = reader.ReadInt();
break;
}
break;
}
case 0:
{
TargetMap = Map;
{
TargetMap = Map;
if (TargetMap == null || TargetMap == Map.Internal)
TargetMap = Map.Trammel;
if (TargetMap == null || TargetMap == Map.Internal)
TargetMap = Map.Trammel;
TargetLocation = FindLocation(TargetMap);
MessageIndex = Utility.Random(MessageEntry.Entries.Length);
TargetLocation = FindLocation(TargetMap);
MessageIndex = Utility.Random(MessageEntry.Entries.Length);
break;
}
break;
}
}
if (version < 2)
@ -144,7 +144,7 @@ namespace Server.Items
else
entry = MessageEntry.Entries[MessageIndex = Utility.Random(MessageEntry.Entries.Length)];
//from.CloseGump( typeof( MessageGump ) );
// from.CloseGump( typeof( MessageGump ) );
from.SendGump(new MessageGump(entry, TargetMap, TargetLocation));
}
else
@ -153,18 +153,18 @@ namespace Server.Items
}
}
private static int[] m_WaterTiles =
private static readonly int[] m_WaterTiles =
{
0x00A8, 0x00AB,
0x0136, 0x0137
};
private static Rectangle2D[] m_BritRegions = { new Rectangle2D(0, 0, 5120, 4096) };
private static readonly Rectangle2D[] m_BritRegions = { new Rectangle2D(0, 0, 5120, 4096) };
private static Rectangle2D[] m_IlshRegions =
private static readonly Rectangle2D[] m_IlshRegions =
{ new Rectangle2D(1472, 272, 304, 240), new Rectangle2D(1240, 1000, 312, 160) };
private static Rectangle2D[] m_MalasRegions = { new Rectangle2D(1376, 1520, 464, 280) };
private static readonly Rectangle2D[] m_MalasRegions = { new Rectangle2D(1376, 1520, 464, 280) };
public static Point3D FindLocation(Map map)
{
@ -242,12 +242,13 @@ namespace Server.Items
AddBackground(0, 40, 350, 300, 2520);
/* This is a message hastily scribbled by a passenger aboard a sinking ship.
* While it is probably too late to save the passengers and crew,
* perhaps some treasure went down with the ship!
* The message gives the ship's last known sextant co-ordinates.
*/
AddHtmlLocalized(30, 80, 285, 160, 1018326, true,
true); /* This is a message hastily scribbled by a passenger aboard a sinking ship.
* While it is probably too late to save the passengers and crew,
* perhaps some treasure went down with the ship!
* The message gives the ship's last known sextant co-ordinates.
*/
true);
AddHtml(35, 240, 230, 20, fmt);
@ -265,13 +266,13 @@ namespace Server.Items
Message = message;
}
public int Width{ get; }
public int Width { get; }
public int Height{ get; }
public int Height { get; }
public string Message{ get; }
public string Message { get; }
public static MessageEntry[] Entries{ get; } =
public static MessageEntry[] Entries { get; } =
{
new MessageEntry(280, 180,
"...Ar! {0} and a fair wind! No chance... storms, though--ar! Is that a sea serp...<br><br>uh oh."),

View file

@ -2,7 +2,7 @@ namespace Server.Items
{
public interface IShipwreckedItem
{
bool IsShipwreckedItem{ get; set; }
bool IsShipwreckedItem { get; set; }
}
public class ShipwreckedItem : Item, IDyable, IShipwreckedItem
@ -36,16 +36,12 @@ namespace Server.Items
return false;
}
#region IShipwreckedItem Members
bool IShipwreckedItem.IsShipwreckedItem
{
get => true;
set { }
}
#endregion
public override void OnSingleClick(Mobile from)
{
LabelTo(from, 1050039, $"#{LabelNumber}\t#1041645");

View file

@ -8,7 +8,7 @@ namespace Server.Items
{
public class SpecialFishingNet : Item
{
private static int[] m_Hues =
private static readonly int[] m_Hues =
{
0x09B,
0x0CD,
@ -26,13 +26,13 @@ namespace Server.Items
0x8AA
};
private static int[] m_WaterTiles =
private static readonly int[] m_WaterTiles =
{
0x00A8, 0x00AB,
0x0136, 0x0137
};
private static int[] m_UndeepWaterTiles =
private static readonly int[] m_UndeepWaterTiles =
{
0x1797, 0x179C
};
@ -42,7 +42,7 @@ namespace Server.Items
{
Weight = 1.0;
if (0.01 > Utility.RandomDouble())
if (Utility.RandomDouble() < 0.01)
Hue = Utility.RandomList(m_Hues);
else
Hue = 0x8A0;
@ -55,7 +55,7 @@ namespace Server.Items
public override int LabelNumber => 1041079; // a special fishing net
[CommandProperty(AccessLevel.GameMaster)]
public bool InUse{ get; set; }
public bool InUse { get; set; }
public virtual bool RequireDeepWater => true;
@ -90,14 +90,14 @@ namespace Server.Items
switch (version)
{
case 1:
{
InUse = reader.ReadBool();
{
InUse = reader.ReadBool();
if (InUse)
Delete();
if (InUse)
Delete();
break;
}
break;
}
}
Stackable = false;
@ -276,7 +276,7 @@ namespace Server.Items
LandTile t = map.Tiles.GetLandTile(tx, ty);
if (t.Z == p.Z && (t.ID >= 0xA8 && t.ID <= 0xAB || t.ID >= 0x136 && t.ID <= 0x137) &&
if (t.Z == p.Z && ((t.ID >= 0xA8 && t.ID <= 0xAB) || (t.ID >= 0x136 && t.ID <= 0x137)) &&
!SpellHelper.CheckMulti(new Point3D(tx, ty, p.Z), map))
{
x = tx;
@ -287,7 +287,7 @@ namespace Server.Items
spawn.MoveToWorld(new Point3D(x, y, p.Z), map);
if (spawn is Kraken && 0.2 > Utility.RandomDouble())
if (spawn is Kraken && Utility.RandomDouble() < 0.2)
spawn.PackItem(new MessageInABottle(map == Map.Felucca ? Map.Felucca : Map.Trammel));
}

View file

@ -10,8 +10,8 @@ namespace Server.Items
{
public interface IUsesRemaining
{
int UsesRemaining{ get; set; }
bool ShowUsesRemaining{ get; set; }
int UsesRemaining { get; set; }
bool ShowUsesRemaining { get; set; }
}
public abstract class BaseHarvestTool : Item, IUsesRemaining, ICraftable
@ -54,9 +54,7 @@ namespace Server.Items
}
}
public abstract HarvestSystem HarvestSystem{ get; }
#region ICraftable Members
public abstract HarvestSystem HarvestSystem { get; }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
@ -69,8 +67,6 @@ namespace Server.Items
return quality;
}
#endregion
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
{
@ -112,8 +108,8 @@ namespace Server.Items
base.GetProperties(list);
// Makers mark not displayed on OSI
//if ( m_Crafter != null )
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
// if (m_Crafter != null)
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
if (m_Quality == ToolQuality.Exceptional)
list.Add(1060636); // exceptional
@ -188,23 +184,23 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Crafter = reader.ReadMobile();
m_Quality = (ToolQuality)reader.ReadInt();
goto case 0;
}
{
m_Crafter = reader.ReadMobile();
m_Quality = (ToolQuality)reader.ReadInt();
goto case 0;
}
case 0:
{
m_UsesRemaining = reader.ReadInt();
break;
}
{
m_UsesRemaining = reader.ReadInt();
break;
}
}
}
private class ToggleMiningStoneEntry : ContextMenuEntry
{
private PlayerMobile m_Mobile;
private bool m_Value;
private readonly PlayerMobile m_Mobile;
private readonly bool m_Value;
public ToggleMiningStoneEntry(PlayerMobile mobile, bool value, int number) : base(number)
{
@ -213,7 +209,7 @@ namespace Server.Items
bool stoneMining = mobile.StoneMining && mobile.Skills.Mining.Base >= 100.0;
if (mobile.ToggleMiningStone == value || value && !stoneMining)
if (mobile.ToggleMiningStone == value || (value && !stoneMining))
Flags |= CMEFlags.Disabled;
}

View file

@ -147,21 +147,21 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_UsesRemaining = reader.ReadInt();
break;
}
{
m_UsesRemaining = reader.ReadInt();
break;
}
case 0:
{
m_UsesRemaining = 50;
break;
}
{
m_UsesRemaining = 50;
break;
}
}
}
private class InternalTarget : Target
{
private ProspectorsTool m_Tool;
private readonly ProspectorsTool m_Tool;
public InternalTarget(ProspectorsTool tool) : base(2, true, TargetFlags.None) => m_Tool = tool;

View file

@ -90,10 +90,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
if (version == 0)
@ -112,7 +112,7 @@ namespace Server.Items
return false;
}
base.ScissorHelper(from, item, 1, false);
this.ScissorHelper(from, item, 1, false);
return true;
}
}

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

View file

@ -95,7 +95,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private Bandage m_Bandage;
private readonly Bandage m_Bandage;
public InternalTarget(Bandage bandage) : base(Bandage.Range, false, TargetFlags.Beneficial) => m_Bandage = bandage;
@ -144,7 +144,7 @@ namespace Server.Items
public class BandageContext
{
private static Dictionary<Mobile, BandageContext> m_Table = new Dictionary<Mobile, BandageContext>();
private static readonly Dictionary<Mobile, BandageContext> m_Table = new Dictionary<Mobile, BandageContext>();
public BandageContext(Mobile healer, Mobile patient, TimeSpan delay)
{
@ -155,13 +155,13 @@ namespace Server.Items
Timer.Start();
}
public Mobile Healer{ get; }
public Mobile Healer { get; }
public Mobile Patient{ get; }
public Mobile Patient { get; }
public int Slips{ get; set; }
public int Slips { get; set; }
public Timer Timer{ get; private set; }
public Timer Timer { get; private set; }
public void Slip()
{
@ -227,9 +227,8 @@ namespace Server.Items
double anatomy = Healer.Skills[secondarySkill].Value;
double chance = (healing - 68.0) / 50.0 - Slips * 0.02;
if ((checkSkills = healing >= 80.0 && anatomy >= 80.0) && chance > Utility.RandomDouble()
|| Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == Healer
) //TODO: Dbl check doesn't check for faction of the horse here?
if (((checkSkills = healing >= 80.0 && anatomy >= 80.0) && chance > Utility.RandomDouble())
|| (Core.SE && petPatient is FactionWarHorse && petPatient.ControlMaster == Healer)) // TODO: Dbl check doesn't check for faction of the horse here?
{
if (Patient.Map?.CanFit(Patient.Location, 16, false, false) != true)
{
@ -494,7 +493,7 @@ namespace Server.Items
m_Table[healer] = context;
if (!onSelf)
patient.SendLocalizedMessage(1008078, false, healer.Name); // : Attempting to heal you.
patient.SendLocalizedMessage(1008078, false, healer.Name); // : Attempting to heal you.
healer.SendLocalizedMessage(500956); // You begin applying the bandages.
return context;
@ -505,7 +504,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private BandageContext m_Context;
private readonly BandageContext m_Context;
public InternalTimer(BandageContext context, TimeSpan delay) : base(delay)
{

View file

@ -89,14 +89,13 @@ namespace Server.Items
List<Mobile> targets = eable.Where(m =>
{
if (from == m || !SpellHelper.ValidIndirectTarget(from, m) || !from.CanBeHarmful(m, false)
|| Core.AOS && !from.InLOS(m))
|| (Core.AOS && !from.InLOS(m)))
return false;
if (m.Player)
playerVsPlayer = true;
return true;
}).ToList();
eable.Free();
@ -194,7 +193,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private FireHorn m_Horn;
private readonly FireHorn m_Horn;
public InternalTarget(FireHorn horn) : base(Core.AOS ? 3 : 2, true, TargetFlags.Harmful) => m_Horn = horn;

View file

@ -105,11 +105,11 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_RecipeID = reader.ReadInt();
{
m_RecipeID = reader.ReadInt();
break;
}
break;
}
}
}
}

View file

@ -23,8 +23,7 @@ namespace Server.Items
private double m_SkillLevel;
[Constructible]
public RepairDeed(RepairSkillType skill, double level, bool normalizeLevel) :
this(skill, level, null, normalizeLevel)
public RepairDeed(RepairSkillType skill, double level, bool normalizeLevel) : this(skill, level, null, normalizeLevel)
{
}
@ -95,7 +94,7 @@ namespace Server.Items
if (m_Crafter != null)
list.Add(1050043, m_Crafter.Name); // crafted by ~1_NAME~
//On OSI it says it's exceptional. Intentional difference.
// On OSI it says it's exceptional. Intentional difference.
}
public override void OnSingleClick(Mobile from)
@ -176,13 +175,13 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Skill = (RepairSkillType)reader.ReadInt();
m_SkillLevel = reader.ReadDouble();
m_Crafter = reader.ReadMobile();
{
m_Skill = (RepairSkillType)reader.ReadInt();
m_SkillLevel = reader.ReadDouble();
m_Crafter = reader.ReadMobile();
break;
}
break;
}
}
}
@ -202,16 +201,15 @@ namespace Server.Items
{
}
public TextDefinition NotNearbyMessage{ get; }
public TextDefinition NotNearbyMessage { get; }
public TextDefinition Name{ get; }
public TextDefinition Name { get; }
public CraftSystem System { get; }
public CraftSystem System{ get; }
public Type[] NearbyTypes { get; }
public Type[] NearbyTypes{ get; }
public static RepairSkillInfo[] Table{ get; } =
public static RepairSkillInfo[] Table { get; } =
{
new RepairSkillInfo(DefBlacksmithy.CraftSystem, typeof(Blacksmith), 1047013, 1023015),
new RepairSkillInfo(DefTailoring.CraftSystem, typeof(Tailor), 1061132, 1022981),

View file

@ -18,7 +18,7 @@ namespace Server.Items
public abstract class BaseInstrument : Item, ICraftable, ISlayer
{
private static Dictionary<Mobile, BaseInstrument> m_Instruments = new Dictionary<Mobile, BaseInstrument>();
private static readonly Dictionary<Mobile, BaseInstrument> m_Instruments = new Dictionary<Mobile, BaseInstrument>();
private Mobile m_Crafter;
private DateTime m_LastReplenished;
@ -40,10 +40,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int SuccessSound{ get; set; }
public int SuccessSound { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int FailureSound{ get; set; }
public int FailureSound { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public InstrumentQuality Quality
@ -113,8 +113,6 @@ namespace Server.Items
}
}
#region ICraftable Members
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
{
@ -126,8 +124,6 @@ namespace Server.Items
return quality;
}
#endregion
[CommandProperty(AccessLevel.GameMaster)]
public SlayerName Slayer
{
@ -160,7 +156,7 @@ namespace Server.Items
TimeSpan timeDifference = DateTime.UtcNow - m_LastReplenished;
m_UsesRemaining = Math.Min(m_UsesRemaining + (int)(timeDifference.Ticks / ChargeReplenishRate.Ticks),
InitMaxUses); //How rude of TimeSpan to not allow timespan division.
InitMaxUses); // How rude of TimeSpan to not allow timespan division.
m_LastReplenished = DateTime.UtcNow;
if (invalidate)
@ -171,7 +167,7 @@ namespace Server.Items
public void ScaleUses()
{
UsesRemaining = UsesRemaining * GetUsesScalar() / 100;
//InvalidateProperties();
// InvalidateProperties();
}
public void UnscaleUses()
@ -425,7 +421,6 @@ namespace Server.Items
if (m_ReplenishesCharges)
writer.Write(m_LastReplenished);
writer.Write(m_Crafter);
writer.WriteEncodedInt((int)m_Quality);
@ -447,51 +442,51 @@ namespace Server.Items
switch (version)
{
case 3:
{
m_ReplenishesCharges = reader.ReadBool();
{
m_ReplenishesCharges = reader.ReadBool();
if (m_ReplenishesCharges)
m_LastReplenished = reader.ReadDateTime();
if (m_ReplenishesCharges)
m_LastReplenished = reader.ReadDateTime();
goto case 2;
}
goto case 2;
}
case 2:
{
m_Crafter = reader.ReadMobile();
{
m_Crafter = reader.ReadMobile();
m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
m_Slayer = (SlayerName)reader.ReadEncodedInt();
m_Slayer2 = (SlayerName)reader.ReadEncodedInt();
m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
m_Slayer = (SlayerName)reader.ReadEncodedInt();
m_Slayer2 = (SlayerName)reader.ReadEncodedInt();
UsesRemaining = reader.ReadEncodedInt();
UsesRemaining = reader.ReadEncodedInt();
SuccessSound = reader.ReadEncodedInt();
FailureSound = reader.ReadEncodedInt();
SuccessSound = reader.ReadEncodedInt();
FailureSound = reader.ReadEncodedInt();
break;
}
break;
}
case 1:
{
m_Crafter = reader.ReadMobile();
{
m_Crafter = reader.ReadMobile();
m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
m_Slayer = (SlayerName)reader.ReadEncodedInt();
m_Quality = (InstrumentQuality)reader.ReadEncodedInt();
m_Slayer = (SlayerName)reader.ReadEncodedInt();
UsesRemaining = reader.ReadEncodedInt();
UsesRemaining = reader.ReadEncodedInt();
SuccessSound = reader.ReadEncodedInt();
FailureSound = reader.ReadEncodedInt();
SuccessSound = reader.ReadEncodedInt();
FailureSound = reader.ReadEncodedInt();
break;
}
break;
}
case 0:
{
SuccessSound = reader.ReadInt();
FailureSound = reader.ReadInt();
UsesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);
{
SuccessSound = reader.ReadInt();
FailureSound = reader.ReadInt();
UsesRemaining = Utility.RandomMinMax(InitMinUses, InitMaxUses);
break;
}
break;
}
}
CheckReplenishUses();
@ -540,7 +535,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Mobile m_From;
private readonly Mobile m_From;
public InternalTimer(Mobile from) : base(TimeSpan.FromSeconds(6.0))
{

View file

@ -24,11 +24,11 @@ namespace Server.Items
{
}
public virtual int WrongAmmoMessage => 1063329; //You can only load fukiya darts
public virtual int NoFreeHandMessage => 1063327; //You must have a free hand to use a fukiya.
public virtual int EmptyWeaponMessage => 1063325; //You have no fukiya darts!
public virtual int RecentlyUsedMessage => 1063326; //You are already using that fukiya.
public virtual int FullWeaponMessage => 1063330; //You can only load fukiya darts
public virtual int WrongAmmoMessage => 1063329; // You can only load fukiya darts
public virtual int NoFreeHandMessage => 1063327; // You must have a free hand to use a fukiya.
public virtual int EmptyWeaponMessage => 1063325; // You have no fukiya darts!
public virtual int RecentlyUsedMessage => 1063326; // You are already using that fukiya.
public virtual int FullWeaponMessage => 1063330; // You can only load fukiya darts
public virtual int WeaponMinRange => 0;
public virtual int WeaponMaxRange => 6;
@ -131,14 +131,14 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
{
m_UsesRemaining = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
break;
}
break;
}
}
}
}

View file

@ -100,14 +100,14 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
{
m_UsesRemaining = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
break;
}
break;
}
}
}
}

View file

@ -15,7 +15,6 @@ namespace Server.Items
[Constructible]
public LeatherNinjaBelt() : base(0x2790)
{
Weight = 1.0;
Layer = Layer.Waist;
@ -27,11 +26,11 @@ namespace Server.Items
public override CraftResource DefaultResource => CraftResource.RegularLeather;
public virtual int WrongAmmoMessage => 1063301; //You can only place shuriken in a ninja belt.
public virtual int NoFreeHandMessage => 1063299; //You must have a free hand to throw shuriken.
public virtual int EmptyWeaponMessage => 1063297; //You have no shuriken in your ninja belt!
public virtual int RecentlyUsedMessage => 1063298; //You cannot throw another shuriken yet.
public virtual int FullWeaponMessage => 1063302; //You cannot add any more shuriken.
public virtual int WrongAmmoMessage => 1063301; // You can only place shuriken in a ninja belt.
public virtual int NoFreeHandMessage => 1063299; // You must have a free hand to throw shuriken.
public virtual int EmptyWeaponMessage => 1063297; // You have no shuriken in your ninja belt!
public virtual int RecentlyUsedMessage => 1063298; // You cannot throw another shuriken yet.
public virtual int FullWeaponMessage => 1063302; // You cannot add any more shuriken.
public virtual int WeaponMinRange => 2;
public virtual int WeaponMaxRange => 10;
@ -145,14 +144,14 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
{
m_UsesRemaining = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
break;
}
break;
}
}
}
}

View file

@ -18,23 +18,23 @@ namespace Server.Items
{
public interface INinjaAmmo : IUsesRemaining
{
int PoisonCharges{ get; set; }
Poison Poison{ get; set; }
int PoisonCharges { get; set; }
Poison Poison { get; set; }
}
public interface INinjaWeapon : IUsesRemaining
{
int NoFreeHandMessage{ get; }
int EmptyWeaponMessage{ get; }
int RecentlyUsedMessage{ get; }
int FullWeaponMessage{ get; }
int WrongAmmoMessage{ get; }
Type AmmoType{ get; }
int PoisonCharges{ get; set; }
Poison Poison{ get; set; }
int WeaponDamage{ get; }
int WeaponMinRange{ get; }
int WeaponMaxRange{ get; }
int NoFreeHandMessage { get; }
int EmptyWeaponMessage { get; }
int RecentlyUsedMessage { get; }
int FullWeaponMessage { get; }
int WrongAmmoMessage { get; }
Type AmmoType { get; }
int PoisonCharges { get; set; }
Poison Poison { get; set; }
int WeaponDamage { get; }
int WeaponMinRange { get; }
int WeaponMaxRange { get; }
void AttackAnimation(Mobile from, Mobile to);
}
@ -114,8 +114,8 @@ namespace Server.Items
else
{
if (weapon.UsesRemaining > 0)
if (weapon.Poison == null && ammo.Poison != null
|| weapon.Poison != null && ammo.Poison != null && weapon.Poison.Level != ammo.Poison.Level)
if ((weapon.Poison == null && ammo.Poison != null)
|| (weapon.Poison != null && ammo.Poison != null && weapon.Poison.Level != ammo.Poison.Level))
{
Unload(from, weapon);
need = Math.Min(MaxUses, ammo.UsesRemaining);
@ -276,7 +276,7 @@ namespace Server.Items
public class LoadEntry : ContextMenuEntry
{
private INinjaWeapon weapon;
private readonly INinjaWeapon weapon;
public LoadEntry(INinjaWeapon wep, int entry)
: base(entry, 0) =>
@ -291,7 +291,7 @@ namespace Server.Items
public class UnloadEntry : ContextMenuEntry
{
private INinjaWeapon weapon;
private readonly INinjaWeapon weapon;
public UnloadEntry(INinjaWeapon wep, int entry)
: base(entry, 0)

View file

@ -101,14 +101,14 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
{
m_UsesRemaining = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
m_Poison = Poison.Deserialize(reader);
m_PoisonCharges = reader.ReadInt();
break;
}
break;
}
}
}
}

View file

@ -17,11 +17,11 @@ namespace Server.Items
Hues = hues;
}
public int Name{ get; }
public int Name { get; }
public string NameString{ get; }
public string NameString { get; }
public int[] Hues{ get; }
public int[] Hues { get; }
}
public class CustomHuePicker
@ -94,26 +94,25 @@ namespace Server.Items
TitleString = title;
}
public bool DefaultSupported{ get; }
public bool DefaultSupported { get; }
public CustomHueGroup[] Groups{ get; }
public CustomHueGroup[] Groups { get; }
public int Title{ get; }
public int Title { get; }
public string TitleString{ get; }
public string TitleString { get; }
}
public delegate void CustomHuePickerCallback<in T>(Mobile from, T state, int hue);
public class CustomHuePickerGump<T> : Gump
{
private CustomHuePickerCallback<T> m_Callback;
private CustomHuePicker m_Definition;
private Mobile m_From;
private T m_State;
private readonly CustomHuePickerCallback<T> m_Callback;
private readonly CustomHuePicker m_Definition;
private readonly Mobile m_From;
private readonly T m_State;
public CustomHuePickerGump(Mobile from, CustomHuePicker definition, CustomHuePickerCallback<T> callback, T state) :
base(50, 50)
public CustomHuePickerGump(Mobile from, CustomHuePicker definition, CustomHuePickerCallback<T> callback, T state) : base(50, 50)
{
m_From = from;
m_Definition = definition;
@ -181,34 +180,34 @@ namespace Server.Items
switch (info.ButtonID)
{
case 1: // Okay
{
int[] switches = info.Switches;
if (switches.Length > 0)
{
int index = switches[0];
int[] switches = info.Switches;
int group = index % m_Definition.Groups.Length;
index /= m_Definition.Groups.Length;
if (group >= 0 && group < m_Definition.Groups.Length)
if (switches.Length > 0)
{
int[] hues = m_Definition.Groups[group].Hues;
int index = switches[0];
if (index >= 0 && index < hues.Length)
m_Callback(m_From, m_State, hues[index]);
int group = index % m_Definition.Groups.Length;
index /= m_Definition.Groups.Length;
if (group >= 0 && group < m_Definition.Groups.Length)
{
int[] hues = m_Definition.Groups[group].Hues;
if (index >= 0 && index < hues.Length)
m_Callback(m_From, m_State, hues[index]);
}
}
break;
}
break;
}
case 2: // Default
{
if (m_Definition.DefaultSupported)
m_Callback(m_From, m_State, 0);
{
if (m_Definition.DefaultSupported)
m_Callback(m_From, m_State, 0);
break;
}
break;
}
}
}
}

View file

@ -70,7 +70,7 @@ namespace Server.Items
public virtual int FailMessage => 1042083;
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override void Serialize(IGenericWriter writer)
{
@ -92,17 +92,17 @@ namespace Server.Items
switch (version)
{
case 1:
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
{
Level = (SecureLevel)reader.ReadInt();
goto case 0;
}
case 0:
{
m_Redyable = reader.ReadBool();
m_DyedHue = reader.ReadInt();
{
m_Redyable = reader.ReadBool();
m_DyedHue = reader.ReadInt();
break;
}
break;
}
}
}
@ -127,7 +127,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private DyeTub m_Tub;
private readonly DyeTub m_Tub;
public InternalTarget(DyeTub tub) : base(1, false, TargetFlags.None) => m_Tub = tub;
@ -164,7 +164,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(item);
if (house == null || !house.HasLockedDownItem(item) && !house.HasSecureItem(item))
if (house == null || (!house.HasLockedDownItem(item) && !house.HasSecureItem(item)))
from.SendLocalizedMessage(501022); // Furniture must be locked down to paint it.
else if (!house.IsCoOwner(from))
from.SendLocalizedMessage(501023); // You must be the owner to use this item.
@ -217,9 +217,9 @@ namespace Server.Items
from.PlaySound(0x23E);
}
}
else if ((item is BaseArmor armor &&
else if (((item is BaseArmor armor &&
(armor.MaterialType == ArmorMaterialType.Leather ||
armor.MaterialType == ArmorMaterialType.Studded) || item is ElvenBoots ||
armor.MaterialType == ArmorMaterialType.Studded)) || item is ElvenBoots ||
item is WoodlandBelt) && m_Tub.AllowLeather)
{
if (!from.InRange(m_Tub.GetWorldLocation(), 1) || !from.InRange(item.GetWorldLocation(), 1))

View file

@ -18,7 +18,7 @@ namespace Server.Items
public override int LabelNumber => 1041246; // Furniture Dye Tub
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnDoubleClick(Mobile from)
{
@ -54,10 +54,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsRewardItem = reader.ReadBool();
break;
}
{
IsRewardItem = reader.ReadBool();
break;
}
}
if (LootType == LootType.Regular)

View file

@ -19,7 +19,7 @@ namespace Server.Items
public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnDoubleClick(Mobile from)
{
@ -55,10 +55,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsRewardItem = reader.ReadBool();
break;
}
{
IsRewardItem = reader.ReadBool();
break;
}
}
}
}

View file

@ -5,10 +5,10 @@ namespace Server.Items
{
public class MetallicHuePicker<T> : Gump
{
private CustomHuePickerCallback<T> m_Callback;
private readonly CustomHuePickerCallback<T> m_Callback;
private Mobile m_From;
private T m_State;
private readonly Mobile m_From;
private readonly T m_State;
public MetallicHuePicker(Mobile from, CustomHuePickerCallback<T> callback, T state)
: base(450, 450)
@ -61,16 +61,16 @@ namespace Server.Items
switch (info.ButtonID)
{
case 1: // Okay
{
if (info.Switches.Length > 0) m_Callback(m_From, m_State, info.Switches[0]);
break;
}
{
if (info.Switches.Length > 0) m_Callback(m_From, m_State, info.Switches[0]);
break;
}
case 2: // Default
{
m_Callback(m_From, m_State, 0);
{
m_Callback(m_From, m_State, 0);
break;
}
break;
}
}
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Items
public override int LabelNumber => 1006008; // Black Dye Tub
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnDoubleClick(Mobile from)
{
@ -55,10 +55,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsRewardItem = reader.ReadBool();
break;
}
{
IsRewardItem = reader.ReadBool();
break;
}
}
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Items
public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnDoubleClick(Mobile from)
{
@ -55,10 +55,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsRewardItem = reader.ReadBool();
break;
}
{
IsRewardItem = reader.ReadBool();
break;
}
}
}
}

View file

@ -15,7 +15,7 @@ namespace Server.Items
public override int LabelNumber => 1041285; // Special Dye Tub
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnDoubleClick(Mobile from)
{
@ -51,10 +51,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsRewardItem = reader.ReadBool();
break;
}
{
IsRewardItem = reader.ReadBool();
break;
}
}
}
}

View file

@ -19,7 +19,7 @@ namespace Server.Items
public override CustomHuePicker CustomHuePicker => CustomHuePicker.LeatherDyeTub;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnDoubleClick(Mobile from)
{
@ -55,10 +55,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
IsRewardItem = reader.ReadBool();
break;
}
{
IsRewardItem = reader.ReadBool();
break;
}
}
}
}

View file

@ -9,7 +9,6 @@ namespace Server.Items
LootType = LootType.Blessed;
}
public WhiteLeatherDyeTub(Serial serial)
: base(serial)
{

View file

@ -89,7 +89,7 @@ namespace Server.Items
private class InternalPicker : HuePicker
{
private DyeTub m_Tub;
private readonly DyeTub m_Tub;
public InternalPicker(DyeTub tub) : base(tub.ItemID) => m_Tub = tub;

View file

@ -53,7 +53,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private Scissors m_Item;
private readonly Scissors m_Item;
public InternalTarget(Scissors item) : base(2, false, TargetFlags.None) => m_Item = item;
@ -62,7 +62,7 @@ namespace Server.Items
if (m_Item.Deleted)
return;
/*if ( targeted is Item && !((Item)targeted).IsStandardLoot() )
/*if (targeted is Item && !((Item)targeted).IsStandardLoot())
{
from.SendLocalizedMessage( 502440 ); // Scissors can not be used on that to produce anything.
}
@ -71,7 +71,7 @@ namespace Server.Items
{
from.SendLocalizedMessage(
1062845 + Utility
.Random(3)); //"That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
.Random(3)); // "That doesn't seem like the smartest thing to do." / "That was an encounter you don't wish to repeat." / "Ha! You missed!"
}
else if (Core.SE && Utility.RandomDouble() > .20 && (from.Direction & Direction.Running) != 0 &&
Core.TickCount - from.LastMoveTime < from.ComputeMovementSpeed(from.Direction))
@ -110,4 +110,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -71,7 +71,7 @@ namespace Server.Items
public class DisguiseGump : Gump
{
private static DisguiseEntry[] m_HairEntries =
private static readonly DisguiseEntry[] m_HairEntries =
{
new DisguiseEntry(8251, 50700, 0, 5, 1011052), // Short
new DisguiseEntry(8261, 60710, 0, 3, 1011047), // Pageboy
@ -85,7 +85,7 @@ namespace Server.Items
new DisguiseEntry(0, 0, 0, 0, 1011051) // None
};
private static DisguiseEntry[] m_BeardEntries =
private static readonly DisguiseEntry[] m_BeardEntries =
{
new DisguiseEntry(8269, 50906, 0, 0, 1011401), // Vandyke
new DisguiseEntry(8257, 50808, 0, -2, 1011062), // Mustache
@ -97,9 +97,9 @@ namespace Server.Items
new DisguiseEntry(0, 0, 0, 0, 1011051) // None
};
private Mobile m_From;
private DisguiseKit m_Kit;
private bool m_Used;
private readonly Mobile m_From;
private readonly DisguiseKit m_Kit;
private readonly bool m_Used;
public DisguiseGump(Mobile from, DisguiseKit kit, bool startAtHair, bool used) : base(50, 50)
{
@ -228,11 +228,11 @@ namespace Server.Items
private class DisguiseEntry
{
public int m_GumpID;
public int m_ItemID;
public int m_Number;
public int m_OffsetX;
public int m_OffsetY;
public readonly int m_GumpID;
public readonly int m_ItemID;
public readonly int m_Number;
public readonly int m_OffsetX;
public readonly int m_OffsetY;
public DisguiseEntry(int itemID, int gumpID, int ox, int oy, int name)
{
@ -247,7 +247,7 @@ namespace Server.Items
public class DisguiseTimers
{
public static Dictionary<Mobile, Timer> Timers{ get; } = new Dictionary<Mobile, Timer>();
public static Dictionary<Mobile, Timer> Timers { get; } = new Dictionary<Mobile, Timer>();
public static void Initialize()
{
@ -294,7 +294,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Mobile m_Player;
private readonly Mobile m_Player;
public InternalTimer(Mobile m, TimeSpan delay) : base(delay)
{

View file

@ -17,7 +17,7 @@ namespace Server.Items
public DisguisePersistance(Serial serial) : base(serial) => Instance = this;
public static DisguisePersistance Instance{ get; private set; }
public static DisguisePersistance Instance { get; private set; }
public override string DefaultName => "Disguise Persistance - Internal";
@ -50,18 +50,18 @@ namespace Server.Items
switch (version)
{
case 0:
{
int count = reader.ReadInt();
for (int i = 0; i < count; ++i)
{
Mobile m = reader.ReadMobile();
DisguiseTimers.CreateTimer(m, reader.ReadTimeSpan());
m.NameMod = reader.ReadString();
}
int count = reader.ReadInt();
break;
}
for (int i = 0; i < count; ++i)
{
Mobile m = reader.ReadMobile();
DisguiseTimers.CreateTimer(m, reader.ReadTimeSpan());
m.NameMod = reader.ReadString();
}
break;
}
}
}

View file

@ -5,16 +5,15 @@ namespace Server.Items
{
public interface ILockpickable : IPoint2D
{
int LockLevel{ get; set; }
bool Locked{ get; set; }
Mobile Picker{ get; set; }
int MaxLockLevel{ get; set; }
int RequiredSkill{ get; set; }
int LockLevel { get; set; }
bool Locked { get; set; }
Mobile Picker { get; set; }
int MaxLockLevel { get; set; }
int RequiredSkill { get; set; }
void LockPick(Mobile from);
}
[Flippable(0x14fc, 0x14fb)]
public class Lockpick : Item
{
@ -54,7 +53,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private Lockpick m_Item;
private readonly Lockpick m_Item;
public InternalTarget(Lockpick item) : base(1, false, TargetFlags.None) => m_Item = item;
@ -88,9 +87,9 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Mobile m_From;
private ILockpickable m_Item;
private Lockpick m_Lockpick;
private readonly Mobile m_From;
private readonly ILockpickable m_Item;
private readonly Lockpick m_Lockpick;
public InternalTimer(Mobile from, ILockpickable item, Lockpick lockpick) : base(TimeSpan.FromSeconds(3.0))
{

View file

@ -20,7 +20,7 @@ namespace Server.Items
public const double SecondsPerUOMinute = 5.0;
public const double MinutesPerUODay = SecondsPerUOMinute * 24;
private static DateTime WorldStart = new DateTime(1997, 9, 1);
private static readonly DateTime WorldStart = new DateTime(1997, 9, 1);
[Constructible]
public Clock(int itemID = 0x104B) : base(itemID) => Weight = 3.0;
@ -29,7 +29,7 @@ namespace Server.Items
{
}
public static DateTime ServerStart{ get; private set; }
public static DateTime ServerStart { get; private set; }
public static void Initialize()
{

View file

@ -33,7 +33,7 @@ namespace Server.Items
return;
FindIngredientObjective obj = qs.FindObjective<FindIngredientObjective>();
if (obj?.Completed == false && obj.Ingredient == Ingredient.StarChart)
{
Clock.GetTime(from.Map, from.X, from.Y, out int hours, out int _);

View file

@ -11,7 +11,7 @@ namespace Server.Items
private static bool m_IsRunicTool;
private static int m_LuckChance;
private static SkillName[] m_PossibleBonusSkills =
private static readonly SkillName[] m_PossibleBonusSkills =
{
SkillName.Swords,
SkillName.Fencing,
@ -43,7 +43,7 @@ namespace Server.Items
SkillName.Ninjitsu
};
private static SkillName[] m_PossibleSpellbookSkills =
private static readonly SkillName[] m_PossibleSpellbookSkills =
{
SkillName.Magery,
SkillName.Meditation,
@ -51,8 +51,8 @@ namespace Server.Items
SkillName.MagicResist
};
private static BitArray m_Props = new BitArray(MaxProperties);
private static int[] m_Possible = new int[MaxProperties];
private static readonly BitArray m_Props = new BitArray(MaxProperties);
private static readonly int[] m_Possible = new int[MaxProperties];
private CraftResource m_Resource;
public BaseRunicTool(CraftResource resource, int itemID) : base(itemID) => m_Resource = resource;
@ -92,10 +92,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
{
m_Resource = (CraftResource)reader.ReadInt();
break;
}
}
}
@ -291,62 +291,62 @@ namespace Server.Items
switch (random)
{
case 0:
{
switch (Utility.Random(5))
{
case 0:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2);
break;
case 1:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2);
break;
case 2:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2);
break;
case 3:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2);
break;
case 4:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2);
break;
}
switch (Utility.Random(5))
{
case 0:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPhysicalArea, 2, 50, 2);
break;
case 1:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireArea, 2, 50, 2);
break;
case 2:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitColdArea, 2, 50, 2);
break;
case 3:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitPoisonArea, 2, 50, 2);
break;
case 4:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitEnergyArea, 2, 50, 2);
break;
}
break;
}
break;
}
case 1:
{
switch (Utility.Random(4))
{
case 0:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2);
break;
case 1:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2);
break;
case 2:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2);
break;
case 3:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2);
break;
}
switch (Utility.Random(4))
{
case 0:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitMagicArrow, 2, 50, 2);
break;
case 1:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitHarm, 2, 50, 2);
break;
case 2:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitFireball, 2, 50, 2);
break;
case 3:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.HitLightning, 2, 50, 2);
break;
}
break;
}
break;
}
case 2:
{
switch (Utility.Random(2))
{
case 0:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1);
break;
case 1:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10);
break;
}
switch (Utility.Random(2))
{
case 0:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.UseBestSkill, 1, 1);
break;
case 1:
ApplyAttribute(secondary, min, max, AosWeaponAttribute.MageWeapon, 1, 10);
break;
}
break;
}
break;
}
case 3:
ApplyAttribute(primary, min, max, AosAttribute.WeaponDamage, 1, 50);
break;
@ -446,22 +446,20 @@ namespace Server.Items
attrs[rand] = temp;
}
/*
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Cold, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Energy, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Fire, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Poison, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Cold, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Energy, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Fire, totalDamage );
totalDamage = AssignElementalDamage( weapon, AosElementAttribute.Poison, totalDamage );
weapon.AosElementDamages[AosElementAttribute.Physical] = 100 - totalDamage;
weapon.AosElementDamages[AosElementAttribute.Physical] = 100 - totalDamage;
* */
for (int i = 0; i < attrs.Length; i++)
totalDamage = AssignElementalDamage(weapon, attrs[i], totalDamage);
//Order is Cold, Energy, Fire, Poison -> Physical left
//Cannot be looped, AoselementAttribute is 'out of order'
// Order is Cold, Energy, Fire, Poison -> Physical left
// Cannot be looped, AoselementAttribute is 'out of order'
weapon.Hue = weapon.GetElementalDamageHue();
}
@ -489,10 +487,10 @@ namespace Server.Items
SlayerGroup
group = groups[
Utility.Random(groups.Length -
1)]; //-1 To Exclude the Fey Slayer which appears ONLY on a certain artifact.
1)]; // -1 To Exclude the Fey Slayer which appears ONLY on a certain artifact.
SlayerEntry entry;
if (10 > Utility.Random(100)) // 10% chance to do super slayer
if (Utility.Random(100) < 10) // 10% chance to do super slayer
{
entry = group.Super;
}
@ -646,7 +644,7 @@ namespace Server.Items
case 23:
ApplyResistance(armor, min, max, ResistanceType.Energy, 1, 15);
break;
/* End Armor */
/* End Armor */
}
}
}
@ -869,14 +867,14 @@ namespace Server.Items
case 1:
case 2:
case 3:
{
ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8);
{
ApplyAttribute(primary, min, max, AosAttribute.BonusInt, 1, 8);
for (int j = 0; j < 4; ++j)
m_Props.Set(j, true);
for (int j = 0; j < 4; ++j)
m_Props.Set(j, true);
break;
}
break;
}
case 4:
ApplyAttribute(primary, min, max, AosAttribute.BonusMana, 1, 8);
break;
@ -917,4 +915,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -57,9 +57,7 @@ namespace Server.Items
public virtual bool BreakOnDepletion => true;
public abstract CraftSystem CraftSystem{ get; }
#region ICraftable Members
public abstract CraftSystem CraftSystem { get; }
public int OnCraft(int quality, bool makersMark, Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool,
CraftItem craftItem, int resHue)
@ -72,8 +70,6 @@ namespace Server.Items
return quality;
}
#endregion
[CommandProperty(AccessLevel.GameMaster)]
public int UsesRemaining
{
@ -85,7 +81,7 @@ namespace Server.Items
}
}
private bool ShowUsesRemaining{ get; set; } = true;
private bool ShowUsesRemaining { get; set; } = true;
bool IUsesRemaining.ShowUsesRemaining
{
@ -117,8 +113,8 @@ namespace Server.Items
base.GetProperties(list);
// Makers mark not displayed on OSI
//if ( m_Crafter != null )
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
// if (m_Crafter != null)
// list.Add( 1050043, m_Crafter.Name ); // crafted by ~1_NAME~
if (m_Quality == ToolQuality.Exceptional)
list.Add(1060636); // exceptional
@ -163,8 +159,7 @@ namespace Server.Items
int num = system.CanCraft(from, this, null);
if (num > 0 && (num != 1044267 || !Core.SE)
) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
if (num > 0 && (num != 1044267 || !Core.SE)) // Blacksmithing shows the gump regardless of proximity of an anvil and forge after SE
{
from.SendLocalizedMessage(num);
}
@ -202,17 +197,17 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Crafter = reader.ReadMobile();
m_Quality = (ToolQuality)reader.ReadInt();
goto case 0;
}
{
m_Crafter = reader.ReadMobile();
m_Quality = (ToolQuality)reader.ReadInt();
goto case 0;
}
case 0:
{
m_UsesRemaining = reader.ReadInt();
break;
}
{
m_UsesRemaining = reader.ReadInt();
break;
}
}
}
}
}
}