Adds style cop (#109)

This commit is contained in:
Kamron Batman 2020-04-26 00:16:02 -07:00 • committed by GitHub
parent 3e715bcb60
commit 556a17aba8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1725 changed files with 33831 additions and 38046 deletions

View file

@ -14,16 +14,15 @@ namespace Server.Engines.ConPVP
{
private bool m_Flying;
private BRGame m_Game;
private readonly BRGame m_Game;
private List<Mobile> m_Helpers;
private readonly List<Mobile> m_Helpers;
private Point3DList m_Path = new Point3DList();
private readonly Point3DList m_Path = new Point3DList();
private int m_PathIdx;
private EffectTimer m_Timer;
private readonly EffectTimer m_Timer;
public BRBomb(BRGame game) :
base(0x103C) // 0x103C = bread, 0x1042 = pie, 0x1364 = rock, 0x13a8 = pillow, 0x2256 = bagball
public BRBomb(BRGame game) : base(0x103C) // 0x103C = bread, 0x1042 = pie, 0x1364 = rock, 0x13a8 = pillow, 0x2256 = bagball
{
Movable = false;
Hue = 0x35;
@ -42,7 +41,7 @@ namespace Server.Engines.ConPVP
public override string DefaultName => "da bomb";
public Mobile Thrower{ get; private set; }
public Mobile Thrower { get; private set; }
private Mobile FindOwner(IEntity parent)
{
@ -64,9 +63,9 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
break;
}
{
break;
}
}
Timer.DelayCall(TimeSpan.Zero, Delete).Start(); // delete this after the world loads
@ -262,7 +261,7 @@ namespace Server.Engines.ConPVP
org.Z += 10; // always add 10 at the start cause we're coming from a mobile's eye level
/*if ( org.X > dest.X || ( org.X == dest.X && org.Y > dest.Y ) || ( org.X == dest.X && org.Y == dest.Y && org.Z > dest.Z ) )
/*if (org.X > dest.X || ( org.X == dest.X && org.Y > dest.Y ) || ( org.X == dest.X && org.Y == dest.Y && org.Z > dest.Z ))
{
Point3D swap = org;
org = dest;
@ -311,12 +310,12 @@ namespace Server.Engines.ConPVP
if (list.Count > 0 && list[list.Count - 1] != dest)
list.Add(dest);
/*if ( dist3d > 4 && ( dest.X != org.X || dest.Y != org.Y ) )
/*if (dist3d > 4 && ( dest.X != org.X || dest.Y != org.Y ))
{
int count = list.Count;
int i;
int climb = count / 2;
if ( climb > 3 )
if (climb > 3)
climb = 3;
for ( i = 0; i < climb; i++ )
@ -470,7 +469,7 @@ namespace Server.Engines.ConPVP
point = m_Path[j];
if (loc.X == point.X && loc.Y == point.Y &&
(i is Blocker || loc.Z <= point.Z && loc.Z + height >= point.Z))
(i is Blocker || (loc.Z <= point.Z && loc.Z + height >= point.Z)))
{
found = true;
if (j > m_PathIdx)
@ -663,7 +662,7 @@ namespace Server.Engines.ConPVP
private class EffectTimer : Timer
{
private BRBomb m_Bomb;
private readonly BRBomb m_Bomb;
private int m_Count;
public EffectTimer(BRBomb bomb) : base(TimeSpan.Zero, TimeSpan.FromSeconds(1.0))
@ -705,8 +704,8 @@ namespace Server.Engines.ConPVP
private class BombTarget : Target
{
private BRBomb m_Bomb;
private Mobile m_Mob;
private readonly BRBomb m_Bomb;
private readonly Mobile m_Mob;
private bool m_Resend = true;
public BombTarget(BRBomb bomb, Mobile from) : base(10, true, TargetFlags.None)
@ -880,14 +879,14 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 1:
{
m_North = reader.ReadBool();
goto case 0;
}
{
m_North = reader.ReadBool();
goto case 0;
}
case 0:
{
break;
}
{
break;
}
}
Hue = 0x84C;
@ -959,11 +958,11 @@ namespace Server.Engines.ConPVP
private const int LabelColor32 = 0xFFFFFF;
private const int BlackColor32 = 0x000000;
// private BRGame m_Game;
// private BRGame m_Game;
public BRBoardGump(Mobile mob, BRGame game, BRTeamInfo section = null) : base(60, 60)
{
// m_Game = game;
// m_Game = game;
BRTeamInfo ourTeam = game.GetTeamInfo(mob);
@ -1010,7 +1009,7 @@ namespace Server.Engines.ConPVP
AddAlphaRegion(16, 15, 369, height - 29);
AddImage(215, -45, 0xEE40);
//AddImage( 330, 141, 0x8BA );
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("BR Scoreboard"), LabelColor32, BlackColor32);
@ -1117,7 +1116,7 @@ namespace Server.Engines.ConPVP
private int m_Kills;
private int m_Score;
private BRTeamInfo m_TeamInfo;
private readonly BRTeamInfo m_TeamInfo;
public BRPlayerInfo(BRTeamInfo teamInfo, Mobile player)
{
@ -1125,7 +1124,7 @@ namespace Server.Engines.ConPVP
Player = player;
}
public Mobile Player{ get; }
public Mobile Player { get; }
public int CompareTo(BRPlayerInfo pi)
{
@ -1198,26 +1197,26 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
Board = ip.ReadItem() as BRBoard;
TeamName = ip.ReadString();
Color = ip.ReadEncodedInt();
m_Goal = ip.ReadItem() as BRGoal;
break;
}
{
Board = ip.ReadItem() as BRBoard;
TeamName = ip.ReadString();
Color = ip.ReadEncodedInt();
m_Goal = ip.ReadItem() as BRGoal;
break;
}
}
}
public BRGame Game{ get; set; }
public BRGame Game { get; set; }
public int TeamID{ get; }
public int TeamID { get; }
public BRPlayerInfo Leader{ get; set; }
public BRPlayerInfo Leader { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public BRBoard Board{ get; set; }
public BRBoard Board { get; set; }
public Dictionary<Mobile, BRPlayerInfo> Players{ get; }
public Dictionary<Mobile, BRPlayerInfo> Players { get; }
public BRPlayerInfo this[Mobile mob]
{
@ -1234,10 +1233,10 @@ namespace Server.Engines.ConPVP
}
[CommandProperty(AccessLevel.GameMaster)]
public int Color{ get; set; }
public int Color { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string TeamName{ get; set; }
public string TeamName { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public BRGoal Goal
@ -1267,11 +1266,11 @@ namespace Server.Engines.ConPVP
public string Name => $"{TeamName} Team";
public int Kills{ get; set; }
public int Kills { get; set; }
public int Captures{ get; set; }
public int Captures { get; set; }
public int Score{ get; set; }
public int Score { get; set; }
public void Reset()
{
@ -1333,7 +1332,7 @@ namespace Server.Engines.ConPVP
{
}
public BRTeamInfo[] TeamInfo{ get; private set; }
public BRTeamInfo[] TeamInfo { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public BRTeamInfo Team1 => TeamInfo[0];
@ -1348,10 +1347,10 @@ namespace Server.Engines.ConPVP
public BRTeamInfo Team4 => TeamInfo[3];
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Duration{ get; set; }
public TimeSpan Duration { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D BombHome{ get; set; }
public Point3D BombHome { get; set; }
public override string Title => "Bombing Run";
public override string DefaultName => "Bombing Run Controller";
@ -1385,18 +1384,18 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
BombHome = reader.ReadPoint3D();
{
BombHome = reader.ReadPoint3D();
Duration = reader.ReadTimeSpan();
Duration = reader.ReadTimeSpan();
TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()];
TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()];
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new BRTeamInfo(i, reader);
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new BRTeamInfo(i, reader);
break;
}
break;
}
}
}
}
@ -1411,7 +1410,7 @@ namespace Server.Engines.ConPVP
public BRGame(BRController controller, DuelContext context) : base(context) => Controller = controller;
public BRController Controller{ get; }
public BRController Controller { get; }
public Map Facet
{
@ -1676,8 +1675,8 @@ namespace Server.Engines.ConPVP
{
sb.Append(": ");
//sb.Append( pl.Score.ToString( "N0" ) );
//sb.Append( pl.Score == 1 ? " point" : " points" );
// sb.Append( pl.Score.ToString( "N0" ) );
// sb.Append( pl.Score == 1 ? " point" : " points" );
sb.Append(pl.Kills.ToString("N0"));
sb.Append(pl.Kills == 1 ? " kill" : " kills");

View file

@ -81,7 +81,7 @@ namespace Server.Engines.ConPVP
if (player.Score > 0)
entries.Add(player);
entries.Sort(delegate(IRankedCTF a, IRankedCTF b) { return b.Score - a.Score; });
entries.Sort((a, b) => b.Score - a.Score);
int height = 0;
@ -102,7 +102,7 @@ namespace Server.Engines.ConPVP
AddAlphaRegion(16, 15, 369, height - 29);
AddImage(215, -45, 0xEE40);
//AddImage( 330, 141, 0x8BA );
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("CTF Scoreboard"), LabelColor32, BlackColor32);
@ -345,27 +345,27 @@ namespace Server.Engines.ConPVP
case 3:
case 2:
case 1:
{
owner?.SendMessage(0x26, "You have {0} {1} to capture the cookies!", m_ReturnCount,
m_ReturnCount == 1 ? "second" : "seconds");
break;
}
case 0:
{
if (owner != null)
{
owner.SendMessage(0x26, "You have taken too long to capture the cookies!");
owner.Kill();
owner?.SendMessage(0x26, "You have {0} {1} to capture the cookies!", m_ReturnCount,
m_ReturnCount == 1 ? "second" : "seconds");
break;
}
SendHome();
case 0:
{
if (owner != null)
{
owner.SendMessage(0x26, "You have taken too long to capture the cookies!");
owner.Kill();
}
m_TeamInfo?.Game?.Alert("The {0} cookies have been returned.", m_TeamInfo.Name);
SendHome();
return;
}
m_TeamInfo?.Game?.Alert("The {0} cookies have been returned.", m_TeamInfo.Name);
return;
}
}
--m_ReturnCount;
@ -497,10 +497,10 @@ namespace Server.Engines.ConPVP
public interface IRankedCTF
{
int Kills{ get; }
int Captures{ get; }
int Score{ get; }
string Name{ get; }
int Kills { get; }
int Captures { get; }
int Score { get; }
string Name { get; }
}
public sealed class CTFPlayerInfo : IRankedCTF
@ -510,7 +510,7 @@ namespace Server.Engines.ConPVP
private int m_Kills;
private int m_Score;
private CTFTeamInfo m_TeamInfo;
private readonly CTFTeamInfo m_TeamInfo;
public CTFPlayerInfo(CTFTeamInfo teamInfo, Mobile player)
{
@ -518,7 +518,7 @@ namespace Server.Engines.ConPVP
Player = player;
}
public Mobile Player{ get; }
public Mobile Player { get; }
string IRankedCTF.Name => Player.Name;
@ -575,38 +575,38 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 2:
{
Board = ip.ReadItem() as CTFBoard;
{
Board = ip.ReadItem() as CTFBoard;
goto case 1;
}
goto case 1;
}
case 1:
{
Name = ip.ReadString();
{
Name = ip.ReadString();
goto case 0;
}
goto case 0;
}
case 0:
{
Color = ip.ReadEncodedInt();
{
Color = ip.ReadEncodedInt();
Flag = ip.ReadItem() as CTFFlag;
Origin = ip.ReadPoint3D();
break;
}
Flag = ip.ReadItem() as CTFFlag;
Origin = ip.ReadPoint3D();
break;
}
}
}
public CTFGame Game{ get; set; }
public CTFGame Game { get; set; }
public int TeamID{ get; }
public int TeamID { get; }
public CTFPlayerInfo Leader{ get; set; }
public CTFPlayerInfo Leader { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public CTFBoard Board{ get; set; }
public CTFBoard Board { get; set; }
public Dictionary<Mobile, CTFPlayerInfo> Players{ get; }
public Dictionary<Mobile, CTFPlayerInfo> Players { get; }
public CTFPlayerInfo this[Mobile mob]
{
@ -623,24 +623,24 @@ namespace Server.Engines.ConPVP
}
[CommandProperty(AccessLevel.GameMaster)]
public int Color{ get; set; }
public int Color { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string Name{ get; set; }
public string Name { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public CTFFlag Flag{ get; set; }
public CTFFlag Flag { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Origin{ get; set; }
public Point3D Origin { get; set; }
string IRankedCTF.Name => $"{Name} Team";
public int Kills{ get; set; }
public int Kills { get; set; }
public int Captures{ get; set; }
public int Captures { get; set; }
public int Score{ get; set; }
public int Score { get; set; }
public void Reset()
{
@ -702,7 +702,7 @@ namespace Server.Engines.ConPVP
{
}
public CTFTeamInfo[] TeamInfo{ get; private set; }
public CTFTeamInfo[] TeamInfo { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public CTFTeamInfo Team1 => TeamInfo[0];
@ -729,7 +729,7 @@ namespace Server.Engines.ConPVP
public CTFTeamInfo Team8 => TeamInfo[7];
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Duration{ get; set; }
public TimeSpan Duration { get; set; }
public override string Title => "CTF";
@ -760,29 +760,29 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 2:
{
Duration = reader.ReadTimeSpan();
{
Duration = reader.ReadTimeSpan();
goto case 1;
}
goto case 1;
}
case 1:
{
TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()];
{
TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()];
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new CTFTeamInfo(i, reader);
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new CTFTeamInfo(i, reader);
break;
}
break;
}
case 0:
{
TeamInfo = new CTFTeamInfo[8];
{
TeamInfo = new CTFTeamInfo[8];
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new CTFTeamInfo(i);
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new CTFTeamInfo(i);
break;
}
break;
}
}
if (version < 2)
@ -796,7 +796,7 @@ namespace Server.Engines.ConPVP
public CTFGame(CTFController controller, DuelContext context) : base(context) => Controller = controller;
public CTFController Controller{ get; }
public CTFController Controller { get; }
public Map Facet
{
@ -999,7 +999,7 @@ namespace Server.Engines.ConPVP
teams.Add(teamInfo);
}
teams.Sort(delegate(CTFTeamInfo a, CTFTeamInfo b) { return b.Score - a.Score; });
teams.Sort((a, b) => b.Score - a.Score);
Tournament tourney = m_Context.m_Tournament;
@ -1063,7 +1063,7 @@ namespace Server.Engines.ConPVP
if (mob == null)
continue;
//"Red v Blue CTF Champion"
// "Red v Blue CTF Champion"
sb = new StringBuilder();

View file

@ -52,12 +52,12 @@ namespace Server.Engines.ConPVP
private const int LabelColor32 = 0xFFFFFF;
private const int BlackColor32 = 0x000000;
// private DDGame m_Game;
// private DDGame m_Game;
public DDBoardGump(Mobile mob, DDGame game, DDTeamInfo section = null)
: base(60, 60)
{
// m_Game = game;
// m_Game = game;
DDTeamInfo ourTeam = game.GetTeamInfo(mob);
@ -76,7 +76,7 @@ namespace Server.Engines.ConPVP
if (player.Score > 0)
entries.Add(player);
entries.Sort(delegate(IRankedCTF a, IRankedCTF b) { return b.Score - a.Score; });
entries.Sort((a, b) => b.Score - a.Score);
int height = 0;
@ -97,7 +97,7 @@ namespace Server.Engines.ConPVP
AddAlphaRegion(16, 15, 369, height - 29);
AddImage(215, -45, 0xEE40);
//AddImage( 330, 141, 0x8BA );
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("DD Scoreboard"), LabelColor32, BlackColor32);
@ -204,7 +204,7 @@ namespace Server.Engines.ConPVP
private int m_Kills;
private int m_Score;
private DDTeamInfo m_TeamInfo;
private readonly DDTeamInfo m_TeamInfo;
public DDPlayerInfo(DDTeamInfo teamInfo, Mobile player)
{
@ -212,7 +212,7 @@ namespace Server.Engines.ConPVP
Player = player;
}
public Mobile Player{ get; }
public Mobile Player { get; }
public string Name => Player.Name;
@ -269,26 +269,26 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
Board = ip.ReadItem() as DDBoard;
TeamName = ip.ReadString();
Color = ip.ReadEncodedInt();
Origin = ip.ReadPoint3D();
break;
}
{
Board = ip.ReadItem() as DDBoard;
TeamName = ip.ReadString();
Color = ip.ReadEncodedInt();
Origin = ip.ReadPoint3D();
break;
}
}
}
public DDGame Game{ get; set; }
public DDGame Game { get; set; }
public int TeamID{ get; }
public int TeamID { get; }
public DDPlayerInfo Leader{ get; set; }
public DDPlayerInfo Leader { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DDBoard Board{ get; set; }
public DDBoard Board { get; set; }
public Dictionary<Mobile, DDPlayerInfo> Players{ get; }
public Dictionary<Mobile, DDPlayerInfo> Players { get; }
public DDPlayerInfo this[Mobile mob]
{
@ -305,21 +305,21 @@ namespace Server.Engines.ConPVP
}
[CommandProperty(AccessLevel.GameMaster)]
public int Color{ get; set; }
public int Color { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string TeamName{ get; set; }
public string TeamName { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public Point3D Origin{ get; set; }
public Point3D Origin { get; set; }
public string Name => $"{TeamName} Team";
public int Kills{ get; set; }
public int Kills { get; set; }
public int Captures{ get; set; }
public int Captures { get; set; }
public int Score{ get; set; }
public int Score { get; set; }
public void Reset()
{
@ -370,7 +370,7 @@ namespace Server.Engines.ConPVP
{
}
public DDTeamInfo[] TeamInfo{ get; private set; }
public DDTeamInfo[] TeamInfo { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public DDTeamInfo Team1 => TeamInfo[0];
@ -379,13 +379,13 @@ namespace Server.Engines.ConPVP
public DDTeamInfo Team2 => TeamInfo[1];
[CommandProperty(AccessLevel.GameMaster)]
public DDWayPoint PointA{ get; set; }
public DDWayPoint PointA { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DDWayPoint PointB{ get; set; }
public DDWayPoint PointB { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Duration{ get; set; }
public TimeSpan Duration { get; set; }
public override string Title => "DoubleDom";
@ -421,18 +421,18 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
Duration = reader.ReadTimeSpan();
TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];
{
Duration = reader.ReadTimeSpan();
TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new DDTeamInfo(i, reader);
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new DDTeamInfo(i, reader);
PointA = reader.ReadItem() as DDWayPoint;
PointB = reader.ReadItem() as DDWayPoint;
PointA = reader.ReadItem() as DDWayPoint;
PointB = reader.ReadItem() as DDWayPoint;
break;
}
break;
}
}
}
}
@ -449,7 +449,7 @@ namespace Server.Engines.ConPVP
public DDGame(DDController controller, DuelContext context) : base(context) => Controller = controller;
public DDController Controller{ get; }
public DDController Controller { get; }
public Map Facet
{
@ -693,7 +693,7 @@ namespace Server.Engines.ConPVP
if (mob == null)
continue;
//"Red v Blue DD Champion"
// "Red v Blue DD Champion"
sb = new StringBuilder();
@ -1071,7 +1071,7 @@ namespace Server.Engines.ConPVP
{
base.Serialize(writer);
writer.Write(0); //version
writer.Write(0); // version
}
public override bool OnMoveOver(Mobile m) => Addon.OnMoveOver(m);

View file

@ -17,7 +17,7 @@ namespace Server.Engines.ConPVP
{
}
public abstract string Title{ get; }
public abstract string Title { get; }
public abstract EventGame Construct(DuelContext dc);
public abstract string GetTeamName(int teamID);

View file

@ -30,7 +30,7 @@ namespace Server.Engines.ConPVP
{
}
public Mobile King{ get; private set; }
public Mobile King { get; private set; }
public KHGame Game
{
@ -47,7 +47,7 @@ namespace Server.Engines.ConPVP
}
[CommandProperty(AccessLevel.GameMaster)]
public int ScoreInterval{ get; set; }
public int ScoreInterval { get; set; }
public int CapturesSoFar
{
@ -68,10 +68,10 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
ScoreInterval = reader.ReadEncodedInt();
break;
}
{
ScoreInterval = reader.ReadEncodedInt();
break;
}
}
}
@ -182,7 +182,7 @@ namespace Server.Engines.ConPVP
private class KingTimer : Timer
{
private int m_Counter;
private HillOfTheKing m_Hill;
private readonly HillOfTheKing m_Hill;
public KingTimer(HillOfTheKing hill)
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
@ -194,7 +194,7 @@ namespace Server.Engines.ConPVP
Priority = TimerPriority.FiftyMS;
}
public int Captures{ get; private set; }
public int Captures { get; private set; }
public void StartHillTicker()
{
@ -329,10 +329,10 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
m_Controller = reader.ReadItem() as KHController;
break;
}
{
m_Controller = reader.ReadItem() as KHController;
break;
}
}
}
}
@ -384,7 +384,7 @@ namespace Server.Engines.ConPVP
AddAlphaRegion(16, 15, 369, height - 29);
AddImage(215, -45, 0xEE40);
//AddImage( 330, 141, 0x8BA );
// AddImage( 330, 141, 0x8BA );
AddBorderedText(22, 22, 294, 20, Center("King of the Hill Scoreboard"), LabelColor32, BlackColor32);
@ -486,7 +486,7 @@ namespace Server.Engines.ConPVP
private int m_Kills;
private int m_Score;
private KHTeamInfo m_TeamInfo;
private readonly KHTeamInfo m_TeamInfo;
public KHPlayerInfo(KHTeamInfo teamInfo, Mobile player)
{
@ -494,7 +494,7 @@ namespace Server.Engines.ConPVP
Player = player;
}
public Mobile Player{ get; }
public Mobile Player { get; }
public int CompareTo(KHPlayerInfo pi)
{
@ -562,21 +562,21 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
TeamName = ip.ReadString();
Color = ip.ReadEncodedInt();
break;
}
{
TeamName = ip.ReadString();
Color = ip.ReadEncodedInt();
break;
}
}
}
public KHGame Game{ get; set; }
public KHGame Game { get; set; }
public int TeamID{ get; }
public int TeamID { get; }
public KHPlayerInfo Leader{ get; set; }
public KHPlayerInfo Leader { get; set; }
public Dictionary<Mobile, KHPlayerInfo> Players{ get; }
public Dictionary<Mobile, KHPlayerInfo> Players { get; }
public KHPlayerInfo this[Mobile mob]
{
@ -593,10 +593,10 @@ namespace Server.Engines.ConPVP
}
[CommandProperty(AccessLevel.GameMaster)]
public int Color{ get; set; }
public int Color { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public string TeamName{ get; set; }
public string TeamName { get; set; }
public int CompareTo(KHTeamInfo ti)
{
@ -614,11 +614,11 @@ namespace Server.Engines.ConPVP
public string Name => $"{TeamName ?? "(none)"} Team";
public int Kills{ get; set; }
public int Kills { get; set; }
public int Captures{ get; set; }
public int Captures { get; set; }
public int Score{ get; set; }
public int Score { get; set; }
public void Reset()
{
@ -668,7 +668,7 @@ namespace Server.Engines.ConPVP
{
}
public KHTeamInfo[] TeamInfo{ get; private set; }
public KHTeamInfo[] TeamInfo { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public KHTeamInfo Team1_W => TeamInfo[0];
@ -694,7 +694,7 @@ namespace Server.Engines.ConPVP
[CommandProperty(AccessLevel.GameMaster)]
public KHTeamInfo Team8_NE => TeamInfo[7];
public HillOfTheKing[] Hills{ get; private set; }
public HillOfTheKing[] Hills { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public HillOfTheKing Hill1
@ -724,10 +724,10 @@ namespace Server.Engines.ConPVP
set => Hills[3] = value;
}
public List<KHBoard> Boards{ get; private set; }
public List<KHBoard> Boards { get; private set; }
[CommandProperty(AccessLevel.GameMaster)]
public TimeSpan Duration{ get; set; }
public TimeSpan Duration { get; set; }
public override string Title => "King of the Hill";
@ -779,23 +779,23 @@ namespace Server.Engines.ConPVP
switch (version)
{
case 0:
{
m_ScoreInterval = reader.ReadEncodedInt();
{
m_ScoreInterval = reader.ReadEncodedInt();
Duration = reader.ReadTimeSpan();
Duration = reader.ReadTimeSpan();
Boards = reader.ReadStrongItemList<KHBoard>();
Boards = reader.ReadStrongItemList<KHBoard>();
Hills = new HillOfTheKing[reader.ReadEncodedInt()];
for (int i = 0; i < Hills.Length; ++i)
Hills[i] = reader.ReadItem() as HillOfTheKing;
Hills = new HillOfTheKing[reader.ReadEncodedInt()];
for (int i = 0; i < Hills.Length; ++i)
Hills[i] = reader.ReadItem() as HillOfTheKing;
TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()];
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new KHTeamInfo(i, reader);
TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()];
for (int i = 0; i < TeamInfo.Length; ++i)
TeamInfo[i] = new KHTeamInfo(i, reader);
break;
}
break;
}
}
}
}
@ -806,7 +806,7 @@ namespace Server.Engines.ConPVP
public KHGame(KHController controller, DuelContext context) : base(context) => Controller = controller;
public KHController Controller{ get; }
public KHController Controller { get; }
public Map Facet
{

View file

@ -43,11 +43,11 @@ namespace Server.Engines.ConPVP
}
}
public List<TourneyParticipant> Participants{ get; set; }
public List<TourneyParticipant> Participants { get; set; }
public TourneyParticipant Winner{ get; set; }
public TourneyParticipant Winner { get; set; }
public DuelContext Context{ get; set; }
public DuelContext Context { get; set; }
public bool InProgress => Context?.Registered == true;
@ -67,7 +67,6 @@ namespace Server.Engines.ConPVP
TourneyPart = tourneyPart
};
for (int j = 0; j < tourneyPart.Players.Count; ++j)
duelPart.Add(tourneyPart.Players[j]);