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

@ -97,11 +97,11 @@
{
return element switch
{
AosElementAttribute.Physical => (label ? 1071091 : 0), // Earring of Protection (Physical) 1071091
AosElementAttribute.Fire => (label ? 1071092 : 0x4ec), // Earring of Protection (Fire) 1071092
AosElementAttribute.Cold => (label ? 1071093 : 0x4f2), // Earring of Protection (Cold) 1071093
AosElementAttribute.Poison => (label ? 1071094 : 0x4f8), // Earring of Protection (Poison) 1071094
AosElementAttribute.Energy => (label ? 1071095 : 0x4fe), // Earring of Protection (Energy) 1071095
AosElementAttribute.Physical => label ? 1071091 : 0, // Earring of Protection (Physical) 1071091
AosElementAttribute.Fire => label ? 1071092 : 0x4ec, // Earring of Protection (Fire) 1071092
AosElementAttribute.Cold => label ? 1071093 : 0x4f2, // Earring of Protection (Cold) 1071093
AosElementAttribute.Poison => label ? 1071094 : 0x4f8, // Earring of Protection (Poison) 1071094
AosElementAttribute.Energy => label ? 1071095 : 0x4fe, // Earring of Protection (Energy) 1071095
_ => -1
};
}

View file

@ -13,7 +13,7 @@ namespace Server.Items
public StopMusic() : base(0x6D, 3)
{
m_Stream.Write((short)0x1FFF);
Stream.Write((short)0x1FFF);
}
}
@ -76,10 +76,10 @@ namespace Server.Items
public override int LabelNumber => 1075198; // Dawn<77>s Music Box
public List<MusicName> Tracks{ get; private set; }
public List<MusicName> Tracks { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override void OnAfterDuped(Item newItem)
{

View file

@ -30,7 +30,7 @@ namespace Server.Items
public static DawnsMusicGear RandomRare => new DawnsMusicGear(DawnsMusicBox.RandomTrack(DawnsMusicRarity.Rare));
[CommandProperty(AccessLevel.GameMaster)]
public MusicName Music{ get; set; }
public MusicName Music { get; set; }
public override void AddNameProperty(ObjectPropertyList list)
{
@ -76,10 +76,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
Music = (MusicName)reader.ReadInt();
break;
}
{
Music = (MusicName)reader.ReadInt();
break;
}
}
if (version == 0) // Music wasn't serialized in version 0, pick a new track of random rarity
@ -100,7 +100,7 @@ namespace Server.Items
public class InternalTarget : Target
{
private DawnsMusicGear m_Gear;
private readonly DawnsMusicGear m_Gear;
public InternalTarget(DawnsMusicGear gear) : base(2, false, TargetFlags.None) => m_Gear = gear;

View file

@ -15,8 +15,8 @@
Rarity = rarity;
}
public int Name{ get; }
public int Name { get; }
public DawnsMusicRarity Rarity{ get; }
public DawnsMusicRarity Rarity { get; }
}
}

View file

@ -37,7 +37,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -31,7 +31,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -135,7 +135,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
writer.Write(m_Charges);
writer.Write(m_Timer.Next);
@ -231,7 +231,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
writer.Write(m_Charges);
}

View file

@ -23,7 +23,7 @@
{
base.Serialize(writer);
writer.WriteEncodedInt(1); //version
writer.WriteEncodedInt(1); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -36,7 +36,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -85,7 +85,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -113,7 +113,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -141,7 +141,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)
@ -169,7 +169,7 @@ namespace Server.Items
{
base.Serialize(writer);
writer.WriteEncodedInt(0); //version
writer.WriteEncodedInt(0); // version
}
public override void Deserialize(IGenericReader reader)

View file

@ -15,7 +15,7 @@
}
public override int Hue => 1150;
public override int LabelNumber => 1075239; //Lucky Necklace 1075239
public override int LabelNumber => 1075239; // Lucky Necklace 1075239
public override void Serialize(IGenericWriter writer)
{

View file

@ -93,7 +93,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private BrokenBedDeed m_Deed;
private readonly BrokenBedDeed m_Deed;
public InternalGump(BrokenBedDeed deed) : base(60, 36)
{

View file

@ -89,7 +89,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private BrokenVanityDeed m_Deed;
private readonly BrokenVanityDeed m_Deed;
public InternalGump(BrokenVanityDeed deed) : base(60, 63)
{

View file

@ -99,10 +99,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Bonus = reader.ReadInt();
break;
}
{
m_Bonus = reader.ReadInt();
break;
}
}
if (m_Bonus != 0 && Parent is Mobile mobile)

View file

@ -221,10 +221,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Bonus = reader.ReadInt();
break;
}
{
m_Bonus = reader.ReadInt();
break;
}
}
if (m_Bonus != 0 && Parent is Mobile mobile)

View file

@ -55,10 +55,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_UsesRemaining = reader.ReadInt();
break;
}
{
m_UsesRemaining = reader.ReadInt();
break;
}
}
}
@ -91,7 +91,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private PowderOfTemperament m_Powder;
private readonly PowderOfTemperament m_Powder;
public InternalTarget(PowderOfTemperament powder) : base(2, false, TargetFlags.None) => m_Powder = powder;
@ -111,7 +111,7 @@ namespace Server.Items
return;
}
if ((item.IsChildOf(from.Backpack) || Core.ML && item.Parent == from) &&
if ((item.IsChildOf(from.Backpack) || (Core.ML && item.Parent == from)) &&
m_Powder.IsChildOf(from.Backpack))
{
int origMaxHP = wearable.MaxHitPoints;

View file

@ -18,7 +18,7 @@
{
}
public override int LabelNumber => 1073256; //Jester Hat of Chuckles - Museum of Vesper Replica 1073256
public override int LabelNumber => 1073256; // Jester Hat of Chuckles - Museum of Vesper Replica 1073256
public override int BasePhysicalResistance => 12;
public override int BaseFireResistance => 12;

View file

@ -105,7 +105,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private AwesomeDisturbingPortraitComponent m_Component;
private readonly AwesomeDisturbingPortraitComponent m_Component;
public InternalTimer(AwesomeDisturbingPortraitComponent c, TimeSpan delay) : base(delay,
TimeSpan.FromMinutes(10))

View file

@ -113,7 +113,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private Point3D m_Location;
private Mobile m_Mobile;
private readonly Mobile m_Mobile;
public InternalTimer(Mobile m)
: base(TimeSpan.Zero, TimeSpan.FromSeconds(1), 5)

View file

@ -97,7 +97,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private HearthOfHomeFireDeed m_Deed;
private readonly HearthOfHomeFireDeed m_Deed;
public InternalGump(HearthOfHomeFireDeed deed) : base(150, 50)
{

View file

@ -59,7 +59,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override void GetProperties(ObjectPropertyList list)
{
@ -134,7 +134,7 @@ namespace Server.Items
private class SpawnTimer : Timer
{
private RoseOfTrinsic m_Rose;
private readonly RoseOfTrinsic m_Rose;
public SpawnTimer(RoseOfTrinsic rose, TimeSpan delay) : base(delay)
{
@ -172,7 +172,6 @@ namespace Server.Items
public override int LabelNumber => 1062926; // Petal of the Rose of Trinsic
public override void OnDoubleClick(Mobile from)
{
if (!IsChildOf(from.Backpack))

View file

@ -23,7 +23,7 @@ namespace Server.Items
public override int LabelNumber => 1062917; // The Tapestry of Sosaria
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
{

View file

@ -15,9 +15,7 @@ namespace Server.Items
public override bool DisplayWeight => false;
[CommandProperty(AccessLevel.GameMaster)]
public int ClosedID{ get; set; }
#region IDyable
public int ClosedID { get; set; }
public virtual bool Dye(Mobile from, DyeTub sender)
{
@ -28,8 +26,6 @@ namespace Server.Items
return true;
}
#endregion
public override void OnDoubleClick(Mobile from)
{
base.OnDoubleClick(from);
@ -159,7 +155,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private CurtainsDeed m_Deed;
private readonly CurtainsDeed m_Deed;
public InternalGump(CurtainsDeed deed) : base(60, 36)
{

View file

@ -16,8 +16,8 @@ namespace Server.Items
{
}
public abstract override BaseAddonDeed Deed{ get; }
public abstract Item Fruit{ get; }
public abstract override BaseAddonDeed Deed { get; }
public abstract Item Fruit { get; }
[CommandProperty(AccessLevel.GameMaster)]
public int Fruits

View file

@ -89,7 +89,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private HangingAxesDeed m_Deed;
private readonly HangingAxesDeed m_Deed;
public InternalGump(HangingAxesDeed deed) : base(60, 36)
{

View file

@ -89,7 +89,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private HangingSwordsDeed m_Deed;
private readonly HangingSwordsDeed m_Deed;
public InternalGump(HangingSwordsDeed deed) : base(60, 36)
{

View file

@ -114,7 +114,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private HouseLadderDeed m_Deed;
private readonly HouseLadderDeed m_Deed;
public InternalGump(HouseLadderDeed deed) : base(60, 36)
{

View file

@ -60,7 +60,7 @@ namespace Server.Items
if (c.ItemID < 0x124D)
return;
// blood
int amount = Utility.RandomMinMax(3, 7);

View file

@ -91,7 +91,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private StoneStatueDeed m_Deed;
private readonly StoneStatueDeed m_Deed;
public InternalGump(StoneStatueDeed deed) : base(60, 36)
{

View file

@ -93,7 +93,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private UnmadeBedDeed m_Deed;
private readonly UnmadeBedDeed m_Deed;
public InternalGump(UnmadeBedDeed deed) : base(60, 36)
{

View file

@ -86,7 +86,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private VanityDeed m_Deed;
private readonly VanityDeed m_Deed;
public InternalGump(VanityDeed deed) : base(60, 36)
{

View file

@ -51,7 +51,6 @@ namespace Server.Items
}
}
public class WallTorchAddon : BaseAddon
{
public WallTorchAddon()

View file

@ -118,7 +118,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private WoodenCoffinDeed m_Deed;
private readonly WoodenCoffinDeed m_Deed;
public InternalGump(WoodenCoffinDeed deed) : base(60, 36)
{

View file

@ -25,71 +25,71 @@ namespace Server.Items
switch (type)
{
case HolidayTreeType.Classic:
{
ItemID = 0xCD7;
{
ItemID = 0xCD7;
AddItem(0, 0, 0, new TreeTrunk(this, 0xCD6));
AddItem(0, 0, 0, new TreeTrunk(this, 0xCD6));
AddOrnament(0, 0, 2, 0xF22);
AddOrnament(0, 0, 9, 0xF18);
AddOrnament(0, 0, 15, 0xF20);
AddOrnament(0, 0, 19, 0xF17);
AddOrnament(0, 0, 20, 0xF24);
AddOrnament(0, 0, 20, 0xF1F);
AddOrnament(0, 0, 20, 0xF19);
AddOrnament(0, 0, 21, 0xF1B);
AddOrnament(0, 0, 28, 0xF2F);
AddOrnament(0, 0, 30, 0xF23);
AddOrnament(0, 0, 32, 0xF2A);
AddOrnament(0, 0, 33, 0xF30);
AddOrnament(0, 0, 34, 0xF29);
AddOrnament(0, 1, 7, 0xF16);
AddOrnament(0, 1, 7, 0xF1E);
AddOrnament(0, 1, 12, 0xF0F);
AddOrnament(0, 1, 13, 0xF13);
AddOrnament(0, 1, 18, 0xF12);
AddOrnament(0, 1, 19, 0xF15);
AddOrnament(0, 1, 25, 0xF28);
AddOrnament(0, 1, 29, 0xF1A);
AddOrnament(0, 1, 37, 0xF2B);
AddOrnament(1, 0, 13, 0xF10);
AddOrnament(1, 0, 14, 0xF1C);
AddOrnament(1, 0, 16, 0xF14);
AddOrnament(1, 0, 17, 0xF26);
AddOrnament(1, 0, 22, 0xF27);
AddOrnament(0, 0, 2, 0xF22);
AddOrnament(0, 0, 9, 0xF18);
AddOrnament(0, 0, 15, 0xF20);
AddOrnament(0, 0, 19, 0xF17);
AddOrnament(0, 0, 20, 0xF24);
AddOrnament(0, 0, 20, 0xF1F);
AddOrnament(0, 0, 20, 0xF19);
AddOrnament(0, 0, 21, 0xF1B);
AddOrnament(0, 0, 28, 0xF2F);
AddOrnament(0, 0, 30, 0xF23);
AddOrnament(0, 0, 32, 0xF2A);
AddOrnament(0, 0, 33, 0xF30);
AddOrnament(0, 0, 34, 0xF29);
AddOrnament(0, 1, 7, 0xF16);
AddOrnament(0, 1, 7, 0xF1E);
AddOrnament(0, 1, 12, 0xF0F);
AddOrnament(0, 1, 13, 0xF13);
AddOrnament(0, 1, 18, 0xF12);
AddOrnament(0, 1, 19, 0xF15);
AddOrnament(0, 1, 25, 0xF28);
AddOrnament(0, 1, 29, 0xF1A);
AddOrnament(0, 1, 37, 0xF2B);
AddOrnament(1, 0, 13, 0xF10);
AddOrnament(1, 0, 14, 0xF1C);
AddOrnament(1, 0, 16, 0xF14);
AddOrnament(1, 0, 17, 0xF26);
AddOrnament(1, 0, 22, 0xF27);
break;
}
break;
}
case HolidayTreeType.Modern:
{
ItemID = 0x1B7E;
{
ItemID = 0x1B7E;
AddOrnament(0, 0, 2, 0xF2F);
AddOrnament(0, 0, 2, 0xF20);
AddOrnament(0, 0, 2, 0xF22);
AddOrnament(0, 0, 5, 0xF30);
AddOrnament(0, 0, 5, 0xF15);
AddOrnament(0, 0, 5, 0xF1F);
AddOrnament(0, 0, 5, 0xF2B);
AddOrnament(0, 0, 6, 0xF0F);
AddOrnament(0, 0, 7, 0xF1E);
AddOrnament(0, 0, 7, 0xF24);
AddOrnament(0, 0, 8, 0xF29);
AddOrnament(0, 0, 9, 0xF18);
AddOrnament(0, 0, 14, 0xF1C);
AddOrnament(0, 0, 15, 0xF13);
AddOrnament(0, 0, 15, 0xF20);
AddOrnament(0, 0, 16, 0xF26);
AddOrnament(0, 0, 17, 0xF12);
AddOrnament(0, 0, 18, 0xF17);
AddOrnament(0, 0, 20, 0xF1B);
AddOrnament(0, 0, 23, 0xF28);
AddOrnament(0, 0, 25, 0xF18);
AddOrnament(0, 0, 25, 0xF2A);
AddOrnament(0, 1, 7, 0xF16);
AddOrnament(0, 0, 2, 0xF2F);
AddOrnament(0, 0, 2, 0xF20);
AddOrnament(0, 0, 2, 0xF22);
AddOrnament(0, 0, 5, 0xF30);
AddOrnament(0, 0, 5, 0xF15);
AddOrnament(0, 0, 5, 0xF1F);
AddOrnament(0, 0, 5, 0xF2B);
AddOrnament(0, 0, 6, 0xF0F);
AddOrnament(0, 0, 7, 0xF1E);
AddOrnament(0, 0, 7, 0xF24);
AddOrnament(0, 0, 8, 0xF29);
AddOrnament(0, 0, 9, 0xF18);
AddOrnament(0, 0, 14, 0xF1C);
AddOrnament(0, 0, 15, 0xF13);
AddOrnament(0, 0, 15, 0xF20);
AddOrnament(0, 0, 16, 0xF26);
AddOrnament(0, 0, 17, 0xF12);
AddOrnament(0, 0, 18, 0xF17);
AddOrnament(0, 0, 20, 0xF1B);
AddOrnament(0, 0, 23, 0xF28);
AddOrnament(0, 0, 25, 0xF18);
AddOrnament(0, 0, 25, 0xF2A);
AddOrnament(0, 1, 7, 0xF16);
break;
}
break;
}
}
}
@ -98,7 +98,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public Mobile Placer{ get; set; }
public Mobile Placer { get; set; }
public override int LabelNumber => 1041117; // a tree for the holidays
@ -147,27 +147,27 @@ namespace Server.Items
switch (version)
{
case 1:
{
Placer = reader.ReadMobile();
goto case 0;
}
case 0:
{
int count = reader.ReadInt();
m_Components = new List<Item>(count);
for (int i = 0; i < count; ++i)
{
Item item = reader.ReadItem();
Placer = reader.ReadMobile();
if (item != null)
m_Components.Add(item);
goto case 0;
}
case 0:
{
int count = reader.ReadInt();
break;
}
m_Components = new List<Item>(count);
for (int i = 0; i < count; ++i)
{
Item item = reader.ReadItem();
if (item != null)
m_Components.Add(item);
}
break;
}
}
Timer.DelayCall(TimeSpan.Zero, ValidatePlacement);
@ -183,7 +183,6 @@ namespace Server.Items
}
}
public override void OnDoubleClick(Mobile from)
{
if (from.InRange(GetWorldLocation(), 1))
@ -279,14 +278,14 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Tree = reader.ReadItem() as HolidayTree;
{
m_Tree = reader.ReadItem() as HolidayTree;
if (m_Tree == null)
Delete();
if (m_Tree == null)
Delete();
break;
}
break;
}
}
}
}

View file

@ -44,7 +44,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1077394; //a Gingerbread House Deed
public override int LabelNumber => 1077394; // a Gingerbread House Deed
public override BaseAddon Addon => new GingerBreadHouseAddon();
public override void Serialize(IGenericWriter writer)

View file

@ -2,7 +2,7 @@
{
public class HolidayBell : Item
{
private static string[] m_StaffNames =
private static readonly string[] m_StaffNames =
{
"Adrick",
"Alai",
@ -28,7 +28,7 @@
"Vex"
};
private static int[] m_Hues =
private static readonly int[] m_Hues =
{
0xA, 0x24, 0x42, 0x56, 0x1A, 0x4C, 0x3C, 0x60, 0x2E, 0x55, 0x23, 0x38, 0x482, 0x6, 0x10
};

View file

@ -22,7 +22,7 @@ namespace Server.Items
{
}
private static Dictionary<Mobile, CandyCaneTimer> m_ToothAches = new Dictionary<Mobile, CandyCaneTimer>();
private static readonly Dictionary<Mobile, CandyCaneTimer> m_ToothAches = new Dictionary<Mobile, CandyCaneTimer>();
private static CandyCaneTimer EnsureTimer(Mobile from)
{
@ -69,9 +69,9 @@ namespace Server.Items
Start();
}
public Mobile Eater{ get; }
public Mobile Eater { get; }
public int Eaten{ get; set; }
public int Eaten { get; set; }
protected override void OnTick()
{

View file

@ -83,7 +83,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private PottedPlantDeed m_Deed;
private readonly PottedPlantDeed m_Deed;
public InternalGump(PottedPlantDeed deed) : base(100, 200)
{

View file

@ -23,7 +23,7 @@ namespace Server.Items
{
}
public override int LabelNumber => 1095159; //An Icy Patch
public override int LabelNumber => 1095159; // An Icy Patch
public override double DefaultWeight => 5.0;
public override bool OnMoveOver(Mobile m)
@ -33,13 +33,13 @@ namespace Server.Items
{
case 0:
RunSequence(m, 1095160, false);
break; //You steadily walk over the slippery surface.
break; // You steadily walk over the slippery surface.
case 1:
RunSequence(m, 1095161, true);
break; //You skillfully manage to maintain your balance.
break; // You skillfully manage to maintain your balance.
default:
RunSequence(m, 1095162, true);
break; //You lose your footing and ungracefully splatter on the ground.
break; // You lose your footing and ungracefully splatter on the ground.
}
return base.OnMoveOver(m);
}
@ -53,7 +53,7 @@ namespace Server.Items
}
m.SendLocalizedMessage(message);
int action = 0;
int sound = 0;
@ -84,7 +84,7 @@ namespace Server.Items
{
if (!m.Mounted)
m.Animate(action, 1, 1, false, true, 0);
m.PlaySound(sound);
}

View file

@ -102,10 +102,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Type = (SnowGlobeTypeOne)reader.ReadEncodedInt();
break;
}
{
m_Type = (SnowGlobeTypeOne)reader.ReadEncodedInt();
break;
}
}
}
}
@ -216,10 +216,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Type = (SnowGlobeTypeTwo)reader.ReadEncodedInt();
break;
}
{
m_Type = (SnowGlobeTypeTwo)reader.ReadEncodedInt();
break;
}
}
}
}
@ -301,10 +301,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Type = (SnowGlobeTypeThree)reader.ReadEncodedInt();
break;
}
{
m_Type = (SnowGlobeTypeThree)reader.ReadEncodedInt();
break;
}
}
}
}

View file

@ -171,7 +171,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private SnowStatueDeed m_Deed;
private readonly SnowStatueDeed m_Deed;
public InternalGump(SnowStatueDeed deed) : base(100, 200)
{

View file

@ -147,10 +147,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Title = reader.ReadString();
break;
}
{
m_Title = reader.ReadString();
break;
}
}
Utility.Intern(ref m_Title);

View file

@ -117,8 +117,8 @@ namespace Server.Items
private class WreathAddonGump : Gump
{
private WreathAddon m_Addon;
private Mobile m_From;
private readonly WreathAddon m_Addon;
private readonly Mobile m_From;
public WreathAddonGump(Mobile from, WreathAddon addon) : base(150, 50)
{
@ -276,9 +276,9 @@ namespace Server.Items
private class WreathDeedGump : Gump
{
private WreathDeed m_Deed;
private Mobile m_From;
private Point3D m_Loc;
private readonly WreathDeed m_Deed;
private readonly Mobile m_From;
private readonly Point3D m_Loc;
public WreathDeedGump(Mobile from, Point3D loc, WreathDeed deed) : base(150, 50)
{

View file

@ -100,7 +100,7 @@ namespace Server.Items
if (IsExpired)
list.Add(1150487); // [Expired]
//list.Add( 1060660, "shard\t{0}", ServerList.ServerName ); // ~1_val~: ~2_val~
// list.Add( 1060660, "shard\t{0}", ServerList.ServerName ); // ~1_val~: ~2_val~
}
public override void OnDoubleClick(Mobile from)
@ -140,19 +140,19 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Stone = reader.ReadItem<HouseRaffleStone>();
{
m_Stone = reader.ReadItem<HouseRaffleStone>();
goto case 0;
}
goto case 0;
}
case 0:
{
m_PlotLocation = reader.ReadPoint3D();
m_Facet = reader.ReadMap();
m_AwardedTo = reader.ReadMobile();
{
m_PlotLocation = reader.ReadPoint3D();
m_Facet = reader.ReadMap();
m_AwardedTo = reader.ReadMobile();
break;
}
break;
}
}
}

View file

@ -17,11 +17,11 @@ namespace Server.Gumps
public const int LabelColor = 0xFFFFFF;
public const int HighlightColor = 0x11EE11;
private List<RaffleEntry> m_List;
private readonly List<RaffleEntry> m_List;
private int m_Page;
private SortMethod m_Sort;
private readonly SortMethod m_Sort;
private HouseRaffleStone m_Stone;
private readonly HouseRaffleStone m_Stone;
public HouseRaffleManagementGump(HouseRaffleStone stone, SortMethod sort = SortMethod.Default,
int page = 0) : base(40, 40)
@ -35,23 +35,23 @@ namespace Server.Gumps
switch (m_Sort)
{
case SortMethod.Name:
{
m_List.Sort(NameComparer.Instance);
{
m_List.Sort(NameComparer.Instance);
break;
}
break;
}
case SortMethod.Account:
{
m_List.Sort(AccountComparer.Instance);
{
m_List.Sort(AccountComparer.Instance);
break;
}
break;
}
case SortMethod.Address:
{
m_List.Sort(AddressComparer.Instance);
{
m_List.Sort(AddressComparer.Instance);
break;
}
break;
}
}
AddPage(0);
@ -158,57 +158,57 @@ namespace Server.Gumps
switch (buttonId)
{
case 1: // Previous
{
if (m_Page > 0)
m_Page--;
from.SendGump(new HouseRaffleManagementGump(m_Stone, m_Sort, m_Page));
break;
}
case 2: // Next
{
if ((m_Page + 1) * 10 < m_Stone.Entries.Count)
m_Page++;
from.SendGump(new HouseRaffleManagementGump(m_Stone, m_Sort, m_Page));
break;
}
case 3: // Sort by name
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Name));
break;
}
case 4: // Sort by account
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Account));
break;
}
case 5: // Sort by address
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Address));
break;
}
default: // Delete
{
buttonId -= 6;
if (buttonId >= 0 && buttonId < m_List.Count)
{
m_Stone.Entries.Remove(m_List[buttonId]);
if (m_Page > 0 && m_Page * 10 >= m_List.Count - 1)
if (m_Page > 0)
m_Page--;
from.SendGump(new HouseRaffleManagementGump(m_Stone, m_Sort, m_Page));
}
break;
}
break;
}
case 2: // Next
{
if ((m_Page + 1) * 10 < m_Stone.Entries.Count)
m_Page++;
from.SendGump(new HouseRaffleManagementGump(m_Stone, m_Sort, m_Page));
break;
}
case 3: // Sort by name
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Name));
break;
}
case 4: // Sort by account
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Account));
break;
}
case 5: // Sort by address
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Address));
break;
}
default: // Delete
{
buttonId -= 6;
if (buttonId >= 0 && buttonId < m_List.Count)
{
m_Stone.Entries.Remove(m_List[buttonId]);
if (m_Page > 0 && m_Page * 10 >= m_List.Count - 1)
m_Page--;
from.SendGump(new HouseRaffleManagementGump(m_Stone, m_Sort, m_Page));
}
break;
}
}
}

View file

@ -7,7 +7,7 @@ namespace Server.Regions
{
public class HouseRaffleRegion : BaseRegion
{
private HouseRaffleStone m_Stone;
private readonly HouseRaffleStone m_Stone;
public HouseRaffleRegion(HouseRaffleStone stone)
: base(null, stone.PlotFacet, DefaultPriority, stone.PlotBounds) =>

View file

@ -29,21 +29,21 @@ namespace Server.Items
case 2:
case 1:
case 0:
{
From = reader.ReadMobile();
Address = Utility.Intern(reader.ReadIPAddress());
Date = reader.ReadDateTime();
{
From = reader.ReadMobile();
Address = Utility.Intern(reader.ReadIPAddress());
Date = reader.ReadDateTime();
break;
}
break;
}
}
}
public Mobile From{ get; }
public Mobile From { get; }
public IPAddress Address{ get; }
public IPAddress Address { get; }
public DateTime Date{ get; }
public DateTime Date { get; }
public void Serialize(IGenericWriter writer)
{
@ -77,7 +77,7 @@ namespace Server.Items
public static readonly TimeSpan DefaultDuration = TimeSpan.FromDays(7.0);
public static readonly TimeSpan ExpirationTime = TimeSpan.FromDays(30.0);
private static List<HouseRaffleStone> m_AllStones = new List<HouseRaffleStone>();
private static readonly List<HouseRaffleStone> m_AllStones = new List<HouseRaffleStone>();
private Rectangle2D m_Bounds;
private TimeSpan m_Duration;
private Map m_Facet;
@ -179,7 +179,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
public HouseRaffleDeed Deed{ get; set; }
public HouseRaffleDeed Deed { get; set; }
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
public DateTime Started
@ -216,7 +216,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
public HouseRaffleExpireAction ExpireAction{ get; set; }
public HouseRaffleExpireAction ExpireAction { get; set; }
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
public int TicketPrice
@ -229,7 +229,7 @@ namespace Server.Items
}
}
public List<RaffleEntry> Entries{ get; private set; }
public List<RaffleEntry> Entries { get; private set; }
public override string DefaultName => "a house raffle stone";
@ -251,20 +251,20 @@ namespace Server.Items
switch (stone.ExpireAction)
{
case HouseRaffleExpireAction.HideStone:
{
if (stone.Visible)
{
stone.Visible = false;
stone.ItemID = 0x1B7B; // Non-blocking ItemID
}
if (stone.Visible)
{
stone.Visible = false;
stone.ItemID = 0x1B7B; // Non-blocking ItemID
}
break;
}
break;
}
case HouseRaffleExpireAction.DeleteStone:
{
stone.Delete();
break;
}
{
stone.Delete();
break;
}
}
}
@ -372,16 +372,16 @@ namespace Server.Items
switch (m_State)
{
case HouseRaffleState.Active:
{
list.Add(1060658, "ticket price\t{0}", FormatPrice()); // ~1_val~: ~2_val~
list.Add(1060659, "ends\t{0}", m_Started + m_Duration); // ~1_val~: ~2_val~
break;
}
{
list.Add(1060658, "ticket price\t{0}", FormatPrice()); // ~1_val~: ~2_val~
list.Add(1060659, "ends\t{0}", m_Started + m_Duration); // ~1_val~: ~2_val~
break;
}
case HouseRaffleState.Completed:
{
list.Add(1060658, "winner\t{0}", m_Winner == null ? "unknown" : m_Winner.Name); // ~1_val~: ~2_val~
break;
}
{
list.Add(1060658, "winner\t{0}", m_Winner == null ? "unknown" : m_Winner.Name); // ~1_val~: ~2_val~
break;
}
}
}
@ -392,15 +392,15 @@ namespace Server.Items
switch (m_State)
{
case HouseRaffleState.Active:
{
LabelTo(from, 1060658, $"Ends\t{m_Started + m_Duration}"); // ~1_val~: ~2_val~
break;
}
{
LabelTo(from, 1060658, $"Ends\t{m_Started + m_Duration}"); // ~1_val~: ~2_val~
break;
}
case HouseRaffleState.Completed:
{
LabelTo(from, 1060658, $"Winner\t{(m_Winner == null ? "Unknown" : m_Winner.Name)}"); // ~1_val~: ~2_val~
break;
}
{
LabelTo(from, 1060658, $"Winner\t{(m_Winner == null ? "Unknown" : m_Winner.Name)}"); // ~1_val~: ~2_val~
break;
}
}
}
@ -555,72 +555,72 @@ namespace Server.Items
switch (version)
{
case 3:
{
m_State = (HouseRaffleState)reader.ReadEncodedInt();
{
m_State = (HouseRaffleState)reader.ReadEncodedInt();
goto case 2;
}
goto case 2;
}
case 2:
{
ExpireAction = (HouseRaffleExpireAction)reader.ReadEncodedInt();
{
ExpireAction = (HouseRaffleExpireAction)reader.ReadEncodedInt();
goto case 1;
}
goto case 1;
}
case 1:
{
Deed = reader.ReadItem<HouseRaffleDeed>();
{
Deed = reader.ReadItem<HouseRaffleDeed>();
goto case 0;
}
goto case 0;
}
case 0:
{
bool oldActive = version < 3 && reader.ReadBool();
m_Bounds = reader.ReadRect2D();
m_Facet = reader.ReadMap();
m_Winner = reader.ReadMobile();
m_TicketPrice = reader.ReadInt();
m_Started = reader.ReadDateTime();
m_Duration = reader.ReadTimeSpan();
int entryCount = reader.ReadInt();
Entries = new List<RaffleEntry>(entryCount);
for (int i = 0; i < entryCount; i++)
{
RaffleEntry entry = new RaffleEntry(reader, version);
bool oldActive = version < 3 && reader.ReadBool();
if (entry.From == null)
continue; // Character was deleted
m_Bounds = reader.ReadRect2D();
m_Facet = reader.ReadMap();
Entries.Add(entry);
m_Winner = reader.ReadMobile();
m_TicketPrice = reader.ReadInt();
m_Started = reader.ReadDateTime();
m_Duration = reader.ReadTimeSpan();
int entryCount = reader.ReadInt();
Entries = new List<RaffleEntry>(entryCount);
for (int i = 0; i < entryCount; i++)
{
RaffleEntry entry = new RaffleEntry(reader, version);
if (entry.From == null)
continue; // Character was deleted
Entries.Add(entry);
}
InvalidateRegion();
m_AllStones.Add(this);
if (version < 3)
{
if (oldActive)
m_State = HouseRaffleState.Active;
else if (m_Winner != null)
m_State = HouseRaffleState.Completed;
else
m_State = HouseRaffleState.Inactive;
}
break;
}
InvalidateRegion();
m_AllStones.Add(this);
if (version < 3)
{
if (oldActive)
m_State = HouseRaffleState.Active;
else if (m_Winner != null)
m_State = HouseRaffleState.Completed;
else
m_State = HouseRaffleState.Inactive;
}
break;
}
}
}
private class RaffleContextMenuEntry : ContextMenuEntry
{
protected Mobile m_From;
protected HouseRaffleStone m_Stone;
protected readonly Mobile m_From;
protected readonly HouseRaffleStone m_Stone;
public RaffleContextMenuEntry(Mobile from, HouseRaffleStone stone, int label)
: base(label)

View file

@ -14,7 +14,7 @@ namespace Server.Items
{
}
public abstract BaseCreature Summon{ get; }
public abstract BaseCreature Summon { get; }
public override void OnDoubleClick(Mobile from)
{

View file

@ -47,9 +47,9 @@ namespace Server.Items
int num = 0;
for (int y = 0; y < size; ++y)
for (int x = 0; x < size; ++x)
if (info.Graphics[num] != 0x1) // Veteran Rewards Mod
AddComponent(new AddonComponent(info.Graphics[num++]), size - x - 1, size - y - 1, 0);
for (int x = 0; x < size; ++x)
if (info.Graphics[num] != 0x1) // Veteran Rewards Mod
AddComponent(new AddonComponent(info.Graphics[num++]), size - x - 1, size - y - 1, 0);
}
public override void Serialize(IGenericWriter writer)
@ -70,10 +70,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
}
}
}
@ -134,10 +134,10 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
{
m_Type = (MiniHouseType)reader.ReadInt();
break;
}
}
if (Weight == 0.0)
@ -167,13 +167,13 @@ namespace Server.Items
SandstoneHouseWithPatio,
SmallStoneWorkshop,
SmallMarbleWorkshop,
MalasMountainPass, //Veteran reward house
ChurchAtNight //Veteran reward house
MalasMountainPass, // Veteran reward house
ChurchAtNight // Veteran reward house
}
public class MiniHouseInfo
{
private static MiniHouseInfo[] m_Info =
private static readonly MiniHouseInfo[] m_Info =
{
/* Stone and plaster house */ new MiniHouseInfo(0x22C4, 1, 1011303),
/* Field stone house */ new MiniHouseInfo(0x22DE, 1, 1011304),
@ -217,9 +217,9 @@ namespace Server.Items
Graphics = graphics;
}
public int[] Graphics{ get; }
public int[] Graphics { get; }
public int LabelNumber{ get; }
public int LabelNumber { get; }
public static MiniHouseInfo GetInfo(MiniHouseType type)
{

View file

@ -51,7 +51,7 @@ namespace Server.Items
public class MonsterStatuetteInfo
{
private static MonsterStatuetteInfo[] m_Table =
private static readonly MonsterStatuetteInfo[] m_Table =
{
/* Crocodile */ new MonsterStatuetteInfo(1041249, 0x20DA, 660),
/* Daemon */ new MonsterStatuetteInfo(1041250, 0x20D3, 357),
@ -109,11 +109,11 @@ namespace Server.Items
Sounds = sounds;
}
public int LabelNumber{ get; }
public int LabelNumber { get; }
public int ItemID{ get; }
public int ItemID { get; }
public int[] Sounds{ get; }
public int[] Sounds { get; }
public static MonsterStatuetteInfo GetInfo(MonsterStatuetteType type)
{
@ -132,8 +132,7 @@ namespace Server.Items
private MonsterStatuetteType m_Type;
[Constructible]
public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) :
base(MonsterStatuetteInfo.GetInfo(type).ItemID)
public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) : base(MonsterStatuetteInfo.GetInfo(type).ItemID)
{
LootType = LootType.Blessed;
@ -191,7 +190,7 @@ namespace Server.Items
public override bool HandlesOnMovement => m_TurnedOn && IsLockedDown;
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
public override void OnMovement(Mobile m, Point3D oldLocation)
{
@ -255,18 +254,18 @@ namespace Server.Items
switch (version)
{
case 0:
{
m_Type = (MonsterStatuetteType)reader.ReadEncodedInt();
m_TurnedOn = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
{
m_Type = (MonsterStatuetteType)reader.ReadEncodedInt();
m_TurnedOn = reader.ReadBool();
IsRewardItem = reader.ReadBool();
break;
}
}
}
private class OnOffGump : Gump
{
private MonsterStatuette m_Statuette;
private readonly MonsterStatuette m_Statuette;
public OnOffGump(MonsterStatuette statuette) : base(150, 200)
{

View file

@ -4,14 +4,14 @@ namespace Server.Items
{
public class PlagueBeastBackpack : BaseContainer
{
private static int[,,] m_Positions =
private static readonly int[,,] m_Positions =
{
{ { 275, 85 }, { 360, 111 }, { 375, 184 }, { 332, 228 }, { 141, 105 }, { 189, 75 } },
{ { 274, 34 }, { 327, 89 }, { 354, 168 }, { 304, 225 }, { 113, 86 }, { 189, 75 } },
{ { 276, 79 }, { 369, 117 }, { 372, 192 }, { 336, 230 }, { 141, 116 }, { 189, 75 } }
};
private static int[] m_BrainHues =
private static readonly int[] m_BrainHues =
{
0x2B, 0x42, 0x54, 0x60
};

View file

@ -5,7 +5,7 @@ namespace Server.Items
{
public class PlagueBeastBlood : PlagueBeastComponent
{
private Timer m_Timer;
private readonly Timer m_Timer;
public PlagueBeastBlood() : base(0x122C, 0) => m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.5), TimeSpan.FromSeconds(1.5), 3, Hemorrhage);

View file

@ -42,7 +42,7 @@ namespace Server.Items
private class InternalTimer : Timer
{
private bool m_Delay;
private PlagueBeastHeart m_Heart;
private readonly PlagueBeastHeart m_Heart;
public InternalTimer(PlagueBeastHeart heart) : base(TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5)) => m_Heart = heart;

View file

@ -76,7 +76,7 @@ namespace Server.Items
{
}
public PlagueBeastOrgan Organ{ get; set; }
public PlagueBeastOrgan Organ { get; set; }
public bool IsBrain => ItemID == 0x1CF0;
@ -95,7 +95,7 @@ namespace Server.Items
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (Organ?.OnDropped(from, dropped, this) == true && dropped is PlagueBeastComponent component)
Organ.Components.Add(component);
Organ.Components.Add(component);
return true;
}

View file

@ -19,7 +19,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public bool Cut{ get; set; }
public bool Cut { get; set; }
public override string DefaultName => "a plague beast mutation core";

View file

@ -24,11 +24,11 @@ namespace Server.Items
public virtual bool IsCuttable => false;
public List<PlagueBeastComponent> Components{ get; private set; }
public List<PlagueBeastComponent> Components { get; private set; }
public int BrainHue{ get; set; }
public int BrainHue { get; set; }
public bool Opened{ get; set; }
public bool Opened { get; set; }
public virtual void Initialize()
{
@ -212,7 +212,7 @@ namespace Server.Items
public class PlagueBeastRubbleOrgan : PlagueBeastOrgan
{
private static int[] m_Hues =
private static readonly int[] m_Hues =
{
0xD, 0x17, 0x2B, 0x42, 0x54, 0x5D
};

View file

@ -13,7 +13,7 @@ namespace Server.Items
{
}
public bool Cut{ get; private set; }
public bool Cut { get; private set; }
public override bool Scissor(Mobile from, Scissors scissors)
{

View file

@ -4,8 +4,8 @@
{
private int m_Quantity;
public BaseWaterContainer(int Item_Id, bool filled)
: base(Item_Id) =>
public BaseWaterContainer(int item_Id, bool filled)
: base(item_Id) =>
m_Quantity = filled ? MaxQuantity : 0;
public BaseWaterContainer(Serial serial)
@ -13,9 +13,9 @@
{
}
public abstract int voidItem_ID{ get; }
public abstract int fullItem_ID{ get; }
public abstract int MaxQuantity{ get; }
public abstract int voidItem_ID { get; }
public abstract int fullItem_ID { get; }
public abstract int MaxQuantity { get; }
public override int DefaultGumpID => 0x3e;

View file

@ -2,8 +2,8 @@
{
internal class Bucket : BaseWaterContainer
{
private static int vItemID = 0x14e0;
private static int fItemID = 0x2004;
private static readonly int vItemID = 0x14e0;
private static readonly int fItemID = 0x2004;
[Constructible]
public Bucket(bool filled = false)

View file

@ -2,8 +2,8 @@
{
internal class WaterBarrel : BaseWaterContainer
{
private static int vItemID = 0xe77;
private static int fItemID = 0x154d;
private static readonly int vItemID = 0xe77;
private static readonly int fItemID = 0x154d;
[Constructible]
public WaterBarrel(bool filled = false)

View file

@ -2,8 +2,8 @@
{
internal class Tub : BaseWaterContainer
{
private static int vItemID = 0xe83;
private static int fItemID = 0xe7b;
private static readonly int vItemID = 0xe83;
private static readonly int fItemID = 0xe7b;
[Constructible]
public Tub(bool filled = false)

View file

@ -170,22 +170,22 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Recharges = reader.ReadEncodedInt();
goto case 0;
}
{
m_Recharges = reader.ReadEncodedInt();
goto case 0;
}
case 0:
{
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
m_BagOfSendingHue = (BagOfSendingHue)reader.ReadEncodedInt();
break;
}
{
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
m_BagOfSendingHue = (BagOfSendingHue)reader.ReadEncodedInt();
break;
}
}
}
private class UseBagEntry : ContextMenuEntry
{
private BagOfSending m_Bag;
private readonly BagOfSending m_Bag;
public UseBagEntry(BagOfSending bag, bool enabled) : base(6189)
{
@ -209,7 +209,7 @@ namespace Server.Items
private class SendTarget : Target
{
private BagOfSending m_Bag;
private readonly BagOfSending m_Bag;
public SendTarget(BagOfSending bag) : base(-1, false, TargetFlags.None) => m_Bag = bag;
@ -265,7 +265,7 @@ namespace Server.Items
}
else if (Core.ML && reqCharges > m_Bag.Charges)
{
from.SendLocalizedMessage(1079932); //You don't have enough charges to send that much weight
from.SendLocalizedMessage(1079932); // You don't have enough charges to send that much weight
}
else
{

View file

@ -53,7 +53,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public string PetName{ get; private set; }
public string PetName { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
@ -134,8 +134,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (RootParent != from
) // TODO: Previous implementation allowed use on ground, without house protection checks. What is the correct behavior?
if (RootParent != from) // TODO: Previous implementation allowed use on ground, without house protection checks. What is the correct behavior?
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2,
1042001); // That must be in your pack for you to use it.
@ -221,7 +220,6 @@ namespace Server.Items
}
}
public void SummonPet(Mobile from)
{
BaseCreature pet = Pet;
@ -300,17 +298,17 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Recharges = reader.ReadEncodedInt();
goto case 0;
}
{
m_Recharges = reader.ReadEncodedInt();
goto case 0;
}
case 0:
{
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
Pet = (BaseCreature)reader.ReadMobile();
PetName = reader.ReadString();
break;
}
{
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
Pet = (BaseCreature)reader.ReadMobile();
PetName = reader.ReadString();
break;
}
}
}
@ -318,7 +316,7 @@ namespace Server.Items
private class BallEntry : ContextMenuEntry
{
private BallCallback m_Callback;
private readonly BallCallback m_Callback;
public BallEntry(BallCallback callback, int number) : base(number, 2) => m_Callback = callback;
@ -333,7 +331,7 @@ namespace Server.Items
private class PetLinkTarget : Target
{
private BallOfSummoning m_Ball;
private readonly BallOfSummoning m_Ball;
public PetLinkTarget(BallOfSummoning ball) : base(-1, false, TargetFlags.None) => m_Ball = ball;
@ -382,10 +380,10 @@ namespace Server.Items
private class PetSummoningSpell : Spell
{
private static SpellInfo m_Info = new SpellInfo("Ball Of Summoning", "", 230);
private static readonly SpellInfo m_Info = new SpellInfo("Ball Of Summoning", "", 230);
private BallOfSummoning m_Ball;
private Mobile m_Caster;
private readonly BallOfSummoning m_Ball;
private readonly Mobile m_Caster;
private bool m_Stop;

View file

@ -327,17 +327,17 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_Recharges = reader.ReadEncodedInt();
goto case 0;
}
{
m_Recharges = reader.ReadEncodedInt();
goto case 0;
}
case 0:
{
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
m_Inscription = reader.ReadString();
Bound = (BraceletOfBinding)reader.ReadItem();
break;
}
{
m_Charges = Math.Min(reader.ReadEncodedInt(), MaxCharges);
m_Inscription = reader.ReadString();
Bound = (BraceletOfBinding)reader.ReadItem();
break;
}
}
}
@ -345,7 +345,7 @@ namespace Server.Items
private class BraceletEntry : ContextMenuEntry
{
private BraceletCallback m_Callback;
private readonly BraceletCallback m_Callback;
public BraceletEntry(BraceletCallback callback, int number, bool enabled) : base(number)
{
@ -366,8 +366,8 @@ namespace Server.Items
private class TransportTimer : Timer
{
private BraceletOfBinding m_Bracelet;
private Mobile m_From;
private readonly BraceletOfBinding m_Bracelet;
private readonly Mobile m_From;
public TransportTimer(BraceletOfBinding bracelet, Mobile from) : base(TimeSpan.FromSeconds(2.0))
{
@ -397,7 +397,7 @@ namespace Server.Items
private class BindTarget : Target
{
private BraceletOfBinding m_Bracelet;
private readonly BraceletOfBinding m_Bracelet;
public BindTarget(BraceletOfBinding bracelet) : base(-1, false, TargetFlags.None) => m_Bracelet = bracelet;
@ -438,7 +438,7 @@ namespace Server.Items
private class InscribePrompt : Prompt
{
private BraceletOfBinding m_Bracelet;
private readonly BraceletOfBinding m_Bracelet;
public InscribePrompt(BraceletOfBinding bracelet) => m_Bracelet = bracelet;

View file

@ -5,11 +5,11 @@ namespace Server.Items
{
public interface TranslocationItem
{
int Charges{ get; set; }
int Recharges{ get; set; }
int MaxCharges{ get; }
int MaxRecharges{ get; }
string TranslocationItemName{ get; }
int Charges { get; set; }
int Recharges { get; set; }
int MaxCharges { get; }
int MaxRecharges { get; }
string TranslocationItemName { get; }
}
public class PowderOfTranslocation : Item
@ -50,7 +50,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private PowderOfTranslocation m_Powder;
private readonly PowderOfTranslocation m_Powder;
public InternalTarget(PowderOfTranslocation powder) : base(-1, false, TargetFlags.None) => m_Powder = powder;

View file

@ -21,8 +21,7 @@ namespace Server.Items
private double m_SkillValue;
[Constructible]
public SoulStone(string account = null, int inactiveItemID = 0x2A93, int activeItemID = 0x2A94) :
base(inactiveItemID)
public SoulStone(string account = null, int inactiveItemID = 0x2A93, int activeItemID = 0x2A94) : base(inactiveItemID)
{
Light = LightType.Circle300;
LootType = LootType.Blessed;
@ -66,7 +65,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public string Account{ get; set; }
public string Account { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string LastUserName
@ -111,7 +110,7 @@ namespace Server.Items
public bool IsEmpty => m_SkillValue <= 0.0;
[CommandProperty(AccessLevel.GameMaster)]
public SecureLevel Level{ get; set; }
public SecureLevel Level { get; set; }
public override void GetProperties(ObjectPropertyList list)
{
@ -210,8 +209,6 @@ namespace Server.Items
return false;
}
#region Scroll of Alacrity
if (pm.AcceleratedStart > DateTime.UtcNow)
{
from.SendLocalizedMessage(
@ -219,8 +216,6 @@ namespace Server.Items
return false;
}
#endregion
return true;
}
@ -247,17 +242,17 @@ namespace Server.Items
writer.WriteEncodedInt(3); // version
//version 3
// version 3
writer.Write(m_LastUserName);
//version 2
// version 2
writer.Write((int)Level);
writer.Write(m_ActiveItemID);
writer.Write(m_InactiveItemID);
writer.Write(Account);
writer.Write(m_NextUse); //TODO: delete it in a harmless way
writer.Write(m_NextUse); // TODO: delete it in a harmless way
writer.WriteEncodedInt((int)m_Skill);
writer.Write(m_SkillValue);
@ -272,31 +267,31 @@ namespace Server.Items
switch (version)
{
case 3:
{
m_LastUserName = reader.ReadString();
goto case 2;
}
{
m_LastUserName = reader.ReadString();
goto case 2;
}
case 2:
{
Level = (SecureLevel)reader.ReadInt();
goto case 1;
}
{
Level = (SecureLevel)reader.ReadInt();
goto case 1;
}
case 1:
{
m_ActiveItemID = reader.ReadInt();
m_InactiveItemID = reader.ReadInt();
{
m_ActiveItemID = reader.ReadInt();
m_InactiveItemID = reader.ReadInt();
goto case 0;
}
goto case 0;
}
case 0:
{
Account = reader.ReadString();
m_NextUse = reader.ReadDateTime(); //TODO: delete it in a harmless way
{
Account = reader.ReadString();
m_NextUse = reader.ReadDateTime(); // TODO: delete it in a harmless way
m_Skill = (SkillName)reader.ReadEncodedInt();
m_SkillValue = reader.ReadDouble();
break;
}
m_Skill = (SkillName)reader.ReadEncodedInt();
m_SkillValue = reader.ReadDouble();
break;
}
}
if (version == 0)
@ -308,7 +303,7 @@ namespace Server.Items
private class SelectSkillGump : Gump
{
private SoulStone m_Stone;
private readonly SoulStone m_Stone;
public SelectSkillGump(SoulStone stone, Mobile from) : base(50, 50)
{
@ -391,8 +386,8 @@ namespace Server.Items
private class ConfirmSkillGump : Gump
{
private Skill m_Skill;
private SoulStone m_Stone;
private readonly Skill m_Skill;
private readonly SoulStone m_Stone;
public ConfirmSkillGump(SoulStone stone, Skill skill) : base(50, 50)
{
@ -506,7 +501,7 @@ namespace Server.Items
private class ConfirmTransferGump : Gump
{
private SoulStone m_Stone;
private readonly SoulStone m_Stone;
public ConfirmTransferGump(SoulStone stone, Mobile from) : base(50, 50)
{
@ -655,8 +650,6 @@ namespace Server.Items
return;
}
#region Scroll of ALacrity
PlayerMobile pm = from as PlayerMobile;
if (pm.AcceleratedStart > DateTime.UtcNow)
{
@ -670,8 +663,6 @@ namespace Server.Items
return;
}
#endregion
if (requiredAmount > 0)
for (int i = 0; i < from.Skills.Length; ++i)
{
@ -715,7 +706,7 @@ namespace Server.Items
private class ConfirmRemovalGump : Gump
{
private SoulStone m_Stone;
private readonly SoulStone m_Stone;
public ConfirmRemovalGump(SoulStone stone) : base(50, 50)
{
@ -764,7 +755,7 @@ namespace Server.Items
private class ErrorGump : Gump
{
private SoulStone m_Stone;
private readonly SoulStone m_Stone;
public ErrorGump(SoulStone stone, int title, int message) : base(50, 50)
{
@ -817,8 +808,7 @@ namespace Server.Items
}
[Constructible]
public SoulstoneFragment(int usesRemaining = 5, string account = null) :
base(account, Utility.Random(0x2AA1, 9)) =>
public SoulstoneFragment(int usesRemaining = 5, string account = null) : base(account, Utility.Random(0x2AA1, 9)) =>
m_UsesRemaining = usesRemaining;
public SoulstoneFragment(Serial serial) : base(serial)
@ -838,7 +828,6 @@ namespace Server.Items
}
}
bool IUsesRemaining.ShowUsesRemaining
{
get => true;
@ -991,10 +980,10 @@ namespace Server.Items
switch (version)
{
case 1:
{
m_IsRewardItem = reader.ReadBool();
break;
}
{
m_IsRewardItem = reader.ReadBool();
break;
}
}
}
}

View file

@ -4,7 +4,7 @@ namespace Server.Items
{
public class PowerScroll : SpecialScroll
{
private static SkillName[] m_Skills =
private static readonly SkillName[] m_Skills =
{
SkillName.Blacksmith,
SkillName.Tailoring,
@ -30,7 +30,7 @@ namespace Server.Items
SkillName.Peacemaking
};
private static SkillName[] m_AOSSkills =
private static readonly SkillName[] m_AOSSkills =
{
SkillName.Chivalry,
SkillName.Focus,
@ -40,13 +40,13 @@ namespace Server.Items
SkillName.SpiritSpeak
};
private static SkillName[] m_SESkills =
private static readonly SkillName[] m_SESkills =
{
SkillName.Ninjitsu,
SkillName.Bushido
};
private static SkillName[] m_MLSkills =
private static readonly SkillName[] m_MLSkills =
{
SkillName.Spellweaving
};
@ -65,7 +65,7 @@ namespace Server.Items
};
*/
private static List<SkillName> _Skills = new List<SkillName>();
private static readonly List<SkillName> _Skills = new List<SkillName>();
[Constructible]
public PowerScroll(SkillName skill = SkillName.Alchemy, double value = 0.0) : base(skill, value)
@ -80,11 +80,13 @@ namespace Server.Items
{
}
/* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window.
*/
public override int Message =>
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window. */
1049469;
public override int Title
{
@ -92,11 +94,13 @@ namespace Server.Items
{
double level = (Value - 105.0) / 5.0;
/* Wonderous Scroll (105 Skill): OR
* Exalted Scroll (110 Skill): OR
* Mythical Scroll (115 Skill): OR
* Legendary Scroll (120 Skill):
*/
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
return 1049635 + (int)level; /* Wonderous Scroll (105 Skill): OR
* Exalted Scroll (110 Skill): OR
* Mythical Scroll (115 Skill): OR
* Legendary Scroll (120 Skill): */
return 1049635 + (int)level;
return 0;
}
@ -154,10 +158,12 @@ namespace Server.Items
double level = (Value - 105.0) / 5.0;
if (level >= 0.0 && level <= 3.0 && Value % 5.0 == 0.0)
list.Add(1049639 + (int)level, GetNameLocalized()); /* a wonderous scroll of ~1_type~ (105 Skill) OR
* an exalted scroll of ~1_type~ (110 Skill) OR
* a mythical scroll of ~1_type~ (115 Skill) OR
* a legendary scroll of ~1_type~ (120 Skill) */
/* a wonderous scroll of ~1_type~ (105 Skill) OR
* an exalted scroll of ~1_type~ (110 Skill) OR
* a mythical scroll of ~1_type~ (115 Skill) OR
* a legendary scroll of ~1_type~ (120 Skill)
*/
list.Add(1049639 + (int)level, GetNameLocalized());
else
list.Add("a power scroll of {0} ({1} Skill)", GetName(), Value);
}

View file

@ -20,10 +20,12 @@ namespace Server.Items
public override int LabelNumber => 1078604; // Scroll of Alacrity
/* Using a Scroll of Transcendence for a given skill will permanently increase your current
* level in that skill by the amount of points displayed on the scroll.
* As you may not gain skills beyond your maximum skill cap, any excess points will be lost.
*/
public override int Message =>
1078602; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
1078602;
public override string DefaultTitle => "<basefont color=#FFFFFF>Scroll of Alacrity:</basefont>";
@ -39,20 +41,17 @@ namespace Server.Items
if (!(base.CanUse(from) && from is PlayerMobile pm))
return false;
#region Mondain's Legacy
MLQuestContext context = MLQuestSystem.GetContext(pm);
if (context != null)
foreach (MLQuestInstance instance in context.QuestInstances)
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
#endregion
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
if (pm.AcceleratedStart > DateTime.UtcNow)
{
@ -73,9 +72,10 @@ namespace Server.Items
if (tskill >= tcap || from.Skills[Skill].Lock != SkillLock.Up)
{
from.SendLocalizedMessage(
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
/* You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
* If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.
*/
from.SendLocalizedMessage(1094935);
return;
}
@ -112,7 +112,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;

View file

@ -20,10 +20,12 @@ namespace Server.Items
public override int LabelNumber => 1094934; // Scroll of Transcendence
/* Using a Scroll of Transcendence for a given skill will permanently increase your current
* level in that skill by the amount of points displayed on the scroll.
* As you may not gain skills beyond your maximum skill cap, any excess points will be lost.
*/
public override int Message =>
1094933; /*Using a Scroll of Transcendence for a given skill will permanently increase your current
*level in that skill by the amount of points displayed on the scroll.
*As you may not gain skills beyond your maximum skill cap, any excess points will be lost.*/
1094933;
public override string DefaultTitle =>
$"<basefont color=#FFFFFF>Scroll of Transcendence ({Value} Skill):</basefont>";
@ -50,20 +52,17 @@ namespace Server.Items
if (!(base.CanUse(from) && from is PlayerMobile pm))
return false;
#region Mondain's Legacy
MLQuestContext context = MLQuestSystem.GetContext(pm);
if (context != null)
foreach (MLQuestInstance instance in context.QuestInstances)
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
#endregion
foreach (BaseObjectiveInstance objective in instance.Objectives)
if (!objective.Expired && objective is GainSkillObjectiveInstance objectiveInstance &&
objectiveInstance.Handles(Skill))
{
from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
return false;
}
if (pm.AcceleratedStart > DateTime.UtcNow)
{
@ -111,9 +110,11 @@ namespace Server.Items
if (!canGain)
{
/* You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
* If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.
*/
from.SendLocalizedMessage(
1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
*If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
1094935);
return;
}
@ -140,7 +141,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;

View file

@ -18,23 +18,19 @@ namespace Server.Items
{
}
#region Old Item Serialization Vars
/* DO NOT USE! Only used in serialization of special scrolls that originally derived from Item */
protected bool InheritsItem{ get; private set; }
protected bool InheritsItem { get; private set; }
#endregion
public abstract int Message{ get; }
public abstract int Message { get; }
public virtual int Title => 0;
public abstract string DefaultTitle{ get; }
public abstract string DefaultTitle { get; }
[CommandProperty(AccessLevel.GameMaster)]
public SkillName Skill{ get; set; }
public SkillName Skill { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public double Value{ get; set; }
public double Value { get; set; }
public virtual string GetNameLocalized() => $"#{AosSkillBonuses.GetLabel(Skill)}";
@ -94,36 +90,36 @@ namespace Server.Items
switch (version)
{
case 1:
{
Skill = (SkillName)reader.ReadInt();
Value = reader.ReadDouble();
break;
}
case 0:
{
InheritsItem = true;
if (!(this is StatCapScroll))
{
Skill = (SkillName)reader.ReadInt();
else
Skill = SkillName.Alchemy;
if (this is ScrollofAlacrity)
Value = 0.0;
else if (this is StatCapScroll)
Value = reader.ReadInt();
else
Value = reader.ReadDouble();
break;
}
case 0:
{
InheritsItem = true;
break;
}
if (!(this is StatCapScroll))
Skill = (SkillName)reader.ReadInt();
else
Skill = SkillName.Alchemy;
if (this is ScrollofAlacrity)
Value = 0.0;
else if (this is StatCapScroll)
Value = reader.ReadInt();
else
Value = reader.ReadDouble();
break;
}
}
}
public class InternalGump : Gump
{
private Mobile m_Mobile;
private SpecialScroll m_Scroll;
private readonly Mobile m_Mobile;
private readonly SpecialScroll m_Scroll;
public InternalGump(Mobile mobile, SpecialScroll scroll) : base(25, 50)
{

View file

@ -11,11 +11,13 @@ namespace Server.Items
{
}
/* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window.
*/
public override int Message =>
1049469; /* Using a scroll increases the maximum amount of a specific skill or your maximum statistics.
* When used, the effect is not immediately seen without a gain of points with that skill or statistics.
* You can view your maximum skill values in your skills window.
* You can view your maximum statistic value in your statistics window. */
1049469;
public override int Title
{
@ -23,12 +25,14 @@ namespace Server.Items
{
int level = ((int)Value - 230) / 5;
/* Wonderous Scroll (+5 Maximum Stats): OR
* Exalted Scroll (+10 Maximum Stats): OR
* Mythical Scroll (+15 Maximum Stats): OR
* Legendary Scroll (+20 Maximum Stats): OR
* Ultimate Scroll (+25 Maximum Stats):
*/
if (level >= 0 && level <= 4 && Value % 5 == 0)
return 1049458 + level; /* Wonderous Scroll (+5 Maximum Stats): OR
* Exalted Scroll (+10 Maximum Stats): OR
* Mythical Scroll (+15 Maximum Stats): OR
* Legendary Scroll (+20 Maximum Stats): OR
* Ultimate Scroll (+25 Maximum Stats): */
return 1049458 + level;
return 0;
}
@ -42,11 +46,13 @@ namespace Server.Items
int level = ((int)Value - 230) / 5;
if (level >= 0 && level <= 4 && (int)Value % 5 == 0)
list.Add(1049463 + level, "#1049476"); /* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
* an ultimate scroll of ~1_type~ (+25 Maximum Stats) */
/* a wonderous scroll of ~1_type~ (+5 Maximum Stats) OR
* an exalted scroll of ~1_type~ (+10 Maximum Stats) OR
* a mythical scroll of ~1_type~ (+15 Maximum Stats) OR
* a legendary scroll of ~1_type~ (+20 Maximum Stats) OR
* an ultimate scroll of ~1_type~ (+25 Maximum Stats)
*/
list.Add(1049463 + level, "#1049476");
else
list.Add("a scroll of power ({0}{1} Maximum Stats)", Value - 225 >= 0 ? "+" : "", Value - 225);
}
@ -119,7 +125,7 @@ namespace Server.Items
{
base.Deserialize(reader);
int version = InheritsItem ? 0 : reader.ReadInt(); //Required for SpecialScroll insertion
int version = InheritsItem ? 0 : reader.ReadInt(); // Required for SpecialScroll insertion
LootType = LootType.Cursed;
Insured = false;

View file

@ -5,7 +5,7 @@ namespace Server.Items
{
public class ValentinesCard : Item
{
private static string Unsigned = "___";
private static readonly string Unsigned = "___";
private string m_From;
private int m_LabelNumber;
@ -73,7 +73,7 @@ namespace Server.Items
{
from.BeginTarget(10, false, TargetFlags.None, OnTarget);
from.SendLocalizedMessage(1077497); //To whom do you wish to give this card?
from.SendLocalizedMessage(1077497); // To whom do you wish to give this card?
}
else
{
@ -95,22 +95,22 @@ namespace Server.Items
m_From = from.Name;
m_To = to.Name;
from.SendLocalizedMessage(
1077498); //You fill out the card. Hopefully the other person actually likes you...
1077498); // You fill out the card. Hopefully the other person actually likes you...
InvalidateProperties();
}
else
{
from.SendLocalizedMessage(1077495); //You can't give yourself a card, silly!
from.SendLocalizedMessage(1077495); // You can't give yourself a card, silly!
}
}
else
{
from.SendLocalizedMessage(1077496); //You can't possibly be THAT lonely!
from.SendLocalizedMessage(1077496); // You can't possibly be THAT lonely!
}
}
else
{
from.SendLocalizedMessage(1077488); //That's not another player!
from.SendLocalizedMessage(1077488); // That's not another player!
}
}
}

View file

@ -80,8 +80,8 @@ namespace Server.Items
private class ResurrectEntry : ContextMenuEntry
{
private AnkhOfSacrificeAddon m_Ankh;
private Mobile m_Mobile;
private readonly AnkhOfSacrificeAddon m_Ankh;
private readonly Mobile m_Mobile;
public ResurrectEntry(Mobile mobile, AnkhOfSacrificeAddon ankh) : base(6195, 2)
{
@ -100,8 +100,8 @@ namespace Server.Items
private class LockKarmaEntry : ContextMenuEntry
{
private AnkhOfSacrificeAddon m_Ankh;
private PlayerMobile m_Mobile;
private readonly AnkhOfSacrificeAddon m_Ankh;
private readonly PlayerMobile m_Mobile;
public LockKarmaEntry(PlayerMobile mobile, AnkhOfSacrificeAddon ankh) : base(mobile.KarmaLocked ? 6197 : 6196, 2)
{

View file

@ -201,7 +201,7 @@ namespace Server.Items
public const int Start = 0x15AE;
public const int End = 0x15F4;
private BannerDeed m_Banner;
private readonly BannerDeed m_Banner;
public InternalGump(BannerDeed banner) : base(100, 200)
{
@ -217,7 +217,6 @@ namespace Server.Items
AddBackground(25, 0, 520, 230, 0xA28);
AddLabel(70, 12, 0x3E3, "Choose a Banner:");
int itemID = Start;
for (int i = 1; i <= 4; i++)
@ -254,8 +253,8 @@ namespace Server.Items
private class InternalTarget : Target
{
private BannerDeed m_Banner;
private int m_ItemID;
private readonly BannerDeed m_Banner;
private readonly int m_ItemID;
public InternalTarget(BannerDeed banner, int itemID) : base(-1, true, TargetFlags.None)
{
@ -336,10 +335,10 @@ namespace Server.Items
private class FacingGump : Gump
{
private BannerDeed m_Banner;
private BaseHouse m_House;
private int m_ItemID;
private Point3D m_Location;
private readonly BannerDeed m_Banner;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
public FacingGump(BannerDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{

View file

@ -7,7 +7,7 @@ namespace Server.Items
{
public class RewardBrazier : Item, IRewardItem
{
private static int[] m_Art =
private static readonly int[] m_Art =
{
0x19AA, 0x19BB
};
@ -204,7 +204,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private RewardBrazierDeed m_Brazier;
private readonly RewardBrazierDeed m_Brazier;
public InternalGump(RewardBrazierDeed brazier) : base(100, 200)
{

View file

@ -47,7 +47,7 @@ namespace Server.Items
public class CannonAddon : BaseAddon
{
private static int[] m_Effects =
private static readonly int[] m_Effects =
{
0x36B0, 0x3728, 0x3709, 0x36FE
};
@ -63,37 +63,37 @@ namespace Server.Items
switch (direction)
{
case CannonDirection.North:
{
AddComponent(new CannonAddonComponent(0xE8D), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8C), 0, 1, 0);
AddComponent(new CannonAddonComponent(0xE8B), 0, 2, 0);
{
AddComponent(new CannonAddonComponent(0xE8D), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8C), 0, 1, 0);
AddComponent(new CannonAddonComponent(0xE8B), 0, 2, 0);
break;
}
break;
}
case CannonDirection.East:
{
AddComponent(new CannonAddonComponent(0xE96), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE95), -1, 0, 0);
AddComponent(new CannonAddonComponent(0xE94), -2, 0, 0);
{
AddComponent(new CannonAddonComponent(0xE96), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE95), -1, 0, 0);
AddComponent(new CannonAddonComponent(0xE94), -2, 0, 0);
break;
}
break;
}
case CannonDirection.South:
{
AddComponent(new CannonAddonComponent(0xE91), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE92), 0, -1, 0);
AddComponent(new CannonAddonComponent(0xE93), 0, -2, 0);
{
AddComponent(new CannonAddonComponent(0xE91), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE92), 0, -1, 0);
AddComponent(new CannonAddonComponent(0xE93), 0, -2, 0);
break;
}
break;
}
default:
{
AddComponent(new CannonAddonComponent(0xE8E), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8F), 1, 0, 0);
AddComponent(new CannonAddonComponent(0xE90), 2, 0, 0);
{
AddComponent(new CannonAddonComponent(0xE8E), 0, 0, 0);
AddComponent(new CannonAddonComponent(0xE8F), 1, 0, 0);
AddComponent(new CannonAddonComponent(0xE90), 2, 0, 0);
break;
}
break;
}
}
}
@ -114,7 +114,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public CannonDirection CannonDirection{ get; private set; }
public CannonDirection CannonDirection { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
@ -245,7 +245,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private CannonAddon m_Cannon;
private readonly CannonAddon m_Cannon;
public InternalTarget(CannonAddon cannon) : base(12, true, TargetFlags.None) => m_Cannon = cannon;
@ -314,8 +314,8 @@ namespace Server.Items
private class InternalGump : Gump
{
private CannonAddon m_Cannon;
private PotionKeg m_Keg;
private readonly CannonAddon m_Cannon;
private readonly PotionKeg m_Keg;
public InternalGump(CannonAddon cannon, PotionKeg keg) : base(50, 50)
{
@ -373,7 +373,8 @@ namespace Server.Items
public override BaseAddon Addon => new CannonAddon(m_Direction)
{
Charges = m_Charges, IsRewardItem = m_IsRewardItem
Charges = m_Charges,
IsRewardItem = m_IsRewardItem
};
[CommandProperty(AccessLevel.GameMaster)]

View file

@ -42,8 +42,8 @@ namespace Server.Items
}
public bool CouldFit(IPoint3D p, Map map) =>
map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) == true && (FacingSouth
&& BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map)
map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) == true && ((FacingSouth
&& BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map))
|| BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));
[CommandProperty(AccessLevel.GameMaster)]
@ -185,7 +185,7 @@ namespace Server.Items
0x1583 => 0x1634,
0x1584 => 0x1637,
0x1585 => 0x1636,
_ => (east + 1)
_ => east + 1
};
}
@ -195,7 +195,7 @@ namespace Server.Items
public const int End = 0x1585;
private int m_Page;
private DecorativeShieldDeed m_Shield;
private readonly DecorativeShieldDeed m_Shield;
public InternalGump(DecorativeShieldDeed shield, int page = 1) : base(150, 50)
{
@ -243,8 +243,8 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Shield?.Deleted != false || info.ButtonID < Start || info.ButtonID > End ||
((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) &&
(info.ButtonID < 0x1582 || info.ButtonID > 0x1585))
(((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) &&
(info.ButtonID < 0x1582 || info.ButtonID > 0x1585)))
return;
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
@ -254,8 +254,8 @@ namespace Server.Items
private class InternalTarget : Target
{
private int m_ItemID;
private DecorativeShieldDeed m_Shield;
private readonly int m_ItemID;
private readonly DecorativeShieldDeed m_Shield;
public InternalTarget(DecorativeShieldDeed shield, int itemID) : base(-1, true, TargetFlags.None)
{
@ -332,10 +332,10 @@ namespace Server.Items
private class FacingGump : Gump
{
private BaseHouse m_House;
private int m_ItemID;
private Point3D m_Location;
private DecorativeShieldDeed m_Shield;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
private readonly DecorativeShieldDeed m_Shield;
public FacingGump(DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{

View file

@ -194,7 +194,7 @@ namespace Server.Items
private class InternalTarget : Target
{
private FlamingHeadDeed m_Head;
private readonly FlamingHeadDeed m_Head;
public InternalTarget(FlamingHeadDeed head) : base(-1, true, TargetFlags.None) => m_Head = head;

View file

@ -202,13 +202,13 @@ namespace Server.Items
{
0x1B1E => 0x1B1D,
0x1B7F => 0x1B7C,
_ => (south + 1)
_ => south + 1
};
}
private class InternalGump : Gump
{
private HangingSkeletonDeed m_Skeleton;
private readonly HangingSkeletonDeed m_Skeleton;
public InternalGump(HangingSkeletonDeed skeleton) : base(100, 200)
{
@ -243,8 +243,8 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Skeleton?.Deleted != false || info.ButtonID != 0x1A03 && info.ButtonID != 0x1A05 &&
info.ButtonID != 0x1A09 && info.ButtonID != 0x1B1E && info.ButtonID != 0x1B7F)
if (m_Skeleton?.Deleted != false || (info.ButtonID != 0x1A03 && info.ButtonID != 0x1A05 &&
info.ButtonID != 0x1A09 && info.ButtonID != 0x1B1E && info.ButtonID != 0x1B7F))
return;
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
@ -254,8 +254,8 @@ namespace Server.Items
private class InternalTarget : Target
{
private int m_ItemID;
private HangingSkeletonDeed m_Skeleton;
private readonly int m_ItemID;
private readonly HangingSkeletonDeed m_Skeleton;
public InternalTarget(HangingSkeletonDeed banner, int itemID) : base(-1, true, TargetFlags.None)
{
@ -332,10 +332,10 @@ namespace Server.Items
private class FacingGump : Gump
{
private BaseHouse m_House;
private int m_ItemID;
private Point3D m_Location;
private HangingSkeletonDeed m_Skeleton;
private readonly BaseHouse m_House;
private readonly int m_ItemID;
private readonly Point3D m_Location;
private readonly HangingSkeletonDeed m_Skeleton;
public FacingGump(HangingSkeletonDeed banner, int itemID, Point3D location, BaseHouse house) : base(150, 50)
{

View file

@ -88,16 +88,16 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public MiningCartType CartType{ get; private set; }
public MiningCartType CartType { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Gems{ get; set; }
public int Gems { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Ore{ get; set; }
public int Ore { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem{ get; set; }
public bool IsRewardItem { get; set; }
private void GiveResources()
{
@ -236,12 +236,8 @@ namespace Server.Items
writer.WriteEncodedInt(1); // version
#region version 1
writer.Write((int)CartType);
#endregion
writer.Write(IsRewardItem);
writer.Write(Gems);
writer.Write(Ore);
@ -308,10 +304,10 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster)]
public int Gems{ get; set; }
public int Gems { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public int Ore{ get; set; }
public int Ore { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public bool IsRewardItem

View file

@ -100,7 +100,6 @@ namespace Server.Items
}
}
public override void GetProperties(ObjectPropertyList list)
{
base.GetProperties(list);
@ -129,7 +128,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private PottedCactusDeed m_Cactus;
private readonly PottedCactusDeed m_Cactus;
public InternalGump(PottedCactusDeed cactus) : base(100, 200)
{

View file

@ -223,7 +223,7 @@ namespace Server.Items
private class InternalGump : Gump
{
private StoneAnkhDeed m_Deed;
private readonly StoneAnkhDeed m_Deed;
public InternalGump(StoneAnkhDeed deed) : base(150, 50)
{

View file

@ -139,7 +139,6 @@ namespace Server.Items
AddComponent(new WallBannerComponent(0x159D), 2, 0, 0);
break;
case 17:
AddComponent(new WallBannerComponent(0x1610), 0, 0, 0);
AddComponent(new WallBannerComponent(0x160F), 0, 1, 0);
@ -350,11 +349,11 @@ namespace Server.Items
private class InternalGump : Gump
{
private WallBannerDeed m_WallBanner;
private readonly WallBannerDeed m_WallBanner;
public InternalGump(WallBannerDeed WallBanner) : base(150, 50)
public InternalGump(WallBannerDeed wallBanner) : base(150, 50)
{
m_WallBanner = WallBanner;
m_WallBanner = wallBanner;
Closable = true;
Disposable = true;

View file

@ -189,7 +189,7 @@ namespace Server.Items
private class TargetWeapon : Target
{
private WeaponEngravingTool m_Tool;
private readonly WeaponEngravingTool m_Tool;
public TargetWeapon(WeaponEngravingTool tool) : base(-1, true, TargetFlags.None) => m_Tool = tool;
@ -212,8 +212,8 @@ namespace Server.Items
private class InternalGump : Gump
{
private BaseWeapon m_Target;
private WeaponEngravingTool m_Tool;
private readonly BaseWeapon m_Target;
private readonly WeaponEngravingTool m_Tool;
public InternalGump(WeaponEngravingTool tool, BaseWeapon target) : base(0, 0)
{
@ -285,8 +285,8 @@ namespace Server.Items
public class ConfirmGump : Gump
{
private WeaponEngravingTool m_Engraver;
private Mobile m_Guildmaster;
private readonly WeaponEngravingTool m_Engraver;
private readonly Mobile m_Guildmaster;
public ConfirmGump(WeaponEngravingTool engraver, Mobile guildmaster) : base(200, 200)
{