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
|
|
@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -194,7 +194,7 @@ namespace Server.Engines.ConPVP
|
|||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddBorderedText(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", LabelColor32, BlackColor32);
|
||||
AddBorderedText(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}", LabelColor32, BlackColor32);
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -243,7 +243,7 @@ namespace Server.Engines.ConPVP
|
|||
y += 35;
|
||||
|
||||
y -= 3;
|
||||
AddButton(314, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314, y, 247, 248, 1);
|
||||
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
|
||||
}
|
||||
|
|
@ -270,9 +270,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AutoReject()
|
||||
|
|
@ -379,4 +379,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,18 +105,13 @@ namespace Server.Engines.ConPVP
|
|||
AddColumnHeader(325, "Participants");
|
||||
AddColumnHeader(40, "Obs");
|
||||
|
||||
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(499 + 40 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
|
||||
AddButton(499 + 40 - 12 - 63, height - 12 - 24, 241, 242, 2);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Arena ar = list[i];
|
||||
|
||||
string name = ar.Name;
|
||||
|
||||
if (name == null)
|
||||
name = "(no name)";
|
||||
|
||||
int x = 12;
|
||||
int y = 32 + i * 31;
|
||||
|
||||
|
|
@ -125,7 +120,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRadio(x + 3, y + 1, 9727, 9730, false, i);
|
||||
x += 35;
|
||||
|
||||
AddBorderedText(x + 5, y + 5, 115 - 5, name, color, 0);
|
||||
AddBorderedText(x + 5, y + 5, 115 - 5, ar.Name ?? "(no name)", color, 0);
|
||||
x += 115;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -271,9 +266,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
@ -287,4 +282,4 @@ namespace Server.Engines.ConPVP
|
|||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,32 +20,32 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
AddImage(215, -43, 0xEE40);
|
||||
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32), false, false);
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32), false, false);
|
||||
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Countdown"), BlackColor32));
|
||||
AddHtml(22, 22, 294, 20, Color(Center("Duel Countdown"), LabelColor32));
|
||||
|
||||
AddHtml(22 - 1, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22 + 1, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50 - 1, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50 + 1, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
BlackColor32), false, false);
|
||||
BlackColor32));
|
||||
AddHtml(22, 50, 294, 80,
|
||||
Color(
|
||||
"The arranged duel is about to begin. During this countdown period you may not cast spells and you may not move. This message will close automatically when the period ends.",
|
||||
0xFFCC66), false, false);
|
||||
0xFFCC66));
|
||||
|
||||
/*AddImageTiled( 32, 128, 264, 1, 9107 );
|
||||
AddImageTiled( 42, 130, 264, 1, 9157 );
|
||||
|
|
@ -56,7 +56,7 @@ namespace Server.Engines.ConPVP
|
|||
AddHtml( 60, 140+1, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#{2:X6}>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", BlackColor32 ), BlackColor32 ), false, false );
|
||||
AddHtml( 60, 140, 250, 20, Color( String.Format( "Duel will begin in <BASEFONT COLOR=#FF6666>{0} <BASEFONT COLOR=#{2:X6}>second{1}.", count, count==1?"":"s", 0x66AACC ), 0x66AACC ), false, false );*/
|
||||
|
||||
AddButton(314 - 50, 157 - offset, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(314 - 50, 157 - offset, 247, 248, 1);
|
||||
}
|
||||
|
||||
public string Center(string text)
|
||||
|
|
@ -69,4 +69,4 @@ namespace Server.Engines.ConPVP
|
|||
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, height, 9250);
|
||||
AddBackground(10, 10, 280, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 230, 20, Center("Duel Setup"), false, false);
|
||||
AddHtml(35, 25, 230, 20, Center("Duel Setup"));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
|
@ -38,12 +38,12 @@ namespace Server.Engines.ConPVP
|
|||
AddGoldenButtonLabeled(x, y, 3, "Add Participant");
|
||||
y += 30;
|
||||
|
||||
AddHtml(35, y, 230, 20, Center("Participants"), false, false);
|
||||
AddHtml(35, y, 230, 20, Center("Participants"));
|
||||
y += 22;
|
||||
|
||||
for (int i = 0; i < context.Participants.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)context.Participants[i];
|
||||
Participant p = context.Participants[i];
|
||||
|
||||
AddGoldenButtonLabeled(x, y, 4 + i,
|
||||
string.Format(p.Count == 1 ? "Player {0}: {3}" : "Team {0}: {1}/{2}: {3}", 1 + i, p.FilledSlots, p.Count,
|
||||
|
|
@ -63,14 +63,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
|
||||
{
|
||||
AddGoldenButton(x, y, bid);
|
||||
AddHtml(x + 25, y, 200, 20, text, false, false);
|
||||
AddHtml(x + 25, y, 200, 20, text);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -129,11 +129,11 @@ namespace Server.Engines.ConPVP
|
|||
index -= 4;
|
||||
|
||||
if (index >= 0 && index < Context.Participants.Count)
|
||||
From.SendGump(new ParticipantGump(From, Context, (Participant)Context.Participants[index]));
|
||||
From.SendGump(new ParticipantGump(From, Context, Context.Participants[index]));
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,18 +103,18 @@ namespace Server.Engines.ConPVP
|
|||
AddAlphaRegion(10, 10, 479, height - 20);
|
||||
|
||||
if (page > 0)
|
||||
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(446, height - 12 - 2 - 16, 0x15E3, 0x15E7, 1);
|
||||
else
|
||||
AddImage(446, height - 12 - 2 - 16, 0x2626);
|
||||
|
||||
if ((page + 1) * 15 < lc)
|
||||
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(466, height - 12 - 2 - 16, 0x15E1, 0x15E5, 2);
|
||||
else
|
||||
AddImage(466, height - 12 - 2 - 16, 0x2622);
|
||||
|
||||
AddHtml(16, height - 12 - 2 - 18, 400, 20,
|
||||
Color(string.Format("Top {3} of {0:N0} duelists, page {1} of {2}", m_List.Count, page + 1, (lc + 14) / 15, lc),
|
||||
0xFFC000), false, false);
|
||||
0xFFC000));
|
||||
|
||||
AddColumnHeader(75, "Rank");
|
||||
AddColumnHeader(115, "Level");
|
||||
|
|
@ -231,9 +231,9 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, 20, text, false, false);
|
||||
AddHtml(x, y, width, 20, text);
|
||||
else
|
||||
AddHtml(x, y, width, 20, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, 20, Color(text, color));
|
||||
}
|
||||
|
||||
private void AddColumnHeader(int width, string name)
|
||||
|
|
@ -245,4 +245,4 @@ namespace Server.Engines.ConPVP
|
|||
m_ColumnX += width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,16 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, height, 9250);
|
||||
AddBackground(10, 10, 280, height - 20, 0xDAC);
|
||||
|
||||
AddButton(240, 25, 0xFB1, 0xFB3, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(240, 25, 0xFB1, 0xFB3, 3);
|
||||
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, GumpButtonType.Reply, 0 );
|
||||
//AddButton( 223, 54, 0x265A, 0x265A, 4, );
|
||||
|
||||
AddHtml(35, 25, 230, 20, Center("Participant Setup"), false, false);
|
||||
AddHtml(35, 25, 230, 20, Center("Participant Setup"));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
||||
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}", false, false);
|
||||
AddHtml(x, y, 200, 20, $"Team Size: {p.Players.Length}");
|
||||
y += 22;
|
||||
|
||||
AddGoldenButtonLabeled(x + 20, y, 1, "Increase");
|
||||
|
|
@ -46,7 +46,7 @@ namespace Server.Engines.ConPVP
|
|||
AddGoldenButtonLabeled(x + 20, y, 2, "Decrease");
|
||||
y += 30;
|
||||
|
||||
AddHtml(35, y, 230, 20, Center("Players"), false, false);
|
||||
AddHtml(35, y, 230, 20, Center("Players"));
|
||||
y += 22;
|
||||
|
||||
for (int i = 0; i < p.Players.Length; ++i)
|
||||
|
|
@ -71,14 +71,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public void AddGoldenButtonLabeled(int x, int y, int bid, string text)
|
||||
{
|
||||
AddGoldenButton(x, y, bid);
|
||||
AddHtml(x + 25, y, 200, 20, text, false, false);
|
||||
AddHtml(x + 25, y, 200, 20, text);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -250,4 +250,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"));
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
|
|
@ -34,37 +34,37 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Ruleset cur = m_Defaults[i];
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title);
|
||||
|
||||
if (ruleset.Base == cur && !ruleset.Changed)
|
||||
AddImage(35, y + 4, 0x939);
|
||||
else if (ruleset.Base == cur)
|
||||
AddButton(35, y + 4, 0x93A, 0x939, 2 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x93A, 0x939, 2 + i);
|
||||
else
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + i);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, "Custom", false, false);
|
||||
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1, GumpButtonType.Reply, 0);
|
||||
AddHtml(35 + 14, y, 176, 20, "Custom");
|
||||
AddButton(35, y + 4, ruleset.Changed ? 0x939 : 0x938, 0x939, 1);
|
||||
|
||||
y += 22;
|
||||
y += 6;
|
||||
|
||||
AddHtml(35, y, 190, 20, Center("Flavors"), false, false);
|
||||
AddHtml(35, y, 190, 20, Center("Flavors"));
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < m_Flavors.Length; ++i)
|
||||
{
|
||||
Ruleset cur = m_Flavors[i];
|
||||
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title, false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, cur.Title);
|
||||
|
||||
if (ruleset.Flavors.Contains(cur))
|
||||
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x939, 0x938, 2 + m_Defaults.Length + i);
|
||||
else
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i, GumpButtonType.Reply, 0);
|
||||
AddButton(35, y + 4, 0x938, 0x939, 2 + m_Defaults.Length + i);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_Context != null && !m_Context.Registered)
|
||||
if (m_Context?.Registered == false)
|
||||
return;
|
||||
|
||||
switch (info.ButtonID)
|
||||
|
|
@ -123,4 +123,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < parts.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
Participant p = parts[i];
|
||||
|
||||
height += 4;
|
||||
|
||||
|
|
@ -44,19 +44,19 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (count == -1)
|
||||
{
|
||||
AddHtml(35, 25, 190, 20, Center("Ready"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Ready"));
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, 25, 190, 20, Center("Starting"), false, false);
|
||||
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count, false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Starting"));
|
||||
AddHtml(35, 25, 190, 20, "<DIV ALIGN=RIGHT>" + count);
|
||||
}
|
||||
|
||||
int y = 25 + 20;
|
||||
|
||||
for (int i = 0; i < parts.Count; ++i)
|
||||
{
|
||||
Participant p = (Participant)parts[i];
|
||||
Participant p = parts[i];
|
||||
|
||||
y += 4;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (p.Players.Length > 1)
|
||||
{
|
||||
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}", false, false);
|
||||
AddHtml(35 + 14, y, 176, 20, $"Participant #{i + 1}");
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DuelPlayer pl = p.Players[j];
|
||||
|
||||
if (pl != null && pl.Ready)
|
||||
if (pl?.Ready == true)
|
||||
{
|
||||
AddImage(35 + offset, y + 4, 0x939);
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
|
||||
|
||||
AddHtml(35 + offset + 14, y, 166, 20, name, false, false);
|
||||
AddHtml(35 + offset + 14, y, 166, 20, name);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -106,4 +106,4 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 210, height, 9250);
|
||||
AddBackground(10, 10, 190, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 140, 20, Center("Rematch?"), false, false);
|
||||
AddHtml(35, 25, 140, 20, Center("Rematch?"));
|
||||
|
||||
AddButton(35, 55, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(115, 55, 242, 241, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(35, 55, 247, 248, 1);
|
||||
AddButton(115, 55, 242, 241, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -58,7 +58,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Participants"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Participants"));
|
||||
|
||||
int y = 20 + 25;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if (p.Players.Length > 1)
|
||||
{
|
||||
AddHtml(35, y, 176, 20, $"Team #{i + 1}", false, false);
|
||||
AddHtml(35, y, 176, 20, $"Team #{i + 1}");
|
||||
y += 22;
|
||||
offset = 10;
|
||||
}
|
||||
|
|
@ -83,7 +83,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string name = pl == null ? "(Empty)" : pl.Mobile.Name;
|
||||
|
||||
AddHtml(35 + offset, y, 166, 20, name, false, false);
|
||||
AddHtml(35 + offset, y, 166, 20, name);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -91,12 +91,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 176, 20, "Continue?", false, false);
|
||||
AddHtml(35, y, 176, 20, "Continue?");
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton(102, y, 247, 248, 0, GumpButtonType.Page, 2);
|
||||
AddButton(169, y, 242, 241, 2, GumpButtonType.Reply, 0);
|
||||
AddButton(169, y, 242, 241, 2);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -118,7 +118,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
|
||||
height += ruleset.Flavors.Count * 18;
|
||||
}
|
||||
|
|
@ -140,20 +140,20 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center("Rules"));
|
||||
|
||||
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}", false, false);
|
||||
AddHtml(35, 50, 190, 20, $"Set: {basedef.Title}");
|
||||
|
||||
y = 70;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications:", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications:");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
|
|
@ -164,7 +164,7 @@ namespace Server.Engines.ConPVP
|
|||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddHtml(60, y, 165, 22, name, false, false);
|
||||
AddHtml(60, y, 165, 22, name);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
|
|
@ -172,18 +172,18 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications: None");
|
||||
y += 20;
|
||||
}
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 176, 20, "Continue?", false, false);
|
||||
AddHtml(35, y, 176, 20, "Continue?");
|
||||
|
||||
y -= 2;
|
||||
|
||||
AddButton(102, y, 247, 248, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(169, y, 242, 241, 3, GumpButtonType.Reply, 0);
|
||||
AddButton(102, y, 247, 248, 1);
|
||||
AddButton(169, y, 242, 241, 3);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
@ -196,8 +196,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -230,4 +230,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 260, height, 9250);
|
||||
AddBackground(10, 10, 240, height - 20, 0xDAC);
|
||||
|
||||
AddHtml(35, 25, 190, 20, Center(page.Title), false, false);
|
||||
AddHtml(35, 25, 190, 20, Center(page.Title));
|
||||
|
||||
int x = 35;
|
||||
int y = 47;
|
||||
|
|
@ -53,7 +53,7 @@ namespace Server.Engines.ConPVP
|
|||
for (int i = 0; i < page.Children.Length; ++i)
|
||||
{
|
||||
AddGoldenButton(x, y, 1 + i);
|
||||
AddHtml(x + 25, y, 250, 22, page.Children[i].Title, false, false);
|
||||
AddHtml(x + 25, y, 250, 22, page.Children[i].Title);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
AddCheck(x, y, 0xD2, 0xD3, enabled, i);
|
||||
|
||||
AddHtml(x + 25, y, 250, 22, page.Options[i], false, false);
|
||||
AddHtml(x + 25, y, 250, 22, page.Options[i]);
|
||||
|
||||
y += 22;
|
||||
}
|
||||
|
|
@ -80,13 +80,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddGoldenButton(int x, int y, int bid)
|
||||
{
|
||||
AddButton(x, y, 0xD2, 0xD2, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0xD2, 0xD2, bid);
|
||||
AddButton(x + 3, y + 3, 0xD8, 0xD8, bid);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
{
|
||||
if (m_DuelContext != null && !m_DuelContext.Registered)
|
||||
if (m_DuelContext?.Registered == false)
|
||||
return;
|
||||
|
||||
if (!m_ReadOnly)
|
||||
|
|
@ -127,4 +127,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Server.Engines.ConPVP
|
|||
Match_Info,
|
||||
Player_Info
|
||||
}
|
||||
|
||||
|
||||
public class TournamentBracketGump : Gump
|
||||
{
|
||||
private const int BlackColor32 = 0x000008;
|
||||
|
|
@ -86,7 +86,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
sb.Append(" Tournament Bracket");
|
||||
|
||||
AddHtml(25, 35, 250, 20, Center(sb.ToString()), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center(sb.ToString()));
|
||||
|
||||
AddRightArrow(25, 53, ToButtonID(0, 4), "Rules");
|
||||
AddRightArrow(25, 71, ToButtonID(0, 1), "Participants");
|
||||
|
|
@ -117,7 +117,7 @@ namespace Server.Engines.ConPVP
|
|||
text = "The tournament will begin shortly.";
|
||||
}
|
||||
|
||||
AddHtml(25, 92, 250, 40, text, false, false);
|
||||
AddHtml(25, 92, 250, 40, text);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ namespace Server.Engines.ConPVP
|
|||
defs = new BitArray(basedef.Options);
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i)
|
||||
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
|
||||
defs.Or(ruleset.Flavors[i].Options);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -158,7 +158,7 @@ namespace Server.Engines.ConPVP
|
|||
60 + 18 + 20 + 20 + 20 + 8 + 20 + ruleset.Flavors.Count * 18 + 4 + 20 + changes * 22 + 6, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rules"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rules"));
|
||||
|
||||
int y = 53;
|
||||
|
||||
|
|
@ -177,7 +177,7 @@ namespace Server.Engines.ConPVP
|
|||
break;
|
||||
}
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Grouping: {groupText}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Grouping: {groupText}");
|
||||
y += 20;
|
||||
|
||||
string tieText = null;
|
||||
|
|
@ -201,7 +201,7 @@ namespace Server.Engines.ConPVP
|
|||
break;
|
||||
}
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Tiebreaker: {tieText}");
|
||||
y += 20;
|
||||
|
||||
string sdText = "Off";
|
||||
|
|
@ -216,22 +216,22 @@ namespace Server.Engines.ConPVP
|
|||
sdText = $"{sdText} (all rounds)";
|
||||
}
|
||||
|
||||
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}", false, false);
|
||||
AddHtml(35, y, 240, 20, $"Sudden Death: {sdText}");
|
||||
y += 20;
|
||||
|
||||
y += 8;
|
||||
|
||||
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $"Ruleset: {basedef.Title}");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < ruleset.Flavors.Count; ++i, y += 18)
|
||||
AddHtml(35, y, 190, 20, $" + {((Ruleset)ruleset.Flavors[i]).Title}", false, false);
|
||||
AddHtml(35, y, 190, 20, $" + {ruleset.Flavors[i].Title}");
|
||||
|
||||
y += 4;
|
||||
|
||||
if (changes > 0)
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications:", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications:");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < opts.Length; ++i)
|
||||
|
|
@ -242,7 +242,7 @@ namespace Server.Engines.ConPVP
|
|||
if (name != null) // sanity
|
||||
{
|
||||
AddImage(35, y, opts[i] ? 0xD3 : 0xD2);
|
||||
AddHtml(60, y, 165, 22, name, false, false);
|
||||
AddHtml(60, y, 165, 22, name);
|
||||
}
|
||||
|
||||
y += 22;
|
||||
|
|
@ -250,7 +250,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
AddHtml(35, y, 190, 20, "Modifications: None", false, false);
|
||||
AddHtml(35, y, 190, 20, "Modifications: None");
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -265,8 +265,7 @@ namespace Server.Engines.ConPVP
|
|||
: new List<TourneyParticipant>(tourney.Participants);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"), false,
|
||||
false);
|
||||
AddHtml(25, 35, 250, 20, Center($"{pList.Count} Participant{(pList.Count == 1 ? "" : "s")}"));
|
||||
|
||||
StartPage(out int index, out int count, out int y, 12);
|
||||
|
||||
|
|
@ -293,11 +292,11 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 60 + 18 + 20 + part.Players.Count * 18 + 20 + 20 + 160, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 1));
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"));
|
||||
|
||||
int y = 53;
|
||||
|
||||
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team", false, false);
|
||||
AddHtml(25, y, 200, 20, part.Players.Count == 1 ? "Players" : "Team");
|
||||
y += 20;
|
||||
|
||||
for (int i = 0; i < part.Players.Count; ++i)
|
||||
|
|
@ -314,10 +313,10 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
AddHtml(25, y, 200, 20,
|
||||
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}", false, false);
|
||||
$"Free Advances: {(part.FreeAdvances == 0 ? "None" : part.FreeAdvances.ToString())}");
|
||||
y += 20;
|
||||
|
||||
AddHtml(25, y, 200, 20, "Log:", false, false);
|
||||
AddHtml(25, y, 200, 20, "Log:");
|
||||
y += 20;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
@ -343,7 +342,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 3));
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Participants"));
|
||||
|
||||
if (!(obj is Mobile mob))
|
||||
break;
|
||||
|
|
@ -351,16 +350,13 @@ namespace Server.Engines.ConPVP
|
|||
Ladder ladder = Ladder.Instance;
|
||||
LadderEntry entry = ladder?.Find(mob);
|
||||
|
||||
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}", false, false);
|
||||
AddHtml(25, 53, 250, 20, $"Name: {mob.Name}");
|
||||
AddHtml(25, 73, 250, 20,
|
||||
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}",
|
||||
false, false);
|
||||
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}", false,
|
||||
false);
|
||||
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}", false,
|
||||
false);
|
||||
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}", false, false);
|
||||
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}", false, false);
|
||||
$"Guild: {(mob.Guild == null ? "None" : mob.Guild.Name + " [" + mob.Guild.Abbreviation + "]")}");
|
||||
AddHtml(25, 93, 250, 20, $"Rank: {(entry == null ? "N/A" : LadderGump.Rank(entry.Index + 1))}");
|
||||
AddHtml(25, 113, 250, 20, $"Level: {(entry == null ? 0 : Ladder.GetLevel(entry.Experience))}");
|
||||
AddHtml(25, 133, 250, 20, $"Wins: {entry?.Wins ?? 0:N0}");
|
||||
AddHtml(25, 153, 250, 20, $"Losses: {entry?.Losses ?? 0:N0}");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -370,7 +366,7 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 0));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
// List<PyramidLevel> levelsList = m_List != null
|
||||
// ? Utility.CastListCovariant<object, PyramidLevel>(m_List)
|
||||
|
|
@ -389,11 +385,11 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 300, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 2));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
if (!(m_Object is PyramidLevel level))
|
||||
break;
|
||||
|
||||
|
||||
List<TourneyMatch> matchesList = m_List != null
|
||||
? Utility.CastListCovariant<object, TourneyMatch>(m_List)
|
||||
: new List<TourneyMatch>(level.Matches);
|
||||
|
|
@ -401,7 +397,7 @@ namespace Server.Engines.ConPVP
|
|||
AddRightArrow(25, 53, ToButtonID(5, 0),
|
||||
$"Free Advance: {(level.FreeAdvance == null ? "None" : level.FreeAdvance.NameList)}");
|
||||
|
||||
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}", false, false);
|
||||
AddHtml(25, 73, 200, 20, $"{matchesList.Count} Match{(matchesList.Count == 1 ? "" : "es")}");
|
||||
|
||||
StartPage(out int index, out int count, out int y, 10);
|
||||
|
||||
|
|
@ -529,14 +525,12 @@ namespace Server.Engines.ConPVP
|
|||
AddBackground(0, 0, 300, 60 + 18 + 20 + 20 + 20 + ct * 18 + 6, 9380);
|
||||
|
||||
AddLeftArrow(25, 11, ToButtonID(0, 5));
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"), false, false);
|
||||
AddHtml(25, 35, 250, 20, Center("Rounds"));
|
||||
|
||||
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}", false,
|
||||
false);
|
||||
AddHtml(25, 53, 250, 20, $"Winner: {(match.Winner == null ? "N/A" : match.Winner.NameList)}");
|
||||
AddHtml(25, 73, 250, 20,
|
||||
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}",
|
||||
false, false);
|
||||
AddHtml(25, 93, 250, 20, "Participants:", false, false);
|
||||
$"State: {(match.InProgress ? "In progress" : match.Context != null ? "Complete" : "Waiting")}");
|
||||
AddHtml(25, 93, 250, 20, "Participants:");
|
||||
|
||||
if (m_Tournament.TourneyType == TourneyType.Standard)
|
||||
for (int i = 0; i < match.Participants.Count; ++i)
|
||||
|
|
@ -613,7 +607,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
else if (m_Tournament.TourneyType == TourneyType.FreeForAll)
|
||||
AddHtml(25, 113, 250, 20, "Free For All", false, false);
|
||||
AddHtml(25, 113, 250, 20, "Free For All");
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -642,17 +636,17 @@ namespace Server.Engines.ConPVP
|
|||
private void AddColoredText(int x, int y, int width, int height, string text, int color)
|
||||
{
|
||||
if (color == 0)
|
||||
AddHtml(x, y, width, height, text, false, false);
|
||||
AddHtml(x, y, width, height, text);
|
||||
else
|
||||
AddHtml(x, y, width, height, Color(text, color), false, false);
|
||||
AddHtml(x, y, width, height, Color(text, color));
|
||||
}
|
||||
|
||||
public void AddRightArrow(int x, int y, int bid, string text)
|
||||
{
|
||||
AddButton(x, y, 0x15E1, 0x15E5, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0x15E1, 0x15E5, bid);
|
||||
|
||||
if (text != null)
|
||||
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
|
||||
AddHtml(x + 20, y - 1, 230, 20, text);
|
||||
}
|
||||
|
||||
public void AddRightArrow(int x, int y, int bid)
|
||||
|
|
@ -662,10 +656,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void AddLeftArrow(int x, int y, int bid, string text)
|
||||
{
|
||||
AddButton(x, y, 0x15E3, 0x15E7, bid, GumpButtonType.Reply, 0);
|
||||
AddButton(x, y, 0x15E3, 0x15E7, bid);
|
||||
|
||||
if (text != null)
|
||||
AddHtml(x + 20, y - 1, 230, 20, text, false, false);
|
||||
AddHtml(x + 20, y - 1, 230, 20, text);
|
||||
}
|
||||
|
||||
public void AddLeftArrow(int x, int y, int bid)
|
||||
|
|
@ -859,4 +853,4 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue