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

@ -44,11 +44,11 @@ namespace Server.Engines.ConPVP
AddImage(215, -43, 0xEE40);
//AddImage( 330, 141, 0x8BA );
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32), false, false);
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32), false, false);
AddHtml(22 - 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22 + 1, 22, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22 - 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22 + 1, 294, 20, Color(Center("Duel Challenge"), BlackColor32));
AddHtml(22, 22, 294, 20, Color(Center("Duel Challenge"), LabelColor32));
string fmt;
@ -57,37 +57,37 @@ namespace Server.Engines.ConPVP
else
fmt = "You have been challenged to a duel from {0}. Do you accept?";
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32), false, false);
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868), false, false);
AddHtml(22 - 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22 + 1, 50, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50 - 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50 + 1, 294, 40, Color(string.Format(fmt, challenger.Name), BlackColor32));
AddHtml(22, 50, 294, 40, Color(string.Format(fmt, challenger.Name), 0xB0C868));
AddImageTiled(32, 88, 264, 1, 9107);
AddImageTiled(42, 90, 264, 1, 9157);
AddRadio(24, 100, 9727, 9730, true, 1);
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32), false, false);
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32), false, false);
AddHtml(60 - 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60 + 1, 105, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105 - 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105 + 1, 250, 20, Color("Yes, I will fight this duel.", BlackColor32));
AddHtml(60, 105, 250, 20, Color("Yes, I will fight this duel.", LabelColor32));
AddRadio(24, 135, 9727, 9730, false, 2);
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32), false, false);
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32), false, false);
AddHtml(60 - 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60 + 1, 140, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140 - 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140 + 1, 250, 20, Color("No, I do not wish to fight.", BlackColor32));
AddHtml(60, 140, 250, 20, Color("No, I do not wish to fight.", LabelColor32));
AddRadio(24, 170, 9727, 9730, false, 3);
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32), false, false);
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32), false, false);
AddHtml(60 - 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60 + 1, 175, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175 - 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175 + 1, 250, 20, Color("No, knave. Do not ask again.", BlackColor32));
AddHtml(60, 175, 250, 20, Color("No, knave. Do not ask again.", LabelColor32));
AddButton(314, 173, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(314, 173, 247, 248, 1);
Timer.DelayCall(TimeSpan.FromSeconds(15.0), AutoReject);
}

View file

@ -86,13 +86,9 @@ namespace Server.Engines.ConPVP
[PropertyObject]
public class ArenaStartPoints
{
public ArenaStartPoints() : this(new Point3D[8])
public ArenaStartPoints(Point3D[] points = null)
{
}
public ArenaStartPoints(Point3D[] points)
{
Points = points;
Points = points ?? new Point3D[8];
}
public ArenaStartPoints(GenericReader reader)
@ -407,7 +403,8 @@ namespace Server.Engines.ConPVP
set
{
m_GateOut = value;
if (Teleporter != null) Teleporter.Location = m_GateOut;
if (Teleporter != null)
Teleporter.Location = m_GateOut;
}
}
@ -664,7 +661,7 @@ namespace Server.Engines.ConPVP
{
ArenaController controller = allControllers[i];
if (controller != null && !controller.Deleted && controller.Arena != null && controller.IsPrivate &&
if (controller?.Deleted == false && controller.Arena != null && controller.IsPrivate &&
controller.Map == first.Map && first.InRange(controller, 24))
{
BaseHouse house = BaseHouse.FindHouseAt(controller);
@ -832,4 +829,4 @@ namespace Server.Engines.ConPVP
#endregion
}
}
}

View file

@ -48,11 +48,7 @@ namespace Server.Engines.ConPVP
private bool m_Yielding;
public DuelContext(Mobile initiator, RulesetLayout layout) : this(initiator, layout, true)
{
}
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew)
public DuelContext(Mobile initiator, RulesetLayout layout, bool addNew = true)
{
Initiator = initiator;
Participants = new List<Participant>();
@ -123,13 +119,8 @@ namespace Server.Engines.ConPVP
public static bool AllowSpecialMove(Mobile from, string name, SpecialMove move)
{
if (!(from is PlayerMobile pm))
return true;
DuelContext dc = pm.DuelContext;
// No DuelContext, or InstaAllowSpecialMove
return dc?.InstAllowSpecialMove(from, name, move) != false;
return (from as PlayerMobile)?.DuelContext?.InstAllowSpecialMove(from, name, move) != false;
}
public bool InstAllowSpecialMove(Mobile from, string name, SpecialMove move)
@ -139,7 +130,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (CantDoAnything(from))
@ -165,9 +156,7 @@ namespace Server.Engines.ConPVP
if (!StartedBeginCountdown)
return true;
DuelPlayer pl = Find(from);
if (pl?.Eliminated != false)
if (Find(from)?.Eliminated != false)
return true;
if (CantDoAnything(from))
@ -256,7 +245,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (item is Dagger || CheckItemEquip(from, item))
@ -350,7 +339,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (CantDoAnything(from))
@ -373,7 +362,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(from);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return true;
if (!(item is BaseRefreshPotion))
@ -507,7 +496,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(mob);
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
return;
if (mob.Map == Map.Internal)
@ -533,30 +522,27 @@ namespace Server.Engines.ConPVP
DuelPlayer pl = Find(mob);
if (pl != null && !pl.Eliminated)
if (pl?.Eliminated == true || m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
return;
pl.Eliminated = true;
if (mob.Poison != null)
mob.Poison = null;
Requip(mob, corpse);
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
Participant winner = CheckCompletion();
if (winner != null)
{
if (m_EventGame != null && !m_EventGame.OnDeath(mob, corpse))
return;
pl.Eliminated = true;
if (mob.Poison != null)
mob.Poison = null;
Requip(mob, corpse);
DelayBounce(TimeSpan.FromSeconds(4.0), mob, corpse);
Participant winner = CheckCompletion();
if (winner != null)
{
Finish(winner);
}
else if (!m_Yielding)
{
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
}
Finish(winner);
}
else if (!m_Yielding)
{
mob.LocalOverheadMessage(MessageType.Regular, 0x22, false, "You have been defeated.");
mob.NonlocalOverheadMessage(MessageType.Regular, 0x22, false, $"{mob.Name} has been defeated.");
}
}
@ -564,7 +550,7 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
if (p.HasOpenSlot)
return false;
@ -609,7 +595,7 @@ namespace Server.Engines.ConPVP
Mobile killer = from.FindMostRecentDamager(false);
if (killer != null && killer.Player)
if (killer?.Player == true)
killer.AddToBackpack(new Head(m_Tournament == null ? HeadType.Duel : HeadType.Tournament, from.Name));
}
@ -671,7 +657,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer pl = winner.Players[i];
if (pl != null && !pl.Eliminated)
if (pl?.Eliminated == false)
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
}
@ -688,7 +674,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant loser = (Participant)Participants[i];
Participant loser = Participants[i];
if (loser != winner)
{
@ -714,8 +700,8 @@ namespace Server.Engines.ConPVP
if (IsOneVsOne)
{
DuelPlayer dp1 = ((Participant)Participants[0]).Players[0];
DuelPlayer dp2 = ((Participant)Participants[1]).Players[0];
DuelPlayer dp1 = Participants[0].Players[0];
DuelPlayer dp2 = Participants[1].Players[0];
if (dp1 != null && dp2 != null)
{
@ -797,7 +783,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
@ -828,7 +814,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant oldPart = (Participant)Participants[i];
Participant oldPart = Participants[i];
Participant newPart = new Participant(dc, oldPart.Players.Length);
for (int j = 0; j < oldPart.Players.Length; ++j)
@ -858,7 +844,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
DuelPlayer pl = p.Find(mob);
if (pl != null)
@ -873,7 +859,7 @@ namespace Server.Engines.ConPVP
DuelPlayer pl1 = Find(m1);
DuelPlayer pl2 = Find(m2);
return pl1 != null && pl2 != null && pl1.Participant == pl2.Participant;
return pl1 != null && pl1.Participant == pl2?.Participant;
}
public Participant CheckCompletion()
@ -885,7 +871,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
if (p.Eliminated)
{
@ -900,10 +886,7 @@ namespace Server.Engines.ConPVP
}
}
if (hasWinner)
return winner ?? (Participant)Participants[0];
return null;
return hasWinner ? winner ?? Participants[0] : null;
}
public void StartCountdown(int count, CountdownCallback cb)
@ -953,13 +936,13 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
DuelPlayer pl = p.Players[j];
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
continue;
pl.Mobile.SendSound(0x1E1);
@ -984,13 +967,13 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
DuelPlayer pl = p.Players[j];
if (pl == null || pl.Eliminated)
if (pl?.Eliminated != false)
continue;
pl.Mobile.SendSound(0x1E1);
@ -1065,7 +1048,7 @@ namespace Server.Engines.ConPVP
{
DuelPlayer pl = p.Players[j];
if (pl != null && !pl.Eliminated)
if (pl?.Eliminated == false)
DelayBounce(TimeSpan.FromSeconds(8.0), pl.Mobile, null);
}
@ -1511,7 +1494,7 @@ namespace Server.Engines.ConPVP
}
}
}
public void CloseAllGumps(DuelPlayer pl)
{
pl.Mobile.CloseGump<BeginGump>();
@ -1527,7 +1510,7 @@ namespace Server.Engines.ConPVP
{
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
@ -1546,7 +1529,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < Participants.Count; ++i)
{
Participant p = (Participant)Participants[i];
Participant p = Participants[i];
for (int j = 0; j < p.Players.Length; ++j)
{
@ -1571,7 +1554,7 @@ namespace Server.Engines.ConPVP
else
mob.SendMessage(0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page);
}
// Close all of them?
mob.CloseGump<DuelContextGump>();
mob.CloseGump<ReadyUpGump>();
@ -1851,9 +1834,9 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < ruleset.Flavors.Count; ++i)
{
defs.Or(((Ruleset)ruleset.Flavors[i]).Options);
defs.Or(ruleset.Flavors[i].Options);
mob.SendMessage(" + {0}", ((Ruleset)ruleset.Flavors[i]).Title);
mob.SendMessage(" + {0}", ruleset.Flavors[i].Title);
}
}
else
@ -2084,10 +2067,7 @@ namespace Server.Engines.ConPVP
}
}
Arena arena = m_OverrideArena;
if (arena == null)
arena = Arena.FindArena(players);
Arena arena = m_OverrideArena ?? Arena.FindArena(players);
if (arena == null)
{
@ -2482,7 +2462,7 @@ namespace Server.Engines.ConPVP
}
else
{
if (m_Teleporter != null && !m_Teleporter.Deleted)
if (m_Teleporter?.Deleted == false)
m_Teleporter.Register(m);
base.UseGate(m);
@ -2512,4 +2492,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -15,12 +15,7 @@ namespace Server.Engines.ConPVP
public class DuelTeleporterAddon : BaseAddon
{
[Constructible]
public DuelTeleporterAddon() : this(DuelTeleporterType.Squares)
{
}
[Constructible]
public DuelTeleporterAddon(DuelTeleporterType type)
public DuelTeleporterAddon(DuelTeleporterType type = DuelTeleporterType.Squares)
{
int itemID = (int)type;
@ -91,4 +86,4 @@ namespace Server.Engines.ConPVP
int version = reader.ReadInt();
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -49,7 +49,7 @@ namespace Server.Engines.ConPVP
public DuelContext Context{ get; set; }
public bool InProgress => Context != null && Context.Registered;
public bool InProgress => Context?.Registered == true;
public void Start(Arena arena, Tournament tourney)
{
@ -120,4 +120,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -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
}
}
}
}
}

