Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -151,17 +151,12 @@ namespace Server.Items
public bool HasAccces(Mobile m)
{
if (m.AccessLevel >= AccessLevel.GameMaster)
return true;
BaseHouse house = BaseHouse.FindHouseAt(this);
return house != null && house.HasAccess(m);
return m.AccessLevel >= AccessLevel.GameMaster || BaseHouse.FindHouseAt(this)?.HasAccess(m) == true;
}
public void PlayMusic(Mobile m, MusicName music)
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
EndMusic(m);
else
m_ItemID = ItemID;
@ -172,7 +167,7 @@ namespace Server.Items
public void EndMusic(Mobile m)
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
m.Send(StopMusic.Instance);

View file

@ -109,7 +109,7 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Gear == null || m_Gear.Deleted)
if (m_Gear?.Deleted != false)
return;
if (targeted is DawnsMusicBox box)
@ -135,4 +135,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -5,13 +5,7 @@ namespace Server.Items
public class EnhancedBandage : Bandage
{
[Constructible]
public EnhancedBandage()
: this(1)
{
}
[Constructible]
public EnhancedBandage(int amount)
public EnhancedBandage(int amount = 1)
: base(amount)
{
Hue = 0x8A5;
@ -61,13 +55,7 @@ namespace Server.Items
private Timer m_Timer;
[Constructible]
public FountainOfLife()
: this(10)
{
}
[Constructible]
public FountainOfLife(int charges)
public FountainOfLife(int charges = 10)
: base(0x2AC0)
{
m_Charges = charges;
@ -222,13 +210,7 @@ namespace Server.Items
private int m_Charges;
[Constructible]
public FountainOfLifeDeed()
: this(10)
{
}
[Constructible]
public FountainOfLifeDeed(int charges)
public FountainOfLifeDeed(int charges = 10)
{
LootType = LootType.Blessed;
m_Charges = charges;
@ -271,4 +253,4 @@ namespace Server.Items
m_Charges = reader.ReadInt();
}
}
}
}

View file

@ -4,12 +4,7 @@ namespace Server.Items
public class HoodedShroudOfShadows : BaseOuterTorso
{
[Constructible]
public HoodedShroudOfShadows() : this(0x455)
{
}
[Constructible]
public HoodedShroudOfShadows(int hue) : base(0x2684, hue)
public HoodedShroudOfShadows(int hue = 0x455) : base(0x2684, hue)
{
LootType = LootType.Blessed;
Weight = 3.0;
@ -39,4 +34,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -109,21 +109,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076749, 0x7FFF, false, false); // Please select your broken bed position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076749, 0x7FFF); // Please select your broken bed position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -131,4 +131,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -105,22 +105,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076747, 0x7FFF, false,
false); // Please select your broken vanity position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076747, 0x7FFF); // Please select your broken vanity position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -128,4 +127,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -9,12 +9,7 @@ namespace Server.Items
private SkillMod m_SkillMod;
[Constructible]
public AncientSmithyHammer(int bonus) : this(bonus, 600)
{
}
[Constructible]
public AncientSmithyHammer(int bonus, int uses) : base(uses, 0x13E4)
public AncientSmithyHammer(int bonus, int uses = 600) : base(uses, 0x13E4)
{
m_Bonus = bonus;
Weight = 8.0;

View file

@ -8,12 +8,7 @@ namespace Server.Items
private int m_UsesRemaining;
[Constructible]
public PowderOfTemperament() : this(10)
{
}
[Constructible]
public PowderOfTemperament(int charges) : base(4102)
public PowderOfTemperament(int charges = 10) : base(4102)
{
Weight = 1.0;
Hue = 2419;
@ -105,7 +100,7 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Powder.Deleted || m_Powder.UsesRemaining <= 0)
if (m_Powder?.Deleted != false || m_Powder.UsesRemaining <= 0)
{
from.SendLocalizedMessage(1049086); // You have used up your powder of temperament.
return;
@ -189,4 +184,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -42,7 +42,7 @@ namespace Server.Items
{
base.OnAfterDelete();
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
}
@ -117,7 +117,7 @@ namespace Server.Items
protected override void OnTick()
{
if (m_Component != null && !m_Component.Deleted)
if (m_Component?.Deleted == false)
m_Component.UpdateImage();
}
}
@ -181,4 +181,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -128,32 +128,29 @@ namespace Server.Items
{
Stop();
}
else
else if (m_Location != m_Mobile.Location)
{
if (m_Location != m_Mobile.Location)
{
int amount = Utility.RandomMinMax(0, 7);
int amount = Utility.RandomMinMax(0, 7);
for (int i = 0; i < amount; i++)
for (int i = 0; i < amount; i++)
{
int x = m_Mobile.X + Utility.RandomMinMax(-1, 1);
int y = m_Mobile.Y + Utility.RandomMinMax(-1, 1);
int z = m_Mobile.Z;
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
{
int x = m_Mobile.X + Utility.RandomMinMax(-1, 1);
int y = m_Mobile.Y + Utility.RandomMinMax(-1, 1);
int z = m_Mobile.Z;
z = m_Mobile.Map.GetAverageZ(x, y);
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
{
z = m_Mobile.Map.GetAverageZ(x, y);
if (!m_Mobile.Map.CanFit(x, y, z, 1, false, false))
continue;
}
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));
blood.MoveToWorld(new Point3D(x, y, z), m_Mobile.Map);
continue;
}
m_Location = m_Mobile.Location;
Blood blood = new Blood(Utility.RandomMinMax(0x122C, 0x122F));
blood.MoveToWorld(new Point3D(x, y, z), m_Mobile.Map);
}
m_Location = m_Mobile.Location;
}
}
}
@ -189,4 +186,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -31,7 +31,7 @@ namespace Server.Items
{
base.OnAfterDelete();
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
}
@ -118,4 +118,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -110,11 +110,11 @@ namespace Server.Items
AddItem(90, 52, 0x2367);
AddItem(112, 35, 0x2360);
AddButton(70, 35, 0x868, 0x869, 1, GumpButtonType.Reply, 0); // South
AddButton(70, 35, 0x868, 0x869, 1); // South
AddItem(220, 35, 0x2352);
AddItem(242, 52, 0x2358);
AddButton(185, 35, 0x868, 0x869, 2, GumpButtonType.Reply, 0); // East
AddButton(185, 35, 0x868, 0x869, 2); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -127,4 +127,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -157,12 +157,7 @@ namespace Server.Items
public class RoseOfTrinsicPetal : Item
{
[Constructible]
public RoseOfTrinsicPetal() : this(1)
{
}
[Constructible]
public RoseOfTrinsicPetal(int amount) : base(0x1021)
public RoseOfTrinsicPetal(int amount = 1) : base(0x1021)
{
Stackable = true;
Amount = amount;
@ -212,4 +207,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -178,21 +178,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076581, 0x7FFF, false, false); // Please select your curtain position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076581, 0x7FFF); // Please select your curtain position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -200,4 +200,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -105,21 +105,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076745, 0x7FFF, false, false); // Please select your hanging axe position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076745, 0x7FFF); // Please select your hanging axe position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -127,4 +127,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -105,22 +105,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076746, 0x7FFF, false,
false); // Please select your hanging sword position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076746, 0x7FFF); // Please select your hanging sword position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -128,4 +127,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -130,42 +130,38 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076780, 0x7FFF, false,
false); // Please select your ladder position. <br>Use the ladders marked (castle) <br> for accessing the tops of keeps <br> and castles.
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076780, 0x7FFF); // Please select your ladder position. <br>Use the ladders marked (castle) <br> for accessing the tops of keeps <br> and castles.
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1076794, 0x7FFF, false, false); // South (Castle)
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1076795, 0x7FFF, false, false); // East (Castle)
AddButton(19, 97, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 95, 213, 20, 1076792, 0x7FFF, false, false); // North (Castle)
AddButton(19, 121, 0x845, 0x846, 4, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 119, 213, 20, 1076793, 0x7FFF, false, false); // West (Castle)
AddButton(19, 145, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 143, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 169, 0x845, 0x846, 6, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 167, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 193, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 191, 213, 20, 1075389, 0x7FFF, false, false); // North
AddButton(19, 217, 0x845, 0x846, 8, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 215, 213, 20, 1075390, 0x7FFF, false, false); // West
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1076794, 0x7FFF); // South (Castle)
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1076795, 0x7FFF); // East (Castle)
AddButton(19, 97, 0x845, 0x846, 3);
AddHtmlLocalized(44, 95, 213, 20, 1076792, 0x7FFF); // North (Castle)
AddButton(19, 121, 0x845, 0x846, 4);
AddHtmlLocalized(44, 119, 213, 20, 1076793, 0x7FFF); // West (Castle)
AddButton(19, 145, 0x845, 0x846, 5);
AddHtmlLocalized(44, 143, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 169, 0x845, 0x846, 6);
AddHtmlLocalized(44, 167, 213, 20, 1075387, 0x7FFF); // East
AddButton(19, 193, 0x845, 0x846, 7);
AddHtmlLocalized(44, 191, 213, 20, 1075389, 0x7FFF); // North
AddButton(19, 217, 0x845, 0x846, 8);
AddHtmlLocalized(44, 215, 213, 20, 1075390, 0x7FFF); // West
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0 || info.ButtonID < 1 || info.ButtonID > 8)
return;
if (info.ButtonID >= 1 && info.ButtonID <= 8)
{
m_Deed.m_Type = info.ButtonID - 1;
m_Deed.SendTarget(sender.Mobile);
}
m_Deed.m_Type = info.ButtonID - 1;
m_Deed.SendTarget(sender.Mobile);
}
}
}
}
}

View file

@ -107,21 +107,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076579, 0x7FFF, false, false); // Please select your statue position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076579, 0x7FFF); // Please select your statue position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -129,4 +129,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -109,21 +109,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076580, 0x7FFF, false, false); // Pleae select your unmade bed position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076580, 0x7FFF); // Pleae select your unmade bed position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -131,4 +131,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -102,21 +102,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076744, 0x7FFF, false, false); // Please select your vanity position.
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076744, 0x7FFF); // Please select your vanity position.
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -124,4 +124,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -134,21 +134,21 @@ namespace Server.Items
AddImageTiled(10, 40, 253, 244, 0xA40);
AddImageTiled(10, 294, 253, 20, 0xA40);
AddAlphaRegion(10, 10, 253, 304);
AddButton(10, 294, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076748, 0x7FFF, false, false); // Please select your coffin position
AddButton(10, 294, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
AddHtmlLocalized(14, 12, 273, 20, 1076748, 0x7FFF); // Please select your coffin position
AddPage(1);
AddButton(19, 49, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF, false, false); // South
AddButton(19, 73, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF, false, false); // East
AddButton(19, 49, 0x845, 0x846, 1);
AddHtmlLocalized(44, 47, 213, 20, 1075386, 0x7FFF); // South
AddButton(19, 73, 0x845, 0x846, 2);
AddHtmlLocalized(44, 71, 213, 20, 1075387, 0x7FFF); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted || info.ButtonID == 0)
if (m_Deed?.Deleted != false || info.ButtonID == 0)
return;
m_Deed.m_East = info.ButtonID != 1;
@ -156,4 +156,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -1,5 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Server.Multis;
@ -264,7 +263,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_Tree != null && !m_Tree.Deleted)
if (m_Tree?.Deleted == false)
m_Tree.OnDoubleClick(from);
}
@ -298,4 +297,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -11,8 +11,7 @@ namespace Server.Items
{
}
public CandyCane(int itemID)
: base(itemID)
public CandyCane(int itemID) : base(itemID, 1)
{
Stackable = false;
LootType = LootType.Blessed;
@ -81,7 +80,7 @@ namespace Server.Items
{
--Eaten;
if (Eater == null || Eater.Deleted || Eaten <= 0)
if (Eater?.Deleted != false || Eaten <= 0)
{
Stop();
m_ToothAches.Remove(Eater);
@ -127,7 +126,7 @@ namespace Server.Items
[Constructible]
public GingerBreadCookie()
: base(Utility.RandomBool() ? 0x2be1 : 0x2be2)
: base(Utility.RandomBool() ? 0x2be1 : 0x2be2, 1)
{
Stackable = false;
LootType = LootType.Blessed;

View file

@ -103,24 +103,24 @@ namespace Server.Items
AddLabel(45, 15, 0, "Choose a Potted Plant:");
AddItem(45, 75, 0x11C8);
AddButton(55, 50, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddButton(55, 50, 0x845, 0x846, 1);
AddItem(100, 75, 0x11C9);
AddButton(115, 50, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddButton(115, 50, 0x845, 0x846, 2);
AddItem(160, 75, 0x11CA);
AddButton(175, 50, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
AddButton(175, 50, 0x845, 0x846, 3);
AddItem(225, 75, 0x11CB);
AddButton(235, 50, 0x845, 0x846, 4, GumpButtonType.Reply, 0);
AddButton(235, 50, 0x845, 0x846, 4);
AddItem(280, 75, 0x11CC);
AddButton(295, 50, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
AddButton(295, 50, 0x845, 0x846, 5);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted)
if (m_Deed?.Deleted != false)
return;
Mobile from = sender.Mobile;
@ -150,4 +150,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -64,7 +64,7 @@ namespace Server.Items
public class Spam : Food
{
[Constructible]
public Spam() : base(0x1044)
public Spam() : base(0x1044, 1)
{
Stackable = false;
LootType = LootType.Blessed;
@ -86,4 +86,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -191,21 +191,21 @@ namespace Server.Items
AddLabel(45, 15, 0, "Select One:");
AddItem(35, 75, 0x456E);
AddButton(65, 50, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddButton(65, 50, 0x845, 0x846, 1);
AddItem(120, 75, 0x4578);
AddButton(135, 50, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddButton(135, 50, 0x845, 0x846, 2);
AddItem(190, 75, 0x457A);
AddButton(205, 50, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
AddButton(205, 50, 0x845, 0x846, 3);
AddItem(250, 75, 0x457C);
AddButton(275, 50, 0x845, 0x846, 4, GumpButtonType.Reply, 0);
AddButton(275, 50, 0x845, 0x846, 4);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted)
if (m_Deed?.Deleted != false)
return;
Mobile from = sender.Mobile;
@ -216,10 +216,12 @@ namespace Server.Items
return;
}
Item statue = null;
Item statue;
switch (info.ButtonID)
{
default:
return;
case 1:
statue = new SnowStatuePegasus();
break;
@ -234,9 +236,6 @@ namespace Server.Items
break;
}
if (statue == null)
return;
if (!from.PlaceInBackpack(statue))
{
statue.Delete();
@ -249,4 +248,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -6,7 +6,7 @@ namespace Server.Items
private string m_Title;
[Constructible]
public Snowman() : this(Utility.RandomDyedHue(), GetRandomTitle())
public Snowman() : this(Utility.RandomDyedHue())
{
}
@ -156,4 +156,4 @@ namespace Server.Items
Utility.Intern(ref m_Title);
}
}
}
}

View file

@ -43,7 +43,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
if (from.InRange(GetWorldLocation(), 1))
{
@ -101,7 +101,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
if (from.InRange(GetWorldLocation(), 3))
{
@ -129,11 +129,11 @@ namespace Server.Items
AddBackground(0, 0, 220, 170, 0x13BE);
AddBackground(10, 10, 200, 150, 0xBB8);
AddHtmlLocalized(20, 30, 180, 60, 1062839, false, false); // Do you wish to re-deed this decoration?
AddHtmlLocalized(55, 100, 160, 25, 1011011, false, false); // CONTINUE
AddButton(20, 100, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 125, 160, 25, 1011012, false, false); // CANCEL
AddButton(20, 125, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(20, 30, 180, 60, 1062839); // Do you wish to re-deed this decoration?
AddHtmlLocalized(55, 100, 160, 25, 1011011); // CONTINUE
AddButton(20, 100, 0xFA5, 0xFA7, 1);
AddHtmlLocalized(55, 125, 160, 25, 1011012); // CANCEL
AddButton(20, 125, 0xFA5, 0xFA7, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -199,7 +199,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
from.SendLocalizedMessage(1062838); // Where would you like to place this decoration?
from.BeginTarget(-1, true, TargetFlags.None, Placement_OnTarget);
@ -224,7 +224,7 @@ namespace Server.Items
BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
bool northWall = BaseAddon.IsWall(loc.X, loc.Y - 1, loc.Z, from.Map);
bool westWall = BaseAddon.IsWall(loc.X - 1, loc.Y, loc.Z, from.Map);
@ -292,8 +292,8 @@ namespace Server.Items
AddItem(90, 30, 0x232D);
AddItem(180, 30, 0x232C);
AddButton(50, 35, 0x868, 0x869, 1, GumpButtonType.Reply, 0);
AddButton(145, 35, 0x868, 0x869, 2, GumpButtonType.Reply, 0);
AddButton(50, 35, 0x868, 0x869, 1);
AddButton(145, 35, 0x868, 0x869, 2);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -313,4 +313,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -10,13 +10,7 @@ namespace Server.Items
private Point3D m_PlotLocation;
private HouseRaffleStone m_Stone;
[Constructible]
public HouseRaffleDeed()
: this(null, null)
{
}
public HouseRaffleDeed(HouseRaffleStone stone, Mobile m) : base(0x2830)
public HouseRaffleDeed(HouseRaffleStone stone = null, Mobile m = null) : base(0x2830)
{
m_Stone = stone;
@ -82,7 +76,7 @@ namespace Server.Items
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Seer)]
public bool IsExpired => m_Stone == null || m_Stone.Deleted || m_Stone.IsExpired;
public bool IsExpired => m_Stone?.Deleted != false || m_Stone.IsExpired;
public override string DefaultName => "a writ of lease";
@ -186,7 +180,7 @@ namespace Server.Items
AddImage(114, 266, 9387);
AddImage(171, 266, 9388);
AddHtmlLocalized(30, 48, 229, 20, 1150484, 200, false, false); // WRIT OF LEASE
AddHtmlLocalized(30, 48, 229, 20, 1150484, 200); // WRIT OF LEASE
AddHtml(28, 75, 231, 280, FormatDescription(deed), false, true);
}
@ -217,4 +211,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -23,12 +23,8 @@ namespace Server.Gumps
private HouseRaffleStone m_Stone;
public HouseRaffleManagementGump(HouseRaffleStone stone)
: this(stone, SortMethod.Default, 0)
{
}
public HouseRaffleManagementGump(HouseRaffleStone stone, SortMethod sort, int page) : base(40, 40)
public HouseRaffleManagementGump(HouseRaffleStone stone, SortMethod sort = SortMethod.Default,
int page = 0) : base(40, 40)
{
m_Stone = stone;
m_Page = page;
@ -63,47 +59,47 @@ namespace Server.Gumps
AddBackground(0, 0, 618, 354, 9270);
AddAlphaRegion(10, 10, 598, 334);
AddHtml(10, 10, 598, 20, Color(Center("Raffle Management"), LabelColor), false, false);
AddHtml(10, 10, 598, 20, Color(Center("Raffle Management"), LabelColor));
AddHtml(45, 35, 100, 20, Color("Location:", LabelColor), false, false);
AddHtml(145, 35, 250, 20, Color(m_Stone.FormatLocation(), LabelColor), false, false);
AddHtml(45, 35, 100, 20, Color("Location:", LabelColor));
AddHtml(145, 35, 250, 20, Color(m_Stone.FormatLocation(), LabelColor));
AddHtml(45, 55, 100, 20, Color("Ticket Price:", LabelColor), false, false);
AddHtml(145, 55, 250, 20, Color(m_Stone.FormatPrice(), LabelColor), false, false);
AddHtml(45, 55, 100, 20, Color("Ticket Price:", LabelColor));
AddHtml(145, 55, 250, 20, Color(m_Stone.FormatPrice(), LabelColor));
AddHtml(45, 75, 100, 20, Color("Total Entries:", LabelColor), false, false);
AddHtml(145, 75, 250, 20, Color(m_Stone.Entries.Count.ToString(), LabelColor), false, false);
AddHtml(45, 75, 100, 20, Color("Total Entries:", LabelColor));
AddHtml(145, 75, 250, 20, Color(m_Stone.Entries.Count.ToString(), LabelColor));
AddButton(440, 33, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
AddHtml(474, 35, 120, 20, Color("Sort by name", LabelColor), false, false);
AddButton(440, 33, 0xFA5, 0xFA7, 3);
AddHtml(474, 35, 120, 20, Color("Sort by name", LabelColor));
AddButton(440, 53, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
AddHtml(474, 55, 120, 20, Color("Sort by account", LabelColor), false, false);
AddButton(440, 53, 0xFA5, 0xFA7, 4);
AddHtml(474, 55, 120, 20, Color("Sort by account", LabelColor));
AddButton(440, 73, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
AddHtml(474, 75, 120, 20, Color("Sort by address", LabelColor), false, false);
AddButton(440, 73, 0xFA5, 0xFA7, 5);
AddHtml(474, 75, 120, 20, Color("Sort by address", LabelColor));
AddImageTiled(13, 99, 592, 242, 9264);
AddImageTiled(14, 100, 590, 240, 9274);
AddAlphaRegion(14, 100, 590, 240);
AddHtml(14, 100, 590, 20, Color(Center("Entries"), LabelColor), false, false);
AddHtml(14, 100, 590, 20, Color(Center("Entries"), LabelColor));
if (page > 0)
AddButton(567, 104, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0);
AddButton(567, 104, 0x15E3, 0x15E7, 1);
else
AddImage(567, 104, 0x25EA);
if ((page + 1) * 10 < m_List.Count)
AddButton(584, 104, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
AddButton(584, 104, 0x15E1, 0x15E5, 2);
else
AddImage(584, 104, 0x25E6);
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor), false, false);
AddHtml(47, 120, 250, 20, Color("Name", LabelColor), false, false);
AddHtml(295, 120, 100, 20, Color(Center("Address"), LabelColor), false, false);
AddHtml(395, 120, 150, 20, Color(Center("Date"), LabelColor), false, false);
AddHtml(545, 120, 60, 20, Color(Center("Num"), LabelColor), false, false);
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor));
AddHtml(47, 120, 250, 20, Color("Name", LabelColor));
AddHtml(295, 120, 100, 20, Color(Center("Address"), LabelColor));
AddHtml(395, 120, 150, 20, Color(Center("Date"), LabelColor));
AddHtml(545, 120, 60, 20, Color(Center("Num"), LabelColor));
int idx = 0;
Mobile winner = m_Stone.Winner;
@ -115,7 +111,7 @@ namespace Server.Gumps
if (entry == null)
continue;
AddButton(13, 138 + idx * 20, 4002, 4004, 6 + i, GumpButtonType.Reply, 0);
AddButton(13, 138 + idx * 20, 4002, 4004, 6 + i);
int x = 45;
int color = winner != null && entry.From == winner ? HighlightColor : LabelColor;
@ -131,19 +127,19 @@ namespace Server.Gumps
}
if (name != null)
AddHtml(x + 2, 140 + idx * 20, 250, 20, Color(name, color), false, false);
AddHtml(x + 2, 140 + idx * 20, 250, 20, Color(name, color));
x += 250;
if (entry.Address != null)
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(entry.Address.ToString()), color), false, false);
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(entry.Address.ToString()), color));
x += 100;
AddHtml(x, 140 + idx * 20, 150, 20, Color(Center(entry.Date.ToString()), color), false, false);
AddHtml(x, 140 + idx * 20, 150, 20, Color(Center(entry.Date.ToString()), color));
x += 150;
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center("1"), color), false, false);
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center("1"), color));
x += 60;
}
}
@ -190,19 +186,19 @@ namespace Server.Gumps
}
case 3: // Sort by name
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Name, 0));
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Name));
break;
}
case 4: // Sort by account
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Account, 0));
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Account));
break;
}
case 5: // Sort by address
{
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Address, 0));
from.SendGump(new HouseRaffleManagementGump(m_Stone, SortMethod.Address));
break;
}
@ -243,9 +239,7 @@ namespace Server.Gumps
int result = Insensitive.Compare(x.From.Name, y.From.Name);
if (result == 0)
return x.Date.CompareTo(y.Date);
return result;
return result == 0 ? x.Date.CompareTo(y.Date) : result;
}
}
@ -277,9 +271,7 @@ namespace Server.Gumps
int result = Insensitive.Compare(a.Username, b.Username);
if (result == 0)
return x.Date.CompareTo(y.Date);
return result;
return result == 0 ? x.Date.CompareTo(y.Date) : result;
}
}
@ -314,4 +306,4 @@ namespace Server.Gumps
}
}
}
}
}

View file

@ -462,8 +462,8 @@ namespace Server.Items
{
Container bank = from.FindBankNoCreate();
if (m_TicketPrice == 0 || from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), m_TicketPrice) ||
bank != null && bank.ConsumeTotal(typeof(Gold), m_TicketPrice))
if (m_TicketPrice == 0 || from.Backpack?.ConsumeTotal(typeof(Gold), m_TicketPrice) == true ||
bank?.ConsumeTotal(typeof(Gold), m_TicketPrice) == true)
{
Entries.Add(new RaffleEntry(from));
@ -690,4 +690,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -7,12 +7,7 @@ namespace Server.Items
private MiniHouseType m_Type;
[Constructible]
public MiniHouseAddon() : this(MiniHouseType.StoneAndPlaster)
{
}
[Constructible]
public MiniHouseAddon(MiniHouseType type)
public MiniHouseAddon(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{
m_Type = type;
@ -88,12 +83,7 @@ namespace Server.Items
private MiniHouseType m_Type;
[Constructible]
public MiniHouseDeed() : this(MiniHouseType.StoneAndPlaster)
{
}
[Constructible]
public MiniHouseDeed(MiniHouseType type)
public MiniHouseDeed(MiniHouseType type = MiniHouseType.StoneAndPlaster)
{
m_Type = type;
@ -241,4 +231,4 @@ namespace Server.Items
return m_Info[v];
}
}
}
}

View file

@ -132,12 +132,8 @@ namespace Server.Items
private MonsterStatuetteType m_Type;
[Constructible]
public MonsterStatuette() : this(MonsterStatuetteType.Crocodile)
{
}
[Constructible]
public MonsterStatuette(MonsterStatuetteType type) : base(MonsterStatuetteInfo.GetInfo(type).ItemID)
public MonsterStatuette(MonsterStatuetteType type = MonsterStatuetteType.Crocodile) :
base(MonsterStatuetteInfo.GetInfo(type).ItemID)
{
LootType = LootType.Blessed;
@ -226,9 +222,7 @@ namespace Server.Items
public bool IsOwner(Mobile mob)
{
BaseHouse house = BaseHouse.FindHouseAt(this);
return house != null && house.IsOwner(mob);
return BaseHouse.FindHouseAt(this)?.IsOwner(mob) == true;
}
public override void OnDoubleClick(Mobile from)
@ -283,14 +277,13 @@ namespace Server.Items
AddBackground(0, 0, 300, 150, 0xA28);
AddHtmlLocalized(45, 20, 300, 35, statuette.TurnedOn ? 1011035 : 1011034, false,
false); // [De]Activate this item
AddHtmlLocalized(45, 20, 300, 35, statuette.TurnedOn ? 1011035 : 1011034); // [De]Activate this item
AddButton(40, 53, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(80, 55, 65, 35, 1011036, false, false); // OKAY
AddButton(40, 53, 0xFA5, 0xFA7, 1);
AddHtmlLocalized(80, 55, 65, 35, 1011036); // OKAY
AddButton(150, 53, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(190, 55, 100, 35, 1011012, false, false); // CANCEL
AddButton(150, 53, 0xFA5, 0xFA7, 0);
AddHtmlLocalized(190, 55, 100, 35, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -312,4 +305,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Items
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
}
@ -30,7 +30,7 @@ namespace Server.Items
{
if (IsAccessibleTo(from) && !Patched)
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
if (Starting)
@ -107,4 +107,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -18,7 +18,7 @@ namespace Server.Items
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
}
@ -51,7 +51,7 @@ namespace Server.Items
protected override void OnTick()
{
if (m_Heart == null || m_Heart.Deleted || m_Heart.Owner == null || !m_Heart.Owner.Alive)
if (m_Heart?.Deleted != false || m_Heart.Owner?.Alive != true)
{
Stop();
return;
@ -76,4 +76,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -76,11 +76,7 @@ namespace Server.Items
public class PlagueBeastComponent : PlagueBeastInnard
{
public PlagueBeastComponent(int itemID, int hue) : this(itemID, hue, false)
{
}
public PlagueBeastComponent(int itemID, int hue, bool movable) : base(itemID, hue)
public PlagueBeastComponent(int itemID, int hue, bool movable = false) : base(itemID, hue)
{
Movable = movable;
}
@ -99,10 +95,7 @@ namespace Server.Items
public override bool DropToItem(Mobile from, Item target, Point3D p)
{
if (target is PlagueBeastBackpack)
return base.DropToItem(from, target, p);
return false;
return target is PlagueBeastBackpack && base.DropToItem(from, target, p);
}
public override bool AllowSecureTrade(Mobile from, Mobile to, Mobile newOwner, bool accepted)
@ -122,8 +115,7 @@ namespace Server.Items
public override bool OnDragDrop(Mobile from, Item dropped)
{
if (Organ != null && Organ.OnDropped(from, dropped, this))
if (dropped is PlagueBeastComponent component)
if (Organ?.OnDropped(from, dropped, this) == true && dropped is PlagueBeastComponent component)
Organ.Components.Add(component);
return true;
@ -133,10 +125,9 @@ namespace Server.Items
{
if (IsAccessibleTo(from))
{
if (Organ != null && Organ.OnLifted(from, this))
if (Organ?.OnLifted(from, this) == true)
{
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null,
0x3B2); // * You rip the organ out of the plague beast's flesh *
from.SendLocalizedMessage(IsGland ? 1071895 : 1071914, null); // * You rip the organ out of the plague beast's flesh *
if (Organ.Components.Contains(this))
Organ.Components.Remove(this);
@ -169,4 +160,4 @@ namespace Server.Items
Organ = reader.ReadItem<PlagueBeastOrgan>();
}
}
}
}

View file

@ -8,17 +8,12 @@ namespace Server.Items
{
private Timer m_Timer;
public PlagueBeastOrgan() : this(1, 0)
{
Visible = false;
}
public PlagueBeastOrgan(int itemID, int hue) : base(itemID, hue)
public PlagueBeastOrgan(int itemID = 1, int hue = 0) : base(itemID, hue)
{
Components = new List<PlagueBeastComponent>();
Opened = false;
Movable = false;
Visible = itemID <= 1;
Timer.DelayCall(TimeSpan.Zero, Initialize);
}
@ -70,7 +65,7 @@ namespace Server.Items
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
}
@ -116,7 +111,7 @@ namespace Server.Items
public class PlagueBeastMaidenOrgan : PlagueBeastOrgan
{
public PlagueBeastMaidenOrgan() : base(0x124D, 0x0)
public PlagueBeastMaidenOrgan() : base(0x124D)
{
}
@ -564,4 +559,4 @@ namespace Server.Items
m_Brains = reader.ReadInt();
}
}
}
}

View file

@ -38,7 +38,7 @@ namespace Server.Items
public override void OnAfterDelete()
{
if (m_Timer != null && m_Timer.Running)
if (m_Timer?.Running == true)
m_Timer.Stop();
}
@ -75,4 +75,4 @@ namespace Server.Items
Cut = reader.ReadBool();
}
}
}
}

View file

@ -6,13 +6,7 @@
private static int fItemID = 0x2004;
[Constructible]
public Bucket()
: this(false)
{
}
[Constructible]
public Bucket(bool filled)
public Bucket(bool filled = false)
: base(filled ? fItemID : vItemID, filled)
{
}
@ -40,4 +34,4 @@
int version = reader.ReadInt();
}
}
}
}

View file

@ -6,13 +6,7 @@
private static int fItemID = 0x154d;
[Constructible]
public WaterBarrel()
: this(false)
{
}
[Constructible]
public WaterBarrel(bool filled)
public WaterBarrel(bool filled = false)
: base(filled ? fItemID : vItemID, filled)
{
}
@ -42,4 +36,4 @@
int version = reader.ReadInt();
}
}
}
}

View file

@ -6,13 +6,7 @@
private static int fItemID = 0xe7b;
[Constructible]
public Tub()
: this(false)
{
}
[Constructible]
public Tub(bool filled)
public Tub(bool filled = false)
: base(filled ? fItemID : vItemID, filled)
{
}
@ -40,4 +34,4 @@
int version = reader.ReadInt();
}
}
}
}

View file

@ -37,7 +37,7 @@ namespace Server.Items
{
get
{
if (m_Pet != null && m_Pet.Deleted)
if (m_Pet?.Deleted == true)
{
m_Pet = null;
InternalUpdatePetName();
@ -475,4 +475,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -49,7 +49,7 @@ namespace Server.Items
{
get
{
if (m_Bound != null && m_Bound.Deleted)
if (m_Bound?.Deleted == true)
m_Bound = null;
return m_Bound;
@ -380,20 +380,18 @@ namespace Server.Items
m_Bracelet.m_Timer = null;
m_From.Frozen = false;
if (m_Bracelet.Deleted || m_From.Deleted)
if (m_Bracelet.Deleted || m_From.Deleted ||
!m_Bracelet.CheckUse(m_From, false) ||
!(m_Bracelet.Bound.RootParent is Mobile boundRoot))
return;
if (m_Bracelet.CheckUse(m_From, false))
if (m_Bracelet.Bound.RootParent is Mobile boundRoot)
{
m_Bracelet.Charges--;
m_Bracelet.Charges--;
BaseCreature.TeleportPets(m_From, boundRoot.Location, boundRoot.Map, true);
BaseCreature.TeleportPets(m_From, boundRoot.Location, boundRoot.Map, true);
m_From.PlaySound(0x1FC);
m_From.MoveToWorld(boundRoot.Location, boundRoot.Map);
m_From.PlaySound(0x1FC);
}
m_From.PlaySound(0x1FC);
m_From.MoveToWorld(boundRoot.Location, boundRoot.Map);
m_From.PlaySound(0x1FC);
}
}
@ -472,4 +470,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -15,12 +15,7 @@ namespace Server.Items
public class PowderOfTranslocation : Item
{
[Constructible]
public PowderOfTranslocation() : this(1)
{
}
[Constructible]
public PowderOfTranslocation(int amount) : base(0x26B8)
public PowderOfTranslocation(int amount = 1) : base(0x26B8)
{
Stackable = true;
Weight = 0.1;
@ -112,4 +107,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -3,12 +3,7 @@ namespace Server.Items
public class ZoogiFungus : Item, ICommodity
{
[Constructible]
public ZoogiFungus() : this(1)
{
}
[Constructible]
public ZoogiFungus(int amount) : base(0x26B7)
public ZoogiFungus(int amount = 1) : base(0x26B7)
{
Stackable = true;
Weight = 0.1;
@ -36,4 +31,4 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -21,22 +21,8 @@ namespace Server.Items
private double m_SkillValue;
[Constructible]
public SoulStone() : this(null)
{
}
[Constructible]
public SoulStone(string account)
: this(account, 0x2A93, 0x2A94)
{
}
public SoulStone(string account, int itemID)
: this(account, itemID, itemID)
{
}
public SoulStone(string account, int inactiveItemID, int activeItemID) : base(inactiveItemID)
public SoulStone(string account = null, int inactiveItemID = 0x2A93, int activeItemID = 0x2A94) :
base(inactiveItemID)
{
Light = LightType.Circle300;
LootType = LootType.Blessed;
@ -135,12 +121,7 @@ namespace Server.Items
list.Add(1070721, "#{0}\t{1:0.0}", AosSkillBonuses.GetLabel(Skill),
SkillValue); // Skill stored: ~1_skillname~ ~2_skillamount~
string name = LastUserName;
if (name == null)
name = $"#{1074235}"; // Unknown
list.Add(1041602, "{0}", name); // Owner: ~1_val~
list.Add(1041602, "{0}", LastUserName ?? $"#{1074235}"); // Owner: ~1_val~
}
private static bool CheckCombat(Mobile m, TimeSpan time)
@ -343,11 +324,10 @@ namespace Server.Items
AddAlphaRegion(10, 10, 500, 420);
AddHtmlLocalized(10, 12, 500, 20, 1061087, 0x7FFF, false,
false); // Which skill do you wish to transfer to the Soulstone?
AddHtmlLocalized(10, 12, 500, 20, 1061087, 0x7FFF); // Which skill do you wish to transfer to the Soulstone?
AddButton(10, 410, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(10, 410, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF); // CANCEL
for (int i = 0, n = 0; i < from.Skills.Length; i++)
{
@ -364,7 +344,7 @@ namespace Server.Items
if (page > 0)
{
AddButton(260, 380, 0xFA5, 0xFA6, 0, GumpButtonType.Page, page + 1);
AddHtmlLocalized(305, 382, 200, 20, 1011066, 0x7FFF, false, false); // Next page
AddHtmlLocalized(305, 382, 200, 20, 1011066, 0x7FFF); // Next page
}
AddPage(page + 1);
@ -372,16 +352,15 @@ namespace Server.Items
if (page > 0)
{
AddButton(10, 380, 0xFAE, 0xFAF, 0, GumpButtonType.Page, page);
AddHtmlLocalized(55, 382, 200, 20, 1011067, 0x7FFF, false, false); // Previous page
AddHtmlLocalized(55, 382, 200, 20, 1011067, 0x7FFF); // Previous page
}
}
int x = p % 2 == 0 ? 10 : 260;
int y = p / 2 * 20 + 40;
AddButton(x, y, 0xFA5, 0xFA6, i + 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(x + 45, y + 2, 200, 20, AosSkillBonuses.GetLabel(skill.SkillName), 0x7FFF, false,
false);
AddButton(x, y, 0xFA5, 0xFA6, i + 1);
AddHtmlLocalized(x + 45, y + 2, 200, 20, AosSkillBonuses.GetLabel(skill.SkillName), 0x7FFF);
n++;
}
@ -428,8 +407,7 @@ namespace Server.Items
AddAlphaRegion(10, 10, 500, 420);
AddHtmlLocalized(10, 12, 500, 20, 1070709, 0x7FFF, false,
false); // <CENTER>Confirm Soulstone Transfer</CENTER>
AddHtmlLocalized(10, 12, 500, 20, 1070709, 0x7FFF); // <CENTER>Confirm Soulstone Transfer</CENTER>
/* <CENTER>Soulstone</CENTER><BR>
* You are using a Soulstone. This powerful artifact allows you to remove skill points
@ -448,27 +426,26 @@ namespace Server.Items
*/
AddHtmlLocalized(10, 42, 500, 110, 1061067, 0x7FFF, false, true);
AddHtmlLocalized(10, 200, 390, 20, 1062297, 0x7FFF, false, false); // Skill Chosen:
AddHtmlLocalized(210, 200, 390, 20, AosSkillBonuses.GetLabel(skill.SkillName), 0x7FFF, false, false);
AddHtmlLocalized(10, 200, 390, 20, 1062297, 0x7FFF); // Skill Chosen:
AddHtmlLocalized(210, 200, 390, 20, AosSkillBonuses.GetLabel(skill.SkillName), 0x7FFF);
AddHtmlLocalized(10, 220, 390, 20, 1062298, 0x7FFF, false, false); // Current Value:
AddHtmlLocalized(10, 220, 390, 20, 1062298, 0x7FFF); // Current Value:
AddLabel(210, 220, 0x481, skill.Base.ToString("0.0"));
AddHtmlLocalized(10, 240, 390, 20, 1062299, 0x7FFF, false, false); // Current Cap:
AddHtmlLocalized(10, 240, 390, 20, 1062299, 0x7FFF); // Current Cap:
AddLabel(210, 240, 0x481, skill.Cap.ToString("0.0"));
AddHtmlLocalized(10, 260, 390, 20, 1062300, 0x7FFF, false, false); // New Value:
AddHtmlLocalized(10, 260, 390, 20, 1062300, 0x7FFF); // New Value:
AddLabel(210, 260, 0x481, "0.0");
AddButton(10, 360, 0xFA5, 0xFA6, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 362, 450, 20, 1070720, 0x7FFF, false,
false); // Activate the stone. I am ready to transfer the skill points to it.
AddButton(10, 360, 0xFA5, 0xFA6, 2);
AddHtmlLocalized(45, 362, 450, 20, 1070720, 0x7FFF); // Activate the stone. I am ready to transfer the skill points to it.
AddButton(10, 380, 0xFA5, 0xFA6, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 382, 450, 20, 1062279, 0x7FFF, false, false); // No, let me make another selection.
AddButton(10, 380, 0xFA5, 0xFA6, 1);
AddHtmlLocalized(45, 382, 450, 20, 1062279, 0x7FFF); // No, let me make another selection.
AddButton(10, 410, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(10, 410, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -543,8 +520,7 @@ namespace Server.Items
AddAlphaRegion(10, 10, 500, 420);
AddHtmlLocalized(10, 12, 500, 20, 1070709, 0x7FFF, false,
false); // <CENTER>Confirm Soulstone Transfer</CENTER>
AddHtmlLocalized(10, 12, 500, 20, 1070709, 0x7FFF); // <CENTER>Confirm Soulstone Transfer</CENTER>
/* <CENTER>Soulstone</CENTER><BR>
* You are using a Soulstone. This powerful artifact allows you to remove skill points
@ -563,30 +539,28 @@ namespace Server.Items
*/
AddHtmlLocalized(10, 42, 500, 110, 1061067, 0x7FFF, false, true);
AddHtmlLocalized(10, 200, 390, 20, 1070718, 0x7FFF, false, false); // Skill Stored:
AddHtmlLocalized(210, 200, 390, 20, AosSkillBonuses.GetLabel(stone.Skill), 0x7FFF, false, false);
AddHtmlLocalized(10, 200, 390, 20, 1070718, 0x7FFF); // Skill Stored:
AddHtmlLocalized(210, 200, 390, 20, AosSkillBonuses.GetLabel(stone.Skill), 0x7FFF);
Skill fromSkill = from.Skills[stone.Skill];
AddHtmlLocalized(10, 220, 390, 20, 1062298, 0x7FFF, false, false); // Current Value:
AddHtmlLocalized(10, 220, 390, 20, 1062298, 0x7FFF); // Current Value:
AddLabel(210, 220, 0x481, fromSkill.Base.ToString("0.0"));
AddHtmlLocalized(10, 240, 390, 20, 1062299, 0x7FFF, false, false); // Current Cap:
AddHtmlLocalized(10, 240, 390, 20, 1062299, 0x7FFF); // Current Cap:
AddLabel(210, 240, 0x481, fromSkill.Cap.ToString("0.0"));
AddHtmlLocalized(10, 260, 390, 20, 1062300, 0x7FFF, false, false); // New Value:
AddHtmlLocalized(10, 260, 390, 20, 1062300, 0x7FFF); // New Value:
AddLabel(210, 260, 0x481, stone.SkillValue.ToString("0.0"));
AddButton(10, 360, 0xFA5, 0xFA6, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 362, 450, 20, 1070719, 0x7FFF, false,
false); // Activate the stone. I am ready to retrieve the skill points from it.
AddButton(10, 360, 0xFA5, 0xFA6, 2);
AddHtmlLocalized(45, 362, 450, 20, 1070719, 0x7FFF); // Activate the stone. I am ready to retrieve the skill points from it.
AddButton(10, 380, 0xFA5, 0xFA6, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 382, 450, 20, 1070723, 0x7FFF, false,
false); // Remove all skill points from this stone and DO NOT absorb them.
AddButton(10, 380, 0xFA5, 0xFA6, 1);
AddHtmlLocalized(45, 382, 450, 20, 1070723, 0x7FFF); // Remove all skill points from this stone and DO NOT absorb them.
AddButton(10, 410, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(10, 410, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -755,8 +729,7 @@ namespace Server.Items
AddAlphaRegion(10, 10, 500, 420);
AddHtmlLocalized(10, 12, 500, 20, 1070725, 0x7FFF, false,
false); // <CENTER>Confirm Soulstone Skill Removal</CENTER>
AddHtmlLocalized(10, 12, 500, 20, 1070725, 0x7FFF); // <CENTER>Confirm Soulstone Skill Removal</CENTER>
/* WARNING!<BR><BR>
*
@ -767,11 +740,11 @@ namespace Server.Items
*/
AddHtmlLocalized(10, 42, 500, 110, 1070724, 0x7FFF, false, true);
AddButton(10, 380, 0xFA5, 0xFA6, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 382, 450, 20, 1052072, 0x7FFF, false, false); // Continue
AddButton(10, 380, 0xFA5, 0xFA6, 1);
AddHtmlLocalized(45, 382, 450, 20, 1052072, 0x7FFF); // Continue
AddButton(10, 410, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(10, 410, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -805,15 +778,15 @@ namespace Server.Items
AddAlphaRegion(10, 10, 500, 420);
AddHtmlLocalized(10, 12, 500, 20, title, 0x7FFF, false, false);
AddHtmlLocalized(10, 12, 500, 20, title, 0x7FFF);
AddHtmlLocalized(10, 42, 500, 110, message, 0x7FFF, false, true);
AddButton(10, 380, 0xFA5, 0xFA6, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 382, 450, 20, 1052072, 0x7FFF, false, false); // Continue
AddButton(10, 380, 0xFA5, 0xFA6, 1);
AddHtmlLocalized(45, 382, 450, 20, 1052072, 0x7FFF); // Continue
AddButton(10, 410, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(10, 410, 0xFB1, 0xFB2, 0);
AddHtmlLocalized(45, 412, 450, 20, 1060051, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -838,23 +811,14 @@ namespace Server.Items
{
private int m_UsesRemaining;
[Constructible]
public SoulstoneFragment() : this(5, null)
{
}
[Constructible]
public SoulstoneFragment(int usesRemaining) : this(usesRemaining, null)
{
}
[Constructible]
public SoulstoneFragment(string account) : this(5, account)
{
}
[Constructible]
public SoulstoneFragment(int usesRemaining, string account) : base(account, Utility.Random(0x2AA1, 9))
public SoulstoneFragment(int usesRemaining = 5, string account = null) :
base(account, Utility.Random(0x2AA1, 9))
{
m_UsesRemaining = usesRemaining;
}
@ -940,13 +904,7 @@ namespace Server.Items
public class BlueSoulstone : SoulStone
{
[Constructible]
public BlueSoulstone()
: this(null)
{
}
[Constructible]
public BlueSoulstone(string account)
public BlueSoulstone(string account = null)
: base(account, 0x2ADC, 0x2ADD)
{
}
@ -995,13 +953,7 @@ namespace Server.Items
private bool m_IsRewardItem;
[Constructible]
public RedSoulstone()
: this(null)
{
}
[Constructible]
public RedSoulstone(string account)
public RedSoulstone(string account = null)
: base(account, 0x32F3, 0x32F4)
{
}
@ -1055,4 +1007,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -67,12 +67,8 @@ namespace Server.Items
private static List<SkillName> _Skills = new List<SkillName>();
public PowerScroll() : this(SkillName.Alchemy, 0.0)
{
}
[Constructible]
public PowerScroll(SkillName skill, double value) : base(skill, value)
public PowerScroll(SkillName skill = SkillName.Alchemy, double value = 0.0) : base(skill, value)
{
Hue = 0x481;
@ -245,4 +241,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -142,23 +142,23 @@ namespace Server.Items
AddHtmlLocalized(40, 48, 387, 100, m_Scroll.Message, true, true);
AddHtmlLocalized(125, 148, 200, 20, 1049478, 0xFFFFFF, false, false); // Do you wish to use this scroll?
AddHtmlLocalized(125, 148, 200, 20, 1049478, 0xFFFFFF); // Do you wish to use this scroll?
AddButton(100, 172, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(135, 172, 120, 20, 1046362, 0xFFFFFF, false, false); // Yes
AddButton(100, 172, 4005, 4007, 1);
AddHtmlLocalized(135, 172, 120, 20, 1046362, 0xFFFFFF); // Yes
AddButton(275, 172, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(310, 172, 120, 20, 1046363, 0xFFFFFF, false, false); // No
AddButton(275, 172, 4005, 4007, 0);
AddHtmlLocalized(310, 172, 120, 20, 1046363, 0xFFFFFF); // No
if (m_Scroll.Title != 0)
AddHtmlLocalized(40, 20, 260, 20, m_Scroll.Title, 0xFFFFFF, false, false);
AddHtmlLocalized(40, 20, 260, 20, m_Scroll.Title, 0xFFFFFF);
else
AddHtml(40, 20, 260, 20, m_Scroll.DefaultTitle, false, false);
AddHtml(40, 20, 260, 20, m_Scroll.DefaultTitle);
if (m_Scroll is StatCapScroll)
AddHtmlLocalized(310, 20, 120, 20, 1038019, 0xFFFFFF, false, false); // Power
AddHtmlLocalized(310, 20, 120, 20, 1038019, 0xFFFFFF); // Power
else
AddHtmlLocalized(310, 20, 120, 20, AosSkillBonuses.GetLabel(m_Scroll.Skill), 0xFFFFFF, false, false);
AddHtmlLocalized(310, 20, 120, 20, AosSkillBonuses.GetLabel(m_Scroll.Skill), 0xFFFFFF);
}
public override void OnResponse(NetState state, RelayInfo info)
@ -168,4 +168,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -4,12 +4,8 @@ namespace Server.Items
{
public class StatCapScroll : SpecialScroll
{
public StatCapScroll() : this(105)
{
}
[Constructible]
public StatCapScroll(int value) : base(SkillName.Alchemy, value)
public StatCapScroll(int value = 105) : base(SkillName.Alchemy, value)
{
Hue = 0x481;
}
@ -132,4 +128,4 @@ namespace Server.Items
Insured = false;
}
}
}
}

View file

@ -8,13 +8,7 @@ namespace Server.Items
public class RedVelvetGiftBox : BaseContainer
{
[Constructible]
public RedVelvetGiftBox()
: this(false)
{
}
[Constructible]
public RedVelvetGiftBox(bool fill)
public RedVelvetGiftBox(bool fill = false)
: base(0xE7A)
{
Hue = 0x20;
@ -60,4 +54,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -91,7 +91,7 @@ namespace Server.Items
public override void OnClick()
{
if (m_Ankh == null || m_Ankh.Deleted)
if (m_Ankh?.Deleted != false)
return;
Resurrect(m_Mobile as PlayerMobile, m_Ankh);
@ -131,7 +131,7 @@ namespace Server.Items
private class AnkhResurrectGump : ResurrectGump
{
public AnkhResurrectGump(Mobile owner, ResurrectMessage msg) : base(owner, owner, msg, false)
public AnkhResurrectGump(Mobile owner, ResurrectMessage msg) : base(owner, owner, msg)
{
}
@ -141,7 +141,7 @@ namespace Server.Items
if (info.ButtonID == 1 || info.ButtonID == 2)
{
if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
if (from.Map?.CanFit(from.Location, 16, false, false) != true)
{
from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
return;
@ -241,12 +241,7 @@ namespace Server.Items
private bool m_IsRewardItem;
[Constructible]
public AnkhOfSacrificeDeed() : this(false)
{
}
[Constructible]
public AnkhOfSacrificeDeed(bool isRewardItem)
public AnkhOfSacrificeDeed(bool isRewardItem = false)
{
LootType = LootType.Blessed;
@ -305,7 +300,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -345,4 +340,4 @@ namespace Server.Items
m_IsRewardItem = reader.ReadBool();
}
}
}
}

View file

@ -81,7 +81,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1018318)); // Do you wish to re-deed this banner?
@ -155,14 +155,14 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
@ -227,7 +227,7 @@ namespace Server.Items
for (int j = 0; j < 8; j++, itemID += 2)
{
AddItem(50 + 60 * j, 70, itemID);
AddButton(50 + 60 * j, 50, 0x845, 0x846, itemID, GumpButtonType.Reply, 0);
AddButton(50 + 60 * j, 50, 0x845, 0x846, itemID);
}
if (i > 1)
@ -240,17 +240,15 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if ((m_Banner == null) | m_Banner.Deleted)
if (m_Banner?.Deleted != false)
return;
Mobile m = sender.Mobile;
if (info.ButtonID >= Start && info.ButtonID <= End)
if ((info.ButtonID & 0x1) == 0)
{
m.SendLocalizedMessage(1042037); // Where would you like to place this banner?
m.Target = new InternalTarget(m_Banner, info.ButtonID);
}
if (info.ButtonID < Start || info.ButtonID > End || (info.ButtonID & 0x1) != 0) return;
m.SendLocalizedMessage(1042037); // Where would you like to place this banner?
m.Target = new InternalTarget(m_Banner, info.ButtonID);
}
}
@ -267,14 +265,14 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Banner == null || m_Banner.Deleted)
if (m_Banner?.Deleted != false)
return;
if (m_Banner.IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
@ -289,7 +287,7 @@ namespace Server.Items
{
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
@ -362,20 +360,20 @@ namespace Server.Items
AddItem(90, 30, itemID + 1);
AddItem(180, 30, itemID);
AddButton(50, 35, 0x868, 0x869, (int)Buttons.East, GumpButtonType.Reply, 0);
AddButton(145, 35, 0x868, 0x869, (int)Buttons.South, GumpButtonType.Reply, 0);
AddButton(50, 35, 0x868, 0x869, (int)Buttons.East);
AddButton(145, 35, 0x868, 0x869, (int)Buttons.South);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Banner == null || m_Banner.Deleted || m_House == null)
if (m_Banner?.Deleted != false || m_House == null)
return;
Banner banner = null;
if (info.ButtonID == (int)Buttons.East)
banner = new Banner(m_ItemID + 1);
if (info.ButtonID == (int)Buttons.South)
else if (info.ButtonID == (int)Buttons.South)
banner = new Banner(m_ItemID);
if (banner != null)
@ -398,4 +396,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -163,7 +163,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
base.OnDoubleClick(from);
@ -195,4 +195,4 @@ namespace Server.Items
m_IsRewardItem = reader.ReadBool();
}
}
}
}

View file

@ -81,7 +81,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsCoOwner(from))
if (house?.IsCoOwner(from) == true)
{
if (m_Fire != null)
TurnOff();
@ -163,7 +163,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -223,35 +223,34 @@ namespace Server.Items
AddLabel(45, 15, 0, "Choose a Brazier:");
AddItem(40, 75, 0x19AA);
AddButton(55, 50, 0x845, 0x846, 0x19AA, GumpButtonType.Reply, 0);
AddButton(55, 50, 0x845, 0x846, 0x19AA);
AddItem(100, 75, 0x19BB);
AddButton(115, 50, 0x845, 0x846, 0x19BB, GumpButtonType.Reply, 0);
AddButton(115, 50, 0x845, 0x846, 0x19BB);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if ((m_Brazier == null) | m_Brazier.Deleted)
if (m_Brazier?.Deleted != false)
return;
Mobile m = sender.Mobile;
if (info.ButtonID == 0x19AA || info.ButtonID == 0x19BB)
{
RewardBrazier brazier = new RewardBrazier(info.ButtonID);
brazier.IsRewardItem = m_Brazier.IsRewardItem;
if (info.ButtonID != 0x19AA && info.ButtonID != 0x19BB)
return;
if (!m.PlaceInBackpack(brazier))
{
brazier.Delete();
m.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
}
else
{
m_Brazier.Delete();
}
RewardBrazier brazier = new RewardBrazier(info.ButtonID) { IsRewardItem = m_Brazier.IsRewardItem };
if (!m.PlaceInBackpack(brazier))
{
brazier.Delete();
m.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
}
else
{
m_Brazier.Delete();
}
}
}
}
}
}

View file

@ -175,9 +175,9 @@ namespace Server.Items
public int Validate(PotionKeg keg)
{
if (keg == null || keg.Deleted || keg.Held != 100)
if (keg?.Deleted != false || keg.Held != 100)
return 0;
switch (keg.Type)
{
case PotionEffect.ExplosionLesser:
@ -261,7 +261,7 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Cannon == null || m_Cannon.Deleted)
if (m_Cannon?.Deleted != false)
return;
if (!(targeted is IPoint3D p))
@ -342,22 +342,18 @@ namespace Server.Items
AddBackground(0, 0, 291, 133, 0x13BE);
AddImageTiled(5, 5, 280, 100, 0xA40);
AddHtmlLocalized(9, 9, 272, 100, 1076196, cannon.Validate(keg).ToString(), 0x7FFF, false,
false); // You will need a full keg of explosion potions to recharge the cannon. Your keg will provide ~1_CHARGES~ charges.
AddHtmlLocalized(9, 9, 272, 100, 1076196, cannon.Validate(keg).ToString(), 0x7FFF); // You will need a full keg of explosion potions to recharge the cannon. Your keg will provide ~1_CHARGES~ charges.
AddButton(5, 107, 0xFB1, 0xFB2, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
AddHtmlLocalized(40, 109, 100, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(5, 107, 0xFB1, 0xFB2, (int)Buttons.Cancel);
AddHtmlLocalized(40, 109, 100, 20, 1060051, 0x7FFF); // CANCEL
AddButton(160, 107, 0xFB7, 0xFB8, (int)Buttons.Recharge, GumpButtonType.Reply, 0);
AddHtmlLocalized(195, 109, 120, 20, 1076197, 0x7FFF, false, false); // Recharge
AddButton(160, 107, 0xFB7, 0xFB8, (int)Buttons.Recharge);
AddHtmlLocalized(195, 109, 120, 20, 1076197, 0x7FFF); // Recharge
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Cannon == null || m_Cannon.Deleted)
return;
if (info.ButtonID == (int)Buttons.Recharge)
if (m_Cannon?.Deleted == false && info.ButtonID == (int)Buttons.Recharge)
m_Cannon.Fill(state.Mobile, m_Keg);
}
@ -388,17 +384,10 @@ namespace Server.Items
public override int LabelNumber => 1076195; // A deed for a cannon
public override BaseAddon Addon
public override BaseAddon Addon => new CannonAddon(m_Direction)
{
get
{
CannonAddon addon = new CannonAddon(m_Direction);
addon.Charges = m_Charges;
addon.IsRewardItem = m_IsRewardItem;
return addon;
}
}
Charges = m_Charges, IsRewardItem = m_IsRewardItem
};
[CommandProperty(AccessLevel.GameMaster)]
public int Charges
@ -450,7 +439,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -484,4 +473,4 @@ namespace Server.Items
m_IsRewardItem = reader.ReadBool();
}
}
}
}

View file

@ -11,12 +11,7 @@ namespace Server.Items
private bool m_IsRewardItem;
[Constructible]
public DecorativeShield() : this(0x156C)
{
}
[Constructible]
public DecorativeShield(int itemID) : base(itemID)
public DecorativeShield(int itemID = 0x156C) : base(itemID)
{
Movable = false;
}
@ -51,12 +46,9 @@ namespace Server.Items
public bool CouldFit(IPoint3D p, Map map)
{
if (map == null || !map.CanFit(p.X, p.Y, p.Z, ItemData.Height))
return false;
if (FacingSouth)
return BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map); // north wall
return BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map); // west wall
return 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)]
@ -84,7 +76,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
@ -158,7 +150,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -233,7 +225,7 @@ namespace Server.Items
for (int j = 0; j < 9 - i; j++)
{
AddItem(40 + j * 60, 70, itemID);
AddButton(60 + j * 60, 50, 0x845, 0x846, itemID, GumpButtonType.Reply, 0);
AddButton(60 + j * 60, 50, 0x845, 0x846, itemID);
if (itemID < 0x1582)
itemID += 2;
@ -255,18 +247,13 @@ namespace Server.Items
public override void OnResponse(NetState sender, RelayInfo info)
{
if ((m_Shield == null) | m_Shield.Deleted)
if (m_Shield?.Deleted != false || info.ButtonID < Start || info.ButtonID > End ||
((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) &&
(info.ButtonID < 0x1582 || info.ButtonID > 0x1585))
return;
Mobile m = sender.Mobile;
if (info.ButtonID >= Start && info.ButtonID <= End)
if ((info.ButtonID & 0x1) == 0 && info.ButtonID < 0x1582 ||
info.ButtonID >= 0x1582 && info.ButtonID <= 0x1585)
{
m.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
m.Target = new InternalTarget(m_Shield, info.ButtonID);
}
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
sender.Mobile.Target = new InternalTarget(m_Shield, info.ButtonID);
}
}
@ -283,72 +270,68 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Shield == null || m_Shield.Deleted)
if (m_Shield?.Deleted != false)
return;
if (m_Shield.IsChildOf(from.Backpack))
if (!m_Shield.IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
return;
}
if (house != null && house.IsOwner(from))
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
BaseHouse house = BaseHouse.FindHouseAt(from);
if (p == null || map == null)
return;
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
return;
}
Point3D p3d = new Point3D(p);
ItemData id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if (map.CanFit(p3d, id.Height))
{
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
if (p == null || map == null)
return;
if (house != null && house.IsOwner(from))
{
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
Point3D p3d = new Point3D(p);
ItemData id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Shield, m_ItemID, p3d, house));
}
else if (north || west)
{
DecorativeShield shield = new DecorativeShield(west ? GetWestItemID(m_ItemID) : m_ItemID);
if (!map.CanFit(p3d, id.Height))
{
from.SendLocalizedMessage(500269); // You cannot build that there.
return;
}
house.Addons.Add(shield);
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
shield.IsRewardItem = m_Shield.IsRewardItem;
shield.MoveToWorld(p3d, map);
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
return;
}
m_Shield.Delete();
}
else
{
from.SendLocalizedMessage(1049781); // This decoration must be placed next to a wall.
}
}
else
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
}
}
else
{
from.SendLocalizedMessage(500269); // You cannot build that there.
}
}
else
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
}
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Shield, m_ItemID, p3d, house));
}
else if (north || west)
{
DecorativeShield shield = new DecorativeShield(west ? GetWestItemID(m_ItemID) : m_ItemID);
house.Addons.Add(shield);
shield.IsRewardItem = m_Shield.IsRewardItem;
shield.MoveToWorld(p3d, map);
m_Shield.Delete();
}
else
{
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
from.SendLocalizedMessage(1049781); // This decoration must be placed next to a wall.
}
}
@ -377,13 +360,13 @@ namespace Server.Items
AddItem(90, 30, GetWestItemID(itemID));
AddItem(180, 30, itemID);
AddButton(50, 35, 0x867, 0x869, (int)Buttons.East, GumpButtonType.Reply, 0);
AddButton(145, 35, 0x867, 0x869, (int)Buttons.South, GumpButtonType.Reply, 0);
AddButton(50, 35, 0x867, 0x869, (int)Buttons.East);
AddButton(145, 35, 0x867, 0x869, (int)Buttons.South);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Shield == null || m_Shield.Deleted || m_House == null)
if (m_Shield?.Deleted != false || m_House == null)
return;
DecorativeShield shield = null;
@ -413,4 +396,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -11,12 +11,7 @@ namespace Server.Items
private bool m_IsRewardItem;
[Constructible]
public FlamingHead() : this(StoneFaceTrapType.NorthWall)
{
}
[Constructible]
public FlamingHead(StoneFaceTrapType type)
public FlamingHead(StoneFaceTrapType type = StoneFaceTrapType.NorthWall)
{
LootType = LootType.Blessed;
Movable = false;
@ -82,7 +77,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1018329)); // Do you wish to re-deed this skull?
@ -156,14 +151,14 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.SendLocalizedMessage(1042264); // Where would you like to place this head?
from.Target = new InternalTarget(this);
@ -208,76 +203,72 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Head == null || m_Head.Deleted)
if (m_Head?.Deleted != false)
return;
if (m_Head.IsChildOf(from.Backpack))
if (!m_Head.IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
return;
}
if (house != null && house.IsOwner(from))
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
BaseHouse house = BaseHouse.FindHouseAt(from);
if (p == null || map == null)
return;
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(502115); // You must be in your house to do this.
return;
}
Point3D p3d = new Point3D(p);
ItemData id = TileData.ItemTable[0x10F5];
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
if (p == null || map == null)
return;
if (house != null && house.IsOwner(from))
{
if (map.CanFit(p3d, id.Height))
{
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
Point3D p3d = new Point3D(p);
ItemData id = TileData.ItemTable[0x10F5];
FlamingHead head = null;
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
if (north && west)
head = new FlamingHead(StoneFaceTrapType.NorthWestWall);
else if (north)
head = new FlamingHead(StoneFaceTrapType.NorthWall);
else if (west)
head = new FlamingHead(StoneFaceTrapType.WestWall);
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
return;
}
if (north || west)
{
house.Addons.Add(head);
if (!map.CanFit(p3d, id.Height))
{
from.SendLocalizedMessage(1042266); // The head must be placed next to a wall.
return;
}
head.IsRewardItem = m_Head.IsRewardItem;
head.MoveToWorld(p3d, map);
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
m_Head.Delete();
}
else
{
from.SendLocalizedMessage(1042266); // The head must be placed next to a wall.
}
}
else
{
from.SendLocalizedMessage(1042266); // The head must be placed next to a wall.
}
}
else
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
}
}
else
{
from.SendLocalizedMessage(502115); // You must be in your house to do this.
}
FlamingHead head = null;
if (north && west)
head = new FlamingHead(StoneFaceTrapType.NorthWestWall);
else if (north)
head = new FlamingHead();
else if (west)
head = new FlamingHead(StoneFaceTrapType.WestWall);
if (north || west)
{
house.Addons.Add(head);
head.IsRewardItem = m_Head.IsRewardItem;
head.MoveToWorld(p3d, map);
m_Head.Delete();
}
else
{
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
from.SendLocalizedMessage(1042266); // The head must be placed next to a wall.
}
}
}
}
}
}

View file

@ -11,12 +11,7 @@ namespace Server.Items
private bool m_IsRewardItem;
[Constructible]
public HangingSkeleton() : this(0x1596)
{
}
[Constructible]
public HangingSkeleton(int itemID) : base(itemID)
public HangingSkeleton(int itemID = 0x1596) : base(itemID)
{
LootType = LootType.Blessed;
Movable = false;
@ -86,7 +81,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
@ -160,14 +155,14 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<InternalGump>();
from.SendGump(new InternalGump(this));
@ -231,34 +226,29 @@ namespace Server.Items
AddPage(1);
AddItem(130, 70, 0x1A03);
AddButton(150, 50, 0x845, 0x846, 0x1A03, GumpButtonType.Reply, 0);
AddButton(150, 50, 0x845, 0x846, 0x1A03);
AddItem(190, 70, 0x1A05);
AddButton(210, 50, 0x845, 0x846, 0x1A05, GumpButtonType.Reply, 0);
AddButton(210, 50, 0x845, 0x846, 0x1A05);
AddItem(250, 70, 0x1A09);
AddButton(270, 50, 0x845, 0x846, 0x1A09, GumpButtonType.Reply, 0);
AddButton(270, 50, 0x845, 0x846, 0x1A09);
AddItem(310, 70, 0x1B1E);
AddButton(330, 50, 0x845, 0x846, 0x1B1E, GumpButtonType.Reply, 0);
AddButton(330, 50, 0x845, 0x846, 0x1B1E);
AddItem(370, 70, 0x1B7F);
AddButton(390, 50, 0x845, 0x846, 0x1B7F, GumpButtonType.Reply, 0);
AddButton(390, 50, 0x845, 0x846, 0x1B7F);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if ((m_Skeleton == null) | m_Skeleton.Deleted)
if (m_Skeleton?.Deleted != false || info.ButtonID != 0x1A03 && info.ButtonID != 0x1A05 &&
info.ButtonID != 0x1A09 && info.ButtonID != 0x1B1E && info.ButtonID != 0x1B7F)
return;
Mobile m = sender.Mobile;
if (info.ButtonID == 0x1A03 || info.ButtonID == 0x1A05 || info.ButtonID == 0x1A09 ||
info.ButtonID == 0x1B1E || info.ButtonID == 0x1B7F)
{
m.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
m.Target = new InternalTarget(m_Skeleton, info.ButtonID);
}
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
sender.Mobile.Target = new InternalTarget(m_Skeleton, info.ButtonID);
}
}
@ -275,72 +265,68 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Skeleton == null || m_Skeleton.Deleted)
if (m_Skeleton?.Deleted != false)
return;
if (m_Skeleton.IsChildOf(from.Backpack))
if (!m_Skeleton.IsChildOf(from.Backpack))
{
BaseHouse house = BaseHouse.FindHouseAt(from);
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
return;
}
if (house != null && house.IsOwner(from))
{
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
BaseHouse house = BaseHouse.FindHouseAt(from);
if (p == null || map == null)
return;
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
return;
}
Point3D p3d = new Point3D(p);
ItemData id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];
IPoint3D p = targeted as IPoint3D;
Map map = from.Map;
if (map.CanFit(p3d, id.Height))
{
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
if (p == null || map == null)
return;
if (house != null && house.IsOwner(from))
{
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
Point3D p3d = new Point3D(p);
ItemData id = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Skeleton, m_ItemID, p3d, house));
}
else if (north || west)
{
HangingSkeleton banner = new HangingSkeleton(west ? GetWestItemID(m_ItemID) : m_ItemID);
if (!map.CanFit(p3d, id.Height))
{
from.SendLocalizedMessage(500269); // You cannot build that there.
return;
}
house.Addons.Add(banner);
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
banner.IsRewardItem = m_Skeleton.IsRewardItem;
banner.MoveToWorld(p3d, map);
if (house?.IsOwner(from) != true)
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
return;
}
m_Skeleton.Delete();
}
else
{
from.SendLocalizedMessage(1042039); // The banner must be placed next to a wall.
}
}
else
{
from.SendLocalizedMessage(1042036); // That location is not in your house.
}
}
else
{
from.SendLocalizedMessage(500269); // You cannot build that there.
}
}
else
{
from.SendLocalizedMessage(502092); // You must be in your house to do this.
}
bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
bool west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
if (north && west)
{
from.CloseGump<FacingGump>();
from.SendGump(new FacingGump(m_Skeleton, m_ItemID, p3d, house));
}
else if (north || west)
{
HangingSkeleton banner = new HangingSkeleton(west ? GetWestItemID(m_ItemID) : m_ItemID);
house.Addons.Add(banner);
banner.IsRewardItem = m_Skeleton.IsRewardItem;
banner.MoveToWorld(p3d, map);
m_Skeleton.Delete();
}
else
{
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
from.SendLocalizedMessage(1042039); // The banner must be placed next to a wall.
}
}
@ -370,13 +356,13 @@ namespace Server.Items
AddItem(90, 30, GetWestItemID(itemID));
AddItem(180, 30, itemID);
AddButton(50, 35, 0x868, 0x869, (int)Buttons.East, GumpButtonType.Reply, 0);
AddButton(145, 35, 0x868, 0x869, (int)Buttons.South, GumpButtonType.Reply, 0);
AddButton(50, 35, 0x868, 0x869, (int)Buttons.East);
AddButton(145, 35, 0x868, 0x869, (int)Buttons.South);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Skeleton == null || m_Skeleton.Deleted || m_House == null)
if (m_Skeleton?.Deleted != false || m_House == null)
return;
HangingSkeleton banner = null;
@ -406,4 +392,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -139,7 +139,7 @@ namespace Server.Items
if (!from.InRange(GetWorldLocation(), 2) || !from.InLOS(this) || !(from.Z - Z > -3 && from.Z - Z < 3))
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
else if (house?.HasSecureAccess(from, SecureLevel.Friends) == true)
switch (CartType)
{
case MiningCartType.OreSouth:
@ -404,7 +404,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -440,4 +440,4 @@ namespace Server.Items
Ore = reader.ReadInt();
}
}
}
}

View file

@ -145,7 +145,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -185,4 +185,4 @@ namespace Server.Items
m_IsRewardItem = reader.ReadBool();
}
}
}
}

View file

@ -90,7 +90,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -151,47 +151,44 @@ namespace Server.Items
AddLabel(45, 15, 0, "Choose a Potted Cactus:");
AddItem(45, 75, 0x1E0F);
AddButton(55, 50, 0x845, 0x846, 0x1E0F, GumpButtonType.Reply, 0);
AddButton(55, 50, 0x845, 0x846, 0x1E0F);
AddItem(105, 75, 0x1E10);
AddButton(115, 50, 0x845, 0x846, 0x1E10, GumpButtonType.Reply, 0);
AddButton(115, 50, 0x845, 0x846, 0x1E10);
AddItem(160, 75, 0x1E14);
AddButton(175, 50, 0x845, 0x846, 0x1E14, GumpButtonType.Reply, 0);
AddButton(175, 50, 0x845, 0x846, 0x1E14);
AddItem(220, 75, 0x1E11);
AddButton(235, 50, 0x845, 0x846, 0x1E11, GumpButtonType.Reply, 0);
AddButton(235, 50, 0x845, 0x846, 0x1E11);
AddItem(280, 75, 0x1E12);
AddButton(295, 50, 0x845, 0x846, 0x1E12, GumpButtonType.Reply, 0);
AddButton(295, 50, 0x845, 0x846, 0x1E12);
AddItem(340, 75, 0x1E13);
AddButton(355, 50, 0x845, 0x846, 0x1E13, GumpButtonType.Reply, 0);
AddButton(355, 50, 0x845, 0x846, 0x1E13);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if ((m_Cactus == null) | m_Cactus.Deleted)
if (m_Cactus?.Deleted != false || info.ButtonID < 0x1E0F || info.ButtonID > 0x1E14)
return;
Mobile m = sender.Mobile;
if (info.ButtonID >= 0x1E0F && info.ButtonID <= 0x1E14)
RewardPottedCactus cactus = new RewardPottedCactus(info.ButtonID)
{
RewardPottedCactus cactus = new RewardPottedCactus(info.ButtonID);
cactus.IsRewardItem = m_Cactus.IsRewardItem;
IsRewardItem = m_Cactus.IsRewardItem
};
if (!m.PlaceInBackpack(cactus))
{
cactus.Delete();
m.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
}
else
{
m_Cactus.Delete();
}
if (!sender.Mobile.PlaceInBackpack(cactus))
{
cactus.Delete();
sender.Mobile.SendLocalizedMessage(1078837); // Your backpack is full! Please make room and try again.
}
else
{
m_Cactus.Delete();
}
}
}
}
}
}

View file

@ -46,12 +46,7 @@ namespace Server.Items
private bool m_IsRewardItem;
[Constructible]
public StoneAnkh() : this(true)
{
}
[Constructible]
public StoneAnkh(bool east)
public StoneAnkh(bool east = true)
{
if (east)
{
@ -110,7 +105,7 @@ namespace Server.Items
{
BaseHouse house = BaseHouse.FindHouseAt(this);
if (house != null && house.IsOwner(from))
if (house?.IsOwner(from) == true)
{
from.CloseGump<RewardDemolitionGump>();
from.SendGump(new RewardDemolitionGump(this, 1049783)); // Do you wish to re-deed this decoration?
@ -187,7 +182,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -251,23 +246,20 @@ namespace Server.Items
AddItem(90, 30, 0x4);
AddItem(112, 30, 0x5);
AddButton(50, 35, 0x867, 0x869, (int)Buttons.South, GumpButtonType.Reply, 0); // South
AddButton(50, 35, 0x867, 0x869, (int)Buttons.South); // South
AddItem(170, 30, 0x2);
AddItem(192, 30, 0x3);
AddButton(145, 35, 0x867, 0x869, (int)Buttons.East, GumpButtonType.Reply, 0); // East
AddButton(145, 35, 0x867, 0x869, (int)Buttons.East); // East
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_Deed == null || m_Deed.Deleted)
if (m_Deed?.Deleted != false || info.ButtonID == (int)Buttons.Cancel)
return;
if (info.ButtonID != (int)Buttons.Cancel)
{
m_Deed.m_East = info.ButtonID == (int)Buttons.East;
m_Deed.SendTarget(sender.Mobile);
}
m_Deed.m_East = info.ButtonID == (int)Buttons.East;
m_Deed.SendTarget(sender.Mobile);
}
private enum Buttons
@ -278,4 +270,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -92,7 +92,7 @@ namespace Server.Items
{
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
}
else if (house != null && house.HasSecureAccess(from, SecureLevel.Friends))
else if (house?.HasSecureAccess(from, SecureLevel.Friends) == true)
{
if (m_Logs > 0)
{
@ -275,7 +275,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -309,4 +309,4 @@ namespace Server.Items
m_Logs = reader.ReadInt();
}
}
}
}

View file

@ -312,7 +312,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (IsChildOf(from.Backpack))
@ -372,27 +372,27 @@ namespace Server.Items
AddItem(55, 110, 0x161D);
AddItem(75, 90, 0x161E);
AddItem(95, 70, 0x161F);
AddButton(70, 50, 0x845, 0x846, 1, GumpButtonType.Reply, 0);
AddButton(70, 50, 0x845, 0x846, 1);
AddItem(105, 70, 0x1586);
AddItem(125, 90, 0x1587);
AddItem(145, 110, 0x1588);
AddButton(145, 50, 0x845, 0x846, 2, GumpButtonType.Reply, 0);
AddButton(145, 50, 0x845, 0x846, 2);
AddItem(200, 110, 0x1620);
AddItem(220, 90, 0x1621);
AddItem(240, 70, 0x1622);
AddButton(220, 50, 0x845, 0x846, 3, GumpButtonType.Reply, 0);
AddButton(220, 50, 0x845, 0x846, 3);
AddItem(250, 70, 0x1589);
AddItem(270, 90, 0x158A);
AddItem(290, 110, 0x158B);
AddButton(300, 50, 0x845, 0x846, 4, GumpButtonType.Reply, 0);
AddButton(300, 50, 0x845, 0x846, 4);
AddItem(350, 110, 0x1623);
AddItem(370, 90, 0x1624);
AddItem(390, 70, 0x1625);
AddButton(365, 50, 0x845, 0x846, 5, GumpButtonType.Reply, 0);
AddButton(365, 50, 0x845, 0x846, 5);
AddItem(400, 70, 0x158C);
AddItem(420, 90, 0x158D);
AddItem(440, 110, 0x158E);
AddButton(445, 50, 0x845, 0x846, 6, GumpButtonType.Reply, 0);
AddButton(445, 50, 0x845, 0x846, 6);
AddButton(455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 2);
AddPage(2);
@ -400,27 +400,27 @@ namespace Server.Items
AddItem(52, 110, 0x1626);
AddItem(72, 90, 0x1627);
AddItem(95, 70, 0x1628);
AddButton(70, 50, 0x845, 0x846, 7, GumpButtonType.Reply, 0);
AddButton(70, 50, 0x845, 0x846, 7);
AddItem(105, 70, 0x1590);
AddItem(125, 90, 0x1591);
AddItem(145, 110, 0x158F);
AddButton(145, 50, 0x845, 0x846, 8, GumpButtonType.Reply, 0);
AddButton(145, 50, 0x845, 0x846, 8);
AddItem(197, 110, 0x1626);
AddItem(217, 90, 0x1629);
AddItem(240, 70, 0x162A);
AddButton(220, 50, 0x845, 0x846, 9, GumpButtonType.Reply, 0);
AddButton(220, 50, 0x845, 0x846, 9);
AddItem(250, 70, 0x1592);
AddItem(270, 90, 0x1593);
AddItem(290, 110, 0x158F);
AddButton(300, 50, 0x845, 0x846, 10, GumpButtonType.Reply, 0);
AddButton(300, 50, 0x845, 0x846, 10);
AddItem(340, 110, 0x162B);
AddItem(363, 90, 0x162C);
AddItem(385, 70, 0x162D);
AddButton(365, 50, 0x845, 0x846, 11, GumpButtonType.Reply, 0);
AddButton(365, 50, 0x845, 0x846, 11);
AddItem(395, 70, 0x1594);
AddItem(417, 90, 0x1595);
AddItem(439, 111, 0x1596);
AddButton(445, 50, 0x845, 0x846, 12, GumpButtonType.Reply, 0);
AddButton(445, 50, 0x845, 0x846, 12);
AddButton(70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 1);
AddButton(455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 3);
@ -429,25 +429,25 @@ namespace Server.Items
AddItem(55, 110, 0x162E);
AddItem(75, 93, 0x1631);
AddItem(95, 70, 0x1632);
AddButton(70, 50, 0x845, 0x846, 13, GumpButtonType.Reply, 0);
AddButton(70, 50, 0x845, 0x846, 13);
AddItem(118, 70, 0x1598);
AddItem(138, 94, 0x159B);
AddItem(159, 113, 0x159C);
AddButton(160, 50, 0x845, 0x846, 14, GumpButtonType.Reply, 0);
AddButton(160, 50, 0x845, 0x846, 14);
AddItem(219, 111, 0x162F);
AddItem(238, 94, 0x1630);
AddItem(258, 70, 0x1633);
AddButton(240, 50, 0x845, 0x846, 15, GumpButtonType.Reply, 0);
AddButton(240, 50, 0x845, 0x846, 15);
AddItem(279, 70, 0x1599);
AddItem(298, 93, 0x159A);
AddItem(319, 113, 0x159D);
AddButton(320, 50, 0x845, 0x846, 16, GumpButtonType.Reply, 0);
AddButton(320, 50, 0x845, 0x846, 16);
AddItem(380, 90, 0x160F);
AddItem(400, 70, 0x1610);
AddButton(390, 50, 0x845, 0x846, 17, GumpButtonType.Reply, 0);
AddButton(390, 50, 0x845, 0x846, 17);
AddItem(420, 70, 0x15A0);
AddItem(440, 90, 0x15A1);
AddButton(455, 50, 0x845, 0x846, 18, GumpButtonType.Reply, 0);
AddButton(455, 50, 0x845, 0x846, 18);
AddButton(70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 2);
AddButton(455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 4);
@ -455,22 +455,22 @@ namespace Server.Items
AddItem(55, 90, 0x1611);
AddItem(75, 70, 0x1612);
AddButton(70, 50, 0x845, 0x846, 19, GumpButtonType.Reply, 0);
AddButton(70, 50, 0x845, 0x846, 19);
AddItem(105, 70, 0x15A2);
AddItem(125, 90, 0x15A3);
AddButton(145, 50, 0x845, 0x846, 20, GumpButtonType.Reply, 0);
AddButton(145, 50, 0x845, 0x846, 20);
AddItem(200, 84, 0x1613);
AddItem(220, 70, 0x1614);
AddButton(215, 50, 0x845, 0x846, 21, GumpButtonType.Reply, 0);
AddButton(215, 50, 0x845, 0x846, 21);
AddItem(250, 70, 0x15A4);
AddItem(270, 84, 0x15A5);
AddButton(290, 50, 0x845, 0x846, 22, GumpButtonType.Reply, 0);
AddButton(290, 50, 0x845, 0x846, 22);
AddItem(350, 90, 0x1615);
AddItem(370, 70, 0x1616);
AddButton(365, 50, 0x845, 0x846, 23, GumpButtonType.Reply, 0);
AddButton(365, 50, 0x845, 0x846, 23);
AddItem(400, 70, 0x15A6);
AddItem(420, 90, 0x15A7);
AddButton(445, 50, 0x845, 0x846, 24, GumpButtonType.Reply, 0);
AddButton(445, 50, 0x845, 0x846, 24);
AddButton(70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 3);
AddButton(455, 205, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 5);
@ -478,33 +478,32 @@ namespace Server.Items
AddItem(55, 90, 0x1617);
AddItem(77, 70, 0x1618);
AddButton(70, 50, 0x845, 0x846, 25, GumpButtonType.Reply, 0);
AddButton(70, 50, 0x845, 0x846, 25);
AddItem(105, 70, 0x15A8);
AddItem(127, 90, 0x15A9);
AddButton(145, 50, 0x845, 0x846, 26, GumpButtonType.Reply, 0);
AddButton(145, 50, 0x845, 0x846, 26);
AddItem(200, 90, 0x1619);
AddItem(222, 70, 0x161A);
AddButton(220, 50, 0x845, 0x846, 27, GumpButtonType.Reply, 0);
AddButton(220, 50, 0x845, 0x846, 27);
AddItem(250, 70, 0x15AA);
AddItem(272, 90, 0x15AB);
AddButton(300, 50, 0x845, 0x846, 28, GumpButtonType.Reply, 0);
AddButton(300, 50, 0x845, 0x846, 28);
AddItem(350, 90, 0x161B);
AddItem(372, 70, 0x161C);
AddButton(365, 50, 0x845, 0x846, 29, GumpButtonType.Reply, 0);
AddButton(365, 50, 0x845, 0x846, 29);
AddItem(400, 70, 0x15AC);
AddItem(422, 90, 0x15AD);
AddButton(445, 50, 0x845, 0x846, 30, GumpButtonType.Reply, 0);
AddButton(445, 50, 0x845, 0x846, 30);
AddButton(70, 205, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 4);
}
public override void OnResponse(NetState sender, RelayInfo info)
{
if (m_WallBanner == null || m_WallBanner.Deleted)
if (m_WallBanner?.Deleted != false || info.ButtonID <= 0 || info.ButtonID >= 31)
return;
if (info.ButtonID > 0 && info.ButtonID < 31)
m_WallBanner.Use(sender.Mobile, info.ButtonID);
m_WallBanner.Use(sender.Mobile, info.ButtonID);
}
}
}
}
}

View file

@ -13,12 +13,7 @@ namespace Server.Items
private int m_UsesRemaining;
[Constructible]
public WeaponEngravingTool() : this(10)
{
}
[Constructible]
public WeaponEngravingTool(int uses) : base(0x32F8)
public WeaponEngravingTool(int uses = 10) : base(0x32F8)
{
LootType = LootType.Blessed;
Weight = 1.0;
@ -62,7 +57,7 @@ namespace Server.Items
public override void OnDoubleClick(Mobile from)
{
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this, null))
if (m_IsRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
return;
if (m_UsesRemaining > 0)
@ -130,7 +125,7 @@ namespace Server.Items
{
if (from.Backpack == null)
return;
BlueDiamond diamond = from.Backpack.FindItemByType<BlueDiamond>();
if (guildmaster != null)
@ -206,7 +201,7 @@ namespace Server.Items
protected override void OnTarget(Mobile from, object targeted)
{
if (m_Tool == null || m_Tool.Deleted)
if (m_Tool?.Deleted != false)
return;
if (targeted is BaseWeapon item)
@ -240,11 +235,11 @@ namespace Server.Items
AddPage(0);
AddHtmlLocalized(50, 70, 400, 20, 1072359, 0x0, false, false); // <CENTER>Engraving Tool</CENTER>
AddHtmlLocalized(50, 70, 400, 20, 1072359, 0x0); // <CENTER>Engraving Tool</CENTER>
AddHtmlLocalized(75, 95, 350, 145, 1076229, 0x0, true,
true); // Please enter the text to add to the selected object. Leave the text area blank to remove any existing text. Removing text does not use a charge.
AddButton(125, 300, 0x81A, 0x81B, (int)Buttons.Okay, GumpButtonType.Reply, 0);
AddButton(320, 300, 0x819, 0x818, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
AddButton(125, 300, 0x81A, 0x81B, (int)Buttons.Okay);
AddButton(320, 300, 0x819, 0x818, (int)Buttons.Cancel);
AddImageTiled(75, 245, 350, 40, 0xDB0);
AddImageTiled(76, 245, 350, 2, 0x23C5);
AddImageTiled(75, 245, 2, 40, 0x23C3);
@ -256,38 +251,34 @@ namespace Server.Items
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Tool == null || m_Tool.Deleted || m_Target == null || m_Target.Deleted)
if (m_Tool?.Deleted != false || m_Target?.Deleted != false)
return;
if (info.ButtonID == (int)Buttons.Okay)
{
if (info.ButtonID != (int)Buttons.Okay)
{
state.Mobile.SendLocalizedMessage(1072363); // The object was not engraved.
return;
}
TextRelay relay = info.GetTextEntry((int)Buttons.Text);
if (relay != null)
if (relay == null)
return;
if (string.IsNullOrEmpty(relay.Text))
{
if (string.IsNullOrEmpty(relay.Text))
{
m_Target.EngravedText = null;
state.Mobile.SendLocalizedMessage(1072362); // You remove the engraving from the object.
}
else
{
if (relay.Text.Length > 64)
m_Target.EngravedText = Utility.FixHtml(relay.Text.Substring(0, 64));
else
m_Target.EngravedText = Utility.FixHtml(relay.Text);
}
else
{
m_Target.EngravedText = Utility.FixHtml(relay.Text.Length > 64 ?
relay.Text.Substring(0, 64) : relay.Text);
state.Mobile.SendLocalizedMessage(1072361); // You engraved the object.
m_Target.InvalidateProperties();
m_Tool.UsesRemaining -= 1;
m_Tool.InvalidateProperties();
}
}
}
else
{
state.Mobile.SendLocalizedMessage(1072363); // The object was not engraved.
}
}
private enum Buttons
@ -320,29 +311,26 @@ namespace Server.Items
if (guildmaster != null)
{
AddHtmlLocalized(9, 9, 272, 100, 1076169, 0x7FFF, false,
false); // It will cost you 100,000 gold and a blue diamond to recharge your weapon engraver with 10 charges.
AddHtmlLocalized(195, 109, 120, 20, 1076172, 0x7FFF, false, false); // Recharge it
AddHtmlLocalized(9, 9, 272, 100, 1076169, 0x7FFF); // It will cost you 100,000 gold and a blue diamond to recharge your weapon engraver with 10 charges.
AddHtmlLocalized(195, 109, 120, 20, 1076172, 0x7FFF); // Recharge it
}
else
{
AddHtmlLocalized(9, 9, 272, 100, 1076176, 0x7FFF, false,
false); // You will need a blue diamond to repair the tip of the engraver. A successful repair will give the engraver 10 charges.
AddHtmlLocalized(195, 109, 120, 20, 1076177, 0x7FFF, false, false); // Replace the tip.
AddHtmlLocalized(9, 9, 272, 100, 1076176, 0x7FFF); // You will need a blue diamond to repair the tip of the engraver. A successful repair will give the engraver 10 charges.
AddHtmlLocalized(195, 109, 120, 20, 1076177, 0x7FFF); // Replace the tip.
}
AddButton(160, 107, 0xFB7, 0xFB8, (int)Buttons.Confirm, GumpButtonType.Reply, 0);
AddButton(5, 107, 0xFB1, 0xFB2, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
AddHtmlLocalized(40, 109, 100, 20, 1060051, 0x7FFF, false, false); // CANCEL
AddButton(160, 107, 0xFB7, 0xFB8, (int)Buttons.Confirm);
AddButton(5, 107, 0xFB1, 0xFB2, (int)Buttons.Cancel);
AddHtmlLocalized(40, 109, 100, 20, 1060051, 0x7FFF); // CANCEL
}
public override void OnResponse(NetState state, RelayInfo info)
{
if (m_Engraver == null || m_Engraver.Deleted)
if (m_Engraver?.Deleted != false || info.ButtonID != (int)Buttons.Confirm)
return;
if (info.ButtonID == (int)Buttons.Confirm)
m_Engraver.Recharge(state.Mobile, m_Guildmaster);
m_Engraver.Recharge(state.Mobile, m_Guildmaster);
}
private enum Buttons
@ -352,4 +340,4 @@ namespace Server.Items
}
}
}
}
}