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
|
|
@ -1,20 +1,7 @@
|
|||
#region Header
|
||||
|
||||
// **********
|
||||
// ServUO - VirtualCheck.cs
|
||||
// **********
|
||||
|
||||
#endregion
|
||||
|
||||
#region References
|
||||
|
||||
using System.Drawing;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace Server
|
||||
{
|
||||
public sealed class VirtualCheck : Item
|
||||
|
|
@ -25,12 +12,7 @@ namespace Server
|
|||
|
||||
private int _Plat;
|
||||
|
||||
public VirtualCheck()
|
||||
: this(0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
public VirtualCheck(int plat, int gold)
|
||||
public VirtualCheck(int plat = 0, int gold = 0)
|
||||
: base(0x14F0)
|
||||
{
|
||||
Plat = plat;
|
||||
|
|
@ -90,7 +72,7 @@ namespace Server
|
|||
{
|
||||
if (UseEditGump && IsAccessibleTo(from))
|
||||
{
|
||||
if (Editor?.Check == null || Editor.Check.Deleted)
|
||||
if (Editor?.Check?.Deleted != false)
|
||||
{
|
||||
Editor = new EditGump(from, this);
|
||||
Editor.Send();
|
||||
|
|
@ -196,14 +178,15 @@ namespace Server
|
|||
{
|
||||
base.OnServerClose(owner);
|
||||
|
||||
if (Check != null && !Check.Deleted) Check.UpdateTrade(User);
|
||||
if (Check?.Deleted == false)
|
||||
Check.UpdateTrade(User);
|
||||
}
|
||||
|
||||
public void Close()
|
||||
{
|
||||
User.CloseGump<EditGump>();
|
||||
|
||||
if (Check != null && !Check.Deleted)
|
||||
if (Check?.Deleted == false)
|
||||
Check.UpdateTrade(User);
|
||||
else
|
||||
Check = null;
|
||||
|
|
@ -211,7 +194,7 @@ namespace Server
|
|||
|
||||
public void Send()
|
||||
{
|
||||
if (Check != null && !Check.Deleted)
|
||||
if (Check?.Deleted == false)
|
||||
User.SendGump(this);
|
||||
else
|
||||
Close();
|
||||
|
|
@ -219,13 +202,14 @@ namespace Server
|
|||
|
||||
public void Refresh(bool recompile)
|
||||
{
|
||||
if (Check == null || Check.Deleted)
|
||||
if (Check?.Deleted != false)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
}
|
||||
|
||||
if (recompile) CompileLayout();
|
||||
if (recompile)
|
||||
CompileLayout();
|
||||
|
||||
Close();
|
||||
Send();
|
||||
|
|
@ -233,7 +217,8 @@ namespace Server
|
|||
|
||||
private void CompileLayout()
|
||||
{
|
||||
if (Check == null || Check.Deleted) return;
|
||||
if (Check?.Deleted != false)
|
||||
return;
|
||||
|
||||
Entries.ForEach(e => e.Parent = null);
|
||||
Entries.Clear();
|
||||
|
|
@ -248,9 +233,9 @@ namespace Server
|
|||
AddImage(360, 8, 113);
|
||||
|
||||
string title =
|
||||
$"<BASEFONT COLOR=#{Color.DarkSlateGray.ToArgb():X}><CENTER>BANK OF {User.RawName.ToUpper()}</CENTER>";
|
||||
$"<BASEFONT COLOR=#FF2F4F4F><CENTER>BANK OF {User.RawName.ToUpper()}</CENTER>";
|
||||
|
||||
AddHtml(40, 15, 320, 20, title, false, false);
|
||||
AddHtml(40, 15, 320, 20, title);
|
||||
|
||||
// Platinum Row
|
||||
AddBackground(15, 60, 175, 20, 9300);
|
||||
|
|
@ -258,7 +243,7 @@ namespace Server
|
|||
AddItem(20, 45, 3826); // Plat
|
||||
AddLabel(60, 50, 0, User.Account.TotalPlat.ToString("#,0"));
|
||||
|
||||
AddButton(195, 50, 95, 95, (int)Buttons.AllPlat, GumpButtonType.Reply, 0); // ->
|
||||
AddButton(195, 50, 95, 95, (int)Buttons.AllPlat); // ->
|
||||
|
||||
AddBackground(210, 60, 175, 20, 9300);
|
||||
AddBackground(215, 45, 165, 30, 9350);
|
||||
|
|
@ -270,21 +255,21 @@ namespace Server
|
|||
AddItem(20, 85, 3823); // Gold
|
||||
AddLabel(60, 90, 0, User.Account.TotalGold.ToString("#,0"));
|
||||
|
||||
AddButton(195, 90, 95, 95, (int)Buttons.AllGold, GumpButtonType.Reply, 0); // ->
|
||||
AddButton(195, 90, 95, 95, (int)Buttons.AllGold); // ->
|
||||
|
||||
AddBackground(210, 100, 175, 20, 9300);
|
||||
AddBackground(215, 85, 165, 30, 9350);
|
||||
AddTextEntry(225, 90, 145, 20, 0, 1, _Gold.ToString(), User.Account.TotalGold.ToString().Length);
|
||||
|
||||
// Buttons
|
||||
AddButton(20, 128, 12006, 12007, (int)Buttons.Close, GumpButtonType.Reply, 0);
|
||||
AddButton(215, 128, 12003, 12004, (int)Buttons.Clear, GumpButtonType.Reply, 0);
|
||||
AddButton(305, 128, 12000, 12002, (int)Buttons.Accept, GumpButtonType.Reply, 0);
|
||||
AddButton(20, 128, 12006, 12007, (int)Buttons.Close);
|
||||
AddButton(215, 128, 12003, 12004, (int)Buttons.Clear);
|
||||
AddButton(305, 128, 12000, 12002, (int)Buttons.Accept);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (Check == null || Check.Deleted || sender.Mobile != User)
|
||||
if (Check?.Deleted != false || sender.Mobile != User)
|
||||
{
|
||||
Close();
|
||||
return;
|
||||
|
|
@ -352,9 +337,10 @@ namespace Server
|
|||
break;
|
||||
}
|
||||
|
||||
if (updated) User.SendMessage("Your offer has been updated.");
|
||||
if (updated)
|
||||
User.SendMessage("Your offer has been updated.");
|
||||
|
||||
if (refresh && Check != null && !Check.Deleted)
|
||||
if (refresh && Check?.Deleted == false)
|
||||
{
|
||||
Refresh(true);
|
||||
return;
|
||||
|
|
@ -364,4 +350,4 @@ namespace Server
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue