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

@ -31,16 +31,16 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.PendingPeriod - DateTime.UtcNow;
int days = (int)(toGo.TotalDays + 0.5);
AddHtmlLocalized(20, 40, 380, 20, 1038034, false, false); // A new election campaign is pending
AddHtmlLocalized(20, 40, 380, 20, 1038034); // A new election campaign is pending
if (days > 0)
{
AddHtmlLocalized(20, 60, 280, 20, 1018062, false, false); // Days until next election :
AddHtmlLocalized(20, 60, 280, 20, 1018062); // Days until next election :
AddLabel(300, 60, 0, days.ToString());
}
else
{
AddHtmlLocalized(20, 60, 280, 20, 1018059, false, false); // Election campaigning begins tonight.
AddHtmlLocalized(20, 60, 280, 20, 1018059); // Election campaigning begins tonight.
}
break;
@ -50,31 +50,29 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.CampaignPeriod - DateTime.UtcNow;
int days = (int)(toGo.TotalDays + 0.5);
AddHtmlLocalized(20, 40, 380, 20, 1018058, false, false); // There is an election campaign in progress.
AddHtmlLocalized(20, 40, 380, 20, 1018058); // There is an election campaign in progress.
if (days > 0)
{
AddHtmlLocalized(20, 60, 280, 20, 1038033, false, false); // Days to go:
AddHtmlLocalized(20, 60, 280, 20, 1038033); // Days to go:
AddLabel(300, 60, 0, days.ToString());
}
else
{
AddHtmlLocalized(20, 60, 280, 20, 1018061, false,
false); // Campaign in progress. Voting begins tonight.
AddHtmlLocalized(20, 60, 280, 20, 1018061); // Campaign in progress. Voting begins tonight.
}
if (m_Election.CanBeCandidate(m_From))
{
AddButton(20, 110, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 110, 350, 20, 1011427, false, false); // CAMPAIGN FOR LEADERSHIP
AddButton(20, 110, 4005, 4007, 2);
AddHtmlLocalized(55, 110, 350, 20, 1011427); // CAMPAIGN FOR LEADERSHIP
}
else
{
PlayerState pl = PlayerState.Find(m_From);
if (pl == null || pl.Rank.Rank < Election.CandidateRank)
AddHtmlLocalized(20, 100, 380, 20, 1010118, false,
false); // You must have a higher rank to run for office
AddHtmlLocalized(20, 100, 380, 20, 1010118); // You must have a higher rank to run for office
}
break;
@ -84,20 +82,20 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.VotingPeriod - DateTime.UtcNow;
int days = (int)Math.Ceiling(toGo.TotalDays);
AddHtmlLocalized(20, 40, 380, 20, 1018060, false, false); // There is an election vote in progress.
AddHtmlLocalized(20, 40, 380, 20, 1018060); // There is an election vote in progress.
AddHtmlLocalized(20, 60, 280, 20, 1038033, false, false);
AddHtmlLocalized(20, 60, 280, 20, 1038033);
AddLabel(300, 60, 0, days.ToString());
AddHtmlLocalized(55, 100, 380, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 100, 380, 20, 1011428); // VOTE FOR LEADERSHIP
AddButton(20, 100, 4005, 4007, 1);
break;
}
}
AddButton(20, 140, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 140, 350, 20, 1011012, false, false); // CANCEL
AddButton(20, 140, 4005, 4007, 0);
AddHtmlLocalized(55, 140, 350, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -126,4 +124,4 @@ namespace Server.Factions
}
}
}
}
}