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
|
|
@ -24,56 +24,29 @@ namespace Server.Engines.Doom
|
|||
|
||||
private GauntletSpawnerState m_State;
|
||||
|
||||
private string m_TypeName;
|
||||
private BaseDoor m_Door;
|
||||
private BaseAddon m_Addon;
|
||||
private GauntletSpawner m_Sequence;
|
||||
private List<Mobile> m_Creatures;
|
||||
|
||||
private Rectangle2D m_RegionBounds;
|
||||
private List<BaseTrap> m_Traps;
|
||||
|
||||
private Region m_Region;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TypeName { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string TypeName
|
||||
{
|
||||
get => m_TypeName;
|
||||
set => m_TypeName = value;
|
||||
}
|
||||
public BaseDoor Door { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseDoor Door
|
||||
{
|
||||
get => m_Door;
|
||||
set => m_Door = value;
|
||||
}
|
||||
public BaseAddon Addon { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public BaseAddon Addon
|
||||
{
|
||||
get => m_Addon;
|
||||
set => m_Addon = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public GauntletSpawner Sequence
|
||||
{
|
||||
get => m_Sequence;
|
||||
set => m_Sequence = value;
|
||||
}
|
||||
public GauntletSpawner Sequence { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool HasCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( m_Creatures.Count == 0 )
|
||||
if ( Creatures.Count == 0 )
|
||||
return false;
|
||||
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
for ( int i = 0; i < Creatures.Count; ++i )
|
||||
{
|
||||
Mobile mob = m_Creatures[i];
|
||||
Mobile mob = Creatures[i];
|
||||
|
||||
if ( !mob.Deleted )
|
||||
return false;
|
||||
|
|
@ -84,11 +57,7 @@ namespace Server.Engines.Doom
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D RegionBounds
|
||||
{
|
||||
get => m_RegionBounds;
|
||||
set => m_RegionBounds = value;
|
||||
}
|
||||
public Rectangle2D RegionBounds { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public GauntletSpawnerState State
|
||||
|
|
@ -111,32 +80,32 @@ namespace Server.Engines.Doom
|
|||
case GauntletSpawnerState.Completed: hue = CompletedItemHue; break;
|
||||
}
|
||||
|
||||
if ( m_Door != null )
|
||||
if ( Door != null )
|
||||
{
|
||||
m_Door.Hue = hue;
|
||||
m_Door.Locked = lockDoors;
|
||||
Door.Hue = hue;
|
||||
Door.Locked = lockDoors;
|
||||
|
||||
if ( lockDoors )
|
||||
{
|
||||
m_Door.KeyValue = Key.RandomValue();
|
||||
m_Door.Open = false;
|
||||
Door.KeyValue = Key.RandomValue();
|
||||
Door.Open = false;
|
||||
}
|
||||
|
||||
if ( m_Door.Link != null )
|
||||
if ( Door.Link != null )
|
||||
{
|
||||
m_Door.Link.Hue = hue;
|
||||
m_Door.Link.Locked = lockDoors;
|
||||
Door.Link.Hue = hue;
|
||||
Door.Link.Locked = lockDoors;
|
||||
|
||||
if ( lockDoors )
|
||||
{
|
||||
m_Door.Link.KeyValue = Key.RandomValue();
|
||||
m_Door.Open = false;
|
||||
Door.Link.KeyValue = Key.RandomValue();
|
||||
Door.Open = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_Addon != null )
|
||||
m_Addon.Hue = hue;
|
||||
if ( Addon != null )
|
||||
Addon.Hue = hue;
|
||||
|
||||
if ( m_State == GauntletSpawnerState.InProgress )
|
||||
{
|
||||
|
|
@ -160,27 +129,15 @@ namespace Server.Engines.Doom
|
|||
|
||||
private Timer m_Timer;
|
||||
|
||||
public List<Mobile> Creatures
|
||||
{
|
||||
get => m_Creatures;
|
||||
set => m_Creatures = value;
|
||||
}
|
||||
public List<Mobile> Creatures { get; set; }
|
||||
|
||||
public List<BaseTrap> Traps
|
||||
{
|
||||
get => m_Traps;
|
||||
set => m_Traps = value;
|
||||
}
|
||||
public List<BaseTrap> Traps { get; set; }
|
||||
|
||||
public Region Region
|
||||
{
|
||||
get => m_Region;
|
||||
set => m_Region = value;
|
||||
}
|
||||
public Region Region { get; set; }
|
||||
|
||||
public virtual void CreateRegion()
|
||||
{
|
||||
if ( m_Region != null )
|
||||
if ( Region != null )
|
||||
return;
|
||||
|
||||
Map map = Map;
|
||||
|
|
@ -188,29 +145,29 @@ namespace Server.Engines.Doom
|
|||
if ( map == null || map == Map.Internal )
|
||||
return;
|
||||
|
||||
m_Region = new GauntletRegion( this, map );
|
||||
Region = new GauntletRegion( this, map );
|
||||
}
|
||||
|
||||
public virtual void DestroyRegion()
|
||||
{
|
||||
m_Region?.Unregister();
|
||||
Region?.Unregister();
|
||||
|
||||
m_Region = null;
|
||||
Region = null;
|
||||
}
|
||||
|
||||
public virtual int ComputeTrapCount()
|
||||
{
|
||||
int area = m_RegionBounds.Width * m_RegionBounds.Height;
|
||||
int area = RegionBounds.Width * RegionBounds.Height;
|
||||
|
||||
return area / 100;
|
||||
}
|
||||
|
||||
public virtual void ClearTraps()
|
||||
{
|
||||
for ( int i = 0; i < m_Traps.Count; ++i )
|
||||
m_Traps[i].Delete();
|
||||
for ( int i = 0; i < Traps.Count; ++i )
|
||||
Traps[i].Delete();
|
||||
|
||||
m_Traps.Clear();
|
||||
Traps.Clear();
|
||||
}
|
||||
|
||||
public virtual void SpawnTrap()
|
||||
|
|
@ -244,8 +201,8 @@ namespace Server.Engines.Doom
|
|||
// try 10 times to find a valid location
|
||||
for ( int i = 0; i < 10; ++i )
|
||||
{
|
||||
int x = Utility.Random( m_RegionBounds.X, m_RegionBounds.Width );
|
||||
int y = Utility.Random( m_RegionBounds.Y, m_RegionBounds.Height );
|
||||
int x = Utility.Random( RegionBounds.X, RegionBounds.Width );
|
||||
int y = Utility.Random( RegionBounds.Y, RegionBounds.Height );
|
||||
int z = Z;
|
||||
|
||||
if ( !map.CanFit( x, y, z, 16, false, false ) )
|
||||
|
|
@ -255,7 +212,7 @@ namespace Server.Engines.Doom
|
|||
continue;
|
||||
|
||||
trap.MoveToWorld( new Point3D( x, y, z ), map );
|
||||
m_Traps.Add( trap );
|
||||
Traps.Add( trap );
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
@ -279,8 +236,8 @@ namespace Server.Engines.Doom
|
|||
playerCount = reg.GetPlayerCount();
|
||||
}
|
||||
|
||||
if ( playerCount == 0 && m_Region != null )
|
||||
playerCount = m_Region.GetPlayerCount();
|
||||
if ( playerCount == 0 && Region != null )
|
||||
playerCount = Region.GetPlayerCount();
|
||||
|
||||
int count = (playerCount + PlayersPerSpawn - 1) / PlayersPerSpawn;
|
||||
|
||||
|
|
@ -292,10 +249,10 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void ClearCreatures()
|
||||
{
|
||||
for ( int i = 0; i < m_Creatures.Count; ++i )
|
||||
m_Creatures[i].Delete();
|
||||
for ( int i = 0; i < Creatures.Count; ++i )
|
||||
Creatures[i].Delete();
|
||||
|
||||
m_Creatures.Clear();
|
||||
Creatures.Clear();
|
||||
}
|
||||
|
||||
public virtual void FullSpawn()
|
||||
|
|
@ -319,10 +276,10 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
try
|
||||
{
|
||||
if ( m_TypeName == null )
|
||||
if ( TypeName == null )
|
||||
return;
|
||||
|
||||
Type type = ScriptCompiler.FindTypeByName( m_TypeName, true );
|
||||
Type type = ScriptCompiler.FindTypeByName( TypeName, true );
|
||||
|
||||
if ( type == null )
|
||||
return;
|
||||
|
|
@ -335,7 +292,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
mob.MoveToWorld( GetWorldLocation(), Map );
|
||||
|
||||
m_Creatures.Add( mob );
|
||||
Creatures.Add( mob );
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
@ -349,8 +306,8 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
State = GauntletSpawnerState.InSequence;
|
||||
|
||||
if ( m_Sequence != null && !m_Sequence.Deleted )
|
||||
m_Sequence.RecurseReset();
|
||||
if ( Sequence != null && !Sequence.Deleted )
|
||||
Sequence.RecurseReset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -361,19 +318,19 @@ namespace Server.Engines.Doom
|
|||
|
||||
int count = ComputeSpawnCount();
|
||||
|
||||
for ( int i = m_Creatures.Count; i < count; ++i )
|
||||
for ( int i = Creatures.Count; i < count; ++i )
|
||||
Spawn();
|
||||
|
||||
if ( HasCompleted )
|
||||
{
|
||||
State = GauntletSpawnerState.Completed;
|
||||
|
||||
if ( m_Sequence != null && !m_Sequence.Deleted )
|
||||
if ( Sequence != null && !Sequence.Deleted )
|
||||
{
|
||||
if ( m_Sequence.State == GauntletSpawnerState.Completed )
|
||||
if ( Sequence.State == GauntletSpawnerState.Completed )
|
||||
RecurseReset();
|
||||
|
||||
m_Sequence.State = GauntletSpawnerState.InProgress;
|
||||
Sequence.State = GauntletSpawnerState.InProgress;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -391,9 +348,9 @@ namespace Server.Engines.Doom
|
|||
Visible = false;
|
||||
Movable = false;
|
||||
|
||||
m_TypeName = typeName;
|
||||
m_Creatures = new List<Mobile>();
|
||||
m_Traps = new List<BaseTrap>();
|
||||
TypeName = typeName;
|
||||
Creatures = new List<Mobile>();
|
||||
Traps = new List<BaseTrap>();
|
||||
}
|
||||
|
||||
public GauntletSpawner( Serial serial ) : base( serial )
|
||||
|
|
@ -406,16 +363,16 @@ namespace Server.Engines.Doom
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_RegionBounds );
|
||||
writer.Write( RegionBounds );
|
||||
|
||||
writer.WriteItemList<BaseTrap>( m_Traps, false );
|
||||
writer.WriteItemList<BaseTrap>( Traps, false );
|
||||
|
||||
writer.Write( m_Creatures, false );
|
||||
writer.Write( Creatures, false );
|
||||
|
||||
writer.Write( m_TypeName );
|
||||
writer.WriteItem<BaseDoor>( m_Door );
|
||||
writer.WriteItem<BaseAddon>( m_Addon );
|
||||
writer.WriteItem<GauntletSpawner>( m_Sequence );
|
||||
writer.Write( TypeName );
|
||||
writer.WriteItem<BaseDoor>( Door );
|
||||
writer.WriteItem<BaseAddon>( Addon );
|
||||
writer.WriteItem<GauntletSpawner>( Sequence );
|
||||
|
||||
writer.Write( (int) m_State );
|
||||
}
|
||||
|
|
@ -430,8 +387,8 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_RegionBounds = reader.ReadRect2D();
|
||||
m_Traps = reader.ReadStrongItemList<BaseTrap>();
|
||||
RegionBounds = reader.ReadRect2D();
|
||||
Traps = reader.ReadStrongItemList<BaseTrap>();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
|
|
@ -439,16 +396,16 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
if ( version < 1 )
|
||||
{
|
||||
m_Traps = new List<BaseTrap>();
|
||||
m_RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 );
|
||||
Traps = new List<BaseTrap>();
|
||||
RegionBounds = new Rectangle2D( X - 40, Y - 40, 80, 80 );
|
||||
}
|
||||
|
||||
m_Creatures = reader.ReadStrongMobileList();
|
||||
Creatures = reader.ReadStrongMobileList();
|
||||
|
||||
m_TypeName = reader.ReadString();
|
||||
m_Door = reader.ReadItem<BaseDoor>(); ;
|
||||
m_Addon = reader.ReadItem<BaseAddon>(); ;
|
||||
m_Sequence = reader.ReadItem<GauntletSpawner>();
|
||||
TypeName = reader.ReadString();
|
||||
Door = reader.ReadItem<BaseDoor>(); ;
|
||||
Addon = reader.ReadItem<BaseAddon>(); ;
|
||||
Sequence = reader.ReadItem<GauntletSpawner>();
|
||||
|
||||
State = (GauntletSpawnerState)reader.ReadInt();
|
||||
|
||||
|
|
|
|||
|
|
@ -14,17 +14,12 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
public class LeverPuzzleController : Item
|
||||
{
|
||||
private bool m_Enabled;
|
||||
private static bool installed;
|
||||
|
||||
private ushort m_MyKey;
|
||||
private ushort m_TheirKey;
|
||||
|
||||
private List<Item> m_Levers;
|
||||
private List<Item> m_Teles;
|
||||
private List<Item> m_Statues;
|
||||
private List<LeverPuzzleRegion> m_Tiles;
|
||||
private Mobile m_Successful;
|
||||
private LampRoomBox m_Box;
|
||||
private Region m_LampRoom;
|
||||
|
||||
|
|
@ -58,21 +53,15 @@ namespace Server.Engines.Doom
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ushort MyKey { get => m_MyKey;
|
||||
set => m_MyKey = value;
|
||||
}
|
||||
public ushort MyKey { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ushort TheirKey { get => m_TheirKey;
|
||||
set => m_TheirKey = value;
|
||||
}
|
||||
public ushort TheirKey { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Enabled { get => m_Enabled;
|
||||
set => m_Enabled = value;
|
||||
}
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public Mobile Successful => m_Successful;
|
||||
public Mobile Successful { get; private set; }
|
||||
|
||||
public bool CircleComplete
|
||||
{
|
||||
|
|
@ -253,7 +242,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
public virtual void RemoveSuccessful()
|
||||
{
|
||||
m_Successful=null;
|
||||
Successful=null;
|
||||
}
|
||||
|
||||
public virtual void LeverPulled( ushort code )
|
||||
|
|
@ -280,7 +269,7 @@ namespace Server.Engines.Doom
|
|||
if ( TheirKey == MyKey )
|
||||
{
|
||||
GenKey();
|
||||
if (( m_Successful = ( m_Player=GetOccupant( 0 ))) != null )
|
||||
if (( Successful = ( m_Player=GetOccupant( 0 ))) != null )
|
||||
{
|
||||
SendLocationEffect( lp_Center, 0x1153, 0, 60, 1 );
|
||||
PlaySounds( lp_Center, cs1 );
|
||||
|
|
@ -290,7 +279,7 @@ namespace Server.Engines.Doom
|
|||
|
||||
m_Timer = new LampRoomTimer( this );
|
||||
m_Timer.Start();
|
||||
m_Enabled = false;
|
||||
Enabled = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -715,9 +704,9 @@ namespace Server.Engines.Doom
|
|||
m_Tiles.Add( new LeverPuzzleRegion( this, TA[i] ));
|
||||
|
||||
m_LampRoom = new LampRoomRegion( this );
|
||||
m_Enabled = true;
|
||||
m_TheirKey = 0;
|
||||
m_MyKey = 0;
|
||||
Enabled = true;
|
||||
TheirKey = 0;
|
||||
MyKey = 0;
|
||||
GenKey();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -95,16 +95,15 @@ namespace Server.Engines.Doom
|
|||
|
||||
public class LeverPuzzleLever : Item
|
||||
{
|
||||
private ushort m_Code;
|
||||
private LeverPuzzleController m_Controller;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ushort Code => m_Code;
|
||||
public ushort Code { get; private set; }
|
||||
|
||||
public LeverPuzzleLever( ushort code, LeverPuzzleController controller ) : base( 0x108E )
|
||||
{
|
||||
m_Controller=controller;
|
||||
m_Code = code;
|
||||
Code = code;
|
||||
Hue = 0x66D;
|
||||
Movable = false;
|
||||
}
|
||||
|
|
@ -115,7 +114,7 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
ItemID^=2;
|
||||
Effects.PlaySound( Location, Map, 0x3E8 );
|
||||
m_Controller.LeverPulled( m_Code );
|
||||
m_Controller.LeverPulled( Code );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -136,14 +135,14 @@ namespace Server.Engines.Doom
|
|||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (ushort) m_Code );
|
||||
writer.Write( (ushort) Code );
|
||||
writer.Write( m_Controller );
|
||||
}
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
m_Code = reader.ReadUShort();
|
||||
Code = reader.ReadUShort();
|
||||
m_Controller = reader.ReadItem() as LeverPuzzleController;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue