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

@ -75,13 +75,7 @@ namespace Server.Items
public class PlagueBeastComponent : PlagueBeastInnard
{
private PlagueBeastOrgan m_Organ;
public PlagueBeastOrgan Organ
{
get => m_Organ;
set => m_Organ = value;
}
public PlagueBeastOrgan Organ { get; set; }
public bool IsBrain => ItemID == 0x1CF0;
@ -123,10 +117,10 @@ namespace Server.Items
public override bool OnDragDrop( Mobile from, Item dropped )
{
if ( m_Organ != null && m_Organ.OnDropped( from, dropped, this ) )
if ( Organ != null && Organ.OnDropped( from, dropped, this ) )
{
if ( dropped is PlagueBeastComponent component )
m_Organ.Components.Add( component );
Organ.Components.Add( component );
}
return true;
@ -136,14 +130,14 @@ namespace Server.Items
{
if ( IsAccessibleTo( from ) )
{
if ( m_Organ != null && m_Organ.OnLifted( from, this ) )
if ( Organ != null && Organ.OnLifted( from, this ) )
{
from.SendLocalizedMessage( IsGland ? 1071895 : 1071914, null, 0x3B2 ); // * You rip the organ out of the plague beast's flesh *
if ( m_Organ.Components.Contains( this ) )
m_Organ.Components.Remove( this );
if ( Organ.Components.Contains( this ) )
Organ.Components.Remove( this );
m_Organ = null;
Organ = null;
from.PlaySound( 0x1CA );
}
@ -163,7 +157,7 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.WriteItem<PlagueBeastOrgan>( m_Organ );
writer.WriteItem<PlagueBeastOrgan>( Organ );
}
public override void Deserialize( GenericReader reader )
@ -172,7 +166,7 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Organ = reader.ReadItem<PlagueBeastOrgan>();
Organ = reader.ReadItem<PlagueBeastOrgan>();
}
}
}

View file

@ -6,32 +6,26 @@ namespace Server.Items
{
public class PlagueBeastMutationCore : Item, IScissorable
{
private bool m_Cut;
[CommandProperty( AccessLevel.GameMaster )]
public bool Cut
{
get => m_Cut;
set => m_Cut = value;
}
public bool Cut { get; set; }
public override string DefaultName => "a plague beast mutation core";
[Constructible]
public PlagueBeastMutationCore() : base( 0x1CF0 )
{
m_Cut = true;
Cut = true;
Weight = 1.0;
Hue = 0x480;
}
public virtual bool Scissor( Mobile from, Scissors scissors )
{
if ( !m_Cut )
if ( !Cut )
{
PlagueBeastLord owner = RootParent as PlagueBeastLord;
m_Cut = true;
Cut = true;
Movable = true;
from.AddToBackpack( this );
@ -62,7 +56,7 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_Cut );
writer.Write( (bool) Cut );
}
public override void Deserialize( GenericReader reader )
@ -71,7 +65,7 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Cut = reader.ReadBool();
Cut = reader.ReadBool();
}
}
}

View file

@ -8,25 +8,11 @@ namespace Server.Items
{
public virtual bool IsCuttable => false;
private List<PlagueBeastComponent> m_Components;
public List<PlagueBeastComponent> Components { get; private set; }
public List<PlagueBeastComponent> Components => m_Components;
public int BrainHue { get; set; }
private int m_BrainHue;
public int BrainHue
{
get => m_BrainHue;
set => m_BrainHue = value;
}
private bool m_Opened;
public bool Opened
{
get => m_Opened;
set => m_Opened = value;
}
public bool Opened { get; set; }
private Timer m_Timer;
@ -37,8 +23,8 @@ namespace Server.Items
public PlagueBeastOrgan( int itemID, int hue ) : base( itemID, hue )
{
m_Components = new List<PlagueBeastComponent>();
m_Opened = false;
Components = new List<PlagueBeastComponent>();
Opened = false;
Movable = false;
@ -58,14 +44,14 @@ namespace Server.Items
c.Location = new Point3D( X + x, Y + y, Z );
c.Map = Map;
m_Components.Add( c );
Components.Add( c );
}
public override bool Scissor( Mobile from, Scissors scissors )
{
if ( IsCuttable && IsAccessibleTo( from ) )
{
if ( !m_Opened && m_Timer == null )
if ( !Opened && m_Timer == null )
{
m_Timer = Timer.DelayCall<Mobile>( TimeSpan.FromSeconds( 3 ), FinishOpening, from );
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071897 ); // You carefully cut into the organ.
@ -96,7 +82,7 @@ namespace Server.Items
public virtual void FinishOpening( Mobile from )
{
m_Opened = true;
Opened = true;
Owner?.PlaySound( 0x50 );
}
@ -111,9 +97,9 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.WriteItemList<PlagueBeastComponent>( m_Components );
writer.Write( (int) m_BrainHue );
writer.Write( (bool) m_Opened );
writer.WriteItemList<PlagueBeastComponent>( Components );
writer.Write( (int) BrainHue );
writer.Write( (bool) Opened );
}
public override void Deserialize( GenericReader reader )
@ -122,9 +108,9 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Components = reader.ReadStrongItemList<PlagueBeastComponent>();
m_BrainHue = reader.ReadInt();
m_Opened = reader.ReadBool();
Components = reader.ReadStrongItemList<PlagueBeastComponent>();
BrainHue = reader.ReadInt();
Opened = reader.ReadBool();
}
}

View file

@ -5,22 +5,20 @@ namespace Server.Items
{
public class PlagueBeastVein : PlagueBeastComponent
{
private bool m_Cut;
public bool Cut => m_Cut;
public bool Cut { get; private set; }
private Timer m_Timer;
public PlagueBeastVein( int itemID, int hue ) : base( itemID, hue )
{
m_Cut = false;
Cut = false;
}
public override bool Scissor( Mobile from, Scissors scissors )
{
if ( IsAccessibleTo( from ) )
{
if ( !m_Cut && m_Timer == null )
if ( !Cut && m_Timer == null )
{
m_Timer = Timer.DelayCall<Mobile>( TimeSpan.FromSeconds( 3 ), CuttingDone, from );
scissors.PublicOverheadMessage( MessageType.Regular, 0x3B2, 1071899 ); // You begin cutting through the vein.
@ -41,7 +39,7 @@ namespace Server.Items
private void CuttingDone( Mobile from )
{
m_Cut = true;
Cut = true;
if ( ItemID == 0x1B1C )
ItemID = 0x1B1B;
@ -64,7 +62,7 @@ namespace Server.Items
writer.WriteEncodedInt( 0 ); // version
writer.Write( (bool) m_Cut );
writer.Write( (bool) Cut );
}
public override void Deserialize( GenericReader reader )
@ -73,7 +71,7 @@ namespace Server.Items
int version = reader.ReadEncodedInt();
m_Cut = reader.ReadBool();
Cut = reader.ReadBool();
}
}
}