Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -10,7 +10,7 @@ namespace Server.Items
|
|||
|
||||
public class CommodityDeed : Item
|
||||
{
|
||||
public CommodityDeed(Item commodity) : base(0x14F0)
|
||||
public CommodityDeed(Item commodity = null) : base(0x14F0)
|
||||
{
|
||||
Weight = 1.0;
|
||||
Hue = 0x47;
|
||||
|
|
@ -20,11 +20,6 @@ namespace Server.Items
|
|||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public CommodityDeed() : this(null)
|
||||
{
|
||||
}
|
||||
|
||||
public CommodityDeed(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
|
@ -167,7 +162,7 @@ namespace Server.Items
|
|||
number = 1047024; // To claim the resources ....
|
||||
}
|
||||
}
|
||||
else if (cox != null && !cox.IsSecure)
|
||||
else if (cox?.IsSecure == false)
|
||||
{
|
||||
number = 1080525; // The commodity deed box must be secured before you can use it.
|
||||
}
|
||||
|
|
@ -215,7 +210,7 @@ namespace Server.Items
|
|||
|
||||
// Veteran Rewards mods
|
||||
if (box != null && m_Deed.IsChildOf(box) && item.IsChildOf(box) ||
|
||||
cox != null && cox.IsSecure && item.IsChildOf(cox))
|
||||
cox?.IsSecure != true && item.IsChildOf(cox))
|
||||
{
|
||||
if (m_Deed.SetCommodity(item))
|
||||
{
|
||||
|
|
@ -245,4 +240,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ namespace Server.Items
|
|||
|
||||
CraftContext context = craftSystem.GetContext(from);
|
||||
|
||||
if (context != null && context.DoNotColor)
|
||||
if (context?.DoNotColor == true)
|
||||
Hue = 0;
|
||||
|
||||
return quality;
|
||||
|
|
@ -172,4 +172,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,30 +104,30 @@ namespace Server.Items
|
|||
|
||||
AddBackground(100, 10, 400, 385, 0xA28);
|
||||
|
||||
AddHtmlLocalized(100, 25, 400, 35, 1013008, false, false);
|
||||
AddButton(175, 340, 0xFA5, 0xFA7, 0x0, GumpButtonType.Reply, 0); // CANCEL
|
||||
AddHtmlLocalized(100, 25, 400, 35, 1013008);
|
||||
AddButton(175, 340, 0xFA5, 0xFA7, 0x0); // CANCEL
|
||||
|
||||
AddHtmlLocalized(210, 342, 90, 35, 1011012, false, false); // <CENTER>HAIRSTYLE SELECTION MENU</center>
|
||||
AddHtmlLocalized(210, 342, 90, 35, 1011012); // <CENTER>HAIRSTYLE SELECTION MENU</center>
|
||||
|
||||
int[][] RacialData = from.Race == Race.Human ? HumanArray : ElvenArray;
|
||||
|
||||
for (int i = 1; i < RacialData.Length; i++)
|
||||
{
|
||||
AddHtmlLocalized(LayoutArray[i][2], LayoutArray[i][3], i == 1 ? 125 : 80, i == 1 ? 70 : 35,
|
||||
m_From.Female ? RacialData[i][0] : RacialData[i][1], false, false);
|
||||
m_From.Female ? RacialData[i][0] : RacialData[i][1]);
|
||||
if (LayoutArray[i][4] != 0)
|
||||
{
|
||||
AddBackground(LayoutArray[i][0], LayoutArray[i][1], 50, 50, 0xA3C);
|
||||
AddImage(LayoutArray[i][4], LayoutArray[i][5], m_From.Female ? RacialData[i][4] : RacialData[i][5]);
|
||||
}
|
||||
|
||||
AddButton(LayoutArray[i][6], LayoutArray[i][7], 0xFA5, 0xFA7, i, GumpButtonType.Reply, 0);
|
||||
AddButton(LayoutArray[i][6], LayoutArray[i][7], 0xFA5, 0xFA7, i);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_From == null || !m_From.Alive)
|
||||
if (m_From?.Alive != true)
|
||||
return;
|
||||
|
||||
if (m_Deed.Deleted)
|
||||
|
|
@ -147,4 +147,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,11 +130,11 @@ namespace Server.Items
|
|||
AddBackground(0, 0, 220, 120, 5054);
|
||||
AddBackground(10, 10, 200, 100, 3000);
|
||||
|
||||
AddButton(20, 35, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 35, 145, 25, 1018322, false, false); // Classic
|
||||
AddButton(20, 35, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 35, 145, 25, 1018322); // Classic
|
||||
|
||||
AddButton(20, 65, 4005, 4007, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 65, 145, 25, 1018321, false, false); // Modern
|
||||
AddButton(20, 65, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 65, 145, 25, 1018321); // Modern
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -157,4 +157,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ namespace Server.Items
|
|||
AddPage(0);
|
||||
|
||||
AddBlackAlpha(10, 120, 250, 85);
|
||||
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF), false, false);
|
||||
AddHtml(10, 125, 250, 20, Color(Center("Name Change Deed"), 0xFFFFFF));
|
||||
|
||||
AddLabel(73, 15, 1152, "");
|
||||
AddLabel(20, 150, 0x480, "New Name:");
|
||||
|
|
@ -94,13 +94,13 @@ namespace Server.Items
|
|||
|
||||
public void AddButtonLabeled(int x, int y, int buttonID, string text)
|
||||
{
|
||||
AddButton(x, y - 1, 4005, 4007, buttonID, GumpButtonType.Reply, 0);
|
||||
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF), false, false);
|
||||
AddButton(x, y - 1, 4005, 4007, buttonID);
|
||||
AddHtml(x + 35, y, 240, 20, Color(text, 0xFFFFFF));
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Sender == null || m_Sender.Deleted || info.ButtonID != 1 || m_Sender.RootParent != sender.Mobile)
|
||||
if (m_Sender?.Deleted != false || info.ButtonID != 1 || m_Sender.RootParent != sender.Mobile)
|
||||
return;
|
||||
|
||||
Mobile m = sender.Mobile;
|
||||
|
|
@ -121,4 +121,4 @@ namespace Server.Items
|
|||
m_Sender.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace Server.Items
|
|||
{
|
||||
Mobile them = theirTicket.Owner;
|
||||
|
||||
if (them == null || them.Deleted)
|
||||
if (them?.Deleted != false)
|
||||
{
|
||||
from.SendLocalizedMessage(501930); // That is not a valid ticket.
|
||||
}
|
||||
|
|
@ -131,26 +131,26 @@ namespace Server.Items
|
|||
AddHtmlLocalized(30, 45, 340, 70, 1013011, true,
|
||||
true); // Choose the gift you prefer. WARNING: if you cancel, and your partner does not, you will need to find another matching ticket!
|
||||
|
||||
AddButton(46, 128, 0xFA5, 0xFA7, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(80, 130, 320, 35, 1013012, false, false); // A sextant
|
||||
AddButton(46, 128, 0xFA5, 0xFA7, 1);
|
||||
AddHtmlLocalized(80, 130, 320, 35, 1013012); // A sextant
|
||||
|
||||
AddButton(46, 163, 0xFA5, 0xFA7, 2, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(80, 165, 320, 35, 1013013, false, false); // A coupon for a single hair restyling
|
||||
AddButton(46, 163, 0xFA5, 0xFA7, 2);
|
||||
AddHtmlLocalized(80, 165, 320, 35, 1013013); // A coupon for a single hair restyling
|
||||
|
||||
AddButton(46, 198, 0xFA5, 0xFA7, 3, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(80, 200, 320, 35, 1013014, false, false); // A spellbook with all 1st - 4th spells.
|
||||
AddButton(46, 198, 0xFA5, 0xFA7, 3);
|
||||
AddHtmlLocalized(80, 200, 320, 35, 1013014); // A spellbook with all 1st - 4th spells.
|
||||
|
||||
AddButton(46, 233, 0xFA5, 0xFA7, 4, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(80, 235, 320, 35, 1013015, false, false); // A wand of fireworks
|
||||
AddButton(46, 233, 0xFA5, 0xFA7, 4);
|
||||
AddHtmlLocalized(80, 235, 320, 35, 1013015); // A wand of fireworks
|
||||
|
||||
AddButton(46, 268, 0xFA5, 0xFA7, 5, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(80, 270, 320, 35, 1013016, false, false); // A spyglass
|
||||
AddButton(46, 268, 0xFA5, 0xFA7, 5);
|
||||
AddHtmlLocalized(80, 270, 320, 35, 1013016); // A spyglass
|
||||
|
||||
AddButton(46, 303, 0xFA5, 0xFA7, 6, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(80, 305, 320, 35, 1013017, false, false); // Dyes and a dye tub
|
||||
AddButton(46, 303, 0xFA5, 0xFA7, 6);
|
||||
AddHtmlLocalized(80, 305, 320, 35, 1013017); // Dyes and a dye tub
|
||||
|
||||
AddButton(120, 340, 0xFA5, 0xFA7, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(154, 342, 100, 35, 1011012, false, false); // CANCEL
|
||||
AddButton(120, 340, 0xFA5, 0xFA7, 0);
|
||||
AddHtmlLocalized(154, 342, 100, 35, 1011012); // CANCEL
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -205,4 +205,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue