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

@ -153,7 +153,7 @@ namespace Server.Misc
private static void EventSink_Login_Callback(Mobile from)
{
NetState ns = from.NetState;
if (ns == null)
return;
@ -409,15 +409,15 @@ namespace Server.Misc
else
title = "Shard Poll";
AddHtml(22, 22, 294, 20, Color(Center(title), LabelColor32), false, false);
AddHtml(22, 22, 294, 20, Color(Center(title), LabelColor32));
if (editing)
{
AddHtml(22, 22, 294, 20, Color($"{totalVotes} total", LabelColor32), false, false);
AddButton(287, 23, 0x2622, 0x2623, 2, GumpButtonType.Reply, 0);
AddHtml(22, 22, 294, 20, Color($"{totalVotes} total", LabelColor32));
AddButton(287, 23, 0x2622, 0x2623, 2);
}
AddHtml(22, 50, 294, 40, Color(poller.Title, 0x99CC66), false, false);
AddHtml(22, 50, 294, 40, Color(poller.Title, 0x99CC66));
AddImageTiled(32, 88, 264, 1, 9107);
AddImageTiled(42, 90, 264, 1, 9157);
@ -433,7 +433,7 @@ namespace Server.Misc
{
double perc = option.Votes / (double)totalVotes;
text = string.Format("[{1}: {2}%] {0}", text, option.Votes, (int)(perc * 100));
text = $"[{option.Votes}: {(int)(perc * 100)}%] {text}";
}
int optHeight = option.ComputeHeight();
@ -445,7 +445,7 @@ namespace Server.Misc
else
AddRadio(24, y - 15, 0x25F9, 0x25FC, false, 1 + i);
AddHtml(60, y - 9 * option.LineBreaks, 250, 18 * option.LineBreaks, Color(text, LabelColor32), false, false);
AddHtml(60, y - 9 * option.LineBreaks, 250, 18 * option.LineBreaks, Color(text, LabelColor32));
y += optHeight / 2;
y += 5;
@ -454,11 +454,11 @@ namespace Server.Misc
if (editing && !isViewingResults)
{
AddRadio(24, y + 15 - 15, 0x25F9, 0x25FC, false, 1 + poller.Options.Length);
AddHtml(60, y + 15 - 9, 250, 18, Color("Create new option.", 0x99CC66), false, false);
AddHtml(60, y + 15 - 9, 250, 18, Color("Create new option.", 0x99CC66));
}
AddButton(314, height - 73, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(314, height - 47, 242, 241, 0, GumpButtonType.Reply, 0);
AddButton(314, height - 73, 247, 248, 1);
AddButton(314, height - 47, 242, 241, 0);
}
public bool Editing{ get; }
@ -568,7 +568,7 @@ namespace Server.Misc
}
else if (m.Groups[2].Success)
{
return string.Format("<a href=\"{0}\">{0}</a>", m.Groups[2].Value);
return $"<a href=\"{m.Groups[2].Value}\">{m.Groups[2].Value}</a>";
}
return m.Value;
@ -606,4 +606,4 @@ namespace Server.Misc
from.SendGump(new ShardPollGump(from, m_Poller, true, null));
}
}
}
}