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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue