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

@ -62,12 +62,11 @@ namespace Server.Items
}
}
private CannonDirection m_CannonDirection;
private int m_Charges;
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public CannonDirection CannonDirection => m_CannonDirection;
public CannonDirection CannonDirection { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Charges
@ -98,7 +97,7 @@ namespace Server.Items
[Constructible]
public CannonAddon( CannonDirection direction )
{
m_CannonDirection = direction;
CannonDirection = direction;
switch ( direction )
{
@ -224,7 +223,7 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.Write( (int) m_CannonDirection );
writer.Write( (int) CannonDirection );
writer.Write( (int) m_Charges );
writer.Write( (bool) m_IsRewardItem );
}
@ -235,7 +234,7 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_CannonDirection = (CannonDirection) reader.ReadInt();
CannonDirection = (CannonDirection) reader.ReadInt();
m_Charges = reader.ReadInt();
m_IsRewardItem = reader.ReadBool();
}

View file

@ -21,52 +21,32 @@ namespace Server.Items
get
{
MiningCartDeed deed = new MiningCartDeed();
deed.IsRewardItem = m_IsRewardItem;
deed.Gems = m_Gems;
deed.Ore = m_Ore;
deed.IsRewardItem = IsRewardItem;
deed.Gems = Gems;
deed.Ore = Ore;
return deed;
}
}
private bool m_IsRewardItem;
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool IsRewardItem
{
get => m_IsRewardItem;
set => m_IsRewardItem = value;
}
private MiningCartType m_CartType;
public MiningCartType CartType { get; private set; }
[CommandProperty( AccessLevel.GameMaster )]
public MiningCartType CartType => m_CartType;
private int m_Gems;
public int Gems { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Gems
{
get => m_Gems;
set => m_Gems = value;
}
private int m_Ore;
[CommandProperty( AccessLevel.GameMaster )]
public int Ore
{
get => m_Ore;
set => m_Ore = value;
}
public int Ore { get; set; }
private Timer m_Timer;
[Constructible]
public MiningCart( MiningCartType type )
{
m_CartType = type;
CartType = type;
switch ( type )
{
@ -121,15 +101,15 @@ namespace Server.Items
private void GiveResources()
{
switch ( m_CartType )
switch ( CartType )
{
case MiningCartType.OreSouth:
case MiningCartType.OreEast:
m_Ore = Math.Min( 100, m_Ore + 10 );
Ore = Math.Min( 100, Ore + 10 );
break;
case MiningCartType.GemSouth:
case MiningCartType.GemEast:
m_Gems = Math.Min( 50, m_Gems + 5 );
Gems = Math.Min( 50, Gems + 5 );
break;
}
}
@ -163,11 +143,11 @@ namespace Server.Items
}
else if ( house != null && house.HasSecureAccess( from, SecureLevel.Friends ) )
{
switch ( m_CartType )
switch ( CartType )
{
case MiningCartType.OreSouth:
case MiningCartType.OreEast:
if ( m_Ore > 0 )
if ( Ore > 0 )
{
Item ingots = null;
@ -184,7 +164,7 @@ namespace Server.Items
case 8: ingots = new ValoriteIngot(); break;
}
int amount = Math.Min( 10, m_Ore );
int amount = Math.Min( 10, Ore );
ingots.Amount = amount;
if ( !from.PlaceInBackpack( ingots ) )
@ -195,7 +175,7 @@ namespace Server.Items
else
{
PublicOverheadMessage(MessageType.Regular, 0, 1094724, amount.ToString() ); // Ore: ~1_COUNT~
m_Ore -= amount;
Ore -= amount;
}
}
else
@ -204,7 +184,7 @@ namespace Server.Items
break;
case MiningCartType.GemSouth:
case MiningCartType.GemEast:
if ( m_Gems > 0 )
if ( Gems > 0 )
{
Item gems = null;
@ -229,7 +209,7 @@ namespace Server.Items
case 14: gems = new BlueDiamond(); break;
}
int amount = Math.Min( 5, m_Gems );
int amount = Math.Min( 5, Gems );
gems.Amount = amount;
if ( !from.PlaceInBackpack( gems ) )
@ -240,7 +220,7 @@ namespace Server.Items
else
{
PublicOverheadMessage( MessageType.Regular, 0, 1094723, amount.ToString() ); // Gems: ~1_COUNT~
m_Gems -= amount;
Gems -= amount;
}
}
else
@ -260,12 +240,12 @@ namespace Server.Items
writer.WriteEncodedInt( 1 ); // version
#region version 1
writer.Write( (int) m_CartType );
writer.Write( (int) CartType );
#endregion
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Gems );
writer.Write( (int) m_Ore );
writer.Write( (bool) IsRewardItem );
writer.Write( (int) Gems );
writer.Write( (int) Ore );
if ( m_Timer != null )
writer.Write( (DateTime) m_Timer.Next );
@ -282,12 +262,12 @@ namespace Server.Items
switch ( version )
{
case 1:
m_CartType = (MiningCartType) reader.ReadInt();
CartType = (MiningCartType) reader.ReadInt();
goto case 0;
case 0:
m_IsRewardItem = reader.ReadBool();
m_Gems = reader.ReadInt();
m_Ore = reader.ReadInt();
IsRewardItem = reader.ReadBool();
Gems = reader.ReadInt();
Ore = reader.ReadInt();
DateTime next = reader.ReadDateTime();
@ -310,8 +290,8 @@ namespace Server.Items
{
MiningCart addon = new MiningCart( m_CartType );
addon.IsRewardItem = m_IsRewardItem;
addon.Gems = m_Gems;
addon.Ore = m_Ore;
addon.Gems = Gems;
addon.Ore = Ore;
return addon;
}
@ -328,23 +308,11 @@ namespace Server.Items
set{ m_IsRewardItem = value; InvalidateProperties(); }
}
private int m_Gems;
[CommandProperty( AccessLevel.GameMaster )]
public int Gems { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public int Gems
{
get => m_Gems;
set => m_Gems = value;
}
private int m_Ore;
[CommandProperty( AccessLevel.GameMaster )]
public int Ore
{
get => m_Ore;
set => m_Ore = value;
}
public int Ore { get; set; }
[Constructible]
public MiningCartDeed()
@ -385,8 +353,8 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_IsRewardItem );
writer.Write( (int) m_Gems );
writer.Write( (int) m_Ore );
writer.Write( (int) Gems );
writer.Write( (int) Ore );
}
public override void Deserialize( GenericReader reader )
@ -396,8 +364,8 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_IsRewardItem = reader.ReadBool();
m_Gems = reader.ReadInt();
m_Ore = reader.ReadInt();
Gems = reader.ReadInt();
Ore = reader.ReadInt();
}
public void GetOptions( RewardOptionList list )