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

@ -29,19 +29,15 @@ namespace Server.Regions
}
private string m_RuneName;
private bool m_NoLogoutDelay;
private SpawnEntry[] m_Spawns;
private SpawnZLevel m_SpawnZLevel;
private bool m_ExcludeFromParentSpawns;
public string RuneName{ get => m_RuneName;
set => m_RuneName = value;
}
public bool NoLogoutDelay{ get => m_NoLogoutDelay;
set => m_NoLogoutDelay = value;
}
public bool NoLogoutDelay { get; set; }
public SpawnEntry[] Spawns
{
@ -58,9 +54,7 @@ namespace Server.Regions
}
}
public SpawnZLevel SpawnZLevel{ get => m_SpawnZLevel;
set => m_SpawnZLevel = value;
}
public SpawnZLevel SpawnZLevel { get; set; }
public bool ExcludeFromParentSpawns{ get => m_ExcludeFromParentSpawns;
set => m_ExcludeFromParentSpawns = value;
@ -90,7 +84,7 @@ namespace Server.Regions
public override TimeSpan GetLogoutDelay( Mobile m )
{
if ( m_NoLogoutDelay )
if ( NoLogoutDelay )
{
if ( m.Aggressors.Count == 0 && m.Aggressed.Count == 0 && !m.Criminal )
return TimeSpan.Zero;
@ -363,7 +357,7 @@ namespace Server.Regions
}
int z;
switch ( m_SpawnZLevel )
switch ( SpawnZLevel )
{
case SpawnZLevel.Lowest:
{
@ -499,7 +493,7 @@ namespace Server.Regions
bool logoutDelayActive = true;
ReadBoolean( xml["logoutDelay"], "active", ref logoutDelayActive, false );
m_NoLogoutDelay = !logoutDelayActive;
NoLogoutDelay = !logoutDelayActive;
XmlElement spawning = xml["spawning"];
@ -509,7 +503,7 @@ namespace Server.Regions
SpawnZLevel zLevel = SpawnZLevel.Lowest;
ReadEnum( spawning, "zLevel", ref zLevel, false );
m_SpawnZLevel = zLevel;
SpawnZLevel = zLevel;
List<SpawnEntry> list = new List<SpawnEntry>();

View file

@ -7,14 +7,11 @@ namespace Server.Regions
public override bool YoungProtected => false;
private Point3D m_EntranceLocation;
private Map m_EntranceMap;
public Point3D EntranceLocation{ get => m_EntranceLocation;
set => m_EntranceLocation = value;
}
public Map EntranceMap{ get => m_EntranceMap;
set => m_EntranceMap = value;
}
public Map EntranceMap { get; set; }
public DungeonRegion( XmlElement xml, Map map, Region parent ) : base( xml, map, parent )
{
@ -24,7 +21,7 @@ namespace Server.Regions
ReadMap( entrEl, "map", ref entrMap, false );
if ( ReadPoint3D( entrEl, entrMap, ref m_EntranceLocation, false ) )
m_EntranceMap = entrMap;
EntranceMap = entrMap;
}
public override bool AllowHousing( Mobile from, Point3D p )

View file

@ -10,15 +10,12 @@ namespace Server.Regions
{
private static object[] m_GuardParams = new object[1];
private Type m_GuardType;
private bool m_Disabled;
public bool Disabled{ get => m_Disabled;
set => m_Disabled = value;
}
public bool Disabled { get; set; }
public virtual bool IsDisabled()
{
return m_Disabled;
return Disabled;
}
public static void Initialize()

View file

@ -10,8 +10,6 @@ namespace Server.Regions
{
public static readonly int HousePriority = DefaultPriority + 1;
private BaseHouse m_House;
public static void Initialize()
{
EventSink.Login += OnLogin;
@ -27,7 +25,7 @@ namespace Server.Regions
public HouseRegion( BaseHouse house ) : base( null, house.Map, HousePriority, GetArea( house ) )
{
m_House = house;
House = house;
Point3D ban = house.RelativeBanLocation;
@ -69,7 +67,7 @@ namespace Server.Regions
public override bool CheckAccessibility( Item item, Mobile from )
{
return m_House.CheckAccessibility( item, from );
return House.CheckAccessibility( item, from );
}
private bool m_Recursion;
@ -87,37 +85,37 @@ namespace Server.Regions
if ( m is BaseCreature && ((BaseCreature)m).NoHouseRestrictions )
{
}
else if ( m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside( oldLocation, 16 )) )
else if ( m is BaseCreature && ((BaseCreature)m).IsHouseSummonable && !(BaseCreature.Summoning || House.IsInside( oldLocation, 16 )) )
{
}
else if ( (m_House.Public || !m_House.IsAosRules) && m_House.IsBanned( m ) && m_House.IsInside( m ) )
else if ( (House.Public || !House.IsAosRules) && House.IsBanned( m ) && House.IsInside( m ) )
{
m.Location = m_House.BanLocation;
m.Location = House.BanLocation;
if ( !Core.SE )
m.SendLocalizedMessage( 501284 ); // You may not enter.
}
else if ( m_House.IsAosRules && !m_House.Public && !m_House.HasAccess( m ) && m_House.IsInside( m ) )
else if ( House.IsAosRules && !House.Public && !House.HasAccess( m ) && House.IsInside( m ) )
{
m.Location = m_House.BanLocation;
m.Location = House.BanLocation;
if ( !Core.SE )
m.SendLocalizedMessage( 501284 ); // You may not enter.
}
else if ( m_House.IsCombatRestricted( m ) && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) )
else if ( House.IsCombatRestricted( m ) && House.IsInside( m ) && !House.IsInside( oldLocation, 16 ) )
{
m.Location = m_House.BanLocation;
m.Location = House.BanLocation;
m.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
}
else
{
HouseFoundation foundation = m_House as HouseFoundation;
HouseFoundation foundation = House as HouseFoundation;
if ( foundation?.Customizer != null && foundation.Customizer != m && m_House.IsInside( m ) )
m.Location = m_House.BanLocation;
if ( foundation?.Customizer != null && foundation.Customizer != m && House.IsInside( m ) )
m.Location = House.BanLocation;
}
if ( m_House.InternalizedVendors.Count > 0 && m_House.IsInside( m ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsOwner( m ) && m.Alive && !m.HasGump( typeof( NoticeGump ) ) )
if ( House.InternalizedVendors.Count > 0 && House.IsInside( m ) && !House.IsInside( oldLocation, 16 ) && House.IsOwner( m ) && m.Alive && !m.HasGump( typeof( NoticeGump ) ) )
{
/* This house has been customized recently, and vendors that work out of this
* house have been temporarily relocated. You must now put your vendors back to work.
@ -143,44 +141,44 @@ namespace Server.Regions
{
return false;
}
else if ( from is BaseCreature && ((BaseCreature)from).IsHouseSummonable && !(BaseCreature.Summoning || m_House.IsInside( oldLocation, 16 )) )
else if ( from is BaseCreature && ((BaseCreature)from).IsHouseSummonable && !(BaseCreature.Summoning || House.IsInside( oldLocation, 16 )) )
{
return false;
}
else if ( from is BaseCreature && !((BaseCreature)from).Controlled && m_House.IsAosRules && !m_House.Public)
else if ( from is BaseCreature && !((BaseCreature)from).Controlled && House.IsAosRules && !House.Public)
{
return false;
}
else if ( (m_House.Public || !m_House.IsAosRules) && m_House.IsBanned( from ) && m_House.IsInside( newLocation, 16 ) )
else if ( (House.Public || !House.IsAosRules) && House.IsBanned( from ) && House.IsInside( newLocation, 16 ) )
{
from.Location = m_House.BanLocation;
from.Location = House.BanLocation;
if ( !Core.SE )
from.SendLocalizedMessage( 501284 ); // You may not enter.
return false;
}
else if ( m_House.IsAosRules && !m_House.Public && !m_House.HasAccess( from ) && m_House.IsInside( newLocation, 16 ) )
else if ( House.IsAosRules && !House.Public && !House.HasAccess( from ) && House.IsInside( newLocation, 16 ) )
{
if ( !Core.SE )
from.SendLocalizedMessage( 501284 ); // You may not enter.
return false;
}
else if ( m_House.IsCombatRestricted( from ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsInside( newLocation, 16 ) )
else if ( House.IsCombatRestricted( from ) && !House.IsInside( oldLocation, 16 ) && House.IsInside( newLocation, 16 ) )
{
from.SendLocalizedMessage( 1061637 ); // You are not allowed to access this.
return false;
}
else
{
HouseFoundation foundation = m_House as HouseFoundation;
HouseFoundation foundation = House as HouseFoundation;
if ( foundation?.Customizer != null && foundation.Customizer != from && m_House.IsInside( newLocation, 16 ) )
if ( foundation?.Customizer != null && foundation.Customizer != from && House.IsInside( newLocation, 16 ) )
return false;
}
if ( m_House.InternalizedVendors.Count > 0 && m_House.IsInside( from ) && !m_House.IsInside( oldLocation, 16 ) && m_House.IsOwner( from ) && from.Alive && !from.HasGump( typeof( NoticeGump ) ) )
if ( House.InternalizedVendors.Count > 0 && House.IsInside( from ) && !House.IsInside( oldLocation, 16 ) && House.IsOwner( from ) && from.Alive && !from.HasGump( typeof( NoticeGump ) ) )
{
/* This house has been customized recently, and vendors that work out of this
* house have been temporarily relocated. You must now put your vendors back to work.
@ -196,7 +194,7 @@ namespace Server.Regions
public override bool OnDecay( Item item )
{
if ( (m_House.IsLockedDown( item ) || m_House.IsSecure( item )) && m_House.IsInside( item ) )
if ( (House.IsLockedDown( item ) || House.IsSecure( item )) && House.IsInside( item ) )
return false;
return base.OnDecay(item );
}
@ -205,7 +203,7 @@ namespace Server.Regions
public override TimeSpan GetLogoutDelay( Mobile m )
{
if ( m_House.IsFriend( m ) && m_House.IsInside( m ) )
if ( House.IsFriend( m ) && House.IsInside( m ) )
{
for ( int i = 0; i < m.Aggressed.Count; ++i )
{
@ -226,11 +224,11 @@ namespace Server.Regions
base.OnSpeech( e );
Mobile from = e.Mobile;
Item sign = m_House.Sign;
Item sign = House.Sign;
bool isOwner = m_House.IsOwner( from );
bool isCoOwner = isOwner || m_House.IsCoOwner( from );
bool isFriend = isCoOwner || m_House.IsFriend( from );
bool isOwner = House.IsOwner( from );
bool isCoOwner = isOwner || House.IsCoOwner( from );
bool isFriend = isCoOwner || House.IsFriend( from );
if ( !isFriend )
return;
@ -244,7 +242,7 @@ namespace Server.Regions
{
from.SendLocalizedMessage( 500295 ); // you are too far away to do that.
}
else if ( DateTime.UtcNow <= m_House.BuiltOn.AddHours ( 1 ) )
else if ( DateTime.UtcNow <= House.BuiltOn.AddHours ( 1 ) )
{
from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition.
}
@ -252,7 +250,7 @@ namespace Server.Regions
{
from.CloseGump( typeof( ConfirmHouseResize ) );
from.CloseGump( typeof( HouseGumpAOS ) );
from.SendGump( new ConfirmHouseResize( from, m_House ) );
from.SendGump( new ConfirmHouseResize( from, House ) );
}
else
{
@ -260,14 +258,14 @@ namespace Server.Regions
}
}
if ( !m_House.IsInside( from ) || !m_House.IsActive )
if ( !House.IsInside( from ) || !House.IsActive )
return;
if ( e.HasKeyword( 0x33 ) ) // remove thyself
{
if ( isFriend )
{
from.SendLocalizedMessage( 501326 ); // Target the individual to eject from this house.
from.Target = new HouseKickTarget( m_House );
from.Target = new HouseKickTarget( House );
}
else
{
@ -280,14 +278,14 @@ namespace Server.Regions
{
from.SendLocalizedMessage( 502094 ); // You must be in your house to do this.
}
else if ( !m_House.Public && m_House.IsAosRules )
else if ( !House.Public && House.IsAosRules )
{
from.SendLocalizedMessage( 1062521 ); // You cannot ban someone from a private house. Revoke their access instead.
}
else
{
from.SendLocalizedMessage( 501325 ); // Target the individual to ban from this house.
from.Target = new HouseBanTarget( true, m_House );
from.Target = new HouseBanTarget( true, House );
}
}
else if ( e.HasKeyword( 0x23 ) ) // I wish to lock this down
@ -295,7 +293,7 @@ namespace Server.Regions
if ( isCoOwner )
{
from.SendLocalizedMessage( 502097 ); // Lock what down?
from.Target = new LockdownTarget( false, m_House );
from.Target = new LockdownTarget( false, House );
}
else if ( isFriend )
{
@ -311,7 +309,7 @@ namespace Server.Regions
if ( isCoOwner )
{
from.SendLocalizedMessage( 502100 ); // Choose the item you wish to release
from.Target = new LockdownTarget( true, m_House );
from.Target = new LockdownTarget( true, House );
}
else if ( isFriend )
{
@ -327,7 +325,7 @@ namespace Server.Regions
if ( isOwner )
{
from.SendLocalizedMessage( 502103 ); // Choose the item you wish to secure
from.Target = new SecureTarget( false, m_House );
from.Target = new SecureTarget( false, House );
}
else
{
@ -339,7 +337,7 @@ namespace Server.Regions
if ( isOwner )
{
from.SendLocalizedMessage( 502106 ); // Choose the item you wish to unsecure
from.Target = new SecureTarget( true, m_House );
from.Target = new SecureTarget( true, House );
}
else
{
@ -354,7 +352,7 @@ namespace Server.Regions
}
else if ( isCoOwner )
{
m_House.AddStrongBox( from );
House.AddStrongBox( from );
}
else if ( isFriend )
{
@ -369,7 +367,7 @@ namespace Server.Regions
{
if ( isCoOwner )
{
m_House.AddTrashBarrel( from );
House.AddTrashBarrel( from );
}
else if ( isFriend )
{
@ -388,7 +386,7 @@ namespace Server.Regions
{
Container c = (Container)o;
SecureAccessResult res = m_House.CheckSecureAccess( from, c );
SecureAccessResult res = House.CheckSecureAccess( from, c );
switch ( res )
{
@ -407,15 +405,15 @@ namespace Server.Regions
{
Item item = (Item)o;
if ( m_House.IsLockedDown( item ) )
if ( House.IsLockedDown( item ) )
item.LabelTo( from, 501643 ); // [locked down]
else if ( m_House.IsSecure( item ) )
else if ( House.IsSecure( item ) )
item.LabelTo( from, 501644 ); // [locked down & secure]
}
return base.OnSingleClick( from, o );
}
public BaseHouse House => m_House;
public BaseHouse House { get; }
}
}

View file

@ -77,10 +77,9 @@ namespace Server.Regions
public abstract class SpawnType : SpawnDefinition
{
private Type m_Type;
private bool m_Init;
public Type Type => m_Type;
public Type Type { get; }
public abstract int Height{ get; }
public abstract bool Land{ get; }
@ -88,7 +87,7 @@ namespace Server.Regions
protected SpawnType( Type type )
{
m_Type = type;
Type = type;
m_Init = false;
}
@ -124,7 +123,7 @@ namespace Server.Regions
{
for ( int i = 0; i < types.Length; i++ )
{
if ( types[i] == m_Type )
if ( types[i] == Type )
return true;
}
@ -254,56 +253,50 @@ namespace Server.Regions
public class SpawnTreasureChest : SpawnItem
{
private int m_ItemID;
private BaseTreasureChest.TreasureLevel m_Level;
public int ItemID { get; }
public int ItemID => m_ItemID;
public BaseTreasureChest.TreasureLevel Level => m_Level;
public BaseTreasureChest.TreasureLevel Level { get; }
public SpawnTreasureChest( int itemID, BaseTreasureChest.TreasureLevel level ) : base( typeof( BaseTreasureChest ) )
{
m_ItemID = itemID;
m_Level = level;
ItemID = itemID;
Level = level;
}
protected override void Init()
{
m_Height = TileData.ItemTable[m_ItemID & TileData.MaxItemValue].Height;
m_Height = TileData.ItemTable[ItemID & TileData.MaxItemValue].Height;
}
protected override Item CreateItem()
{
return new BaseTreasureChest( m_ItemID, m_Level );
return new BaseTreasureChest( ItemID, Level );
}
}
public class SpawnGroupElement
{
private SpawnDefinition m_SpawnDefinition;
private int m_Weight;
public SpawnDefinition SpawnDefinition { get; }
public SpawnDefinition SpawnDefinition => m_SpawnDefinition;
public int Weight => m_Weight;
public int Weight { get; }
public SpawnGroupElement( SpawnDefinition spawnDefinition, int weight )
{
m_SpawnDefinition = spawnDefinition;
m_Weight = weight;
SpawnDefinition = spawnDefinition;
Weight = weight;
}
}
public class SpawnGroup : SpawnDefinition
{
private static Hashtable m_Table = new Hashtable();
public static Hashtable Table => m_Table;
public static Hashtable Table { get; } = new Hashtable();
public static void Register( SpawnGroup group )
{
if ( m_Table.Contains( group.Name ) )
if ( Table.Contains( group.Name ) )
Console.WriteLine( "Warning: Double SpawnGroup name '{0}'", group.Name );
else
m_Table[group.Name] = group;
Table[group.Name] = group;
}
static SpawnGroup()
@ -357,17 +350,16 @@ namespace Server.Regions
}
}
private string m_Name;
private SpawnGroupElement[] m_Elements;
private int m_TotalWeight;
public string Name => m_Name;
public SpawnGroupElement[] Elements => m_Elements;
public string Name { get; }
public SpawnGroupElement[] Elements { get; }
public SpawnGroup( string name, SpawnGroupElement[] elements )
{
m_Name = name;
m_Elements = elements;
Name = name;
Elements = elements;
m_TotalWeight = 0;
for ( int i = 0; i < elements.Length; i++ )
@ -378,9 +370,9 @@ namespace Server.Regions
{
int index = Utility.Random( m_TotalWeight );
for ( int i = 0; i < m_Elements.Length; i++ )
for ( int i = 0; i < Elements.Length; i++ )
{
SpawnGroupElement element = m_Elements[i];
SpawnGroupElement element = Elements[i];
if ( index < element.Weight )
return element.SpawnDefinition.Spawn( entry );
@ -393,9 +385,9 @@ namespace Server.Regions
public override bool CanSpawn( params Type[] types )
{
for ( int i = 0; i < m_Elements.Length; i++ )
for ( int i = 0; i < Elements.Length; i++ )
{
if ( m_Elements[i].SpawnDefinition.CanSpawn( types ) )
if ( Elements[i].SpawnDefinition.CanSpawn( types ) )
return true;
}

View file

@ -11,9 +11,7 @@ namespace Server.Regions
public static readonly TimeSpan DefaultMinSpawnTime = TimeSpan.FromMinutes( 2.0 );
public static readonly TimeSpan DefaultMaxSpawnTime = TimeSpan.FromMinutes( 5.0 );
private static Hashtable m_Table = new Hashtable();
public static Hashtable Table => m_Table;
public static Hashtable Table { get; } = new Hashtable();
// When a creature's AI is deactivated (PlayerRangeSensitive optimization) does it return home?
@ -28,83 +26,81 @@ namespace Server.Regions
public static readonly Direction InvalidDirection = Direction.Running;
private int m_ID;
private BaseRegion m_Region;
private Point3D m_Home;
private int m_Range;
private Direction m_Direction;
private SpawnDefinition m_Definition;
private List<ISpawnable> m_SpawnedObjects;
private int m_Max;
private TimeSpan m_MinSpawnTime;
private TimeSpan m_MaxSpawnTime;
private bool m_Running;
private DateTime m_NextSpawn;
private Timer m_SpawnTimer;
public int ID => m_ID;
public BaseRegion Region => m_Region;
Region ISpawner.Region => m_Region;
public Point3D HomeLocation => m_Home;
public int HomeRange => m_Range;
public Direction Direction => m_Direction;
public SpawnDefinition Definition => m_Definition;
public List<ISpawnable> SpawnedObjects => m_SpawnedObjects;
public int Max => m_Max;
public TimeSpan MinSpawnTime => m_MinSpawnTime;
public TimeSpan MaxSpawnTime => m_MaxSpawnTime;
public bool Running => m_Running;
public int ID { get; }
public bool Complete => m_SpawnedObjects.Count >= m_Max;
public bool Spawning => m_Running && !Complete;
public BaseRegion Region { get; }
Region ISpawner.Region => Region;
public Point3D HomeLocation { get; }
public int HomeRange { get; }
public Direction Direction { get; }
public SpawnDefinition Definition { get; }
public List<ISpawnable> SpawnedObjects { get; }
public int Max { get; private set; }
public TimeSpan MinSpawnTime { get; }
public TimeSpan MaxSpawnTime { get; }
public bool Running { get; private set; }
public bool Complete => SpawnedObjects.Count >= Max;
public bool Spawning => Running && !Complete;
public SpawnEntry( int id, BaseRegion region, Point3D home, int range, Direction direction, SpawnDefinition definition, int max, TimeSpan minSpawnTime, TimeSpan maxSpawnTime )
{
m_ID = id;
m_Region = region;
m_Home = home;
m_Range = range;
m_Direction = direction;
m_Definition = definition;
m_SpawnedObjects = new List<ISpawnable>();
m_Max = max;
m_MinSpawnTime = minSpawnTime;
m_MaxSpawnTime = maxSpawnTime;
m_Running = false;
ID = id;
Region = region;
HomeLocation = home;
HomeRange = range;
Direction = direction;
Definition = definition;
SpawnedObjects = new List<ISpawnable>();
Max = max;
MinSpawnTime = minSpawnTime;
MaxSpawnTime = maxSpawnTime;
Running = false;
if ( m_Table.Contains( id ) )
if ( Table.Contains( id ) )
Console.WriteLine( "Warning: double SpawnEntry ID '{0}'", id );
else
m_Table[id] = this;
Table[id] = this;
}
public Point3D RandomSpawnLocation( int spawnHeight, bool land, bool water )
{
return m_Region.RandomSpawnLocation( spawnHeight, land, water, m_Home, m_Range );
return Region.RandomSpawnLocation( spawnHeight, land, water, HomeLocation, HomeRange );
}
public void Start()
{
if ( m_Running )
if ( Running )
return;
m_Running = true;
Running = true;
CheckTimer();
}
public void Stop()
{
if ( !m_Running )
if ( !Running )
return;
m_Running = false;
Running = false;
CheckTimer();
}
private void Spawn()
{
ISpawnable spawn = m_Definition.Spawn(this);
ISpawnable spawn = Definition.Spawn(this);
if ( spawn != null )
Add( spawn );
@ -112,7 +108,7 @@ namespace Server.Regions
private void Add( ISpawnable spawn )
{
m_SpawnedObjects.Add( spawn );
SpawnedObjects.Add( spawn );
spawn.Spawner = this;
@ -122,15 +118,15 @@ namespace Server.Regions
void ISpawner.Remove( ISpawnable spawn )
{
m_SpawnedObjects.Remove( spawn );
SpawnedObjects.Remove( spawn );
CheckTimer();
}
private TimeSpan RandomTime()
{
int min = (int) m_MinSpawnTime.TotalSeconds;
int max = (int) m_MaxSpawnTime.TotalSeconds;
int min = (int) MinSpawnTime.TotalSeconds;
int max = (int) MaxSpawnTime.TotalSeconds;
int rand = Utility.RandomMinMax( min, max );
return TimeSpan.FromSeconds( rand );
@ -156,7 +152,7 @@ namespace Server.Regions
private void TimerCallback()
{
int amount = Math.Max( (m_Max - m_SpawnedObjects.Count) / 3, 1 );
int amount = Math.Max( (Max - SpawnedObjects.Count) / 3, 1 );
for ( int i = 0; i < amount; i++ )
Spawn();
@ -169,13 +165,13 @@ namespace Server.Regions
{
InternalDeleteSpawnedObjects();
m_Running = false;
Running = false;
CheckTimer();
}
private void InternalDeleteSpawnedObjects()
{
foreach ( ISpawnable spawnable in m_SpawnedObjects )
foreach ( ISpawnable spawnable in SpawnedObjects )
{
spawnable.Spawner = null;
@ -185,23 +181,23 @@ namespace Server.Regions
spawnable.Delete();
}
m_SpawnedObjects.Clear();
SpawnedObjects.Clear();
}
public void Respawn()
{
InternalDeleteSpawnedObjects();
for ( int i = 0; !Complete && i < m_Max; i++ )
for ( int i = 0; !Complete && i < Max; i++ )
Spawn();
m_Running = true;
Running = true;
CheckTimer();
}
public void Delete()
{
m_Max = 0;
Max = 0;
InternalDeleteSpawnedObjects();
if ( m_SpawnTimer != null )
@ -210,24 +206,24 @@ namespace Server.Regions
m_SpawnTimer = null;
}
if ( m_Table[m_ID] == this )
m_Table.Remove( m_ID );
if ( Table[ID] == this )
Table.Remove( ID );
}
public void Serialize( GenericWriter writer )
{
writer.Write( (int) m_SpawnedObjects.Count );
writer.Write( (int) SpawnedObjects.Count );
for ( int i = 0; i < m_SpawnedObjects.Count; i++ )
for ( int i = 0; i < SpawnedObjects.Count; i++ )
{
ISpawnable spawn = m_SpawnedObjects[i];
ISpawnable spawn = SpawnedObjects[i];
int serial = spawn.Serial;
writer.Write( (int) serial );
}
writer.Write( (bool) m_Running );
writer.Write( (bool) Running );
if ( m_SpawnTimer != null )
{
@ -253,7 +249,7 @@ namespace Server.Regions
Add(spawnableEntity);
}
m_Running = reader.ReadBool();
Running = reader.ReadBool();
if ( reader.ReadBool() )
{
@ -355,7 +351,7 @@ namespace Server.Regions
[Description( "Respawns all regions and sets the spawners as running." )]
private static void RespawnAllRegions_OnCommand( CommandEventArgs args )
{
foreach ( SpawnEntry entry in m_Table.Values )
foreach ( SpawnEntry entry in Table.Values )
{
entry.Respawn();
}
@ -382,7 +378,7 @@ namespace Server.Regions
[Description( "Deletes all spawned objects of every regions and sets the spawners as not running." )]
private static void DelAllRegionSpawns_OnCommand( CommandEventArgs args )
{
foreach ( SpawnEntry entry in m_Table.Values )
foreach ( SpawnEntry entry in Table.Values )
{
entry.DeleteSpawnedObjects();
}
@ -409,7 +405,7 @@ namespace Server.Regions
[Description( "Sets the region spawners of all regions as running." )]
private static void StartAllRegionSpawns_OnCommand( CommandEventArgs args )
{
foreach ( SpawnEntry entry in m_Table.Values )
foreach ( SpawnEntry entry in Table.Values )
{
entry.Start();
}
@ -436,7 +432,7 @@ namespace Server.Regions
[Description( "Sets the region spawners of all regions as not running." )]
private static void StopAllRegionSpawns_OnCommand( CommandEventArgs args )
{
foreach ( SpawnEntry entry in m_Table.Values )
foreach ( SpawnEntry entry in Table.Values )
{
entry.Stop();
}