View file

@ -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;
}
}
}
}

View file

@ -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

View file

@ -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;
}
}
}
}
}
}

View file

@ -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;
}
}
}
}

View file

@ -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
}
}
}
}
}

View file

@ -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
}
}
}
}
}

View file

@ -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
{
}
}
}
}

View file

@ -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
}
}
}
}
}

View file

@ -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
}
}
}
}
}

View file

@ -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
}
}
}
}
}

View file

@ -52,7 +52,7 @@ namespace Server.Engines.ConPVP
get
{
for (int i = 0; i < Players.Length; ++i)
if (Players[i] != null && !Players[i].Eliminated)
if (Players[i]?.Eliminated == false)
return false;
return true;
@ -96,7 +96,7 @@ namespace Server.Engines.ConPVP
}
for (int i = 0; i < Players.Length; ++i)
if (Players[i] != null && Players[i].Mobile == mob)
if (Players[i]?.Mobile == mob)
return Players[i];
return null;
@ -228,4 +228,4 @@ namespace Server.Engines.ConPVP
public Participant Participant{ get; set; }
}
}
}

View file

@ -198,8 +198,8 @@ namespace Server.Engines.ConPVP
AddColumnHeader(35, null);
AddColumnHeader(115, "Arena");
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1, GumpButtonType.Reply, 0);
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2, GumpButtonType.Reply, 0);
AddButton(499 + 40 - 365 - 12 - 63 - 4 - 63, height - 12 - 24, 247, 248, 1);
AddButton(499 + 40 - 365 - 12 - 63, height - 12 - 24, 241, 242, 2);
for (int i = 0; i < arenas.Count; ++i)
{
@ -258,9 +258,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)

View file

@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
{
if (m_Root != null)
return m_Root;
List<RulesetLayout> entries = new List<RulesetLayout>
{
new RulesetLayout("Spells",
@ -761,4 +761,4 @@ namespace Server.Engines.ConPVP
return TotalLength;
}
}
}
}

View file

@ -21,10 +21,7 @@ namespace Server.Engines.ConPVP
public override bool AllowHousing(Mobile from, Point3D p)
{
if (from.AccessLevel < AccessLevel.GameMaster)
return false;
return base.AllowHousing(from, p);
return from.AccessLevel >= AccessLevel.GameMaster && base.AllowHousing(from, p);
}
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation)
@ -35,12 +32,11 @@ namespace Server.Engines.ConPVP
return false;
}
PlayerMobile pm = m as PlayerMobile;
PlayerMobile pm = m as PlayerMobile ??
(m is BaseCreature bc && bc.Summoned ?
bc.SummonMaster as PlayerMobile : null);
if (pm == null && m is BaseCreature bc && bc.Summoned)
pm = bc.SummonMaster as PlayerMobile;
if (pm?.DuelContext != null && pm.DuelContext.StartedBeginCountdown)
if (pm?.DuelContext?.StartedBeginCountdown == true)
return true;
if (DuelContext.CheckCombat(m))
@ -67,4 +63,4 @@ namespace Server.Engines.ConPVP
return false;
}
}
}
}

View file

@ -247,7 +247,7 @@ namespace Server.Engines.ConPVP
sb.Append(remaining.Count == 2 ? "between " : "among ");
sb.Append(remaining.Count);
sb.Append(remaining[0].Players.Count == 1 ? " players: " : " teams: ");
bool hasAppended = false;
@ -370,9 +370,7 @@ namespace Server.Engines.ConPVP
for (int i = 0; i < part.Context.Participants.Count; ++i)
{
Participant check = part.Context.Participants[i];
if (check != null && !check.Eliminated)
if (part.Context.Participants[i]?.Eliminated == false)
++rem;
}
@ -559,7 +557,7 @@ namespace Server.Engines.ConPVP
{
Mobile mob = players[i];
if (mob == null || mob.Deleted)
if (mob?.Deleted != false)
continue;
Item item = new Trophy(title, rank);
@ -762,7 +760,7 @@ namespace Server.Engines.ConPVP
if (!match.InProgress)
for (int j = 0; j < Arenas.Count; ++j)
{
Arena arena = (Arena)Arenas[j];
Arena arena = Arenas[j];
if (!arena.IsOccupied)
{
@ -794,7 +792,7 @@ namespace Server.Engines.ConPVP
if (!bad)
continue;
for (int j = 0; j < part.Players.Count; ++j)
part.Players[j].SendMessage("You have been disqualified from the tournament.");
@ -882,7 +880,7 @@ namespace Server.Engines.ConPVP
Undefeated.Clear();
break;
}
}
if (Undefeated.Count > 1)
@ -895,7 +893,7 @@ namespace Server.Engines.ConPVP
public void Alert(params string[] alerts)
{
for (int i = 0; i < Arenas.Count; ++i)
Alert((Arena)Arenas[i], alerts);
Alert(Arenas[i], alerts);
}
public void Alert(Arena arena, params string[] alerts)
@ -909,4 +907,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -34,7 +34,7 @@ namespace Server.Engines.ConPVP
{
TournamentController controller = m_Instances[i];
if (controller != null && !controller.Deleted && controller.Tournament != null &&
if (controller?.Deleted == false && controller.Tournament != null &&
controller.Tournament.Stage != TournamentStage.Inactive)
return true;
}
@ -140,4 +140,4 @@ namespace Server.Engines.ConPVP
}
}
}
}
}

View file

@ -70,7 +70,8 @@ namespace Server.Engines.ConPVP
{
Faction fac = Faction.Find(mob);
if (fac != null) index = fac.Definition.Sort;
if (fac != null)
index = fac.Definition.Sort;
}
else if (partsPerMatch == 2)
{
@ -186,4 +187,4 @@ namespace Server.Engines.ConPVP
public List<TourneyMatch> Matches{ get; set; } = new List<TourneyMatch>();
public TourneyParticipant FreeAdvance{ get; set; }
}
}
}