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
|
|
@ -4,31 +4,16 @@ namespace Server.Items
|
|||
{
|
||||
public class BaseTreasureChest : LockableContainer
|
||||
{
|
||||
private TreasureLevel m_TreasureLevel;
|
||||
private short m_MaxSpawnTime = 60;
|
||||
private short m_MinSpawnTime = 10;
|
||||
private TreasureResetTimer m_ResetTimer;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TreasureLevel Level
|
||||
{
|
||||
get => m_TreasureLevel;
|
||||
set => m_TreasureLevel = value;
|
||||
}
|
||||
public TreasureLevel Level { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public short MaxSpawnTime
|
||||
{
|
||||
get => m_MaxSpawnTime;
|
||||
set => m_MaxSpawnTime = value;
|
||||
}
|
||||
public short MaxSpawnTime { get; set; } = 60;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public short MinSpawnTime
|
||||
{
|
||||
get => m_MinSpawnTime;
|
||||
set => m_MinSpawnTime = value;
|
||||
}
|
||||
public short MinSpawnTime { get; set; } = 10;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public override bool Locked {
|
||||
|
|
@ -51,7 +36,7 @@ namespace Server.Items
|
|||
|
||||
public BaseTreasureChest( int itemID, TreasureLevel level ) : base( itemID )
|
||||
{
|
||||
m_TreasureLevel = level;
|
||||
Level = level;
|
||||
Locked = true;
|
||||
Movable = false;
|
||||
|
||||
|
|
@ -79,9 +64,9 @@ namespace Server.Items
|
|||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 );
|
||||
writer.Write( (byte) m_TreasureLevel );
|
||||
writer.Write( m_MinSpawnTime );
|
||||
writer.Write( m_MaxSpawnTime );
|
||||
writer.Write( (byte) Level );
|
||||
writer.Write( MinSpawnTime );
|
||||
writer.Write( MaxSpawnTime );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -90,9 +75,9 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_TreasureLevel = (TreasureLevel)reader.ReadByte();
|
||||
m_MinSpawnTime = reader.ReadShort();
|
||||
m_MaxSpawnTime = reader.ReadShort();
|
||||
Level = (TreasureLevel)reader.ReadByte();
|
||||
MinSpawnTime = reader.ReadShort();
|
||||
MaxSpawnTime = reader.ReadShort();
|
||||
|
||||
if ( !Locked )
|
||||
StartResetTimer();
|
||||
|
|
@ -100,7 +85,7 @@ namespace Server.Items
|
|||
|
||||
protected virtual void SetLockLevel()
|
||||
{
|
||||
switch( m_TreasureLevel )
|
||||
switch( Level )
|
||||
{
|
||||
case TreasureLevel.Level1:
|
||||
RequiredSkill = LockLevel = 5;
|
||||
|
|
@ -133,7 +118,7 @@ namespace Server.Items
|
|||
if ( m_ResetTimer == null )
|
||||
m_ResetTimer = new TreasureResetTimer( this );
|
||||
else
|
||||
m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( m_MinSpawnTime, m_MaxSpawnTime ));
|
||||
m_ResetTimer.Delay = TimeSpan.FromMinutes( Utility.Random( MinSpawnTime, MaxSpawnTime ));
|
||||
|
||||
m_ResetTimer.Start();
|
||||
}
|
||||
|
|
@ -143,7 +128,7 @@ namespace Server.Items
|
|||
int MinGold = 1;
|
||||
int MaxGold = 2;
|
||||
|
||||
switch( m_TreasureLevel )
|
||||
switch( Level )
|
||||
{
|
||||
case TreasureLevel.Level1:
|
||||
MinGold = 100;
|
||||
|
|
|
|||
|
|
@ -629,9 +629,7 @@ namespace Server.Items
|
|||
|
||||
public class FillableBvrge : FillableEntry
|
||||
{
|
||||
private BeverageType m_Content;
|
||||
|
||||
public BeverageType Content => m_Content;
|
||||
public BeverageType Content { get; }
|
||||
|
||||
public FillableBvrge( Type type, BeverageType content )
|
||||
: this( 1, type, content )
|
||||
|
|
@ -641,7 +639,7 @@ namespace Server.Items
|
|||
public FillableBvrge( int weight, Type type, BeverageType content )
|
||||
: base( weight, type )
|
||||
{
|
||||
m_Content = content;
|
||||
Content = content;
|
||||
}
|
||||
|
||||
public override Item Construct()
|
||||
|
|
@ -652,11 +650,11 @@ namespace Server.Items
|
|||
|
||||
if ( m_Types[ index ] == typeof( BeverageBottle ) )
|
||||
{
|
||||
item = new BeverageBottle( m_Content );
|
||||
item = new BeverageBottle( Content );
|
||||
}
|
||||
else if ( m_Types[ index ] == typeof( Jug ) )
|
||||
{
|
||||
item = new Jug( m_Content );
|
||||
item = new Jug( Content );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -664,7 +662,7 @@ namespace Server.Items
|
|||
|
||||
if ( item is BaseBeverage bev )
|
||||
{
|
||||
bev.Content = m_Content;
|
||||
bev.Content = Content;
|
||||
bev.Quantity = bev.MaxQuantity;
|
||||
}
|
||||
}
|
||||
|
|
@ -692,21 +690,19 @@ namespace Server.Items
|
|||
|
||||
public class FillableContent
|
||||
{
|
||||
private int m_Level;
|
||||
private Type[] m_Vendors;
|
||||
|
||||
private FillableEntry[] m_Entries;
|
||||
private int m_Weight;
|
||||
|
||||
public int Level => m_Level;
|
||||
public Type[] Vendors => m_Vendors;
|
||||
public int Level { get; }
|
||||
|
||||
public Type[] Vendors { get; }
|
||||
|
||||
public FillableContentType TypeID => Lookup( this );
|
||||
|
||||
public FillableContent( int level, Type[] vendors, FillableEntry[] entries )
|
||||
{
|
||||
m_Level = level;
|
||||
m_Vendors = vendors;
|
||||
Level = level;
|
||||
Vendors = vendors;
|
||||
m_Entries = entries;
|
||||
|
||||
for( int i = 0; i < entries.Length; ++i )
|
||||
|
|
@ -1498,8 +1494,8 @@ namespace Server.Items
|
|||
{
|
||||
FillableContent fill = m_ContentTypes[ i ];
|
||||
|
||||
for( int j = 0; j < fill.m_Vendors.Length; ++j )
|
||||
m_AcquireTable[ fill.m_Vendors[ j ] ] = fill;
|
||||
for( int j = 0; j < fill.Vendors.Length; ++j )
|
||||
m_AcquireTable[ fill.Vendors[ j ] ] = fill;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,38 +7,18 @@ namespace Server.Items
|
|||
public abstract class LockableContainer : TrappableContainer, ILockable, ILockpickable, ICraftable, IShipwreckedItem
|
||||
{
|
||||
private bool m_Locked;
|
||||
private int m_LockLevel, m_MaxLockLevel, m_RequiredSkill;
|
||||
private uint m_KeyValue;
|
||||
private Mobile m_Picker;
|
||||
private bool m_TrapOnLockpick;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Picker
|
||||
{
|
||||
get => m_Picker;
|
||||
set => m_Picker = value;
|
||||
}
|
||||
public Mobile Picker { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MaxLockLevel
|
||||
{
|
||||
get => m_MaxLockLevel;
|
||||
set => m_MaxLockLevel = value;
|
||||
}
|
||||
public int MaxLockLevel { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int LockLevel
|
||||
{
|
||||
get => m_LockLevel;
|
||||
set => m_LockLevel = value;
|
||||
}
|
||||
public int LockLevel { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int RequiredSkill
|
||||
{
|
||||
get => m_RequiredSkill;
|
||||
set => m_RequiredSkill = value;
|
||||
}
|
||||
public int RequiredSkill { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual bool Locked
|
||||
|
|
@ -49,27 +29,19 @@ namespace Server.Items
|
|||
m_Locked = value;
|
||||
|
||||
if ( m_Locked )
|
||||
m_Picker = null;
|
||||
Picker = null;
|
||||
|
||||
InvalidateProperties();
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public uint KeyValue
|
||||
{
|
||||
get => m_KeyValue;
|
||||
set => m_KeyValue = value;
|
||||
}
|
||||
public uint KeyValue { get; set; }
|
||||
|
||||
public override bool TrapOnOpen => !m_TrapOnLockpick;
|
||||
public override bool TrapOnOpen => !TrapOnLockpick;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool TrapOnLockpick
|
||||
{
|
||||
get => m_TrapOnLockpick;
|
||||
set => m_TrapOnLockpick = value;
|
||||
}
|
||||
public bool TrapOnLockpick { get; set; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
|
|
@ -77,16 +49,16 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 6 ); // version
|
||||
|
||||
writer.Write( m_IsShipwreckedItem );
|
||||
writer.Write( IsShipwreckedItem );
|
||||
|
||||
writer.Write( (bool) m_TrapOnLockpick );
|
||||
writer.Write( (bool) TrapOnLockpick );
|
||||
|
||||
writer.Write( (int) m_RequiredSkill );
|
||||
writer.Write( (int) RequiredSkill );
|
||||
|
||||
writer.Write( (int) m_MaxLockLevel );
|
||||
writer.Write( (int) MaxLockLevel );
|
||||
|
||||
writer.Write( m_KeyValue );
|
||||
writer.Write( (int) m_LockLevel );
|
||||
writer.Write( KeyValue );
|
||||
writer.Write( (int) LockLevel );
|
||||
writer.Write( (bool) m_Locked );
|
||||
}
|
||||
|
||||
|
|
@ -100,56 +72,56 @@ namespace Server.Items
|
|||
{
|
||||
case 6:
|
||||
{
|
||||
m_IsShipwreckedItem = reader.ReadBool();
|
||||
IsShipwreckedItem = reader.ReadBool();
|
||||
|
||||
goto case 5;
|
||||
}
|
||||
case 5:
|
||||
{
|
||||
m_TrapOnLockpick = reader.ReadBool();
|
||||
TrapOnLockpick = reader.ReadBool();
|
||||
|
||||
goto case 4;
|
||||
}
|
||||
case 4:
|
||||
{
|
||||
m_RequiredSkill = reader.ReadInt();
|
||||
RequiredSkill = reader.ReadInt();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_MaxLockLevel = reader.ReadInt();
|
||||
MaxLockLevel = reader.ReadInt();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
m_KeyValue = reader.ReadUInt();
|
||||
KeyValue = reader.ReadUInt();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_LockLevel = reader.ReadInt();
|
||||
LockLevel = reader.ReadInt();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 3 )
|
||||
m_MaxLockLevel = 100;
|
||||
MaxLockLevel = 100;
|
||||
|
||||
if ( version < 4 )
|
||||
{
|
||||
if ( (m_MaxLockLevel - m_LockLevel) == 40 )
|
||||
if ( (MaxLockLevel - LockLevel) == 40 )
|
||||
{
|
||||
m_RequiredSkill = m_LockLevel + 6;
|
||||
m_LockLevel = m_RequiredSkill - 10;
|
||||
m_MaxLockLevel = m_RequiredSkill + 39;
|
||||
RequiredSkill = LockLevel + 6;
|
||||
LockLevel = RequiredSkill - 10;
|
||||
MaxLockLevel = RequiredSkill + 39;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RequiredSkill = m_LockLevel;
|
||||
RequiredSkill = LockLevel;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -162,7 +134,7 @@ namespace Server.Items
|
|||
|
||||
public LockableContainer( int itemID ) : base( itemID )
|
||||
{
|
||||
m_MaxLockLevel = 100;
|
||||
MaxLockLevel = 100;
|
||||
}
|
||||
|
||||
public LockableContainer( Serial serial ) : base( serial )
|
||||
|
|
@ -298,7 +270,7 @@ namespace Server.Items
|
|||
{
|
||||
base.AddNameProperties( list );
|
||||
|
||||
if ( m_IsShipwreckedItem )
|
||||
if ( IsShipwreckedItem )
|
||||
list.Add( 1041645 ); // recovered from a shipwreck
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +278,7 @@ namespace Server.Items
|
|||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_IsShipwreckedItem )
|
||||
if ( IsShipwreckedItem )
|
||||
LabelTo( from, 1041645 ); //recovered from a shipwreck
|
||||
}
|
||||
|
||||
|
|
@ -353,14 +325,9 @@ namespace Server.Items
|
|||
|
||||
#region IShipwreckedItem Members
|
||||
|
||||
private bool m_IsShipwreckedItem;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsShipwreckedItem
|
||||
{
|
||||
get => m_IsShipwreckedItem;
|
||||
set => m_IsShipwreckedItem = value;
|
||||
}
|
||||
public bool IsShipwreckedItem { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,9 +61,6 @@ namespace Server.Items
|
|||
|
||||
private bool m_AutoLock;
|
||||
private InternalTimer m_RelockTimer;
|
||||
private Map m_TargetMap;
|
||||
private Point3D m_Target;
|
||||
private string m_Description;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool AutoLock
|
||||
|
|
@ -81,14 +78,10 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Map TargetMap { get => m_TargetMap;
|
||||
set => m_TargetMap = value;
|
||||
}
|
||||
public Map TargetMap { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point3D Target { get => m_Target;
|
||||
set => m_Target = value;
|
||||
}
|
||||
public Point3D Target { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Bone
|
||||
|
|
@ -102,9 +95,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Description { get => m_Description;
|
||||
set => m_Description = value;
|
||||
}
|
||||
public string Description { get; set; }
|
||||
|
||||
public override bool IsDecoContainer => false;
|
||||
|
||||
|
|
@ -164,11 +155,9 @@ namespace Server.Items
|
|||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private MarkContainer m_Container;
|
||||
private DateTime m_RelockTime;
|
||||
public MarkContainer Container { get; }
|
||||
|
||||
public MarkContainer Container => m_Container;
|
||||
public DateTime RelockTime => m_RelockTime;
|
||||
public DateTime RelockTime { get; }
|
||||
|
||||
public InternalTimer( MarkContainer container ) : this( container, TimeSpan.FromMinutes( 5.0 ) )
|
||||
{
|
||||
|
|
@ -176,16 +165,16 @@ namespace Server.Items
|
|||
|
||||
public InternalTimer( MarkContainer container, TimeSpan delay ) : base( delay )
|
||||
{
|
||||
m_Container = container;
|
||||
m_RelockTime = DateTime.UtcNow + delay;
|
||||
Container = container;
|
||||
RelockTime = DateTime.UtcNow + delay;
|
||||
|
||||
Start();
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Container.Locked = true;
|
||||
m_Container.LockLevel = -255;
|
||||
Container.Locked = true;
|
||||
Container.LockLevel = -255;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -194,9 +183,9 @@ namespace Server.Items
|
|||
if ( TargetMap != null )
|
||||
{
|
||||
rune.Marked = true;
|
||||
rune.TargetMap = m_TargetMap;
|
||||
rune.Target = m_Target;
|
||||
rune.Description = m_Description;
|
||||
rune.TargetMap = TargetMap;
|
||||
rune.Target = Target;
|
||||
rune.Description = Description;
|
||||
rune.House = null;
|
||||
}
|
||||
}
|
||||
|
|
@ -234,9 +223,9 @@ namespace Server.Items
|
|||
if ( !Locked && m_AutoLock )
|
||||
writer.WriteDeltaTime( m_RelockTimer.RelockTime );
|
||||
|
||||
writer.Write( m_TargetMap );
|
||||
writer.Write( m_Target );
|
||||
writer.Write( m_Description );
|
||||
writer.Write( TargetMap );
|
||||
writer.Write( Target );
|
||||
writer.Write( Description );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -250,9 +239,9 @@ namespace Server.Items
|
|||
if ( !Locked && m_AutoLock )
|
||||
m_RelockTimer = new InternalTimer( this, reader.ReadDeltaTime() - DateTime.UtcNow );
|
||||
|
||||
m_TargetMap = reader.ReadMap();
|
||||
m_Target = reader.ReadPoint3D();
|
||||
m_Description = reader.ReadString();
|
||||
TargetMap = reader.ReadMap();
|
||||
Target = reader.ReadPoint3D();
|
||||
Description = reader.ReadString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,30 +13,14 @@ namespace Server.Items
|
|||
|
||||
public abstract class TrappableContainer : BaseContainer, ITelekinesisable
|
||||
{
|
||||
private TrapType m_TrapType;
|
||||
private int m_TrapPower;
|
||||
private int m_TrapLevel;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TrapType TrapType { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TrapType TrapType
|
||||
{
|
||||
get => m_TrapType;
|
||||
set => m_TrapType = value;
|
||||
}
|
||||
public int TrapPower { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TrapPower
|
||||
{
|
||||
get => m_TrapPower;
|
||||
set => m_TrapPower = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TrapLevel
|
||||
{
|
||||
get => m_TrapLevel;
|
||||
set => m_TrapLevel = value;
|
||||
}
|
||||
public int TrapLevel { get; set; }
|
||||
|
||||
public virtual bool TrapOnOpen => true;
|
||||
|
||||
|
|
@ -66,7 +50,7 @@ namespace Server.Items
|
|||
|
||||
public virtual bool ExecuteTrap( Mobile from )
|
||||
{
|
||||
if ( m_TrapType != TrapType.None )
|
||||
if ( TrapType != TrapType.None )
|
||||
{
|
||||
Point3D loc = GetWorldLocation();
|
||||
Map facet = Map;
|
||||
|
|
@ -77,7 +61,7 @@ namespace Server.Items
|
|||
return false;
|
||||
}
|
||||
|
||||
switch ( m_TrapType )
|
||||
switch ( TrapType )
|
||||
{
|
||||
case TrapType.ExplosionTrap:
|
||||
{
|
||||
|
|
@ -87,10 +71,10 @@ namespace Server.Items
|
|||
{
|
||||
int damage;
|
||||
|
||||
if ( m_TrapLevel > 0 )
|
||||
damage = Utility.RandomMinMax( 10, 30 ) * m_TrapLevel;
|
||||
if ( TrapLevel > 0 )
|
||||
damage = Utility.RandomMinMax( 10, 30 ) * TrapLevel;
|
||||
else
|
||||
damage = m_TrapPower;
|
||||
damage = TrapPower;
|
||||
|
||||
AOS.Damage( from, damage, 0, 100, 0, 0, 0 );
|
||||
|
||||
|
|
@ -106,7 +90,7 @@ namespace Server.Items
|
|||
case TrapType.MagicTrap:
|
||||
{
|
||||
if ( from.InRange( loc, 1 ) )
|
||||
from.Damage( m_TrapPower );
|
||||
from.Damage( TrapPower );
|
||||
//AOS.Damage( from, m_TrapPower, 0, 100, 0, 0, 0 );
|
||||
|
||||
Effects.PlaySound( loc, Map, 0x307 );
|
||||
|
|
@ -129,10 +113,10 @@ namespace Server.Items
|
|||
{
|
||||
int damage;
|
||||
|
||||
if ( m_TrapLevel > 0 )
|
||||
damage = Utility.RandomMinMax( 5, 15 ) * m_TrapLevel;
|
||||
if ( TrapLevel > 0 )
|
||||
damage = Utility.RandomMinMax( 5, 15 ) * TrapLevel;
|
||||
else
|
||||
damage = m_TrapPower;
|
||||
damage = TrapPower;
|
||||
|
||||
AOS.Damage( from, damage, 100, 0, 0, 0, 0 );
|
||||
|
||||
|
|
@ -152,13 +136,13 @@ namespace Server.Items
|
|||
{
|
||||
Poison poison;
|
||||
|
||||
if ( m_TrapLevel > 0 )
|
||||
if ( TrapLevel > 0 )
|
||||
{
|
||||
poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, m_TrapLevel - 1 ) ) );
|
||||
poison = Poison.GetPoison( Math.Max( 0, Math.Min( 4, TrapLevel - 1 ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
AOS.Damage( from, m_TrapPower, 0, 0, 0, 100, 0 );
|
||||
AOS.Damage( from, TrapPower, 0, 0, 0, 100, 0 );
|
||||
poison = Poison.Greater;
|
||||
}
|
||||
|
||||
|
|
@ -175,9 +159,9 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
m_TrapType = TrapType.None;
|
||||
m_TrapPower = 0;
|
||||
m_TrapLevel = 0;
|
||||
TrapType = TrapType.None;
|
||||
TrapPower = 0;
|
||||
TrapLevel = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -207,10 +191,10 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_TrapLevel );
|
||||
writer.Write( (int) TrapLevel );
|
||||
|
||||
writer.Write( (int) m_TrapPower );
|
||||
writer.Write( (int) m_TrapType );
|
||||
writer.Write( (int) TrapPower );
|
||||
writer.Write( (int) TrapType );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -223,17 +207,17 @@ namespace Server.Items
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_TrapLevel = reader.ReadInt();
|
||||
TrapLevel = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_TrapPower = reader.ReadInt();
|
||||
TrapPower = reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_TrapType = (TrapType)reader.ReadInt();
|
||||
TrapType = (TrapType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@ namespace Server.Items
|
|||
{
|
||||
public override int LabelNumber => 3000541;
|
||||
|
||||
public static Type[] Artifacts => m_Artifacts;
|
||||
|
||||
private static Type[] m_Artifacts = {
|
||||
public static Type[] Artifacts { get; } =
|
||||
{
|
||||
typeof( CandelabraOfSouls ), typeof( GoldBricks ), typeof( PhillipsWoodenSteed ),
|
||||
typeof( ArcticDeathDealer ), typeof( BlazeOfDeath ), typeof( BurglarsBandana ),
|
||||
typeof( CavortingClub ), typeof( DreadPirateHat ),
|
||||
|
|
@ -23,33 +22,21 @@ namespace Server.Items
|
|||
typeof( ColdBlood ), typeof( AlchemistsBauble )
|
||||
};
|
||||
|
||||
private int m_Level;
|
||||
private DateTime m_DeleteTime;
|
||||
private Timer m_Timer;
|
||||
private Mobile m_Owner;
|
||||
private bool m_Temporary;
|
||||
|
||||
private List<Mobile> m_Guardians;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Level{ get => m_Level;
|
||||
set => m_Level = value;
|
||||
}
|
||||
public int Level { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner{ get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime DeleteTime => m_DeleteTime;
|
||||
public DateTime DeleteTime { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Temporary{ get => m_Temporary;
|
||||
set => m_Temporary = value;
|
||||
}
|
||||
public bool Temporary { get; set; }
|
||||
|
||||
public List<Mobile> Guardians => m_Guardians;
|
||||
public List<Mobile> Guardians { get; private set; }
|
||||
|
||||
[Constructible]
|
||||
public TreasureMapChest( int level ) : this( null, level, false )
|
||||
|
|
@ -58,14 +45,14 @@ namespace Server.Items
|
|||
|
||||
public TreasureMapChest( Mobile owner, int level, bool temporary ) : base( 0xE40 )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Level = level;
|
||||
m_DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 );
|
||||
Owner = owner;
|
||||
Level = level;
|
||||
DeleteTime = DateTime.UtcNow + TimeSpan.FromHours( 3.0 );
|
||||
|
||||
m_Temporary = temporary;
|
||||
m_Guardians = new List<Mobile>();
|
||||
Temporary = temporary;
|
||||
Guardians = new List<Mobile>();
|
||||
|
||||
m_Timer = new DeleteTimer( this, m_DeleteTime );
|
||||
m_Timer = new DeleteTimer( this, DeleteTime );
|
||||
m_Timer.Start();
|
||||
|
||||
Fill( this, level );
|
||||
|
|
@ -278,7 +265,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
if ( level == 6 && Core.AOS )
|
||||
cont.DropItem( (Item)Activator.CreateInstance( m_Artifacts[Utility.Random(m_Artifacts.Length)] ) );
|
||||
cont.DropItem( (Item)Activator.CreateInstance( Artifacts[Utility.Random(Artifacts.Length)] ) );
|
||||
}
|
||||
|
||||
public override bool CheckLocked( Mobile from )
|
||||
|
|
@ -308,13 +295,13 @@ namespace Server.Items
|
|||
|
||||
private bool CheckLoot( Mobile m, bool criminalAction )
|
||||
{
|
||||
if ( m_Temporary )
|
||||
if ( Temporary )
|
||||
return false;
|
||||
|
||||
if ( m.AccessLevel >= AccessLevel.GameMaster || m_Owner == null || m == m_Owner )
|
||||
if ( m.AccessLevel >= AccessLevel.GameMaster || Owner == null || m == Owner )
|
||||
return true;
|
||||
|
||||
Party p = Party.Get( m_Owner );
|
||||
Party p = Party.Get( Owner );
|
||||
|
||||
if ( p != null && p.Contains( m ) )
|
||||
return true;
|
||||
|
|
@ -358,7 +345,7 @@ namespace Server.Items
|
|||
m_Lifted.Add( item );
|
||||
|
||||
if ( 0.1 >= Utility.RandomDouble() ) // 10% chance to spawn a new monster
|
||||
TreasureMap.Spawn( m_Level, GetWorldLocation(), Map, from, false );
|
||||
TreasureMap.Spawn( Level, GetWorldLocation(), Map, from, false );
|
||||
}
|
||||
|
||||
base.OnItemLifted( from, item );
|
||||
|
|
@ -385,13 +372,13 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( m_Guardians, true );
|
||||
writer.Write( (bool) m_Temporary );
|
||||
writer.Write( Guardians, true );
|
||||
writer.Write( (bool) Temporary );
|
||||
|
||||
writer.Write( m_Owner );
|
||||
writer.Write( Owner );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.WriteDeltaTime( m_DeleteTime );
|
||||
writer.Write( (int) Level );
|
||||
writer.WriteDeltaTime( DeleteTime );
|
||||
writer.Write( m_Lifted, true );
|
||||
}
|
||||
|
||||
|
|
@ -405,33 +392,33 @@ namespace Server.Items
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_Guardians = reader.ReadStrongMobileList();
|
||||
m_Temporary = reader.ReadBool();
|
||||
Guardians = reader.ReadStrongMobileList();
|
||||
Temporary = reader.ReadBool();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Owner = reader.ReadMobile();
|
||||
Owner = reader.ReadMobile();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Level = reader.ReadInt();
|
||||
m_DeleteTime = reader.ReadDeltaTime();
|
||||
Level = reader.ReadInt();
|
||||
DeleteTime = reader.ReadDeltaTime();
|
||||
m_Lifted = reader.ReadStrongItemList();
|
||||
|
||||
if ( version < 2 )
|
||||
m_Guardians = new List<Mobile>();
|
||||
Guardians = new List<Mobile>();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !m_Temporary )
|
||||
if ( !Temporary )
|
||||
{
|
||||
m_Timer = new DeleteTimer( this, m_DeleteTime );
|
||||
m_Timer = new DeleteTimer( this, DeleteTime );
|
||||
m_Timer.Start();
|
||||
}
|
||||
else
|
||||
|
|
@ -468,7 +455,7 @@ namespace Server.Items
|
|||
|
||||
public void EndRemove( Mobile from )
|
||||
{
|
||||
if ( Deleted || from != m_Owner || !from.InRange( GetWorldLocation(), 3 ) )
|
||||
if ( Deleted || from != Owner || !from.InRange( GetWorldLocation(), 3 ) )
|
||||
return;
|
||||
|
||||
from.SendLocalizedMessage( 1048124, "", 0x8A5 ); // The old, rusted chest crumbles when you hit it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue