Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -7,16 +7,13 @@ namespace Server.Engines.ConPVP
|
|||
public class ArenaController : Item
|
||||
{
|
||||
private Arena m_Arena;
|
||||
private bool m_IsPrivate;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Arena Arena{ get => m_Arena;
|
||||
set{} }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsPrivate{ get => m_IsPrivate;
|
||||
set => m_IsPrivate = value;
|
||||
}
|
||||
public bool IsPrivate { get; set; }
|
||||
|
||||
public override string DefaultName => "arena controller";
|
||||
|
||||
|
|
@ -28,14 +25,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Arena = new Arena();
|
||||
|
||||
m_Instances.Add( this );
|
||||
Instances.Add( this );
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
m_Instances.Remove( this );
|
||||
Instances.Remove( this );
|
||||
m_Arena.Delete();
|
||||
}
|
||||
|
||||
|
|
@ -55,7 +52,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (bool) m_IsPrivate );
|
||||
writer.Write( (bool) IsPrivate );
|
||||
|
||||
m_Arena.Serialize( writer );
|
||||
}
|
||||
|
|
@ -70,7 +67,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_IsPrivate = reader.ReadBool();
|
||||
IsPrivate = reader.ReadBool();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -81,61 +78,55 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Instances.Add( this );
|
||||
Instances.Add( this );
|
||||
}
|
||||
|
||||
private static List<ArenaController> m_Instances = new List<ArenaController>();
|
||||
|
||||
public static List<ArenaController> Instances{ get => m_Instances;
|
||||
set => m_Instances = value;
|
||||
}
|
||||
public static List<ArenaController> Instances { get; set; } = new List<ArenaController>();
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public class ArenaStartPoints
|
||||
{
|
||||
private Point3D[] m_Points;
|
||||
|
||||
public Point3D[] Points => m_Points;
|
||||
public Point3D[] Points { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeWest{ get => m_Points[0];
|
||||
set => m_Points[0] = value;
|
||||
public Point3D EdgeWest{ get => Points[0];
|
||||
set => Points[0] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeEast{ get => m_Points[1];
|
||||
set => m_Points[1] = value;
|
||||
public Point3D EdgeEast{ get => Points[1];
|
||||
set => Points[1] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeNorth{ get => m_Points[2];
|
||||
set => m_Points[2] = value;
|
||||
public Point3D EdgeNorth{ get => Points[2];
|
||||
set => Points[2] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D EdgeSouth{ get => m_Points[3];
|
||||
set => m_Points[3] = value;
|
||||
public Point3D EdgeSouth{ get => Points[3];
|
||||
set => Points[3] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerNW{ get => m_Points[4];
|
||||
set => m_Points[4] = value;
|
||||
public Point3D CornerNW{ get => Points[4];
|
||||
set => Points[4] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerSE{ get => m_Points[5];
|
||||
set => m_Points[5] = value;
|
||||
public Point3D CornerSE{ get => Points[5];
|
||||
set => Points[5] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerSW{ get => m_Points[6];
|
||||
set => m_Points[6] = value;
|
||||
public Point3D CornerSW{ get => Points[6];
|
||||
set => Points[6] = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D CornerNE{ get => m_Points[7];
|
||||
set => m_Points[7] = value;
|
||||
public Point3D CornerNE{ get => Points[7];
|
||||
set => Points[7] = value;
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -149,23 +140,23 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public ArenaStartPoints( Point3D[] points )
|
||||
{
|
||||
m_Points = points;
|
||||
Points = points;
|
||||
}
|
||||
|
||||
public ArenaStartPoints( GenericReader reader )
|
||||
{
|
||||
m_Points = new Point3D[reader.ReadEncodedInt()];
|
||||
Points = new Point3D[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_Points.Length; ++i )
|
||||
m_Points[i] = reader.ReadPoint3D();
|
||||
for ( int i = 0; i < Points.Length; ++i )
|
||||
Points[i] = reader.ReadPoint3D();
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.WriteEncodedInt( (int) m_Points.Length );
|
||||
writer.WriteEncodedInt( (int) Points.Length );
|
||||
|
||||
for ( int i = 0; i < m_Points.Length; ++i )
|
||||
writer.Write( (Point3D) m_Points[i] );
|
||||
for ( int i = 0; i < Points.Length; ++i )
|
||||
writer.Write( (Point3D) Points[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -175,9 +166,6 @@ namespace Server.Engines.ConPVP
|
|||
private Map m_Facet;
|
||||
private Rectangle2D m_Bounds;
|
||||
private Rectangle2D m_Zone;
|
||||
private Point3D m_Outside;
|
||||
private Point3D m_Wall;
|
||||
private Point3D m_GateIn;
|
||||
private Point3D m_GateOut;
|
||||
private ArenaStartPoints m_Points;
|
||||
private bool m_Active;
|
||||
|
|
@ -185,21 +173,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private bool m_IsGuarded;
|
||||
|
||||
private Item m_Teleporter;
|
||||
|
||||
private List<Mobile> m_Players;
|
||||
|
||||
private TournamentController m_Tournament;
|
||||
private Mobile m_Announcer;
|
||||
|
||||
private LadderController m_Ladder;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public LadderController Ladder
|
||||
{
|
||||
get => m_Ladder;
|
||||
set => m_Ladder = value;
|
||||
}
|
||||
public LadderController Ladder { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsGuarded
|
||||
|
|
@ -216,8 +193,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public Ladder AcquireLadder()
|
||||
{
|
||||
if ( m_Ladder != null )
|
||||
return m_Ladder.Ladder;
|
||||
if ( Ladder != null )
|
||||
return Ladder.Ladder;
|
||||
|
||||
return Server.Engines.ConPVP.Ladder.Instance;
|
||||
}
|
||||
|
|
@ -237,17 +214,13 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Announcer
|
||||
{
|
||||
get => m_Announcer;
|
||||
set => m_Announcer = value;
|
||||
}
|
||||
public Mobile Announcer { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Name
|
||||
{
|
||||
get => m_Name;
|
||||
set{ m_Name = value; if ( m_Active ) m_Arenas.Sort(); }
|
||||
set{ m_Name = value; if ( m_Active ) Arenas.Sort(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -258,13 +231,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Facet = value;
|
||||
|
||||
if ( m_Teleporter != null )
|
||||
m_Teleporter.Map = value;
|
||||
if ( Teleporter != null )
|
||||
Teleporter.Map = value;
|
||||
|
||||
m_Region?.Unregister();
|
||||
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded );
|
||||
else
|
||||
m_Region = null;
|
||||
}
|
||||
|
|
@ -284,7 +257,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Region == null )
|
||||
return 0;
|
||||
|
||||
int specs = m_Region.GetPlayerCount() - m_Players.Count;
|
||||
int specs = m_Region.GetPlayerCount() - Players.Count;
|
||||
|
||||
if ( specs < 0 )
|
||||
specs = 0;
|
||||
|
|
@ -305,7 +278,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Region?.Unregister();
|
||||
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -317,36 +290,28 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Outside{ get => m_Outside;
|
||||
set => m_Outside = value;
|
||||
}
|
||||
public Point3D Outside { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D GateIn{ get => m_GateIn;
|
||||
set => m_GateIn = value;
|
||||
}
|
||||
public Point3D GateIn { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D GateOut{ get => m_GateOut;
|
||||
set{ m_GateOut = value; if ( m_Teleporter != null ) m_Teleporter.Location = m_GateOut; } }
|
||||
set{ m_GateOut = value; if ( Teleporter != null ) Teleporter.Location = m_GateOut; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Wall{ get => m_Wall;
|
||||
set => m_Wall = value;
|
||||
}
|
||||
public Point3D Wall { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsOccupied => ( m_Players.Count > 0 );
|
||||
public bool IsOccupied => ( Players.Count > 0 );
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ArenaStartPoints Points{ get => m_Points;
|
||||
set{} }
|
||||
|
||||
public Item Teleporter{ get => m_Teleporter;
|
||||
set => m_Teleporter = value;
|
||||
}
|
||||
public Item Teleporter { get; set; }
|
||||
|
||||
public List<Mobile> Players => m_Players;
|
||||
public List<Mobile> Players { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
|
|
@ -361,12 +326,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_Arenas.Add( this );
|
||||
m_Arenas.Sort();
|
||||
Arenas.Add( this );
|
||||
Arenas.Sort();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Arenas.Remove( this );
|
||||
Arenas.Remove( this );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -482,16 +447,16 @@ namespace Server.Engines.ConPVP
|
|||
p.Y = (p.X * matrix[1, 0]) + (p.Y * matrix[1, 1]);
|
||||
|
||||
mob.MoveToWorld( new Point3D( start.X + p.X, start.Y + p.Y, start.Z ), m_Facet );
|
||||
mob.Direction = mob.GetDirectionTo( m_Wall );
|
||||
mob.Direction = mob.GetDirectionTo( Wall );
|
||||
|
||||
m_Players.Add( mob );
|
||||
Players.Add( mob );
|
||||
}
|
||||
}
|
||||
|
||||
public Arena()
|
||||
{
|
||||
m_Points = new ArenaStartPoints();
|
||||
m_Players = new List<Mobile>();
|
||||
Players = new List<Mobile>();
|
||||
}
|
||||
|
||||
public Arena( GenericReader reader )
|
||||
|
|
@ -508,14 +473,14 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 6:
|
||||
{
|
||||
m_Ladder = reader.ReadItem() as LadderController;
|
||||
Ladder = reader.ReadItem() as LadderController;
|
||||
|
||||
goto case 5;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
m_Tournament = reader.ReadItem() as TournamentController;
|
||||
m_Announcer = reader.ReadMobile();
|
||||
Announcer = reader.ReadMobile();
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
|
|
@ -533,15 +498,15 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
m_GateIn = reader.ReadPoint3D();
|
||||
GateIn = reader.ReadPoint3D();
|
||||
m_GateOut = reader.ReadPoint3D();
|
||||
m_Teleporter = reader.ReadItem();
|
||||
Teleporter = reader.ReadItem();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Players = reader.ReadStrongMobileList();
|
||||
Players = reader.ReadStrongMobileList();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -549,13 +514,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Facet = reader.ReadMap();
|
||||
m_Bounds = reader.ReadRect2D();
|
||||
m_Outside = reader.ReadPoint3D();
|
||||
m_Wall = reader.ReadPoint3D();
|
||||
Outside = reader.ReadPoint3D();
|
||||
Wall = reader.ReadPoint3D();
|
||||
|
||||
if ( version == 0 )
|
||||
{
|
||||
reader.ReadBool();
|
||||
m_Players = new List<Mobile>();
|
||||
Players = new List<Mobile>();
|
||||
}
|
||||
|
||||
m_Active = reader.ReadBool();
|
||||
|
|
@ -563,8 +528,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( m_Active )
|
||||
{
|
||||
m_Arenas.Add( this );
|
||||
m_Arenas.Sort();
|
||||
Arenas.Add( this );
|
||||
Arenas.Sort();
|
||||
}
|
||||
|
||||
break;
|
||||
|
|
@ -572,7 +537,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
if ( m_Zone.Start != Point2D.Zero && m_Zone.End != Point2D.Zero && m_Facet != null )
|
||||
m_Region = new SafeZone( m_Zone, m_Outside, m_Facet, m_IsGuarded );
|
||||
m_Region = new SafeZone( m_Zone, Outside, m_Facet, m_IsGuarded );
|
||||
|
||||
if ( IsOccupied )
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), Evict );
|
||||
|
|
@ -602,15 +567,15 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
loc = m_Outside;
|
||||
loc = Outside;
|
||||
facet = m_Facet;
|
||||
}
|
||||
|
||||
bool hasBounds = ( m_Bounds.Start != Point2D.Zero && m_Bounds.End != Point2D.Zero );
|
||||
|
||||
for ( int i = 0; i < m_Players.Count; ++i )
|
||||
for ( int i = 0; i < Players.Count; ++i )
|
||||
{
|
||||
Mobile mob = m_Players[i];
|
||||
Mobile mob = Players[i];
|
||||
|
||||
if ( mob == null )
|
||||
continue;
|
||||
|
|
@ -635,7 +600,7 @@ namespace Server.Engines.ConPVP
|
|||
List<Mobile> pets = new List<Mobile>();
|
||||
|
||||
foreach ( Mobile mob in facet.GetMobilesInBounds( m_Bounds ) ) {
|
||||
if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && m_Players.Contains( pet.ControlMaster ) ) {
|
||||
if ( mob is BaseCreature pet && pet.Controlled && pet.ControlMaster != null && Players.Contains( pet.ControlMaster ) ) {
|
||||
pets.Add( pet );
|
||||
}
|
||||
}
|
||||
|
|
@ -648,7 +613,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
|
|
@ -657,33 +622,31 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (bool) m_IsGuarded );
|
||||
|
||||
writer.Write( (Item) m_Ladder );
|
||||
writer.Write( (Item) Ladder );
|
||||
|
||||
writer.Write( (Item) m_Tournament );
|
||||
writer.Write( (Mobile) m_Announcer );
|
||||
writer.Write( (Mobile) Announcer );
|
||||
|
||||
writer.Write( (string) m_Name );
|
||||
|
||||
writer.Write( (Rectangle2D) m_Zone );
|
||||
|
||||
writer.Write( (Point3D) m_GateIn );
|
||||
writer.Write( (Point3D) GateIn );
|
||||
writer.Write( (Point3D) m_GateOut );
|
||||
writer.Write( (Item) m_Teleporter );
|
||||
writer.Write( (Item) Teleporter );
|
||||
|
||||
writer.Write( m_Players );
|
||||
writer.Write( Players );
|
||||
|
||||
writer.Write( (Map) m_Facet );
|
||||
writer.Write( (Rectangle2D) m_Bounds );
|
||||
writer.Write( (Point3D) m_Outside );
|
||||
writer.Write( (Point3D) m_Wall );
|
||||
writer.Write( (Point3D) Outside );
|
||||
writer.Write( (Point3D) Wall );
|
||||
writer.Write( (bool) m_Active );
|
||||
|
||||
m_Points.Serialize( writer );
|
||||
}
|
||||
|
||||
private static List<Arena> m_Arenas = new List<Arena>();
|
||||
|
||||
public static List<Arena> Arenas => m_Arenas;
|
||||
public static List<Arena> Arenas { get; } = new List<Arena>();
|
||||
|
||||
public static Arena FindArena( List<Mobile> players )
|
||||
{
|
||||
|
|
@ -692,7 +655,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( prefs == null )
|
||||
return FindArena();
|
||||
|
||||
if ( m_Arenas.Count == 0 )
|
||||
if ( Arenas.Count == 0 )
|
||||
return null;
|
||||
|
||||
if ( players.Count > 0 )
|
||||
|
|
@ -735,16 +698,16 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
List<ArenaEntry> arenas = new List<ArenaEntry>();
|
||||
|
||||
for ( int i = 0; i < m_Arenas.Count; ++i )
|
||||
for ( int i = 0; i < Arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = m_Arenas[i];
|
||||
Arena arena = Arenas[i];
|
||||
|
||||
if ( !arena.IsOccupied )
|
||||
arenas.Add( new ArenaEntry( arena ) );
|
||||
}
|
||||
|
||||
if ( arenas.Count == 0 )
|
||||
return m_Arenas[0];
|
||||
return Arenas[0];
|
||||
|
||||
int tc = 0;
|
||||
|
||||
|
|
@ -796,20 +759,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public static Arena FindArena()
|
||||
{
|
||||
if ( m_Arenas.Count == 0 )
|
||||
if ( Arenas.Count == 0 )
|
||||
return null;
|
||||
|
||||
int offset = Utility.Random( m_Arenas.Count );
|
||||
int offset = Utility.Random( Arenas.Count );
|
||||
|
||||
for ( int i = 0; i < m_Arenas.Count; ++i )
|
||||
for ( int i = 0; i < Arenas.Count; ++i )
|
||||
{
|
||||
Arena arena = m_Arenas[(i + offset) % m_Arenas.Count];
|
||||
Arena arena = Arenas[(i + offset) % Arenas.Count];
|
||||
|
||||
if ( !arena.IsOccupied )
|
||||
return arena;
|
||||
}
|
||||
|
||||
return m_Arenas[offset];
|
||||
return Arenas[offset];
|
||||
}
|
||||
|
||||
public int CompareTo(object obj)
|
||||
|
|
|
|||
|
|
@ -22,31 +22,25 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class DuelContext
|
||||
{
|
||||
private Mobile m_Initiator;
|
||||
private ArrayList m_Participants;
|
||||
private Ruleset m_Ruleset;
|
||||
private Arena m_Arena;
|
||||
private bool m_Registered = true;
|
||||
private bool m_Finished, m_Started;
|
||||
public bool Rematch { get; private set; }
|
||||
|
||||
private bool m_ReadyWait;
|
||||
private int m_ReadyCount;
|
||||
public bool ReadyWait { get; private set; }
|
||||
|
||||
private bool m_Rematch;
|
||||
public int ReadyCount { get; private set; }
|
||||
|
||||
public bool Rematch => m_Rematch;
|
||||
public bool Registered { get; private set; } = true;
|
||||
|
||||
public bool ReadyWait => m_ReadyWait;
|
||||
public int ReadyCount => m_ReadyCount;
|
||||
public bool Finished { get; private set; }
|
||||
|
||||
public bool Registered => m_Registered;
|
||||
public bool Finished => m_Finished;
|
||||
public bool Started => m_Started;
|
||||
public bool Started { get; private set; }
|
||||
|
||||
public Mobile Initiator => m_Initiator;
|
||||
public ArrayList Participants => m_Participants;
|
||||
public Ruleset Ruleset => m_Ruleset;
|
||||
public Arena Arena => m_Arena;
|
||||
public Mobile Initiator { get; }
|
||||
|
||||
public ArrayList Participants { get; }
|
||||
|
||||
public Ruleset Ruleset { get; private set; }
|
||||
|
||||
public Arena Arena { get; private set; }
|
||||
|
||||
private bool CantDoAnything( Mobile mob )
|
||||
{
|
||||
|
|
@ -83,7 +77,7 @@ namespace Server.Engines.ConPVP
|
|||
public bool InstAllowSpecialMove( Mobile from, string name, SpecialMove move )
|
||||
{
|
||||
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -102,7 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
title = "Ninjitsu";
|
||||
|
||||
|
||||
if ( title == null || name == null || m_Ruleset.GetOption( title, name ) )
|
||||
if ( title == null || name == null || Ruleset.GetOption( title, name ) )
|
||||
return true;
|
||||
|
||||
from.SendMessage( "The dueling ruleset prevents you from using this move." );
|
||||
|
|
@ -111,7 +105,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowSpellCast( Mobile from, Spell spell )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -174,7 +168,7 @@ namespace Server.Engines.ConPVP
|
|||
option = spell.Name;
|
||||
}
|
||||
|
||||
if ( title == null || option == null || m_Ruleset.GetOption( title, option ) )
|
||||
if ( title == null || option == null || Ruleset.GetOption( title, option ) )
|
||||
return true;
|
||||
|
||||
from.SendMessage( "The dueling ruleset prevents you from casting this spell." );
|
||||
|
|
@ -183,7 +177,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowItemEquip( Mobile from, Item item )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -211,7 +205,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool InstAllowSpecialAbility( Mobile from, string name, bool message )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -222,7 +216,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( CantDoAnything( from ) )
|
||||
return false;
|
||||
|
||||
if ( m_Ruleset.GetOption( "Combat Abilities", name ) )
|
||||
if ( Ruleset.GetOption( "Combat Abilities", name ) )
|
||||
return true;
|
||||
|
||||
if ( message )
|
||||
|
|
@ -235,38 +229,38 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if ( item is Fists )
|
||||
{
|
||||
if ( !m_Ruleset.GetOption( "Weapons", "Wrestling" ) )
|
||||
if ( !Ruleset.GetOption( "Weapons", "Wrestling" ) )
|
||||
return false;
|
||||
}
|
||||
else if ( item is BaseArmor armor )
|
||||
{
|
||||
if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !m_Ruleset.GetOption( "Armor", "Magical" ) )
|
||||
if ( armor.ProtectionLevel > ArmorProtectionLevel.Regular && !Ruleset.GetOption( "Armor", "Magical" ) )
|
||||
return false;
|
||||
|
||||
if ( !Core.AOS && armor.Resource != armor.DefaultResource && !m_Ruleset.GetOption( "Armor", "Colored" ) )
|
||||
if ( !Core.AOS && armor.Resource != armor.DefaultResource && !Ruleset.GetOption( "Armor", "Colored" ) )
|
||||
return false;
|
||||
|
||||
if ( armor is BaseShield && !m_Ruleset.GetOption( "Armor", "Shields" ) )
|
||||
if ( armor is BaseShield && !Ruleset.GetOption( "Armor", "Shields" ) )
|
||||
return false;
|
||||
}
|
||||
else if ( item is BaseWeapon weapon )
|
||||
{
|
||||
if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !m_Ruleset.GetOption( "Weapons", "Magical" ) )
|
||||
if ( (weapon.DamageLevel > WeaponDamageLevel.Regular || weapon.AccuracyLevel > WeaponAccuracyLevel.Regular) && !Ruleset.GetOption( "Weapons", "Magical" ) )
|
||||
return false;
|
||||
|
||||
if ( !Core.AOS && weapon.Resource != CraftResource.Iron && weapon.Resource != CraftResource.None && !m_Ruleset.GetOption( "Weapons", "Runics" ) )
|
||||
if ( !Core.AOS && weapon.Resource != CraftResource.Iron && weapon.Resource != CraftResource.None && !Ruleset.GetOption( "Weapons", "Runics" ) )
|
||||
return false;
|
||||
|
||||
if ( weapon is BaseRanged && !m_Ruleset.GetOption( "Weapons", "Ranged" ) )
|
||||
if ( weapon is BaseRanged && !Ruleset.GetOption( "Weapons", "Ranged" ) )
|
||||
return false;
|
||||
|
||||
if ( !(weapon is BaseRanged) && !m_Ruleset.GetOption( "Weapons", "Melee" ) )
|
||||
if ( !(weapon is BaseRanged) && !Ruleset.GetOption( "Weapons", "Melee" ) )
|
||||
return false;
|
||||
|
||||
if ( weapon.PoisonCharges > 0 && weapon.Poison != null && !m_Ruleset.GetOption( "Weapons", "Poisoned" ) )
|
||||
if ( weapon.PoisonCharges > 0 && weapon.Poison != null && !Ruleset.GetOption( "Weapons", "Poisoned" ) )
|
||||
return false;
|
||||
|
||||
if ( weapon is BaseWand && !m_Ruleset.GetOption( "Items", "Wands" ) )
|
||||
if ( weapon is BaseWand && !Ruleset.GetOption( "Items", "Wands" ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +269,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowSkillUse( Mobile from, SkillName skill )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -290,7 +284,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( id >= 0 && id < SkillInfo.Table.Length )
|
||||
{
|
||||
if ( m_Ruleset.GetOption( "Skills", SkillInfo.Table[id].Name ) )
|
||||
if ( Ruleset.GetOption( "Skills", SkillInfo.Table[id].Name ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -300,7 +294,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool AllowItemUse( Mobile from, Item item )
|
||||
{
|
||||
if ( !m_StartedBeginCountdown )
|
||||
if ( !StartedBeginCountdown )
|
||||
return true;
|
||||
|
||||
DuelPlayer pl = Find( from );
|
||||
|
|
@ -386,7 +380,7 @@ namespace Server.Engines.ConPVP
|
|||
option = "Wands";
|
||||
}
|
||||
|
||||
if ( title != null && option != null && m_StartedBeginCountdown && !m_Started )
|
||||
if ( title != null && option != null && StartedBeginCountdown && !Started )
|
||||
{
|
||||
from.SendMessage( "You may not use this item before the duel begins." );
|
||||
return false;
|
||||
|
|
@ -402,7 +396,7 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( title == null || option == null || m_Ruleset.GetOption( title, option ) )
|
||||
if ( title == null || option == null || Ruleset.GetOption( title, option ) )
|
||||
return true;
|
||||
|
||||
from.SendMessage( "The dueling ruleset prevents you from using this item." );
|
||||
|
|
@ -430,10 +424,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void OnLocationChanged( Mobile mob )
|
||||
{
|
||||
if ( !m_Registered || !m_StartedBeginCountdown || m_Finished )
|
||||
if ( !Registered || !StartedBeginCountdown || Finished )
|
||||
return;
|
||||
|
||||
Arena arena = m_Arena;
|
||||
Arena arena = Arena;
|
||||
|
||||
if ( arena == null )
|
||||
return;
|
||||
|
|
@ -472,7 +466,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void OnDeath( Mobile mob, Container corpse )
|
||||
{
|
||||
if ( !m_Registered || !m_Started )
|
||||
if ( !Registered || !Started )
|
||||
return;
|
||||
|
||||
DuelPlayer pl = Find( mob );
|
||||
|
|
@ -506,9 +500,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public bool CheckFull()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.HasOpenSlot )
|
||||
return false;
|
||||
|
|
@ -596,11 +590,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendOutside( Mobile mob )
|
||||
{
|
||||
if ( m_Arena == null )
|
||||
if ( Arena == null )
|
||||
return;
|
||||
|
||||
mob.Combatant = null;
|
||||
mob.MoveToWorld( m_Arena.Outside, m_Arena.Facet );
|
||||
mob.MoveToWorld( Arena.Outside, Arena.Facet );
|
||||
}
|
||||
|
||||
private Point3D m_GatePoint;
|
||||
|
|
@ -608,13 +602,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Finish( Participant winner )
|
||||
{
|
||||
if ( m_Finished )
|
||||
if ( Finished )
|
||||
return;
|
||||
|
||||
EndAutoTie();
|
||||
StopSDTimers();
|
||||
|
||||
m_Finished = true;
|
||||
Finished = true;
|
||||
|
||||
for ( int i = 0; i < winner.Players.Length; ++i )
|
||||
{
|
||||
|
|
@ -630,12 +624,12 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Match.Winner = winner.TournyPart;
|
||||
winner.TournyPart.WonMatch( m_Match );
|
||||
m_Tournament.HandleWon( m_Arena, m_Match, winner.TournyPart );
|
||||
m_Tournament.HandleWon( Arena, m_Match, winner.TournyPart );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant loser = (Participant)m_Participants[i];
|
||||
Participant loser = (Participant)Participants[i];
|
||||
|
||||
if ( loser != winner )
|
||||
{
|
||||
|
|
@ -661,8 +655,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( IsOneVsOne )
|
||||
{
|
||||
DuelPlayer dp1 = ((Participant)m_Participants[0]).Players[0];
|
||||
DuelPlayer dp2 = ((Participant)m_Participants[1]).Players[0];
|
||||
DuelPlayer dp1 = ((Participant)Participants[0]).Players[0];
|
||||
DuelPlayer dp2 = ((Participant)Participants[1]).Players[0];
|
||||
|
||||
if ( dp1 != null && dp2 != null )
|
||||
{
|
||||
|
|
@ -678,7 +672,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Award( Mobile us, Mobile them, bool won )
|
||||
{
|
||||
Ladder ladder = ( m_Arena == null ? Ladder.Instance : m_Arena.AcquireLadder() );
|
||||
Ladder ladder = ( Arena == null ? Ladder.Instance : Arena.AcquireLadder() );
|
||||
|
||||
if ( ladder == null )
|
||||
return;
|
||||
|
|
@ -733,20 +727,20 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DestroyWall();
|
||||
|
||||
if ( !m_Registered )
|
||||
if ( !Registered )
|
||||
return;
|
||||
|
||||
m_Registered = false;
|
||||
Registered = false;
|
||||
|
||||
m_Arena?.Evict();
|
||||
Arena?.Evict();
|
||||
|
||||
StopSDTimers();
|
||||
|
||||
Type[] types = { typeof( BeginGump ), typeof( DuelContextGump ), typeof( ParticipantGump ), typeof( PickRulesetGump ), typeof( ReadyGump ), typeof( ReadyUpGump ), typeof( RulesetGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -769,16 +763,16 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void QueryRematch()
|
||||
{
|
||||
DuelContext dc = new DuelContext( m_Initiator, m_Ruleset.Layout, false );
|
||||
DuelContext dc = new DuelContext( Initiator, Ruleset.Layout, false );
|
||||
|
||||
dc.m_Ruleset = m_Ruleset;
|
||||
dc.m_Rematch = true;
|
||||
dc.Ruleset = Ruleset;
|
||||
dc.Rematch = true;
|
||||
|
||||
dc.m_Participants.Clear();
|
||||
dc.Participants.Clear();
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant oldPart = (Participant)m_Participants[i];
|
||||
Participant oldPart = (Participant)Participants[i];
|
||||
Participant newPart = new Participant( dc, oldPart.Players.Length );
|
||||
|
||||
for ( int j = 0; j < oldPart.Players.Length; ++j )
|
||||
|
|
@ -789,7 +783,7 @@ namespace Server.Engines.ConPVP
|
|||
newPart.Players[j] = new DuelPlayer( oldPlayer.Mobile, newPart );
|
||||
}
|
||||
|
||||
dc.m_Participants.Add( newPart );
|
||||
dc.Participants.Add( newPart );
|
||||
}
|
||||
|
||||
dc.CloseAllGumps();
|
||||
|
|
@ -806,9 +800,9 @@ namespace Server.Engines.ConPVP
|
|||
return null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
DuelPlayer pl = p.Find( mob );
|
||||
|
||||
if ( pl != null )
|
||||
|
|
@ -833,15 +827,15 @@ namespace Server.Engines.ConPVP
|
|||
bool hasWinner = false;
|
||||
int eliminated = 0;
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.Eliminated )
|
||||
{
|
||||
++eliminated;
|
||||
|
||||
if ( eliminated == (m_Participants.Count - 1) )
|
||||
if ( eliminated == (Participants.Count - 1) )
|
||||
hasWinner = true;
|
||||
}
|
||||
else
|
||||
|
|
@ -851,7 +845,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
if ( hasWinner )
|
||||
return winner ?? (Participant) m_Participants[0];
|
||||
return winner ?? (Participant) Participants[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -891,15 +885,10 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
private Timer m_AutoTieTimer;
|
||||
private bool m_Tied;
|
||||
|
||||
public bool Tied => m_Tied;
|
||||
public bool Tied { get; private set; }
|
||||
|
||||
private bool m_IsSuddenDeath;
|
||||
|
||||
public bool IsSuddenDeath{ get => m_IsSuddenDeath;
|
||||
set => m_IsSuddenDeath = value;
|
||||
}
|
||||
public bool IsSuddenDeath { get; set; }
|
||||
|
||||
private Timer m_SDWarnTimer, m_SDActivateTimer;
|
||||
|
||||
|
|
@ -927,9 +916,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void WarnSuddenDeath()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -944,7 +933,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Tournament?.Alert( m_Arena, "Sudden death will be active soon!" );
|
||||
m_Tournament?.Alert( Arena, "Sudden death will be active soon!" );
|
||||
|
||||
m_SDWarnTimer?.Stop();
|
||||
|
||||
|
|
@ -958,9 +947,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void ActivateSuddenDeath()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -975,9 +964,9 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Tournament?.Alert( m_Arena, "Sudden death has been activated!" );
|
||||
m_Tournament?.Alert( Arena, "Sudden death has been activated!" );
|
||||
|
||||
m_IsSuddenDeath = true;
|
||||
IsSuddenDeath = true;
|
||||
|
||||
m_SDActivateTimer?.Stop();
|
||||
|
||||
|
|
@ -1006,19 +995,19 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_AutoTieTimer = null;
|
||||
|
||||
if ( !m_Started || m_Finished )
|
||||
if ( !Started || Finished )
|
||||
return;
|
||||
|
||||
m_Tied = true;
|
||||
m_Finished = true;
|
||||
Tied = true;
|
||||
Finished = true;
|
||||
|
||||
StopSDTimers();
|
||||
|
||||
ArrayList remaining = new ArrayList();
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.Eliminated )
|
||||
{
|
||||
|
|
@ -1052,7 +1041,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
m_Tournament?.HandleTie( m_Arena, m_Match, remaining );
|
||||
m_Tournament?.HandleTie( Arena, m_Match, remaining );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 10.0 ), Unregister );
|
||||
}
|
||||
|
|
@ -1061,13 +1050,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
if ( m_Participants.Count != 2 )
|
||||
if ( Participants.Count != 2 )
|
||||
return false;
|
||||
|
||||
if ( ((Participant)m_Participants[0]).Players.Length != 1 )
|
||||
if ( ((Participant)Participants[0]).Players.Length != 1 )
|
||||
return false;
|
||||
|
||||
if ( ((Participant)m_Participants[1]).Players.Length != 1 )
|
||||
if ( ((Participant)Participants[1]).Players.Length != 1 )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -1140,7 +1129,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( dc.ReadyWait && pm.DuelPlayer.Ready && !dc.Started && !dc.StartedBeginCountdown && !dc.Finished )
|
||||
{
|
||||
if ( dc.m_Tournament == null )
|
||||
pm.SendGump( new ReadyGump( pm, dc, dc.m_ReadyCount ) );
|
||||
pm.SendGump( new ReadyGump( pm, dc, dc.ReadyCount ) );
|
||||
}
|
||||
else if ( dc.ReadyWait && !dc.StartedBeginCountdown && !dc.Started && !dc.Finished )
|
||||
{
|
||||
|
|
@ -1362,7 +1351,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
dc.Unregister();
|
||||
}
|
||||
else if ( dc.m_Registered )
|
||||
else if ( dc.Registered )
|
||||
{
|
||||
p.Nullify( pl );
|
||||
pm.DuelPlayer=null;
|
||||
|
|
@ -1400,7 +1389,7 @@ namespace Server.Engines.ConPVP
|
|||
pm.DuelContext.m_Countdown?.Stop();
|
||||
pm.DuelContext.m_Countdown = null;
|
||||
|
||||
pm.DuelContext.m_StartedReadyCountdown=false;
|
||||
pm.DuelContext.StartedReadyCountdown=false;
|
||||
p.Broadcast( 0x22, null, "{0} has yielded.", "You have yielded." );
|
||||
|
||||
dc.m_Yielding=true;
|
||||
|
|
@ -1411,7 +1400,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
dc.Unregister();
|
||||
}
|
||||
else if ( dc.m_Registered )
|
||||
else if ( dc.Registered )
|
||||
{
|
||||
p.Nullify( pl );
|
||||
pm.DuelPlayer=null;
|
||||
|
|
@ -1500,17 +1489,17 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelContext( Mobile initiator, RulesetLayout layout, bool addNew )
|
||||
{
|
||||
m_Initiator = initiator;
|
||||
m_Participants = new ArrayList();
|
||||
m_Ruleset = new Ruleset( layout );
|
||||
m_Ruleset.ApplyDefault( layout.Defaults[0] );
|
||||
Initiator = initiator;
|
||||
Participants = new ArrayList();
|
||||
Ruleset = new Ruleset( layout );
|
||||
Ruleset.ApplyDefault( layout.Defaults[0] );
|
||||
|
||||
if ( addNew )
|
||||
{
|
||||
m_Participants.Add( new Participant( this, 1 ) );
|
||||
m_Participants.Add( new Participant( this, 1 ) );
|
||||
Participants.Add( new Participant( this, 1 ) );
|
||||
Participants.Add( new Participant( this, 1 ) );
|
||||
|
||||
((Participant)m_Participants[0]).Add( initiator );
|
||||
((Participant)Participants[0]).Add( initiator );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1519,9 +1508,9 @@ namespace Server.Engines.ConPVP
|
|||
Type[] types = { typeof( DuelContextGump ), typeof( ParticipantGump ), typeof( RulesetGump ) };
|
||||
int[] defs = { -1, -1, -1 };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1541,15 +1530,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void RejectReady( Mobile rejector, string page )
|
||||
{
|
||||
if ( m_StartedReadyCountdown )
|
||||
if ( StartedReadyCountdown )
|
||||
return; // sanity
|
||||
|
||||
Type[] types = { typeof( DuelContextGump ), typeof( ReadyUpGump ), typeof( ReadyGump ) };
|
||||
int[] defs = { -1, -1, -1 };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1570,9 +1559,9 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
{
|
||||
if ( mob == rejector )
|
||||
mob.SendMessage( 0x22, "You have rejected the {0}.", m_Rematch ? "rematch" : page );
|
||||
mob.SendMessage( 0x22, "You have rejected the {0}.", Rematch ? "rematch" : page );
|
||||
else
|
||||
mob.SendMessage( 0x22, "{0} has rejected the {1}.", rejector.Name, m_Rematch ? "rematch" : page );
|
||||
mob.SendMessage( 0x22, "{0} has rejected the {1}.", rejector.Name, Rematch ? "rematch" : page );
|
||||
}
|
||||
|
||||
for ( int k = 0; k < types.Length; ++k )
|
||||
|
|
@ -1581,13 +1570,13 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Rematch )
|
||||
if ( Rematch )
|
||||
Unregister();
|
||||
else if ( !m_Yielding )
|
||||
m_Initiator.SendGump( new DuelContextGump( m_Initiator, this ) );
|
||||
Initiator.SendGump( new DuelContextGump( Initiator, this ) );
|
||||
|
||||
m_ReadyWait = false;
|
||||
m_ReadyCount = 0;
|
||||
ReadyWait = false;
|
||||
ReadyCount = 0;
|
||||
}
|
||||
|
||||
public void SendReadyGump()
|
||||
|
|
@ -1651,11 +1640,9 @@ namespace Server.Engines.ConPVP
|
|||
Targeting.Target.Cancel( mob );
|
||||
}
|
||||
|
||||
private bool m_StartedBeginCountdown;
|
||||
private bool m_StartedReadyCountdown;
|
||||
public bool StartedBeginCountdown { get; private set; }
|
||||
|
||||
public bool StartedBeginCountdown => m_StartedBeginCountdown;
|
||||
public bool StartedReadyCountdown => m_StartedReadyCountdown;
|
||||
public bool StartedReadyCountdown { get; private set; }
|
||||
|
||||
private class InternalWall : Item
|
||||
{
|
||||
|
|
@ -1704,11 +1691,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void CreateWall()
|
||||
{
|
||||
if ( m_Arena == null )
|
||||
if ( Arena == null )
|
||||
return;
|
||||
|
||||
Point3D start = m_Arena.Points.EdgeWest;
|
||||
Point3D wall = m_Arena.Wall;
|
||||
Point3D start = Arena.Points.EdgeWest;
|
||||
Point3D wall = Arena.Wall;
|
||||
|
||||
int dx = start.X - wall.X;
|
||||
int dy = start.Y - wall.Y;
|
||||
|
|
@ -1726,7 +1713,7 @@ namespace Server.Engines.ConPVP
|
|||
else
|
||||
eastToWest = false;
|
||||
|
||||
Effects.PlaySound( wall, m_Arena.Facet, 0x1F6 );
|
||||
Effects.PlaySound( wall, Arena.Facet, 0x1F6 );
|
||||
|
||||
for ( int i = -1; i <= 1; ++i )
|
||||
{
|
||||
|
|
@ -1734,7 +1721,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
InternalWall created = new InternalWall();
|
||||
|
||||
created.Appear( loc, m_Arena.Facet );
|
||||
created.Appear( loc, Arena.Facet );
|
||||
|
||||
m_Walls.Add( created );
|
||||
}
|
||||
|
|
@ -1742,9 +1729,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void BuildParties()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
if ( p.Players.Length > 1 )
|
||||
{
|
||||
|
|
@ -1810,9 +1797,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void ClearIllegalItems()
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1877,11 +1864,11 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
|
||||
private void MessageRuleset( Mobile mob ) {
|
||||
if ( m_Ruleset == null ) {
|
||||
if ( Ruleset == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ruleset ruleset = m_Ruleset;
|
||||
Ruleset ruleset = Ruleset;
|
||||
Ruleset basedef = ruleset.Base;
|
||||
|
||||
mob.SendMessage( "Ruleset: {0}", basedef.Title );
|
||||
|
|
@ -1928,7 +1915,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendBeginGump( int count )
|
||||
{
|
||||
if ( !m_Registered || m_Finished )
|
||||
if ( !Registered || Finished )
|
||||
return;
|
||||
|
||||
if ( count == 10 )
|
||||
|
|
@ -1942,19 +1929,19 @@ namespace Server.Engines.ConPVP
|
|||
DestroyWall();
|
||||
}
|
||||
|
||||
m_StartedBeginCountdown = true;
|
||||
StartedBeginCountdown = true;
|
||||
|
||||
if ( count == 0 )
|
||||
{
|
||||
m_Started = true;
|
||||
Started = true;
|
||||
BeginAutoTie();
|
||||
}
|
||||
|
||||
Type[] types = { typeof( ReadyGump ), typeof( ReadyUpGump ), typeof( BeginGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -1985,44 +1972,43 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private class ReturnEntry
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private Point3D m_Location;
|
||||
private Map m_Facet;
|
||||
private DateTime m_Expire;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Point3D Location => m_Location;
|
||||
public Map Facet => m_Facet;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public Point3D Location { get; private set; }
|
||||
|
||||
public Map Facet { get; private set; }
|
||||
|
||||
public void Return()
|
||||
{
|
||||
if ( m_Facet == Map.Internal || m_Facet == null )
|
||||
if ( Facet == Map.Internal || Facet == null )
|
||||
return;
|
||||
|
||||
if ( m_Mobile.Map == Map.Internal )
|
||||
if ( Mobile.Map == Map.Internal )
|
||||
{
|
||||
m_Mobile.LogoutLocation = m_Location;
|
||||
m_Mobile.LogoutMap = m_Facet;
|
||||
Mobile.LogoutLocation = Location;
|
||||
Mobile.LogoutMap = Facet;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Mobile.Location = m_Location;
|
||||
m_Mobile.Map = m_Facet;
|
||||
Mobile.Location = Location;
|
||||
Mobile.Map = Facet;
|
||||
}
|
||||
}
|
||||
|
||||
public ReturnEntry( Mobile mob )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
Mobile = mob;
|
||||
|
||||
Update();
|
||||
}
|
||||
|
||||
public ReturnEntry( Mobile mob, Point3D loc, Map facet )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Location = loc;
|
||||
m_Facet = facet;
|
||||
Mobile = mob;
|
||||
Location = loc;
|
||||
Facet = facet;
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 );
|
||||
}
|
||||
|
||||
|
|
@ -2032,15 +2018,15 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_Expire = DateTime.UtcNow + TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
if ( m_Mobile.Map == Map.Internal )
|
||||
if ( Mobile.Map == Map.Internal )
|
||||
{
|
||||
m_Facet = m_Mobile.LogoutMap;
|
||||
m_Location = m_Mobile.LogoutLocation;
|
||||
Facet = Mobile.LogoutMap;
|
||||
Location = Mobile.LogoutLocation;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Facet = m_Mobile.Map;
|
||||
m_Location = m_Mobile.Location;
|
||||
Facet = Mobile.Map;
|
||||
Location = Mobile.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2243,9 +2229,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void RemoveAggressions( Mobile mob )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2264,17 +2250,17 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendReadyUpGump()
|
||||
{
|
||||
if ( !m_Registered )
|
||||
if ( !Registered )
|
||||
return;
|
||||
|
||||
m_ReadyWait = true;
|
||||
m_ReadyCount = -1;
|
||||
ReadyWait = true;
|
||||
ReadyCount = -1;
|
||||
|
||||
Type[] types = { typeof( ReadyUpGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2296,9 +2282,9 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Tournament == null && TournamentController.IsActive )
|
||||
return "a tournament is active";
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2347,13 +2333,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void SendReadyGump( int count )
|
||||
{
|
||||
if ( !m_Registered )
|
||||
if ( !Registered )
|
||||
return;
|
||||
|
||||
if ( count != -1 )
|
||||
m_StartedReadyCountdown = true;
|
||||
StartedReadyCountdown = true;
|
||||
|
||||
m_ReadyCount = count;
|
||||
ReadyCount = count;
|
||||
|
||||
if ( count == 0 )
|
||||
{
|
||||
|
|
@ -2361,9 +2347,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( error != null )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2378,13 +2364,13 @@ namespace Server.Engines.ConPVP
|
|||
return;
|
||||
}
|
||||
|
||||
m_ReadyWait = false;
|
||||
ReadyWait = false;
|
||||
|
||||
List<Mobile> players = new List<Mobile>();
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2402,9 +2388,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( arena == null )
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2420,17 +2406,17 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
if ( !arena.IsOccupied )
|
||||
{
|
||||
m_Arena = arena;
|
||||
Arena = arena;
|
||||
|
||||
if ( m_Initiator.Map == Map.Internal )
|
||||
if ( Initiator.Map == Map.Internal )
|
||||
{
|
||||
m_GatePoint = m_Initiator.LogoutLocation;
|
||||
m_GateFacet = m_Initiator.LogoutMap;
|
||||
m_GatePoint = Initiator.LogoutLocation;
|
||||
m_GateFacet = Initiator.LogoutMap;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_GatePoint = m_Initiator.Location;
|
||||
m_GateFacet = m_Initiator.Map;
|
||||
m_GatePoint = Initiator.Location;
|
||||
m_GateFacet = Initiator.Map;
|
||||
}
|
||||
|
||||
if ( !(arena.Teleporter is ExitTeleporter tp) )
|
||||
|
|
@ -2441,11 +2427,11 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
ArenaMoongate mg = new ArenaMoongate( arena.GateIn == Point3D.Zero ? arena.Outside : arena.GateIn, arena.Facet, tp );
|
||||
|
||||
m_StartedBeginCountdown = true;
|
||||
StartedBeginCountdown = true;
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2476,9 +2462,9 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
else
|
||||
{
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
@ -2494,15 +2480,15 @@ namespace Server.Engines.ConPVP
|
|||
return;
|
||||
}
|
||||
|
||||
m_ReadyWait = true;
|
||||
ReadyWait = true;
|
||||
|
||||
bool isAllReady = true;
|
||||
|
||||
Type[] types = { typeof( ReadyGump ) };
|
||||
|
||||
for ( int i = 0; i < m_Participants.Count; ++i )
|
||||
for ( int i = 0; i < Participants.Count; ++i )
|
||||
{
|
||||
Participant p = (Participant)m_Participants[i];
|
||||
Participant p = (Participant)Participants[i];
|
||||
|
||||
for ( int j = 0; j < p.Players.Length; ++j )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,11 +6,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class DuelContextGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
public Mobile From { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public DuelContext Context => m_Context;
|
||||
public DuelContext Context { get; }
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
|
|
@ -31,8 +29,8 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DuelContextGump( Mobile from, DuelContext context ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
From = from;
|
||||
Context = context;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
|
|
@ -71,7 +69,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
if ( !Context.Registered )
|
||||
return;
|
||||
|
||||
int index = info.ButtonID;
|
||||
|
|
@ -84,39 +82,39 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
case 0: // closed
|
||||
{
|
||||
m_Context.Unregister();
|
||||
Context.Unregister();
|
||||
break;
|
||||
}
|
||||
case 1: // Rules
|
||||
{
|
||||
//m_From.SendGump( new RulesetGump( m_From, m_Context.Ruleset, m_Context.Ruleset.Layout, m_Context ) );
|
||||
m_From.SendGump( new PickRulesetGump( m_From, m_Context, m_Context.Ruleset ) );
|
||||
From.SendGump( new PickRulesetGump( From, Context, Context.Ruleset ) );
|
||||
break;
|
||||
}
|
||||
case 2: // Start
|
||||
{
|
||||
if ( m_Context.CheckFull() )
|
||||
if ( Context.CheckFull() )
|
||||
{
|
||||
m_Context.CloseAllGumps();
|
||||
m_Context.SendReadyUpGump();
|
||||
Context.CloseAllGumps();
|
||||
Context.SendReadyUpGump();
|
||||
//m_Context.SendReadyGump();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "You cannot start the duel before all participating players have been assigned." );
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
From.SendMessage( "You cannot start the duel before all participating players have been assigned." );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // New Participant
|
||||
{
|
||||
if ( m_Context.Participants.Count < 10 )
|
||||
m_Context.Participants.Add( new Participant( m_Context, 1 ) );
|
||||
if ( Context.Participants.Count < 10 )
|
||||
Context.Participants.Add( new Participant( Context, 1 ) );
|
||||
else
|
||||
m_From.SendMessage( "The number of participating parties may not be increased further." );
|
||||
From.SendMessage( "The number of participating parties may not be increased further." );
|
||||
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -124,8 +122,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
index -= 4;
|
||||
|
||||
if ( index >= 0 && index < m_Context.Participants.Count )
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, (Participant)m_Context.Participants[index] ) );
|
||||
if ( index >= 0 && index < Context.Participants.Count )
|
||||
From.SendGump( new ParticipantGump( From, Context, (Participant)Context.Participants[index] ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Server.Engines.ConPVP
|
|||
public override string DefaultName => "da bomb";
|
||||
|
||||
private BRGame m_Game;
|
||||
private Mobile m_Thrower;
|
||||
private EffectTimer m_Timer;
|
||||
private bool m_Flying;
|
||||
|
||||
|
|
@ -287,7 +286,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_Flying = true;
|
||||
Visible = false;
|
||||
m_Thrower = from;
|
||||
Thrower = from;
|
||||
MoveToWorld( GetWorldLocation(), from.Map );
|
||||
|
||||
BeginFlight( pt );
|
||||
|
|
@ -348,7 +347,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
string verb = "caught";
|
||||
|
||||
if ( m_Thrower != null && m_Game.GetTeamInfo( m_Thrower ) != useTeam )
|
||||
if ( Thrower != null && m_Game.GetTeamInfo( Thrower ) != useTeam )
|
||||
verb = "intercepted";
|
||||
|
||||
if ( !TakeBomb( m, useTeam, verb ) )
|
||||
|
|
@ -607,7 +606,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( i is BRGoal goal )
|
||||
{
|
||||
Point3D oldLoc = new Point3D( GetWorldLocation() );
|
||||
if ( CheckScore( goal, m_Thrower, 3 ) )
|
||||
if ( CheckScore( goal, Thrower, 3 ) )
|
||||
DoAnim( oldLoc, point, Map );
|
||||
else
|
||||
HitObject( point, loc.Z, height );
|
||||
|
|
@ -626,7 +625,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Mobile m = ns.Mobile;
|
||||
|
||||
if ( m == null || m == m_Thrower )
|
||||
if ( m == null || m == Thrower )
|
||||
continue;
|
||||
|
||||
Point3D point;
|
||||
|
|
@ -705,7 +704,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
public Mobile Thrower => m_Thrower;
|
||||
public Mobile Thrower { get; private set; }
|
||||
|
||||
public bool CheckScore( BRGoal goal, Mobile m, int points )
|
||||
{
|
||||
|
|
@ -1165,14 +1164,12 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private BRTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
|
|
@ -1188,7 +1185,7 @@ namespace Server.Engines.ConPVP
|
|||
return res;
|
||||
}
|
||||
|
||||
public string Name => m_Player.Name;
|
||||
public string Name => Player.Name;
|
||||
|
||||
public int Kills
|
||||
{
|
||||
|
|
@ -1226,29 +1223,15 @@ namespace Server.Engines.ConPVP
|
|||
public BRPlayerInfo( BRTeamInfo teamInfo, Mobile player )
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public sealed class BRTeamInfo : IRankedCTF, IComparable
|
||||
{
|
||||
private BRGame m_Game;
|
||||
private int m_TeamID;
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
|
||||
private BRBoard m_Board;
|
||||
private BRGoal m_Goal;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
private Hashtable m_Players;
|
||||
|
||||
public int CompareTo( object obj )
|
||||
{
|
||||
BRTeamInfo ti = (BRTeamInfo)obj;
|
||||
|
|
@ -1263,40 +1246,24 @@ namespace Server.Engines.ConPVP
|
|||
return res;
|
||||
}
|
||||
|
||||
public string Name => $"{m_Name} Team";
|
||||
public string Name => $"{TeamName} Team";
|
||||
|
||||
public BRGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
public BRGame Game { get; set; }
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
public int TeamID { get; }
|
||||
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
public int Kills { get; set; }
|
||||
|
||||
private BRPlayerInfo m_Leader;
|
||||
public int Captures { get; set; }
|
||||
|
||||
public BRPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public int Score { get; set; }
|
||||
|
||||
public BRPlayerInfo Leader { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRBoard Board
|
||||
{
|
||||
get => m_Board;
|
||||
set => m_Board = value;
|
||||
}
|
||||
public BRBoard Board { get; set; }
|
||||
|
||||
public Hashtable Players => m_Players;
|
||||
public Hashtable Players { get; }
|
||||
|
||||
public BRPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -1305,26 +1272,18 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
if ( !(m_Players[mob] is BRPlayerInfo val) )
|
||||
m_Players[mob] = val = new BRPlayerInfo( this, mob );
|
||||
if ( !(Players[mob] is BRPlayerInfo val) )
|
||||
Players[mob] = val = new BRPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TeamName
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string TeamName { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRGoal Goal
|
||||
|
|
@ -1340,30 +1299,30 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public BRTeamInfo( int teamID )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
m_Score = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
|
||||
if ( m_Board != null )
|
||||
m_Board.m_TeamInfo = this;
|
||||
if ( Board != null )
|
||||
Board.m_TeamInfo = this;
|
||||
if ( m_Goal != null )
|
||||
m_Goal.Team = this;
|
||||
}
|
||||
|
||||
public BRTeamInfo( int teamID, GenericReader ip )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -1371,9 +1330,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Board = ip.ReadItem() as BRBoard;
|
||||
m_Name = ip.ReadString();
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
Board = ip.ReadItem() as BRBoard;
|
||||
TeamName = ip.ReadString();
|
||||
Color = ip.ReadEncodedInt();
|
||||
m_Goal = ip.ReadItem() as BRGoal;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1384,18 +1343,18 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt( 0 ); // version
|
||||
|
||||
op.Write( m_Board );
|
||||
op.Write( Board );
|
||||
|
||||
op.Write( m_Name );
|
||||
op.Write( TeamName );
|
||||
|
||||
op.WriteEncodedInt( m_Color );
|
||||
op.WriteEncodedInt( Color );
|
||||
|
||||
op.Write( m_Goal );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if ( m_Name != null )
|
||||
if ( TeamName != null )
|
||||
return $"({Name}) ...";
|
||||
return "...";
|
||||
}
|
||||
|
|
@ -1403,48 +1362,36 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class BRController : EventController
|
||||
{
|
||||
private BRTeamInfo[] m_TeamInfo;
|
||||
private TimeSpan m_Duration;
|
||||
private Point3D m_BombHome;
|
||||
|
||||
public BRTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public BRTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team1 { get => m_TeamInfo[0];
|
||||
public BRTeamInfo Team1 { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team2 { get => m_TeamInfo[1];
|
||||
public BRTeamInfo Team2 { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team3 { get => m_TeamInfo[2];
|
||||
public BRTeamInfo Team3 { get => TeamInfo[2];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BRTeamInfo Team4 { get => m_TeamInfo[3];
|
||||
public BRTeamInfo Team4 { get => TeamInfo[3];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D BombHome
|
||||
{
|
||||
get => m_BombHome;
|
||||
set => m_BombHome = value;
|
||||
}
|
||||
public Point3D BombHome { get; set; }
|
||||
|
||||
public override string Title => "Bombing Run";
|
||||
public override string DefaultName => "Bombing Run Controller";
|
||||
|
||||
public override string GetTeamName( int teamID )
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct( DuelContext context )
|
||||
|
|
@ -1458,14 +1405,14 @@ namespace Server.Engines.ConPVP
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
m_BombHome = Point3D.Zero;
|
||||
BombHome = Point3D.Zero;
|
||||
|
||||
m_TeamInfo = new BRTeamInfo[4];
|
||||
TeamInfo = new BRTeamInfo[4];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new BRTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new BRTeamInfo( i );
|
||||
}
|
||||
|
||||
public BRController( Serial serial )
|
||||
|
|
@ -1479,14 +1426,14 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( m_BombHome );
|
||||
writer.Write( BombHome );
|
||||
|
||||
writer.Write( m_Duration );
|
||||
writer.Write( Duration );
|
||||
|
||||
writer.WriteEncodedInt( m_TeamInfo.Length );
|
||||
writer.WriteEncodedInt( TeamInfo.Length );
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i].Serialize( writer );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -1499,14 +1446,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_BombHome = reader.ReadPoint3D();
|
||||
BombHome = reader.ReadPoint3D();
|
||||
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
|
||||
m_TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()];
|
||||
TeamInfo = new BRTeamInfo[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new BRTeamInfo( i, reader );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new BRTeamInfo( i, reader );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -1535,12 +1482,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void ReturnBomb()
|
||||
{
|
||||
if ( m_Bomb != null && m_Controller != null )
|
||||
if ( m_Bomb != null && Controller != null )
|
||||
{
|
||||
if ( m_UnhideCallback == null )
|
||||
m_UnhideCallback = UnhideBomb;
|
||||
m_Bomb.Visible = false;
|
||||
m_Bomb.MoveToWorld( m_Controller.BombHome, m_Controller.Map );
|
||||
m_Bomb.MoveToWorld( Controller.BombHome, Controller.Map );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( Utility.RandomMinMax( 5, 15 ) ), m_UnhideCallback );
|
||||
}
|
||||
}
|
||||
|
|
@ -1554,9 +1501,7 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
private BRController m_Controller;
|
||||
|
||||
public BRController Controller => m_Controller;
|
||||
public BRController Controller { get; }
|
||||
|
||||
public void Alert( string text )
|
||||
{
|
||||
|
|
@ -1581,7 +1526,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public BRGame( BRController controller, DuelContext context ) : base( context )
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -1591,7 +1536,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Context.Arena != null )
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1600,7 +1545,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID( mob );
|
||||
|
||||
if ( teamID >= 0 )
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1718,23 +1663,23 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStart()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
BRTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
BRTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color );
|
||||
ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color );
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
|
||||
m_Bomb = new BRBomb( this );
|
||||
ReturnBomb();
|
||||
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback );
|
||||
m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback );
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -1743,7 +1688,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
BRTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length];
|
||||
BRTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length];
|
||||
|
||||
if ( teamInfo == null )
|
||||
continue;
|
||||
|
|
@ -1787,8 +1732,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Controller != null )
|
||||
sb.Append( ' ' ).Append( m_Controller.Title );
|
||||
if ( Controller != null )
|
||||
sb.Append( ' ' ).Append( Controller.Title );
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -1899,9 +1844,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
BRTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
BRTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
if ( teamInfo.Board != null )
|
||||
teamInfo.Board.m_TeamInfo = null;
|
||||
|
|
|
|||
|
|
@ -528,16 +528,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private CTFTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
string IRankedCTF.Name => m_Player.Name;
|
||||
string IRankedCTF.Name => Player.Name;
|
||||
|
||||
public int Kills
|
||||
{
|
||||
|
|
@ -575,65 +573,31 @@ namespace Server.Engines.ConPVP
|
|||
public CTFPlayerInfo( CTFTeamInfo teamInfo, Mobile player )
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public sealed class CTFTeamInfo : IRankedCTF
|
||||
{
|
||||
private CTFGame m_Game;
|
||||
private int m_TeamID;
|
||||
string IRankedCTF.Name => $"{Name} Team";
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
public CTFGame Game { get; set; }
|
||||
|
||||
private CTFBoard m_Board;
|
||||
public int TeamID { get; }
|
||||
|
||||
private CTFFlag m_Flag;
|
||||
private Point3D m_Origin;
|
||||
public int Kills { get; set; }
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
public int Captures { get; set; }
|
||||
|
||||
private int m_Score;
|
||||
public int Score { get; set; }
|
||||
|
||||
private Dictionary<Mobile, CTFPlayerInfo> m_Players;
|
||||
|
||||
string IRankedCTF.Name => $"{m_Name} Team";
|
||||
|
||||
public CTFGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
|
||||
private CTFPlayerInfo m_Leader;
|
||||
|
||||
public CTFPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public CTFPlayerInfo Leader { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFBoard Board
|
||||
{
|
||||
get => m_Board;
|
||||
set => m_Board = value;
|
||||
}
|
||||
public CTFBoard Board { get; set; }
|
||||
|
||||
public Dictionary<Mobile, CTFPlayerInfo> Players => m_Players;
|
||||
public Dictionary<Mobile, CTFPlayerInfo> Players { get; }
|
||||
|
||||
public CTFPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -642,73 +606,57 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
if (!m_Players.TryGetValue( mob, out CTFPlayerInfo val ))
|
||||
m_Players[mob] = val = new CTFPlayerInfo( this, mob );
|
||||
if (!Players.TryGetValue( mob, out CTFPlayerInfo val ))
|
||||
Players[mob] = val = new CTFPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Name
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string Name { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFFlag Flag
|
||||
{
|
||||
get => m_Flag;
|
||||
set => m_Flag = value;
|
||||
}
|
||||
public CTFFlag Flag { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Origin
|
||||
{
|
||||
get => m_Origin;
|
||||
set => m_Origin = value;
|
||||
}
|
||||
public Point3D Origin { get; set; }
|
||||
|
||||
public CTFTeamInfo( int teamID )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
|
||||
m_Score = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
|
||||
if ( m_Flag != null )
|
||||
if ( Flag != null )
|
||||
{
|
||||
m_Flag.m_TeamInfo = this;
|
||||
m_Flag.Hue = m_Color;
|
||||
m_Flag.SendHome();
|
||||
Flag.m_TeamInfo = this;
|
||||
Flag.Hue = Color;
|
||||
Flag.SendHome();
|
||||
}
|
||||
|
||||
if ( m_Board != null )
|
||||
m_Board.m_TeamInfo = this;
|
||||
if ( Board != null )
|
||||
Board.m_TeamInfo = this;
|
||||
}
|
||||
|
||||
public CTFTeamInfo( int teamID, GenericReader ip )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, CTFPlayerInfo>();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -716,22 +664,22 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_Board = ip.ReadItem() as CTFBoard;
|
||||
Board = ip.ReadItem() as CTFBoard;
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Name = ip.ReadString();
|
||||
Name = ip.ReadString();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
Color = ip.ReadEncodedInt();
|
||||
|
||||
m_Flag = ip.ReadItem() as CTFFlag;
|
||||
m_Origin = ip.ReadPoint3D();
|
||||
Flag = ip.ReadItem() as CTFFlag;
|
||||
Origin = ip.ReadPoint3D();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -741,14 +689,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt( 2 ); // version
|
||||
|
||||
op.Write( m_Board );
|
||||
op.Write( Board );
|
||||
|
||||
op.Write( m_Name );
|
||||
op.Write( Name );
|
||||
|
||||
op.WriteEncodedInt( m_Color );
|
||||
op.WriteEncodedInt( Color );
|
||||
|
||||
op.Write( m_Flag );
|
||||
op.Write( m_Origin );
|
||||
op.Write( Flag );
|
||||
op.Write( Origin );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -759,56 +707,48 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class CTFController : EventController
|
||||
{
|
||||
private CTFTeamInfo[] m_TeamInfo;
|
||||
|
||||
private TimeSpan m_Duration;
|
||||
|
||||
public CTFTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public CTFTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team1 { get => m_TeamInfo[0];
|
||||
public CTFTeamInfo Team1 { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team2 { get => m_TeamInfo[1];
|
||||
public CTFTeamInfo Team2 { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team3 { get => m_TeamInfo[2];
|
||||
public CTFTeamInfo Team3 { get => TeamInfo[2];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team4 { get => m_TeamInfo[3];
|
||||
public CTFTeamInfo Team4 { get => TeamInfo[3];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team5 { get => m_TeamInfo[4];
|
||||
public CTFTeamInfo Team5 { get => TeamInfo[4];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team6 { get => m_TeamInfo[5];
|
||||
public CTFTeamInfo Team6 { get => TeamInfo[5];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team7 { get => m_TeamInfo[6];
|
||||
public CTFTeamInfo Team7 { get => TeamInfo[6];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public CTFTeamInfo Team8 { get => m_TeamInfo[7];
|
||||
public CTFTeamInfo Team8 { get => TeamInfo[7];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
public override string Title => "CTF";
|
||||
|
||||
public override string GetTeamName( int teamID )
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct( DuelContext context )
|
||||
|
|
@ -822,12 +762,12 @@ namespace Server.Engines.ConPVP
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
m_TeamInfo = new CTFTeamInfo[8];
|
||||
TeamInfo = new CTFTeamInfo[8];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new CTFTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new CTFTeamInfo( i );
|
||||
}
|
||||
|
||||
public CTFController( Serial serial )
|
||||
|
|
@ -841,12 +781,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 2 );
|
||||
|
||||
writer.Write( m_Duration );
|
||||
writer.Write( Duration );
|
||||
|
||||
writer.WriteEncodedInt( m_TeamInfo.Length );
|
||||
writer.WriteEncodedInt( TeamInfo.Length );
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i].Serialize( writer );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -859,32 +799,32 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()];
|
||||
TeamInfo = new CTFTeamInfo[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new CTFTeamInfo( i, reader );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new CTFTeamInfo( i, reader );
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_TeamInfo = new CTFTeamInfo[8];
|
||||
TeamInfo = new CTFTeamInfo[8];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new CTFTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new CTFTeamInfo( i );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version < 2 )
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -896,9 +836,7 @@ namespace Server.Engines.ConPVP
|
|||
TileData.ItemTable[i].Flags |= TileFlag.NoShoot;
|
||||
}
|
||||
|
||||
private CTFController m_Controller;
|
||||
|
||||
public CTFController Controller => m_Controller;
|
||||
public CTFController Controller { get; }
|
||||
|
||||
public void Alert( string text )
|
||||
{
|
||||
|
|
@ -923,7 +861,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public CTFGame( CTFController controller, DuelContext context ) : base( context )
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -933,7 +871,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Context.Arena != null )
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -942,7 +880,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID( mob );
|
||||
|
||||
if ( teamID >= 0 )
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1052,15 +990,15 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob.InRange( teamInfo.Origin, 24 ) && mob.Map == Facet )
|
||||
playerInfo.Score += 1; // fragged in base -- guarding
|
||||
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
if ( m_Controller.TeamInfo[i] == teamInfo )
|
||||
if ( Controller.TeamInfo[i] == teamInfo )
|
||||
continue;
|
||||
|
||||
Mobile ourFlagCarrier = null;
|
||||
|
||||
if ( m_Controller.TeamInfo[i].Flag != null )
|
||||
ourFlagCarrier = m_Controller.TeamInfo[i].Flag.RootParent as Mobile;
|
||||
if ( Controller.TeamInfo[i].Flag != null )
|
||||
ourFlagCarrier = Controller.TeamInfo[i].Flag.RootParent as Mobile;
|
||||
|
||||
if ( ourFlagCarrier != null && GetTeamInfo( ourFlagCarrier ) == teamInfo )
|
||||
{
|
||||
|
|
@ -1094,20 +1032,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStart()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
CTFTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % 8].Color );
|
||||
ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % 8].Color );
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback );
|
||||
m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback );
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -1116,7 +1054,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i % 8];
|
||||
CTFTeamInfo teamInfo = Controller.TeamInfo[i % 8];
|
||||
|
||||
if ( teamInfo?.Flag == null )
|
||||
continue;
|
||||
|
|
@ -1163,8 +1101,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Controller != null )
|
||||
sb.Append( ' ' ).Append( m_Controller.Title );
|
||||
if ( Controller != null )
|
||||
sb.Append( ' ' ).Append( Controller.Title );
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -1277,9 +1215,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
CTFTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
CTFTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
if ( teamInfo.Flag != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -223,16 +223,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private DDTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
public string Name => m_Player.Name;
|
||||
public string Name => Player.Name;
|
||||
|
||||
public int Kills
|
||||
{
|
||||
|
|
@ -270,64 +268,31 @@ namespace Server.Engines.ConPVP
|
|||
public DDPlayerInfo( DDTeamInfo teamInfo, Mobile player )
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
}
|
||||
|
||||
[PropertyObject]
|
||||
public sealed class DDTeamInfo : IRankedCTF
|
||||
{
|
||||
private DDGame m_Game;
|
||||
private int m_TeamID;
|
||||
public string Name => $"{TeamName} Team";
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
public DDGame Game { get; set; }
|
||||
|
||||
private DDBoard m_Board;
|
||||
public int TeamID { get; }
|
||||
|
||||
private Point3D m_Origin;
|
||||
public int Kills { get; set; }
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
public int Captures { get; set; }
|
||||
|
||||
private int m_Score;
|
||||
public int Score { get; set; }
|
||||
|
||||
private Dictionary<Mobile, DDPlayerInfo> m_Players;
|
||||
|
||||
public string Name => $"{m_Name} Team";
|
||||
|
||||
public DDGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
|
||||
private DDPlayerInfo m_Leader;
|
||||
|
||||
public DDPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public DDPlayerInfo Leader { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDBoard Board
|
||||
{
|
||||
get => m_Board;
|
||||
set => m_Board = value;
|
||||
}
|
||||
public DDBoard Board { get; set; }
|
||||
|
||||
public Dictionary<Mobile, DDPlayerInfo> Players => m_Players;
|
||||
public Dictionary<Mobile, DDPlayerInfo> Players { get; }
|
||||
|
||||
public DDPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -336,59 +301,47 @@ namespace Server.Engines.ConPVP
|
|||
if ( mob == null )
|
||||
return null;
|
||||
|
||||
if (!m_Players.TryGetValue( mob, out DDPlayerInfo val ))
|
||||
m_Players[mob] = val = new DDPlayerInfo( this, mob );
|
||||
if (!Players.TryGetValue( mob, out DDPlayerInfo val ))
|
||||
Players[mob] = val = new DDPlayerInfo( this, mob );
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TeamName
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
public string TeamName { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Origin
|
||||
{
|
||||
get => m_Origin;
|
||||
set => m_Origin = value;
|
||||
}
|
||||
public Point3D Origin { get; set; }
|
||||
|
||||
public DDTeamInfo( int teamID )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
|
||||
m_Score = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
|
||||
if ( m_Board != null )
|
||||
m_Board.m_TeamInfo = this;
|
||||
if ( Board != null )
|
||||
Board.m_TeamInfo = this;
|
||||
}
|
||||
|
||||
public DDTeamInfo( int teamID, GenericReader ip )
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
TeamID = teamID;
|
||||
Players = new Dictionary<Mobile, DDPlayerInfo>();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -396,10 +349,10 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Board = ip.ReadItem() as DDBoard;
|
||||
m_Name = ip.ReadString();
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
m_Origin = ip.ReadPoint3D();
|
||||
Board = ip.ReadItem() as DDBoard;
|
||||
TeamName = ip.ReadString();
|
||||
Color = ip.ReadEncodedInt();
|
||||
Origin = ip.ReadPoint3D();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -409,10 +362,10 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt( 0 ); // version
|
||||
|
||||
op.Write( m_Board );
|
||||
op.Write( m_Name );
|
||||
op.WriteEncodedInt( m_Color );
|
||||
op.Write( m_Origin );
|
||||
op.Write( Board );
|
||||
op.Write( TeamName );
|
||||
op.WriteEncodedInt( Color );
|
||||
op.Write( Origin );
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
|
|
@ -423,44 +376,30 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class DDController : EventController
|
||||
{
|
||||
private DDTeamInfo[] m_TeamInfo;
|
||||
|
||||
private TimeSpan m_Duration;
|
||||
|
||||
public DDTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public DDTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDTeamInfo Team1 { get => m_TeamInfo[0];
|
||||
public DDTeamInfo Team1 { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDTeamInfo Team2 { get => m_TeamInfo[1];
|
||||
public DDTeamInfo Team2 { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDWayPoint PointA { get => m_PointA;
|
||||
set => m_PointA = value;
|
||||
}
|
||||
public DDWayPoint PointA { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DDWayPoint PointB { get => m_PointB;
|
||||
set => m_PointB = value;
|
||||
}
|
||||
|
||||
private DDWayPoint m_PointA, m_PointB;
|
||||
public DDWayPoint PointB { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
public override string Title => "DoubleDom";
|
||||
|
||||
public override string GetTeamName( int teamID )
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct( DuelContext context )
|
||||
|
|
@ -476,12 +415,12 @@ namespace Server.Engines.ConPVP
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
Duration = TimeSpan.FromMinutes( 30.0 );
|
||||
|
||||
m_TeamInfo = new DDTeamInfo[2];
|
||||
TeamInfo = new DDTeamInfo[2];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new DDTeamInfo( i );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new DDTeamInfo( i );
|
||||
}
|
||||
|
||||
public DDController( Serial serial )
|
||||
|
|
@ -495,15 +434,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int)0 );
|
||||
|
||||
writer.Write( m_Duration );
|
||||
writer.Write( Duration );
|
||||
|
||||
writer.WriteEncodedInt( m_TeamInfo.Length );
|
||||
writer.WriteEncodedInt( TeamInfo.Length );
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i].Serialize( writer );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i].Serialize( writer );
|
||||
|
||||
writer.Write( m_PointA );
|
||||
writer.Write( m_PointB );
|
||||
writer.Write( PointA );
|
||||
writer.Write( PointB );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -516,14 +455,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
m_TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];
|
||||
Duration = reader.ReadTimeSpan();
|
||||
TeamInfo = new DDTeamInfo[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_TeamInfo.Length; ++i )
|
||||
m_TeamInfo[i] = new DDTeamInfo( i, reader );
|
||||
for ( int i = 0; i < TeamInfo.Length; ++i )
|
||||
TeamInfo[i] = new DDTeamInfo( i, reader );
|
||||
|
||||
m_PointA = reader.ReadItem() as DDWayPoint;
|
||||
m_PointB = reader.ReadItem() as DDWayPoint;
|
||||
PointA = reader.ReadItem() as DDWayPoint;
|
||||
PointB = reader.ReadItem() as DDWayPoint;
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -533,9 +472,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class DDGame : EventGame
|
||||
{
|
||||
private DDController m_Controller;
|
||||
|
||||
public DDController Controller => m_Controller;
|
||||
public DDController Controller { get; }
|
||||
|
||||
public void Alert( string text )
|
||||
{
|
||||
|
|
@ -560,7 +497,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public DDGame( DDController controller, DuelContext context ) : base( context )
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -570,7 +507,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( m_Context.Arena != null )
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -579,7 +516,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID( mob );
|
||||
|
||||
if ( teamID >= 0 )
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -706,25 +643,25 @@ namespace Server.Engines.ConPVP
|
|||
m_UncaptureTimer = null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
DDTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
DDTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.Game = this;
|
||||
if ( Controller.PointA != null )
|
||||
Controller.PointA.Game = this;
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.Game = this;
|
||||
if ( Controller.PointB != null )
|
||||
Controller.PointB.Game = this;
|
||||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
ApplyHues( m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color );
|
||||
ApplyHues( m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color );
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
m_FinishTimer = Timer.DelayCall( m_Controller.Duration, Finish_Callback );
|
||||
m_FinishTimer = Timer.DelayCall( Controller.Duration, Finish_Callback );
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -733,7 +670,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for ( int i = 0; i < m_Context.Participants.Count; ++i )
|
||||
{
|
||||
DDTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length];
|
||||
DDTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length];
|
||||
|
||||
if ( teamInfo != null )
|
||||
teams.Add( teamInfo );
|
||||
|
|
@ -775,8 +712,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if ( m_Controller != null )
|
||||
sb.Append( ' ' ).Append( m_Controller.Title );
|
||||
if ( Controller != null )
|
||||
sb.Append( ' ' ).Append( Controller.Title );
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -889,9 +826,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for ( int i = 0; i < m_Controller.TeamInfo.Length; ++i )
|
||||
for ( int i = 0; i < Controller.TeamInfo.Length; ++i )
|
||||
{
|
||||
DDTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
DDTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
if ( teamInfo.Board != null )
|
||||
teamInfo.Board.m_TeamInfo = null;
|
||||
|
|
@ -899,11 +836,11 @@ namespace Server.Engines.ConPVP
|
|||
teamInfo.Game = null;
|
||||
}
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
m_Controller.PointA.Game = null;
|
||||
if ( Controller.PointA != null )
|
||||
Controller.PointA.Game = null;
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
m_Controller.PointB.Game = null;
|
||||
if ( Controller.PointB != null )
|
||||
Controller.PointB.Game = null;
|
||||
|
||||
m_Capturable = false;
|
||||
|
||||
|
|
@ -936,21 +873,21 @@ namespace Server.Engines.ConPVP
|
|||
if ( point == null || from == null || team == null || !m_Capturable )
|
||||
return;
|
||||
|
||||
bool wasDom = ( m_Controller.PointA != null && m_Controller.PointB != null &&
|
||||
m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null );
|
||||
bool wasDom = ( Controller.PointA != null && Controller.PointB != null &&
|
||||
Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null );
|
||||
|
||||
point.TeamOwner = team;
|
||||
Alert( "{0} has captured {1}!", team.Name, point.Name );
|
||||
|
||||
bool isDom = ( m_Controller.PointA != null && m_Controller.PointB != null &&
|
||||
m_Controller.PointA.TeamOwner == m_Controller.PointB.TeamOwner && m_Controller.PointA.TeamOwner != null );
|
||||
bool isDom = ( Controller.PointA != null && Controller.PointB != null &&
|
||||
Controller.PointA.TeamOwner == Controller.PointB.TeamOwner && Controller.PointA.TeamOwner != null );
|
||||
|
||||
if ( wasDom && !isDom )
|
||||
{
|
||||
Alert( "Domination averted!" );
|
||||
|
||||
m_Controller.PointA?.SetNonCaptureHue();
|
||||
m_Controller.PointB?.SetNonCaptureHue();
|
||||
Controller.PointA?.SetNonCaptureHue();
|
||||
Controller.PointB?.SetNonCaptureHue();
|
||||
m_CaptureTimer?.Stop();
|
||||
m_CaptureTimer = null;
|
||||
}
|
||||
|
|
@ -967,10 +904,10 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
DDTeamInfo team = null;
|
||||
|
||||
if ( m_Controller.PointA?.TeamOwner != null )
|
||||
team = m_Controller.PointA.TeamOwner;
|
||||
else if ( m_Controller.PointB?.TeamOwner != null )
|
||||
team = m_Controller.PointB.TeamOwner;
|
||||
if ( Controller.PointA?.TeamOwner != null )
|
||||
team = Controller.PointA.TeamOwner;
|
||||
else if ( Controller.PointB?.TeamOwner != null )
|
||||
team = Controller.PointB.TeamOwner;
|
||||
|
||||
if ( team == null )
|
||||
{
|
||||
|
|
@ -984,8 +921,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Alert( "{0} is dominating... {1}", team.Name, 10 - m_CapStage );
|
||||
|
||||
m_Controller.PointA?.SetCaptureHue( m_CapStage );
|
||||
m_Controller.PointB?.SetCaptureHue( m_CapStage );
|
||||
Controller.PointA?.SetCaptureHue( m_CapStage );
|
||||
Controller.PointB?.SetCaptureHue( m_CapStage );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -999,16 +936,16 @@ namespace Server.Engines.ConPVP
|
|||
m_CaptureTimer.Stop();
|
||||
m_CaptureTimer = null;
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
if ( Controller.PointA != null )
|
||||
{
|
||||
m_Controller.PointA.TeamOwner = null;
|
||||
m_Controller.PointA.SetUncapturableHue();
|
||||
Controller.PointA.TeamOwner = null;
|
||||
Controller.PointA.SetUncapturableHue();
|
||||
}
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
if ( Controller.PointB != null )
|
||||
{
|
||||
m_Controller.PointB.TeamOwner = null;
|
||||
m_Controller.PointB.SetUncapturableHue();
|
||||
Controller.PointB.TeamOwner = null;
|
||||
Controller.PointB.SetUncapturableHue();
|
||||
}
|
||||
|
||||
m_UncaptureTimer = Timer.DelayCall( TimeSpan.FromSeconds( 30.0 ), UncaptureTick );
|
||||
|
|
@ -1032,16 +969,16 @@ namespace Server.Engines.ConPVP
|
|||
m_UncaptureTimer = null;
|
||||
}
|
||||
|
||||
if ( m_Controller.PointA != null )
|
||||
if ( Controller.PointA != null )
|
||||
{
|
||||
m_Controller.PointA.TeamOwner = null;
|
||||
m_Controller.PointA.SetNonCaptureHue();
|
||||
Controller.PointA.TeamOwner = null;
|
||||
Controller.PointA.SetNonCaptureHue();
|
||||
}
|
||||
|
||||
if ( m_Controller.PointB != null )
|
||||
if ( Controller.PointB != null )
|
||||
{
|
||||
m_Controller.PointB.TeamOwner = null;
|
||||
m_Controller.PointB.SetNonCaptureHue();
|
||||
Controller.PointB.TeamOwner = null;
|
||||
Controller.PointB.SetNonCaptureHue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,18 +11,16 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class HillOfTheKing : Item
|
||||
{
|
||||
private int m_ScoreInterval;
|
||||
private KHGame m_Game;
|
||||
private Mobile m_King;
|
||||
private KingTimer m_KingTimer;
|
||||
private KHGame m_Game;
|
||||
private KingTimer m_KingTimer;
|
||||
|
||||
[Constructible]
|
||||
public HillOfTheKing()
|
||||
: base(0x520)
|
||||
{
|
||||
m_ScoreInterval = 10;
|
||||
ScoreInterval = 10;
|
||||
m_Game = null;
|
||||
m_King = null;
|
||||
King = null;
|
||||
Movable = false;
|
||||
|
||||
Name = "the hill";
|
||||
|
|
@ -43,7 +41,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_ScoreInterval = reader.ReadEncodedInt();
|
||||
ScoreInterval = reader.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -55,10 +53,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.WriteEncodedInt(m_ScoreInterval);
|
||||
writer.WriteEncodedInt(ScoreInterval);
|
||||
}
|
||||
|
||||
public Mobile King => m_King;
|
||||
public Mobile King { get; private set; }
|
||||
|
||||
public KHGame Game
|
||||
{
|
||||
|
|
@ -69,17 +67,15 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_KingTimer?.Stop();
|
||||
m_Game = value;
|
||||
m_King = null;
|
||||
King = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ScoreInterval { get => m_ScoreInterval;
|
||||
set => m_ScoreInterval = value;
|
||||
}
|
||||
public int ScoreInterval { get; set; }
|
||||
|
||||
public int CapturesSoFar
|
||||
public int CapturesSoFar
|
||||
{
|
||||
get
|
||||
{
|
||||
|
|
@ -100,7 +96,7 @@ namespace Server.Engines.ConPVP
|
|||
return false;
|
||||
|
||||
// Not current king (or they are the current king)
|
||||
if (m_King != null && m_King != m)
|
||||
if (King != null && King != m)
|
||||
return false;
|
||||
|
||||
// They are on a team
|
||||
|
|
@ -137,7 +133,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (base.OnMoveOff(m))
|
||||
{
|
||||
if (m_King == m)
|
||||
if (King == m)
|
||||
DeKingify();
|
||||
|
||||
return true;
|
||||
|
|
@ -169,7 +165,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
m_KingTimer?.Stop();
|
||||
|
||||
m_King = null;
|
||||
King = null;
|
||||
}
|
||||
|
||||
private void ReKingify(Mobile m)
|
||||
|
|
@ -182,30 +178,29 @@ namespace Server.Engines.ConPVP
|
|||
if (ti == null)
|
||||
return;
|
||||
|
||||
m_King = m;
|
||||
King = m;
|
||||
|
||||
if (m_KingTimer == null)
|
||||
m_KingTimer = new KingTimer(this);
|
||||
m_KingTimer.Stop();
|
||||
m_KingTimer.StartHillTicker();
|
||||
|
||||
if (m_King.Name != null)
|
||||
PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {m_King.Name}!");
|
||||
if (King.Name != null)
|
||||
PublicOverheadMessage(MessageType.Regular, 0x0481, false, $"Taken by {King.Name}!");
|
||||
}
|
||||
|
||||
private class KingTimer : Timer
|
||||
{
|
||||
private HillOfTheKing m_Hill;
|
||||
private int m_Total;
|
||||
private int m_Counter;
|
||||
private int m_Counter;
|
||||
|
||||
public int Captures => m_Total;
|
||||
public int Captures { get; private set; }
|
||||
|
||||
public KingTimer(HillOfTheKing hill)
|
||||
public KingTimer(HillOfTheKing hill)
|
||||
: base(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0))
|
||||
{
|
||||
m_Hill = hill;
|
||||
m_Total = 0;
|
||||
Captures = 0;
|
||||
m_Counter = 0;
|
||||
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
|
|
@ -213,7 +208,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void StartHillTicker()
|
||||
{
|
||||
m_Total = 0;
|
||||
Captures = 0;
|
||||
m_Counter = 0;
|
||||
|
||||
Start();
|
||||
|
|
@ -268,7 +263,7 @@ namespace Server.Engines.ConPVP
|
|||
m_Hill.PublicOverheadMessage(MessageType.Regular, 0x0481, false, "Capture!");
|
||||
|
||||
pi.Captures++;
|
||||
m_Total++;
|
||||
Captures++;
|
||||
|
||||
pi.Score += m_Counter;
|
||||
|
||||
|
|
@ -512,21 +507,19 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
private KHTeamInfo m_TeamInfo;
|
||||
|
||||
private Mobile m_Player;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
private int m_Score;
|
||||
|
||||
public KHPlayerInfo(KHTeamInfo teamInfo, Mobile player)
|
||||
{
|
||||
m_TeamInfo = teamInfo;
|
||||
m_Player = player;
|
||||
Player = player;
|
||||
}
|
||||
|
||||
public Mobile Player => m_Player;
|
||||
public Mobile Player { get; }
|
||||
|
||||
public int CompareTo(object obj)
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
KHPlayerInfo pi = (KHPlayerInfo)obj;
|
||||
int res = pi.Score.CompareTo(Score);
|
||||
|
|
@ -544,9 +537,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
if (m_Player?.Name == null)
|
||||
if (Player?.Name == null)
|
||||
return "";
|
||||
return m_Player.Name;
|
||||
return Player.Name;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -587,20 +580,7 @@ namespace Server.Engines.ConPVP
|
|||
[PropertyObject]
|
||||
public sealed class KHTeamInfo : IRankedCTF, IComparable
|
||||
{
|
||||
private KHGame m_Game;
|
||||
private int m_TeamID;
|
||||
|
||||
private int m_Color;
|
||||
private string m_Name;
|
||||
|
||||
private int m_Kills;
|
||||
private int m_Captures;
|
||||
|
||||
private int m_Score;
|
||||
|
||||
private Hashtable m_Players;
|
||||
|
||||
public int CompareTo(object obj)
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
KHTeamInfo ti = (KHTeamInfo)obj;
|
||||
int res = ti.Score.CompareTo(Score);
|
||||
|
|
@ -618,36 +598,25 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
if (m_Name == null)
|
||||
if (TeamName == null)
|
||||
return "(null) Team";
|
||||
return $"{m_Name} Team";
|
||||
return $"{TeamName} Team";
|
||||
}
|
||||
}
|
||||
|
||||
public KHGame Game { get => m_Game;
|
||||
set => m_Game = value;
|
||||
}
|
||||
public int TeamID => m_TeamID;
|
||||
public KHGame Game { get; set; }
|
||||
|
||||
public int Kills { get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Captures { get => m_Captures;
|
||||
set => m_Captures = value;
|
||||
}
|
||||
public int Score { get => m_Score;
|
||||
set => m_Score = value;
|
||||
}
|
||||
public int TeamID { get; }
|
||||
|
||||
private KHPlayerInfo m_Leader;
|
||||
public int Kills { get; set; }
|
||||
|
||||
public KHPlayerInfo Leader
|
||||
{
|
||||
get => m_Leader;
|
||||
set => m_Leader = value;
|
||||
}
|
||||
public int Captures { get; set; }
|
||||
|
||||
public Hashtable Players => m_Players;
|
||||
public int Score { get; set; }
|
||||
|
||||
public KHPlayerInfo Leader { get; set; }
|
||||
|
||||
public Hashtable Players { get; }
|
||||
|
||||
public KHPlayerInfo this[Mobile mob]
|
||||
{
|
||||
|
|
@ -656,48 +625,40 @@ namespace Server.Engines.ConPVP
|
|||
if (mob == null)
|
||||
return null;
|
||||
|
||||
if (!(m_Players[mob] is KHPlayerInfo val))
|
||||
m_Players[mob] = val = new KHPlayerInfo(this, mob);
|
||||
if (!(Players[mob] is KHPlayerInfo val))
|
||||
Players[mob] = val = new KHPlayerInfo(this, mob);
|
||||
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Color
|
||||
{
|
||||
get => m_Color;
|
||||
set => m_Color = value;
|
||||
}
|
||||
public int Color { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string TeamName
|
||||
{
|
||||
get => m_Name;
|
||||
set => m_Name = value;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string TeamName { get; set; }
|
||||
|
||||
public KHTeamInfo(int teamID)
|
||||
public KHTeamInfo(int teamID)
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
m_Kills = 0;
|
||||
m_Captures = 0;
|
||||
m_Score = 0;
|
||||
Kills = 0;
|
||||
Captures = 0;
|
||||
Score = 0;
|
||||
|
||||
m_Leader = null;
|
||||
Leader = null;
|
||||
|
||||
m_Players.Clear();
|
||||
Players.Clear();
|
||||
}
|
||||
|
||||
public KHTeamInfo(int teamID, GenericReader ip)
|
||||
{
|
||||
m_TeamID = teamID;
|
||||
m_Players = new Hashtable();
|
||||
TeamID = teamID;
|
||||
Players = new Hashtable();
|
||||
|
||||
int version = ip.ReadEncodedInt();
|
||||
|
||||
|
|
@ -705,8 +666,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Name = ip.ReadString();
|
||||
m_Color = ip.ReadEncodedInt();
|
||||
TeamName = ip.ReadString();
|
||||
Color = ip.ReadEncodedInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -716,13 +677,13 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
op.WriteEncodedInt(0); // version
|
||||
|
||||
op.Write(m_Name);
|
||||
op.WriteEncodedInt(m_Color);
|
||||
op.Write(TeamName);
|
||||
op.WriteEncodedInt(Color);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
if (m_Name != null)
|
||||
if (TeamName != null)
|
||||
return $"({Name}) ...";
|
||||
return "...";
|
||||
}
|
||||
|
|
@ -730,82 +691,74 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class KHController : EventController
|
||||
{
|
||||
private KHTeamInfo[] m_TeamInfo;
|
||||
private HillOfTheKing[] m_Hills;
|
||||
private ArrayList m_Boards;
|
||||
private TimeSpan m_Duration;
|
||||
private int m_ScoreInterval;
|
||||
private int m_ScoreInterval;
|
||||
|
||||
public KHTeamInfo[] TeamInfo => m_TeamInfo;
|
||||
public KHTeamInfo[] TeamInfo { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team1_W { get => m_TeamInfo[0];
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team1_W { get => TeamInfo[0];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team2_E { get => m_TeamInfo[1];
|
||||
public KHTeamInfo Team2_E { get => TeamInfo[1];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team3_N { get => m_TeamInfo[2];
|
||||
public KHTeamInfo Team3_N { get => TeamInfo[2];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team4_S { get => m_TeamInfo[3];
|
||||
public KHTeamInfo Team4_S { get => TeamInfo[3];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team5_NW { get => m_TeamInfo[4];
|
||||
public KHTeamInfo Team5_NW { get => TeamInfo[4];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team6_SE { get => m_TeamInfo[5];
|
||||
public KHTeamInfo Team6_SE { get => TeamInfo[5];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team7_SW { get => m_TeamInfo[6];
|
||||
public KHTeamInfo Team7_SW { get => TeamInfo[6];
|
||||
set { } }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public KHTeamInfo Team8_NE { get => m_TeamInfo[7];
|
||||
public KHTeamInfo Team8_NE { get => TeamInfo[7];
|
||||
set { } }
|
||||
|
||||
public HillOfTheKing[] Hills => m_Hills;
|
||||
public HillOfTheKing[] Hills { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill1 { get => m_Hills[0];
|
||||
set => m_Hills[0] = value;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill1 { get => Hills[0];
|
||||
set => Hills[0] = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill2 { get => m_Hills[1];
|
||||
set => m_Hills[1] = value;
|
||||
public HillOfTheKing Hill2 { get => Hills[1];
|
||||
set => Hills[1] = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill3 { get => m_Hills[2];
|
||||
set => m_Hills[2] = value;
|
||||
public HillOfTheKing Hill3 { get => Hills[2];
|
||||
set => Hills[2] = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HillOfTheKing Hill4 { get => m_Hills[3];
|
||||
set => m_Hills[3] = value;
|
||||
public HillOfTheKing Hill4 { get => Hills[3];
|
||||
set => Hills[3] = value;
|
||||
}
|
||||
|
||||
public ArrayList Boards => m_Boards;
|
||||
public ArrayList Boards { get; private set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan Duration
|
||||
{
|
||||
get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan Duration { get; set; }
|
||||
|
||||
public override string Title => "King of the Hill";
|
||||
public override string Title => "King of the Hill";
|
||||
|
||||
public override string GetTeamName(int teamID)
|
||||
{
|
||||
return m_TeamInfo[teamID % m_TeamInfo.Length].Name;
|
||||
return TeamInfo[teamID % TeamInfo.Length].Name;
|
||||
}
|
||||
|
||||
public override EventGame Construct(DuelContext context)
|
||||
|
|
@ -817,7 +770,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
if (b != null)
|
||||
{
|
||||
m_Boards.Remove(b);
|
||||
Boards.Remove(b);
|
||||
b.m_Game = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -825,7 +778,7 @@ namespace Server.Engines.ConPVP
|
|||
public void AddBoard(KHBoard b)
|
||||
{
|
||||
if (b != null)
|
||||
m_Boards.Add(b);
|
||||
Boards.Add(b);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
|
|
@ -836,13 +789,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
Name = "King of the Hill Controller";
|
||||
|
||||
m_Duration = TimeSpan.FromMinutes(30.0);
|
||||
m_Boards = new ArrayList();
|
||||
m_Hills = new HillOfTheKing[4];
|
||||
m_TeamInfo = new KHTeamInfo[8];
|
||||
Duration = TimeSpan.FromMinutes(30.0);
|
||||
Boards = new ArrayList();
|
||||
Hills = new HillOfTheKing[4];
|
||||
TeamInfo = new KHTeamInfo[8];
|
||||
|
||||
for (int i = 0; i < m_TeamInfo.Length; ++i)
|
||||
m_TeamInfo[i] = new KHTeamInfo(i);
|
||||
for (int i = 0; i < TeamInfo.Length; ++i)
|
||||
TeamInfo[i] = new KHTeamInfo(i);
|
||||
}
|
||||
|
||||
public KHController(Serial serial)
|
||||
|
|
@ -857,17 +810,17 @@ namespace Server.Engines.ConPVP
|
|||
writer.Write((int)0);
|
||||
|
||||
writer.WriteEncodedInt(m_ScoreInterval);
|
||||
writer.Write(m_Duration);
|
||||
writer.Write(Duration);
|
||||
|
||||
writer.WriteItemList(m_Boards, true);
|
||||
writer.WriteItemList(Boards, true);
|
||||
|
||||
writer.WriteEncodedInt(m_Hills.Length);
|
||||
for (int i = 0; i < m_Hills.Length; ++i)
|
||||
writer.Write(m_Hills[i]);
|
||||
writer.WriteEncodedInt(Hills.Length);
|
||||
for (int i = 0; i < Hills.Length; ++i)
|
||||
writer.Write(Hills[i]);
|
||||
|
||||
writer.WriteEncodedInt(m_TeamInfo.Length);
|
||||
for (int i = 0; i < m_TeamInfo.Length; ++i)
|
||||
m_TeamInfo[i].Serialize(writer);
|
||||
writer.WriteEncodedInt(TeamInfo.Length);
|
||||
for (int i = 0; i < TeamInfo.Length; ++i)
|
||||
TeamInfo[i].Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -882,17 +835,17 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
m_ScoreInterval = reader.ReadEncodedInt();
|
||||
|
||||
m_Duration = reader.ReadTimeSpan();
|
||||
Duration = reader.ReadTimeSpan();
|
||||
|
||||
m_Boards = reader.ReadItemList();
|
||||
Boards = reader.ReadItemList();
|
||||
|
||||
m_Hills = new HillOfTheKing[reader.ReadEncodedInt()];
|
||||
for (int i = 0; i < m_Hills.Length; ++i)
|
||||
m_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;
|
||||
|
||||
m_TeamInfo = new KHTeamInfo[reader.ReadEncodedInt()];
|
||||
for (int i = 0; i < m_TeamInfo.Length; ++i)
|
||||
m_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;
|
||||
}
|
||||
|
|
@ -902,17 +855,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public sealed class KHGame : EventGame
|
||||
{
|
||||
private KHController m_Controller;
|
||||
public KHController Controller { get; }
|
||||
|
||||
public KHController Controller => m_Controller;
|
||||
|
||||
public override bool CantDoAnything(Mobile mob)
|
||||
public override bool CantDoAnything(Mobile mob)
|
||||
{
|
||||
if (mob != null && GetTeamInfo(mob) != null && m_Controller != null)
|
||||
if (mob != null && GetTeamInfo(mob) != null && Controller != null)
|
||||
{
|
||||
for (int i = 0; i < m_Controller.Hills.Length; i++)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
{
|
||||
if (m_Controller.Hills[i] != null && m_Controller.Hills[i].King == mob)
|
||||
if (Controller.Hills[i] != null && Controller.Hills[i].King == mob)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -944,7 +895,7 @@ namespace Server.Engines.ConPVP
|
|||
public KHGame(KHController controller, DuelContext context)
|
||||
: base(context)
|
||||
{
|
||||
m_Controller = controller;
|
||||
Controller = controller;
|
||||
}
|
||||
|
||||
public Map Facet
|
||||
|
|
@ -954,7 +905,7 @@ namespace Server.Engines.ConPVP
|
|||
if (m_Context?.Arena != null)
|
||||
return m_Context.Arena.Facet;
|
||||
|
||||
return m_Controller.Map;
|
||||
return Controller.Map;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -963,7 +914,7 @@ namespace Server.Engines.ConPVP
|
|||
int teamID = GetTeamID(mob);
|
||||
|
||||
if (teamID >= 0)
|
||||
return m_Controller.TeamInfo[teamID % m_Controller.TeamInfo.Length];
|
||||
return Controller.TeamInfo[teamID % Controller.TeamInfo.Length];
|
||||
|
||||
return null;
|
||||
}
|
||||
|
|
@ -1038,18 +989,18 @@ namespace Server.Engines.ConPVP
|
|||
if (killer != null && killer.Player)
|
||||
teamInfo = GetTeamInfo(killer);
|
||||
|
||||
for (int i = 0; i < m_Controller.Hills.Length; i++)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
{
|
||||
if (m_Controller.Hills[i] == null)
|
||||
if (Controller.Hills[i] == null)
|
||||
continue;
|
||||
|
||||
if (m_Controller.Hills[i].King == mob)
|
||||
if (Controller.Hills[i].King == mob)
|
||||
{
|
||||
bonus += m_Controller.Hills[i].CapturesSoFar;
|
||||
m_Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo);
|
||||
bonus += Controller.Hills[i].CapturesSoFar;
|
||||
Controller.Hills[i].OnKingDied(mob, victInfo, killer, teamInfo);
|
||||
}
|
||||
|
||||
if (m_Controller.Hills[i].King == killer)
|
||||
if (Controller.Hills[i].King == killer)
|
||||
bonus += 2;
|
||||
}
|
||||
|
||||
|
|
@ -1077,32 +1028,32 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStart()
|
||||
{
|
||||
for (int i = 0; i < m_Controller.TeamInfo.Length; ++i)
|
||||
for (int i = 0; i < Controller.TeamInfo.Length; ++i)
|
||||
{
|
||||
KHTeamInfo teamInfo = m_Controller.TeamInfo[i];
|
||||
KHTeamInfo teamInfo = Controller.TeamInfo[i];
|
||||
|
||||
teamInfo.Game = this;
|
||||
teamInfo.Reset();
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
ApplyHues(m_Context.Participants[i] as Participant, m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length].Color);
|
||||
ApplyHues(m_Context.Participants[i] as Participant, Controller.TeamInfo[i % Controller.TeamInfo.Length].Color);
|
||||
|
||||
m_FinishTimer?.Stop();
|
||||
|
||||
for (int i = 0; i < m_Controller.Hills.Length; i++)
|
||||
for (int i = 0; i < Controller.Hills.Length; i++)
|
||||
{
|
||||
if (m_Controller.Hills[i] != null)
|
||||
m_Controller.Hills[i].Game = this;
|
||||
if (Controller.Hills[i] != null)
|
||||
Controller.Hills[i].Game = this;
|
||||
}
|
||||
|
||||
foreach (KHBoard board in m_Controller.Boards)
|
||||
foreach (KHBoard board in Controller.Boards)
|
||||
{
|
||||
if (board != null && !board.Deleted)
|
||||
board.m_Game = this;
|
||||
}
|
||||
|
||||
m_FinishTimer = Timer.DelayCall(m_Controller.Duration, Finish_Callback);
|
||||
m_FinishTimer = Timer.DelayCall(Controller.Duration, Finish_Callback);
|
||||
}
|
||||
|
||||
private void Finish_Callback()
|
||||
|
|
@ -1111,7 +1062,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
for (int i = 0; i < m_Context.Participants.Count; ++i)
|
||||
{
|
||||
KHTeamInfo teamInfo = m_Controller.TeamInfo[i % m_Controller.TeamInfo.Length];
|
||||
KHTeamInfo teamInfo = Controller.TeamInfo[i % Controller.TeamInfo.Length];
|
||||
|
||||
if (teamInfo == null)
|
||||
continue;
|
||||
|
|
@ -1150,8 +1101,8 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
if (m_Controller != null)
|
||||
sb.Append(' ').Append(m_Controller.Title);
|
||||
if (Controller != null)
|
||||
sb.Append(' ').Append(Controller.Title);
|
||||
|
||||
string title = sb.ToString();
|
||||
|
||||
|
|
@ -1263,16 +1214,16 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnStop()
|
||||
{
|
||||
for (int i = 0; i < m_Controller.TeamInfo.Length; ++i)
|
||||
m_Controller.TeamInfo[i].Game = null;
|
||||
for (int i = 0; i < Controller.TeamInfo.Length; ++i)
|
||||
Controller.TeamInfo[i].Game = null;
|
||||
|
||||
for (int i = 0; i < m_Controller.Hills.Length; ++i)
|
||||
for (int i = 0; i < Controller.Hills.Length; ++i)
|
||||
{
|
||||
if (m_Controller.Hills[i] != null)
|
||||
m_Controller.Hills[i].Game = null;
|
||||
if (Controller.Hills[i] != null)
|
||||
Controller.Hills[i].Game = null;
|
||||
}
|
||||
|
||||
foreach (KHBoard board in m_Controller.Boards)
|
||||
foreach (KHBoard board in Controller.Boards)
|
||||
{
|
||||
if (board != null)
|
||||
board.m_Game = null;
|
||||
|
|
|
|||
|
|
@ -243,11 +243,7 @@ namespace Server.Engines.ConPVP
|
|||
return m_Table[mob] as LadderEntry;
|
||||
}
|
||||
|
||||
private static Ladder m_Instance;
|
||||
|
||||
public static Ladder Instance{ get => m_Instance;
|
||||
set => m_Instance = value;
|
||||
}
|
||||
public static Ladder Instance { get; set; }
|
||||
|
||||
public Ladder()
|
||||
{
|
||||
|
|
@ -311,40 +307,30 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class LadderEntry : IComparable
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private int m_Experience;
|
||||
private int m_Wins;
|
||||
private int m_Losses;
|
||||
private int m_Index;
|
||||
private Ladder m_Ladder;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Experience{ get => m_Experience;
|
||||
set{ m_Experience = value; m_Ladder.UpdateEntry(this); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Wins{ get => m_Wins;
|
||||
set => m_Wins = value;
|
||||
}
|
||||
public int Wins { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public int Losses{ get => m_Losses;
|
||||
set => m_Losses = value;
|
||||
}
|
||||
public int Losses { get; set; }
|
||||
|
||||
public int Index{ get => m_Index;
|
||||
set => m_Index = value;
|
||||
}
|
||||
public int Index { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Rank => m_Index;
|
||||
public int Rank => Index;
|
||||
|
||||
public LadderEntry( Mobile mob, Ladder ladder )
|
||||
{
|
||||
m_Ladder = ladder;
|
||||
m_Mobile = mob;
|
||||
Mobile = mob;
|
||||
}
|
||||
|
||||
public LadderEntry( GenericReader reader, Ladder ladder, int version )
|
||||
|
|
@ -356,10 +342,10 @@ namespace Server.Engines.ConPVP
|
|||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
m_Experience = reader.ReadEncodedInt();
|
||||
m_Wins = reader.ReadEncodedInt();
|
||||
m_Losses = reader.ReadEncodedInt();
|
||||
Wins = reader.ReadEncodedInt();
|
||||
Losses = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -368,10 +354,10 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
writer.WriteEncodedInt( (int) m_Experience );
|
||||
writer.WriteEncodedInt( (int) m_Wins );
|
||||
writer.WriteEncodedInt( (int) m_Losses );
|
||||
writer.WriteEncodedInt( (int) Wins );
|
||||
writer.WriteEncodedInt( (int) Losses );
|
||||
}
|
||||
|
||||
public int CompareTo( object obj )
|
||||
|
|
|
|||
|
|
@ -7,14 +7,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class LadderItem : Item
|
||||
{
|
||||
private LadderController m_Ladder;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public LadderController Ladder
|
||||
{
|
||||
get => m_Ladder;
|
||||
set => m_Ladder = value;
|
||||
}
|
||||
public LadderController Ladder { get; set; }
|
||||
|
||||
public override string DefaultName => "1v1 leaderboard";
|
||||
|
||||
|
|
@ -34,7 +28,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (Item) m_Ladder );
|
||||
writer.Write( (Item) Ladder );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -47,7 +41,7 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Ladder = reader.ReadItem() as LadderController;
|
||||
Ladder = reader.ReadItem() as LadderController;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,8 +53,8 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
Ladder ladder = Server.Engines.ConPVP.Ladder.Instance;
|
||||
|
||||
if ( m_Ladder != null )
|
||||
ladder = m_Ladder.Ladder;
|
||||
if ( Ladder != null )
|
||||
ladder = Ladder.Ladder;
|
||||
|
||||
if ( ladder != null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,31 +6,27 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class Participant
|
||||
{
|
||||
private DuelContext m_Context;
|
||||
private DuelPlayer[] m_Players;
|
||||
private TournyParticipant m_TournyPart;
|
||||
public int Count => Players.Length;
|
||||
public DuelPlayer[] Players { get; private set; }
|
||||
|
||||
public int Count => m_Players.Length;
|
||||
public DuelPlayer[] Players => m_Players;
|
||||
public DuelContext Context => m_Context;
|
||||
public TournyParticipant TournyPart{ get => m_TournyPart;
|
||||
set => m_TournyPart = value;
|
||||
}
|
||||
public DuelContext Context { get; }
|
||||
|
||||
public TournyParticipant TournyPart { get; set; }
|
||||
|
||||
public DuelPlayer Find( Mobile mob )
|
||||
{
|
||||
if ( mob is PlayerMobile pm )
|
||||
{
|
||||
if ( pm.DuelContext == m_Context && pm.DuelPlayer.Participant == this )
|
||||
if ( pm.DuelContext == Context && pm.DuelPlayer.Participant == this )
|
||||
return pm.DuelPlayer;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null && m_Players[i].Mobile == mob )
|
||||
return m_Players[i];
|
||||
if ( Players[i] != null && Players[i].Mobile == mob )
|
||||
return Players[i];
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -43,18 +39,18 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Broadcast( int hue, string message, string nonLocalOverhead, string localOverhead )
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null )
|
||||
if ( Players[i] != null )
|
||||
{
|
||||
if ( message != null )
|
||||
m_Players[i].Mobile.SendMessage( hue, message );
|
||||
Players[i].Mobile.SendMessage( hue, message );
|
||||
|
||||
if ( nonLocalOverhead != null )
|
||||
m_Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, string.Format( nonLocalOverhead, m_Players[i].Mobile.Name, m_Players[i].Mobile.Female ? "her" : "his" ) );
|
||||
Players[i].Mobile.NonlocalOverheadMessage( Network.MessageType.Regular, hue, false, string.Format( nonLocalOverhead, Players[i].Mobile.Name, Players[i].Mobile.Female ? "her" : "his" ) );
|
||||
|
||||
if ( localOverhead != null )
|
||||
m_Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead );
|
||||
Players[i].Mobile.LocalOverheadMessage( Network.MessageType.Regular, hue, false, localOverhead );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,9 +61,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
int count = 0;
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null )
|
||||
if ( Players[i] != null )
|
||||
++count;
|
||||
}
|
||||
|
||||
|
|
@ -79,9 +75,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
if ( Players[i] == null )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -93,9 +89,9 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] != null && !m_Players[i].Eliminated )
|
||||
if ( Players[i] != null && !Players[i].Eliminated )
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -109,12 +105,12 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
if ( Players[i] == null )
|
||||
continue;
|
||||
|
||||
Mobile mob = m_Players[i].Mobile;
|
||||
Mobile mob = Players[i].Mobile;
|
||||
|
||||
if ( sb.Length > 0 )
|
||||
sb.Append( ", " );
|
||||
|
|
@ -134,12 +130,12 @@ namespace Server.Engines.ConPVP
|
|||
if ( player == null )
|
||||
return;
|
||||
|
||||
int index = Array.IndexOf( m_Players, player );
|
||||
int index = Array.IndexOf( Players, player );
|
||||
|
||||
if ( index == -1 )
|
||||
return;
|
||||
|
||||
m_Players[index] = null;
|
||||
Players[index] = null;
|
||||
}
|
||||
|
||||
public void Remove( DuelPlayer player )
|
||||
|
|
@ -147,19 +143,19 @@ namespace Server.Engines.ConPVP
|
|||
if ( player == null )
|
||||
return;
|
||||
|
||||
int index = Array.IndexOf( m_Players, player );
|
||||
int index = Array.IndexOf( Players, player );
|
||||
|
||||
if ( index == -1 )
|
||||
return;
|
||||
|
||||
DuelPlayer[] old = m_Players;
|
||||
m_Players = new DuelPlayer[old.Length - 1];
|
||||
DuelPlayer[] old = Players;
|
||||
Players = new DuelPlayer[old.Length - 1];
|
||||
|
||||
for ( int i = 0; i < index; ++i )
|
||||
m_Players[i] = old[i];
|
||||
Players[i] = old[i];
|
||||
|
||||
for ( int i = index + 1; i < old.Length; ++i )
|
||||
m_Players[i - 1] = old[i];
|
||||
Players[i - 1] = old[i];
|
||||
}
|
||||
|
||||
public void Remove( Mobile player )
|
||||
|
|
@ -172,23 +168,23 @@ namespace Server.Engines.ConPVP
|
|||
if ( Contains( player ) )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < m_Players.Length; ++i )
|
||||
for ( int i = 0; i < Players.Length; ++i )
|
||||
{
|
||||
if ( m_Players[i] == null )
|
||||
if ( Players[i] == null )
|
||||
{
|
||||
m_Players[i] = new DuelPlayer( player, this );
|
||||
Players[i] = new DuelPlayer( player, this );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Resize( m_Players.Length + 1 );
|
||||
m_Players[m_Players.Length - 1] = new DuelPlayer( player, this );
|
||||
Resize( Players.Length + 1 );
|
||||
Players[Players.Length - 1] = new DuelPlayer( player, this );
|
||||
}
|
||||
|
||||
public void Resize( int count )
|
||||
{
|
||||
DuelPlayer[] old = m_Players;
|
||||
m_Players = new DuelPlayer[count];
|
||||
DuelPlayer[] old = Players;
|
||||
Players = new DuelPlayer[count];
|
||||
|
||||
if ( old != null )
|
||||
{
|
||||
|
|
@ -197,14 +193,14 @@ namespace Server.Engines.ConPVP
|
|||
for ( int i = 0; i < old.Length; ++i )
|
||||
{
|
||||
if ( old[i] != null && ct < count )
|
||||
m_Players[ct++] = old[i];
|
||||
Players[ct++] = old[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Participant( DuelContext context, int count )
|
||||
{
|
||||
m_Context = context;
|
||||
Context = context;
|
||||
//m_Stakes = new StakesContainer( context, this );
|
||||
Resize( count );
|
||||
}
|
||||
|
|
@ -212,25 +208,20 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class DuelPlayer
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private bool m_Eliminated;
|
||||
private bool m_Ready;
|
||||
private Participant m_Participant;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public bool Ready{ get => m_Ready;
|
||||
set => m_Ready = value;
|
||||
}
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public bool Ready { get; set; }
|
||||
|
||||
public bool Eliminated{ get => m_Eliminated;
|
||||
set{ m_Eliminated = value; if ( m_Participant.Context.m_Tournament != null && m_Eliminated ){ m_Participant.Context.m_Tournament.OnEliminated( this ); m_Mobile.SendEverything(); } } }
|
||||
public Participant Participant{ get => m_Participant;
|
||||
set => m_Participant = value;
|
||||
}
|
||||
set{ m_Eliminated = value; if ( Participant.Context.m_Tournament != null && m_Eliminated ){ Participant.Context.m_Tournament.OnEliminated( this ); Mobile.SendEverything(); } } }
|
||||
public Participant Participant { get; set; }
|
||||
|
||||
public DuelPlayer( Mobile mob, Participant p )
|
||||
{
|
||||
m_Mobile = mob;
|
||||
m_Participant = p;
|
||||
Mobile = mob;
|
||||
Participant = p;
|
||||
|
||||
if ( mob is PlayerMobile mobile )
|
||||
mobile.DuelPlayer = this;
|
||||
|
|
|
|||
|
|
@ -8,13 +8,11 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class ParticipantGump : Gump
|
||||
{
|
||||
private Mobile m_From;
|
||||
private DuelContext m_Context;
|
||||
private Participant m_Participant;
|
||||
public Mobile From { get; }
|
||||
|
||||
public Mobile From => m_From;
|
||||
public DuelContext Context => m_Context;
|
||||
public Participant Participant => m_Participant;
|
||||
public DuelContext Context { get; }
|
||||
|
||||
public Participant Participant { get; }
|
||||
|
||||
public string Center( string text )
|
||||
{
|
||||
|
|
@ -35,9 +33,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public ParticipantGump( Mobile from, DuelContext context, Participant p ) : base( 50, 50 )
|
||||
{
|
||||
m_From = from;
|
||||
m_Context = context;
|
||||
m_Participant = p;
|
||||
From = from;
|
||||
Context = context;
|
||||
Participant = p;
|
||||
|
||||
from.CloseGump( typeof( RulesetGump ) );
|
||||
from.CloseGump( typeof( DuelContextGump ) );
|
||||
|
|
@ -81,54 +79,54 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public override void OnResponse( NetState sender, RelayInfo info )
|
||||
{
|
||||
if ( !m_Context.Registered )
|
||||
if ( !Context.Registered )
|
||||
return;
|
||||
|
||||
int bid = info.ButtonID;
|
||||
|
||||
if ( bid == 0 )
|
||||
{
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
}
|
||||
else if ( bid == 1 )
|
||||
{
|
||||
if ( m_Participant.Count < 8 )
|
||||
m_Participant.Resize( m_Participant.Count + 1 );
|
||||
if ( Participant.Count < 8 )
|
||||
Participant.Resize( Participant.Count + 1 );
|
||||
else
|
||||
m_From.SendMessage( "You may not raise the team size any further." );
|
||||
From.SendMessage( "You may not raise the team size any further." );
|
||||
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
else if ( bid == 2 )
|
||||
{
|
||||
if ( m_Participant.Count > 1 && m_Participant.Count > m_Participant.FilledSlots )
|
||||
m_Participant.Resize( m_Participant.Count - 1 );
|
||||
if ( Participant.Count > 1 && Participant.Count > Participant.FilledSlots )
|
||||
Participant.Resize( Participant.Count - 1 );
|
||||
else
|
||||
m_From.SendMessage( "You may not lower the team size any further." );
|
||||
From.SendMessage( "You may not lower the team size any further." );
|
||||
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
else if ( bid == 3 )
|
||||
{
|
||||
if ( m_Participant.FilledSlots > 0 )
|
||||
if ( Participant.FilledSlots > 0 )
|
||||
{
|
||||
m_From.SendMessage( "There is at least one currently active player. You must remove them first." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendMessage( "There is at least one currently active player. You must remove them first." );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
else if ( m_Context.Participants.Count > 2 )
|
||||
else if ( Context.Participants.Count > 2 )
|
||||
{
|
||||
/*Container cont = m_Participant.Stakes;
|
||||
|
||||
if ( cont != null )
|
||||
cont.Delete();*/
|
||||
|
||||
m_Context.Participants.Remove( m_Participant );
|
||||
m_From.SendGump( new DuelContextGump( m_From, m_Context ) );
|
||||
Context.Participants.Remove( Participant );
|
||||
From.SendGump( new DuelContextGump( From, Context ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendMessage( "Duels must have at least two participating parties." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
From.SendMessage( "Duels must have at least two participating parties." );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
}
|
||||
/*else if ( bid == 4 )
|
||||
|
|
@ -155,23 +153,23 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
bid -= 5;
|
||||
|
||||
if ( bid >= 0 && bid < m_Participant.Players.Length )
|
||||
if ( bid >= 0 && bid < Participant.Players.Length )
|
||||
{
|
||||
if ( m_Participant.Players[bid] == null )
|
||||
if ( Participant.Players[bid] == null )
|
||||
{
|
||||
m_From.Target = new ParticipantTarget( m_Context, m_Participant, bid );
|
||||
m_From.SendMessage( "Target a player." );
|
||||
From.Target = new ParticipantTarget( Context, Participant, bid );
|
||||
From.SendMessage( "Target a player." );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." );
|
||||
Participant.Players[bid].Mobile.SendMessage( "You have been removed from the duel." );
|
||||
|
||||
if ( m_Participant.Players[bid].Mobile is PlayerMobile )
|
||||
((PlayerMobile)(m_Participant.Players[bid].Mobile)).DuelPlayer = null;
|
||||
if ( Participant.Players[bid].Mobile is PlayerMobile )
|
||||
((PlayerMobile)(Participant.Players[bid].Mobile)).DuelPlayer = null;
|
||||
|
||||
m_Participant.Players[bid] = null;
|
||||
m_From.SendMessage( "They have been removed from the duel." );
|
||||
m_From.SendGump( new ParticipantGump( m_From, m_Context, m_Participant ) );
|
||||
Participant.Players[bid] = null;
|
||||
From.SendMessage( "They have been removed from the duel." );
|
||||
From.SendGump( new ParticipantGump( From, Context, Participant ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,9 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public class Preferences
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private Hashtable m_Table;
|
||||
|
||||
public ArrayList Entries => m_Entries;
|
||||
public ArrayList Entries { get; }
|
||||
|
||||
public PreferencesEntry Find( Mobile mob )
|
||||
{
|
||||
|
|
@ -81,22 +80,18 @@ namespace Server.Engines.ConPVP
|
|||
if ( entry == null )
|
||||
{
|
||||
m_Table[mob] = entry = new PreferencesEntry( mob, this );
|
||||
m_Entries.Add( entry );
|
||||
Entries.Add( entry );
|
||||
}
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
private static Preferences m_Instance;
|
||||
|
||||
public static Preferences Instance{ get => m_Instance;
|
||||
set => m_Instance = value;
|
||||
}
|
||||
public static Preferences Instance { get; set; }
|
||||
|
||||
public Preferences()
|
||||
{
|
||||
m_Table = new Hashtable();
|
||||
m_Entries = new ArrayList();
|
||||
Entries = new ArrayList();
|
||||
}
|
||||
|
||||
public Preferences( GenericReader reader )
|
||||
|
|
@ -110,7 +105,7 @@ namespace Server.Engines.ConPVP
|
|||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Table = new Hashtable( count );
|
||||
m_Entries = new ArrayList( count );
|
||||
Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
@ -119,7 +114,7 @@ namespace Server.Engines.ConPVP
|
|||
if ( entry.Mobile != null )
|
||||
{
|
||||
m_Table[entry.Mobile] = entry;
|
||||
m_Entries.Add( entry );
|
||||
Entries.Add( entry );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,27 +127,26 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version;
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
writer.WriteEncodedInt( (int) Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
((PreferencesEntry)m_Entries[i]).Serialize( writer );
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
((PreferencesEntry)Entries[i]).Serialize( writer );
|
||||
}
|
||||
}
|
||||
|
||||
public class PreferencesEntry
|
||||
{
|
||||
private Mobile m_Mobile;
|
||||
private ArrayList m_Disliked;
|
||||
private Preferences m_Preferences;
|
||||
|
||||
public Mobile Mobile => m_Mobile;
|
||||
public ArrayList Disliked => m_Disliked;
|
||||
public Mobile Mobile { get; }
|
||||
|
||||
public ArrayList Disliked { get; }
|
||||
|
||||
public PreferencesEntry( Mobile mob, Preferences prefs )
|
||||
{
|
||||
m_Preferences = prefs;
|
||||
m_Mobile = mob;
|
||||
m_Disliked = new ArrayList();
|
||||
Mobile = mob;
|
||||
Disliked = new ArrayList();
|
||||
}
|
||||
|
||||
public PreferencesEntry( GenericReader reader, Preferences prefs, int version )
|
||||
|
|
@ -163,14 +157,14 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Mobile = reader.ReadMobile();
|
||||
Mobile = reader.ReadMobile();
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Disliked = new ArrayList( count );
|
||||
Disliked = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
m_Disliked.Add( reader.ReadString() );
|
||||
Disliked.Add( reader.ReadString() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -179,12 +173,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( (Mobile) m_Mobile );
|
||||
writer.Write( (Mobile) Mobile );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Disliked.Count );
|
||||
writer.WriteEncodedInt( (int) Disliked.Count );
|
||||
|
||||
for ( int i = 0; i < m_Disliked.Count; ++i )
|
||||
writer.Write( (string) m_Disliked[i] );
|
||||
for ( int i = 0; i < Disliked.Count; ++i )
|
||||
writer.Write( (string) Disliked[i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,106 +4,98 @@ namespace Server.Engines.ConPVP
|
|||
{
|
||||
public class Ruleset
|
||||
{
|
||||
private RulesetLayout m_Layout;
|
||||
private BitArray m_Options;
|
||||
private string m_Title;
|
||||
public RulesetLayout Layout { get; }
|
||||
|
||||
private Ruleset m_Base;
|
||||
private ArrayList m_Flavors = new ArrayList();
|
||||
private bool m_Changed;
|
||||
public BitArray Options { get; private set; }
|
||||
|
||||
public RulesetLayout Layout => m_Layout;
|
||||
public BitArray Options => m_Options;
|
||||
public string Title{ get => m_Title;
|
||||
set => m_Title = value;
|
||||
}
|
||||
public string Title { get; set; }
|
||||
|
||||
public Ruleset Base => m_Base;
|
||||
public ArrayList Flavors => m_Flavors;
|
||||
public bool Changed{ get => m_Changed;
|
||||
set => m_Changed = value;
|
||||
}
|
||||
public Ruleset Base { get; private set; }
|
||||
|
||||
public ArrayList Flavors { get; } = new ArrayList();
|
||||
|
||||
public bool Changed { get; set; }
|
||||
|
||||
public void ApplyDefault( Ruleset newDefault )
|
||||
{
|
||||
m_Base = newDefault;
|
||||
m_Changed = false;
|
||||
Base = newDefault;
|
||||
Changed = false;
|
||||
|
||||
m_Options = new BitArray( newDefault.m_Options );
|
||||
Options = new BitArray( newDefault.Options );
|
||||
|
||||
ApplyFlavorsTo( this );
|
||||
}
|
||||
|
||||
public void ApplyFlavorsTo( Ruleset ruleset )
|
||||
{
|
||||
for ( int i = 0; i < m_Flavors.Count; ++i )
|
||||
for ( int i = 0; i < Flavors.Count; ++i )
|
||||
{
|
||||
Ruleset flavor = (Ruleset)m_Flavors[i];
|
||||
Ruleset flavor = (Ruleset)Flavors[i];
|
||||
|
||||
m_Options.Or( flavor.m_Options );
|
||||
Options.Or( flavor.Options );
|
||||
}
|
||||
}
|
||||
|
||||
public void AddFlavor( Ruleset flavor )
|
||||
{
|
||||
if ( m_Flavors.Contains( flavor ) )
|
||||
if ( Flavors.Contains( flavor ) )
|
||||
return;
|
||||
|
||||
m_Flavors.Add( flavor );
|
||||
m_Options.Or( flavor.m_Options );
|
||||
Flavors.Add( flavor );
|
||||
Options.Or( flavor.Options );
|
||||
}
|
||||
|
||||
public void RemoveFlavor( Ruleset flavor )
|
||||
{
|
||||
if ( !m_Flavors.Contains( flavor ) )
|
||||
if ( !Flavors.Contains( flavor ) )
|
||||
return;
|
||||
|
||||
m_Flavors.Remove( flavor );
|
||||
m_Options.And( flavor.m_Options.Not() );
|
||||
flavor.m_Options.Not();
|
||||
Flavors.Remove( flavor );
|
||||
Options.And( flavor.Options.Not() );
|
||||
flavor.Options.Not();
|
||||
}
|
||||
|
||||
public void SetOptionRange( string title, bool value )
|
||||
{
|
||||
RulesetLayout layout = m_Layout.FindByTitle( title );
|
||||
RulesetLayout layout = Layout.FindByTitle( title );
|
||||
|
||||
if ( layout == null )
|
||||
return;
|
||||
|
||||
for ( int i = 0; i < layout.TotalLength; ++i )
|
||||
m_Options[i + layout.Offset] = value;
|
||||
Options[i + layout.Offset] = value;
|
||||
|
||||
m_Changed = true;
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
public bool GetOption( string title, string option )
|
||||
{
|
||||
int index = 0;
|
||||
RulesetLayout layout = m_Layout.FindByOption( title, option, ref index );
|
||||
RulesetLayout layout = Layout.FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout == null )
|
||||
return true;
|
||||
|
||||
return m_Options[layout.Offset + index];
|
||||
return Options[layout.Offset + index];
|
||||
}
|
||||
|
||||
public void SetOption( string title, string option, bool value )
|
||||
{
|
||||
int index = 0;
|
||||
RulesetLayout layout = m_Layout.FindByOption( title, option, ref index );
|
||||
RulesetLayout layout = Layout.FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout == null )
|
||||
return;
|
||||
|
||||
m_Options[layout.Offset + index] = value;
|
||||
Options[layout.Offset + index] = value;
|
||||
|
||||
m_Changed = true;
|
||||
Changed = true;
|
||||
}
|
||||
|
||||
public Ruleset( RulesetLayout layout )
|
||||
{
|
||||
m_Layout = layout;
|
||||
m_Options = new BitArray( layout.TotalLength );
|
||||
Layout = layout;
|
||||
Options = new BitArray( layout.TotalLength );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -649,42 +649,32 @@ namespace Server.Engines.ConPVP
|
|||
}
|
||||
}
|
||||
|
||||
private string m_Title, m_Description;
|
||||
private string[] m_Options;
|
||||
public string Title { get; }
|
||||
|
||||
private int m_Offset, m_TotalLength;
|
||||
public string Description { get; }
|
||||
|
||||
private Ruleset[] m_Defaults;
|
||||
private Ruleset[] m_Flavors;
|
||||
public string[] Options { get; }
|
||||
|
||||
private RulesetLayout m_Parent;
|
||||
private RulesetLayout[] m_Children;
|
||||
public int Offset { get; private set; }
|
||||
|
||||
public string Title => m_Title;
|
||||
public string Description => m_Description;
|
||||
public string[] Options => m_Options;
|
||||
public int TotalLength { get; private set; }
|
||||
|
||||
public int Offset => m_Offset;
|
||||
public int TotalLength => m_TotalLength;
|
||||
public RulesetLayout Parent { get; private set; }
|
||||
|
||||
public RulesetLayout Parent => m_Parent;
|
||||
public RulesetLayout[] Children => m_Children;
|
||||
public RulesetLayout[] Children { get; }
|
||||
|
||||
public Ruleset[] Defaults{ get => m_Defaults;
|
||||
set => m_Defaults = value;
|
||||
}
|
||||
public Ruleset[] Flavors{ get => m_Flavors;
|
||||
set => m_Flavors = value;
|
||||
}
|
||||
public Ruleset[] Defaults { get; set; }
|
||||
|
||||
public Ruleset[] Flavors { get; set; }
|
||||
|
||||
public RulesetLayout FindByTitle( string title )
|
||||
{
|
||||
if ( m_Title == title )
|
||||
if ( Title == title )
|
||||
return this;
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
{
|
||||
RulesetLayout layout = m_Children[i].FindByTitle( title );
|
||||
RulesetLayout layout = Children[i].FindByTitle( title );
|
||||
|
||||
if ( layout != null )
|
||||
return layout;
|
||||
|
|
@ -695,12 +685,12 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public string FindByIndex( int index )
|
||||
{
|
||||
if ( index >= m_Offset && index < (m_Offset + m_Options.Length) )
|
||||
return m_Description + ": " + m_Options[index - m_Offset];
|
||||
if ( index >= Offset && index < (Offset + Options.Length) )
|
||||
return Description + ": " + Options[index - Offset];
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
{
|
||||
string opt = m_Children[i].FindByIndex( index );
|
||||
string opt = Children[i].FindByIndex( index );
|
||||
|
||||
if ( opt != null )
|
||||
return opt;
|
||||
|
|
@ -711,7 +701,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public RulesetLayout FindByOption( string title, string option, ref int index )
|
||||
{
|
||||
if ( title == null || m_Title == title )
|
||||
if ( title == null || Title == title )
|
||||
{
|
||||
index = GetOptionIndex( option );
|
||||
|
||||
|
|
@ -721,9 +711,9 @@ namespace Server.Engines.ConPVP
|
|||
title = null;
|
||||
}
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
{
|
||||
RulesetLayout layout = m_Children[i].FindByOption( title, option, ref index );
|
||||
RulesetLayout layout = Children[i].FindByOption( title, option, ref index );
|
||||
|
||||
if ( layout != null )
|
||||
return layout;
|
||||
|
|
@ -734,7 +724,7 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public int GetOptionIndex( string option )
|
||||
{
|
||||
return Array.IndexOf( m_Options, option );
|
||||
return Array.IndexOf( Options, option );
|
||||
}
|
||||
|
||||
public void ComputeOffsets()
|
||||
|
|
@ -746,15 +736,15 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
private int RecurseComputeOffsets( ref int offset )
|
||||
{
|
||||
m_Offset = offset;
|
||||
Offset = offset;
|
||||
|
||||
offset += m_Options.Length;
|
||||
m_TotalLength += m_Options.Length;
|
||||
offset += Options.Length;
|
||||
TotalLength += Options.Length;
|
||||
|
||||
for ( int i = 0; i < m_Children.Length; ++i )
|
||||
m_TotalLength += m_Children[i].RecurseComputeOffsets( ref offset );
|
||||
for ( int i = 0; i < Children.Length; ++i )
|
||||
TotalLength += Children[i].RecurseComputeOffsets( ref offset );
|
||||
|
||||
return m_TotalLength;
|
||||
return TotalLength;
|
||||
}
|
||||
|
||||
public RulesetLayout( string title, string[] options ) : this( title, title, new RulesetLayout[0], options )
|
||||
|
|
@ -779,13 +769,13 @@ namespace Server.Engines.ConPVP
|
|||
|
||||
public RulesetLayout( string title, string description, RulesetLayout[] children, string[] options )
|
||||
{
|
||||
m_Title = title;
|
||||
m_Description = description;
|
||||
m_Children = children;
|
||||
m_Options = options;
|
||||
Title = title;
|
||||
Description = description;
|
||||
Children = children;
|
||||
Options = options;
|
||||
|
||||
for ( int i = 0; i < children.Length; ++i )
|
||||
children[i].m_Parent = this;
|
||||
children[i].Parent = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -12,34 +12,27 @@ namespace Server.Items
|
|||
[Flippable( 5020, 4647 )]
|
||||
public class Trophy : Item
|
||||
{
|
||||
private string m_Title;
|
||||
private TrophyRank m_Rank;
|
||||
private Mobile m_Owner;
|
||||
private DateTime m_Date;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title{ get => m_Title;
|
||||
set => m_Title = value;
|
||||
}
|
||||
public string Title { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TrophyRank Rank{ get => m_Rank;
|
||||
set{ m_Rank = value; UpdateStyle(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner{ get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime Date => m_Date;
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
[Constructible]
|
||||
public Trophy( string title, TrophyRank rank ) : base( 5020 )
|
||||
{
|
||||
m_Title = title;
|
||||
Title = title;
|
||||
m_Rank = rank;
|
||||
m_Date = DateTime.UtcNow;
|
||||
Date = DateTime.UtcNow;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
|
|
@ -56,10 +49,10 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (string) m_Title );
|
||||
writer.Write( (string) Title );
|
||||
writer.Write( (int) m_Rank );
|
||||
writer.Write( (Mobile) m_Owner );
|
||||
writer.Write( (DateTime) m_Date );
|
||||
writer.Write( (Mobile) Owner );
|
||||
writer.Write( (DateTime) Date );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -68,10 +61,10 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Title = reader.ReadString();
|
||||
Title = reader.ReadString();
|
||||
m_Rank = (TrophyRank) reader.ReadInt();
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_Date = reader.ReadDateTime();
|
||||
Owner = reader.ReadMobile();
|
||||
Date = reader.ReadDateTime();
|
||||
|
||||
if ( version == 0 )
|
||||
LootType = LootType.Blessed;
|
||||
|
|
@ -81,21 +74,21 @@ namespace Server.Items
|
|||
{
|
||||
base.OnAdded( parent );
|
||||
|
||||
if ( m_Owner == null )
|
||||
m_Owner = RootParent as Mobile;
|
||||
if ( Owner == null )
|
||||
Owner = RootParent as Mobile;
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_Owner != null )
|
||||
LabelTo( from, "{0} -- {1}", m_Title, m_Owner.RawName );
|
||||
else if ( m_Title != null )
|
||||
LabelTo( from, m_Title );
|
||||
if ( Owner != null )
|
||||
LabelTo( from, "{0} -- {1}", Title, Owner.RawName );
|
||||
else if ( Title != null )
|
||||
LabelTo( from, Title );
|
||||
|
||||
if ( m_Date != DateTime.MinValue )
|
||||
LabelTo( from, m_Date.ToString( "d" ) );
|
||||
if ( Date != DateTime.MinValue )
|
||||
LabelTo( from, Date.ToString( "d" ) );
|
||||
}
|
||||
|
||||
public void UpdateStyle()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue