Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

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