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
|
|
@ -150,7 +150,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
BaseHouse house = BaseHouse.FindHouseAt(this);
|
||||
|
||||
if (house != null && house.IsCoOwner(from) || (int)from.AccessLevel > (int)AccessLevel.Counselor)
|
||||
if (house?.IsCoOwner(from) == true || from.AccessLevel > AccessLevel.Counselor)
|
||||
list.Add(new DemolishEntry(this));
|
||||
}
|
||||
}
|
||||
|
|
@ -159,7 +159,7 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (Plinth != null && !Plinth.Deleted)
|
||||
if (Plinth?.Deleted == false)
|
||||
Plinth.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -309,12 +309,14 @@ namespace Server.Mobiles
|
|||
|
||||
public Item CloneItem(Item item)
|
||||
{
|
||||
Item cloned = new Item(item.ItemID);
|
||||
cloned.Layer = item.Layer;
|
||||
cloned.Name = item.Name;
|
||||
cloned.Hue = item.Hue;
|
||||
cloned.Weight = item.Weight;
|
||||
cloned.Movable = false;
|
||||
Item cloned = new Item(item.ItemID)
|
||||
{
|
||||
Layer = item.Layer,
|
||||
Name = item.Name,
|
||||
Hue = item.Hue,
|
||||
Weight = item.Weight,
|
||||
Movable = false
|
||||
};
|
||||
|
||||
return cloned;
|
||||
}
|
||||
|
|
@ -569,7 +571,7 @@ namespace Server.Mobiles
|
|||
IPoint3D p = targeted as IPoint3D;
|
||||
Map map = from.Map;
|
||||
|
||||
if (p == null || map == null || m_Maker == null || m_Maker.Deleted)
|
||||
if (p == null || map == null || m_Maker?.Deleted != false)
|
||||
return;
|
||||
|
||||
if (m_Maker.IsChildOf(from.Backpack))
|
||||
|
|
@ -666,4 +668,4 @@ namespace Server.Mobiles
|
|||
return AddonFitResult.Valid;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Statue != null && !m_Statue.Deleted)
|
||||
if (m_Statue?.Deleted == false)
|
||||
m_Statue.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -106,9 +106,9 @@ namespace Server.Items
|
|||
|
||||
AddPage(0);
|
||||
AddImage(0, 0, 0x24F4);
|
||||
AddHtml(55, 50, 150, 20, statue.Name, false, false);
|
||||
AddHtml(55, 75, 150, 20, statue.SculptedOn.ToString(), false, false);
|
||||
AddHtmlLocalized(55, 100, 150, 20, GetTypeNumber(statue.StatueType), 0, false, false);
|
||||
AddHtml(55, 50, 150, 20, statue.Name);
|
||||
AddHtml(55, 75, 150, 20, statue.SculptedOn.ToString());
|
||||
AddHtmlLocalized(55, 100, 150, 20, GetTypeNumber(statue.StatueType), 0);
|
||||
}
|
||||
|
||||
public int GetTypeNumber(StatueType type)
|
||||
|
|
@ -123,4 +123,4 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,40 +30,39 @@ namespace Server.Gumps
|
|||
AddImageTiled(10, 40, 307, 244, 0xA40);
|
||||
AddImageTiled(10, 294, 307, 20, 0xA40);
|
||||
AddAlphaRegion(10, 10, 307, 304);
|
||||
AddHtmlLocalized(14, 12, 327, 20, 1076156, 0x7FFF, false, false); // Character Statue Maker
|
||||
AddHtmlLocalized(14, 12, 327, 20, 1076156, 0x7FFF); // Character Statue Maker
|
||||
|
||||
// pose
|
||||
AddHtmlLocalized(133, 41, 120, 20, 1076168, 0x7FFF, false, false); // Choose Pose
|
||||
AddHtmlLocalized(133, 61, 120, 20, 1076208 + (int)m_Statue.Pose, 0x77E, false, false);
|
||||
AddButton(163, 81, 0xFA5, 0xFA7, (int)Buttons.PoseNext, GumpButtonType.Reply, 0);
|
||||
AddButton(133, 81, 0xFAE, 0xFB0, (int)Buttons.PosePrev, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(133, 41, 120, 20, 1076168, 0x7FFF); // Choose Pose
|
||||
AddHtmlLocalized(133, 61, 120, 20, 1076208 + (int)m_Statue.Pose, 0x77E);
|
||||
AddButton(163, 81, 0xFA5, 0xFA7, (int)Buttons.PoseNext);
|
||||
AddButton(133, 81, 0xFAE, 0xFB0, (int)Buttons.PosePrev);
|
||||
|
||||
// direction
|
||||
AddHtmlLocalized(133, 126, 120, 20, 1076170, 0x7FFF, false, false); // Choose Direction
|
||||
AddHtmlLocalized(133, 146, 120, 20, GetDirectionNumber(m_Statue.Direction), 0x77E, false, false);
|
||||
AddButton(163, 167, 0xFA5, 0xFA7, (int)Buttons.DirNext, GumpButtonType.Reply, 0);
|
||||
AddButton(133, 167, 0xFAE, 0xFB0, (int)Buttons.DirPrev, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(133, 126, 120, 20, 1076170, 0x7FFF); // Choose Direction
|
||||
AddHtmlLocalized(133, 146, 120, 20, GetDirectionNumber(m_Statue.Direction), 0x77E);
|
||||
AddButton(163, 167, 0xFA5, 0xFA7, (int)Buttons.DirNext);
|
||||
AddButton(133, 167, 0xFAE, 0xFB0, (int)Buttons.DirPrev);
|
||||
|
||||
// material
|
||||
AddHtmlLocalized(133, 211, 120, 20, 1076171, 0x7FFF, false, false); // Choose Material
|
||||
AddHtmlLocalized(133, 231, 120, 20, GetMaterialNumber(m_Statue.StatueType, m_Statue.Material), 0x77E, false,
|
||||
false);
|
||||
AddButton(163, 253, 0xFA5, 0xFA7, (int)Buttons.MatNext, GumpButtonType.Reply, 0);
|
||||
AddButton(133, 253, 0xFAE, 0xFB0, (int)Buttons.MatPrev, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(133, 211, 120, 20, 1076171, 0x7FFF); // Choose Material
|
||||
AddHtmlLocalized(133, 231, 120, 20, GetMaterialNumber(m_Statue.StatueType, m_Statue.Material), 0x77E);
|
||||
AddButton(163, 253, 0xFA5, 0xFA7, (int)Buttons.MatNext);
|
||||
AddButton(133, 253, 0xFAE, 0xFB0, (int)Buttons.MatPrev);
|
||||
|
||||
// cancel
|
||||
AddButton(10, 294, 0xFB1, 0xFB2, (int)Buttons.Close, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(45, 294, 80, 20, 1006045, 0x7FFF, false, false); // Cancel
|
||||
AddButton(10, 294, 0xFB1, 0xFB2, (int)Buttons.Close);
|
||||
AddHtmlLocalized(45, 294, 80, 20, 1006045, 0x7FFF); // Cancel
|
||||
|
||||
// sculpt
|
||||
AddButton(234, 294, 0xFB7, 0xFB9, (int)Buttons.Sculpt, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(269, 294, 80, 20, 1076174, 0x7FFF, false, false); // Sculpt
|
||||
AddButton(234, 294, 0xFB7, 0xFB9, (int)Buttons.Sculpt);
|
||||
AddHtmlLocalized(269, 294, 80, 20, 1076174, 0x7FFF); // Sculpt
|
||||
|
||||
// restore
|
||||
if (m_Maker is CharacterStatueDeed)
|
||||
{
|
||||
AddButton(107, 294, 0xFAB, 0xFAD, (int)Buttons.Restore, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(142, 294, 80, 20, 1076193, 0x7FFF, false, false); // Restore
|
||||
AddButton(107, 294, 0xFAB, 0xFAD, (int)Buttons.Restore);
|
||||
AddHtmlLocalized(142, 294, 80, 20, 1076193, 0x7FFF); // Restore
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +110,7 @@ namespace Server.Gumps
|
|||
|
||||
public override void OnResponse(NetState state, RelayInfo info)
|
||||
{
|
||||
if (m_Statue == null || m_Statue.Deleted)
|
||||
if (m_Statue?.Deleted != false)
|
||||
return;
|
||||
|
||||
bool sendGump = false;
|
||||
|
|
@ -195,4 +194,4 @@ namespace Server.Gumps
|
|||
Restore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,10 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
AddBackground(10, 10, 600, 450, 2600);
|
||||
|
||||
AddButton(530, 415, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddButton(530, 415, 4017, 4019, 0);
|
||||
|
||||
AddButton(60, 415, 4014, 4016, 0, GumpButtonType.Page, 1);
|
||||
AddHtmlLocalized(95, 415, 200, 20, 1049755, false, false); // Main Menu
|
||||
AddHtmlLocalized(95, 415, 200, 20, 1049755); // Main Menu
|
||||
}
|
||||
|
||||
private void RenderCategories()
|
||||
|
|
@ -61,10 +61,10 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
RewardSystem.ComputeRewardInfo(m_From, out int cur, out int max);
|
||||
|
||||
AddHtmlLocalized(60, 105, 300, 35, 1006006, false, false); // Your current total of rewards to choose:
|
||||
AddHtmlLocalized(60, 105, 300, 35, 1006006); // Your current total of rewards to choose:
|
||||
AddLabel(370, 107, 50, (max - cur).ToString());
|
||||
|
||||
AddHtmlLocalized(60, 140, 300, 35, 1006007, false, false); // You have already chosen:
|
||||
AddHtmlLocalized(60, 140, 300, 35, 1006007); // You have already chosen:
|
||||
AddLabel(370, 142, 50, cur.ToString());
|
||||
|
||||
RewardCategory[] categories = RewardSystem.Categories;
|
||||
|
|
@ -84,9 +84,9 @@ namespace Server.Engines.VeteranRewards
|
|||
page += PagesPerCategory(categories[i]);
|
||||
|
||||
if (categories[i].NameString != null)
|
||||
AddHtml(135, 180 + i * 40, 300, 20, categories[i].NameString, false, false);
|
||||
AddHtml(135, 180 + i * 40, 300, 20, categories[i].NameString);
|
||||
else
|
||||
AddHtmlLocalized(135, 180 + i * 40, 300, 20, categories[i].Name, false, false);
|
||||
AddHtmlLocalized(135, 180 + i * 40, 300, 20, categories[i].Name);
|
||||
}
|
||||
|
||||
page = 2;
|
||||
|
|
@ -130,22 +130,22 @@ namespace Server.Engines.VeteranRewards
|
|||
if (i == 24)
|
||||
{
|
||||
AddButton(305, 415, 0xFA5, 0xFA7, 0, GumpButtonType.Page, ++page);
|
||||
AddHtmlLocalized(340, 415, 200, 20, 1011066, false, false); // Next page
|
||||
AddHtmlLocalized(340, 415, 200, 20, 1011066); // Next page
|
||||
|
||||
AddPage(page);
|
||||
|
||||
AddButton(270, 415, 0xFAE, 0xFB0, 0, GumpButtonType.Page, page - 1);
|
||||
AddHtmlLocalized(185, 415, 200, 20, 1011067, false, false); // Previous page
|
||||
AddHtmlLocalized(185, 415, 200, 20, 1011067); // Previous page
|
||||
|
||||
i = 0;
|
||||
}
|
||||
|
||||
AddButton(55 + i / 12 * 250, 80 + i % 12 * 25, 5540, 5541, GetButtonID(index, j), GumpButtonType.Reply, 0);
|
||||
AddButton(55 + i / 12 * 250, 80 + i % 12 * 25, 5540, 5541, GetButtonID(index, j));
|
||||
|
||||
if (entry.NameString != null)
|
||||
AddHtml(80 + i / 12 * 250, 80 + i % 12 * 25, 250, 20, entry.NameString, false, false);
|
||||
AddHtml(80 + i / 12 * 250, 80 + i % 12 * 25, 250, 20, entry.NameString);
|
||||
else
|
||||
AddHtmlLocalized(80 + i / 12 * 250, 80 + i % 12 * 25, 250, 20, entry.Name, false, false);
|
||||
AddHtmlLocalized(80 + i / 12 * 250, 80 + i % 12 * 25, 250, 20, entry.Name);
|
||||
++i;
|
||||
}
|
||||
|
||||
|
|
@ -189,4 +189,4 @@ namespace Server.Engines.VeteranRewards
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,24 +20,24 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
AddBackground(10, 10, 500, 300, 2600);
|
||||
|
||||
AddHtmlLocalized(30, 55, 300, 35, 1006000, false, false); // You have selected:
|
||||
AddHtmlLocalized(30, 55, 300, 35, 1006000); // You have selected:
|
||||
|
||||
if (entry.NameString != null)
|
||||
AddHtml(335, 55, 150, 35, entry.NameString, false, false);
|
||||
AddHtml(335, 55, 150, 35, entry.NameString);
|
||||
else
|
||||
AddHtmlLocalized(335, 55, 150, 35, entry.Name, false, false);
|
||||
AddHtmlLocalized(335, 55, 150, 35, entry.Name);
|
||||
|
||||
AddHtmlLocalized(30, 95, 300, 35, 1006001, false, false); // This will be assigned to this character:
|
||||
AddHtmlLocalized(30, 95, 300, 35, 1006001); // This will be assigned to this character:
|
||||
AddLabel(335, 95, 0, from.Name);
|
||||
|
||||
AddHtmlLocalized(35, 160, 450, 90, 1006002, true,
|
||||
true); // Are you sure you wish to select this reward for this character? You will not be able to transfer this reward to another character on another shard. Click 'ok' below to confirm your selection or 'cancel' to go back to the selection screen.
|
||||
|
||||
AddButton(60, 265, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(95, 266, 150, 35, 1006044, false, false); // Ok
|
||||
AddButton(60, 265, 4005, 4007, 1);
|
||||
AddHtmlLocalized(95, 266, 150, 35, 1006044); // Ok
|
||||
|
||||
AddButton(295, 265, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(330, 266, 150, 35, 1006045, false, false); // Cancel
|
||||
AddButton(295, 265, 4017, 4019, 0);
|
||||
AddHtmlLocalized(330, 266, 150, 35, 1006045); // Cancel
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -67,4 +67,4 @@ namespace Server.Engines.VeteranRewards
|
|||
m_From.SendGump(new RewardNoticeGump(m_From));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,13 +20,13 @@ namespace Server.Gumps
|
|||
AddBackground(0, 0, 220, 170, 0x13BE);
|
||||
AddBackground(10, 10, 200, 150, 0xBB8);
|
||||
|
||||
AddHtmlLocalized(20, 30, 180, 60, question, false, false); // Do you wish to re-deed this decoration?
|
||||
AddHtmlLocalized(20, 30, 180, 60, question); // Do you wish to re-deed this decoration?
|
||||
|
||||
AddHtmlLocalized(55, 100, 150, 25, 1011011, false, false); // CONTINUE
|
||||
AddButton(20, 100, 0xFA5, 0xFA7, (int)Buttons.Confirm, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 100, 150, 25, 1011011); // CONTINUE
|
||||
AddButton(20, 100, 0xFA5, 0xFA7, (int)Buttons.Confirm);
|
||||
|
||||
AddHtmlLocalized(55, 125, 150, 25, 1011012, false, false); // CANCEL
|
||||
AddButton(20, 125, 0xFA5, 0xFA7, (int)Buttons.Cancel, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 125, 150, 25, 1011012); // CANCEL
|
||||
AddButton(20, 125, 0xFA5, 0xFA7, (int)Buttons.Cancel);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -71,4 +71,4 @@ namespace Server.Gumps
|
|||
Confirm
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ namespace Server.Engines.VeteranRewards
|
|||
*/
|
||||
AddHtmlLocalized(52, 35, 420, 55, 1006046, true, true);
|
||||
|
||||
AddButton(60, 95, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(95, 96, 150, 35, 1006044, false, false); // Ok
|
||||
AddButton(60, 95, 4005, 4007, 1);
|
||||
AddHtmlLocalized(95, 96, 150, 35, 1006044); // Ok
|
||||
|
||||
AddButton(285, 95, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(320, 96, 150, 35, 1006045, false, false); // Cancel
|
||||
AddButton(285, 95, 4017, 4019, 0);
|
||||
AddHtmlLocalized(320, 96, 150, 35, 1006045); // Cancel
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -35,4 +35,4 @@ namespace Server.Engines.VeteranRewards
|
|||
m_From.SendGump(new RewardChoiceGump(m_From));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,7 @@ namespace Server.Gumps
|
|||
private IRewardOption m_Option;
|
||||
private RewardOptionList m_Options = new RewardOptionList();
|
||||
|
||||
public RewardOptionGump(IRewardOption option) : this(option, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public RewardOptionGump(IRewardOption option, int title) : base(60, 36)
|
||||
public RewardOptionGump(IRewardOption option, int title = 0) : base(60, 36)
|
||||
{
|
||||
m_Option = option;
|
||||
|
||||
|
|
@ -32,20 +28,20 @@ namespace Server.Gumps
|
|||
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
|
||||
AddButton(10, 294, 0xFB1, 0xFB2, 0);
|
||||
AddHtmlLocalized(45, 296, 450, 20, 1060051, 0x7FFF); // CANCEL
|
||||
|
||||
if (title > 0)
|
||||
AddHtmlLocalized(14, 12, 273, 20, title, 0x7FFF, false, false);
|
||||
AddHtmlLocalized(14, 12, 273, 20, title, 0x7FFF);
|
||||
else
|
||||
AddHtmlLocalized(14, 12, 273, 20, 1080392, 0x7FFF, false, false); // Select your choice from the menu below.
|
||||
AddHtmlLocalized(14, 12, 273, 20, 1080392, 0x7FFF); // Select your choice from the menu below.
|
||||
|
||||
AddPage(1);
|
||||
|
||||
for (int i = 0; i < m_Options.Count; i++)
|
||||
{
|
||||
AddButton(19, 49 + i * 24, 0x845, 0x846, m_Options[i].ID, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(44, 47 + i * 24, 213, 20, m_Options[i].Cliloc, 0x7FFF, false, false);
|
||||
AddButton(19, 49 + i * 24, 0x845, 0x846, m_Options[i].ID);
|
||||
AddHtmlLocalized(44, 47 + i * 24, 213, 20, m_Options[i].Cliloc, 0x7FFF);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -88,4 +84,4 @@ namespace Server.Gumps
|
|||
Add(new RewardOption(id, cliloc));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -171,7 +171,7 @@ namespace Server.Engines.VeteranRewards
|
|||
max = 2 + level;
|
||||
}
|
||||
|
||||
public static bool CheckIsUsableBy(Mobile from, Item item, object[] args)
|
||||
public static bool CheckIsUsableBy(Mobile from, Item item, object[] args = null)
|
||||
{
|
||||
if (m_Lists == null)
|
||||
SetupRewardTables();
|
||||
|
|
@ -189,12 +189,12 @@ namespace Server.Engines.VeteranRewards
|
|||
{
|
||||
if (entries[j].ItemType != type)
|
||||
continue;
|
||||
|
||||
|
||||
if (args == null && entries[j].Args.Length == 0)
|
||||
{
|
||||
if (isRelaxedRules && i <= 0 || HasAccess(from, list, out TimeSpan ts))
|
||||
return true;
|
||||
|
||||
|
||||
from.SendLocalizedMessage(1008126, true,
|
||||
Math.Ceiling(ts.TotalDays / 30.0)
|
||||
.ToString()); // Your account is not old enough to use this item. Months until you can use this item :
|
||||
|
|
@ -204,7 +204,7 @@ namespace Server.Engines.VeteranRewards
|
|||
|
||||
if (args?.Length != entries[j].Args.Length)
|
||||
continue;
|
||||
|
||||
|
||||
bool match = true;
|
||||
|
||||
for (int k = 0; match && k < args.Length; ++k)
|
||||
|
|
@ -214,7 +214,7 @@ namespace Server.Engines.VeteranRewards
|
|||
{
|
||||
if (isRelaxedRules && i <= 0 || HasAccess(from, list, out TimeSpan ts))
|
||||
return true;
|
||||
|
||||
|
||||
from.SendLocalizedMessage(1008126, true,
|
||||
Math.Ceiling(ts.TotalDays / 30.0)
|
||||
.ToString()); // Your account is not old enough to use this item. Months until you can use this item :
|
||||
|
|
@ -503,4 +503,4 @@ namespace Server.Engines.VeteranRewards
|
|||
{
|
||||
bool IsRewardItem{ get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue