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

@ -2,9 +2,7 @@ namespace Server.Ethics
{
public class EthicsPersistance : Item
{
private static EthicsPersistance m_Instance;
public static EthicsPersistance Instance => m_Instance;
public static EthicsPersistance Instance { get; private set; }
public override string DefaultName => "Ethics Persistance - Internal";
@ -14,8 +12,8 @@ namespace Server.Ethics
{
Movable = false;
if ( m_Instance == null || m_Instance.Deleted )
m_Instance = this;
if ( Instance == null || Instance.Deleted )
Instance = this;
else
base.Delete();
}
@ -23,7 +21,7 @@ namespace Server.Ethics
public EthicsPersistance( Serial serial )
: base( serial )
{
m_Instance = this;
Instance = this;
}
public override void Serialize( GenericWriter writer )

View file

@ -41,39 +41,23 @@ namespace Server.Ethics
return pl;
}
private Ethic m_Ethic;
private Mobile m_Mobile;
private int m_Power;
private int m_History;
private Mobile m_Steed;
private Mobile m_Familiar;
private DateTime m_Shield;
public Ethic Ethic => m_Ethic;
public Mobile Mobile => m_Mobile;
public Ethic Ethic { get; }
public Mobile Mobile { get; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public int Power { get => m_Power;
set => m_Power = value;
}
public int Power { get; set; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public int History { get => m_History;
set => m_History = value;
}
public int History { get; set; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public Mobile Steed { get => m_Steed;
set => m_Steed = value;
}
public Mobile Steed { get; set; }
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
public Mobile Familiar { get => m_Familiar;
set => m_Familiar = value;
}
public Mobile Familiar { get; set; }
[CommandProperty( AccessLevel.GameMaster )]
public bool IsShielded
@ -103,38 +87,38 @@ namespace Server.Ethics
public Player( Ethic ethic, Mobile mobile )
{
m_Ethic = ethic;
m_Mobile = mobile;
Ethic = ethic;
Mobile = mobile;
m_Power = 5;
m_History = 5;
Power = 5;
History = 5;
}
public void CheckAttach()
{
if ( m_Ethic.IsEligible( m_Mobile ) )
if ( Ethic.IsEligible( Mobile ) )
Attach();
}
public void Attach()
{
if ( m_Mobile is PlayerMobile mobile )
if ( Mobile is PlayerMobile mobile )
mobile.EthicPlayer = this;
m_Ethic.Players.Add( this );
Ethic.Players.Add( this );
}
public void Detach()
{
if ( m_Mobile is PlayerMobile mobile )
if ( Mobile is PlayerMobile mobile )
mobile.EthicPlayer = null;
m_Ethic.Players.Remove( this );
Ethic.Players.Remove( this );
}
public Player( Ethic ethic, GenericReader reader )
{
m_Ethic = ethic;
Ethic = ethic;
int version = reader.ReadEncodedInt();
@ -142,13 +126,13 @@ namespace Server.Ethics
{
case 0:
{
m_Mobile = reader.ReadMobile();
Mobile = reader.ReadMobile();
m_Power = reader.ReadEncodedInt();
m_History = reader.ReadEncodedInt();
Power = reader.ReadEncodedInt();
History = reader.ReadEncodedInt();
m_Steed = reader.ReadMobile();
m_Familiar = reader.ReadMobile();
Steed = reader.ReadMobile();
Familiar = reader.ReadMobile();
m_Shield = reader.ReadDeltaTime();
@ -161,13 +145,13 @@ namespace Server.Ethics
{
writer.WriteEncodedInt( 0 ); // version
writer.Write( m_Mobile );
writer.Write( Mobile );
writer.WriteEncodedInt( m_Power );
writer.WriteEncodedInt( m_History );
writer.WriteEncodedInt( Power );
writer.WriteEncodedInt( History );
writer.Write( m_Steed );
writer.Write( m_Familiar );
writer.Write( Steed );
writer.Write( Familiar );
writer.WriteDeltaTime( m_Shield );
}

View file

@ -2,34 +2,26 @@ namespace Server.Ethics
{
public class EthicDefinition
{
private int m_PrimaryHue;
public int PrimaryHue { get; }
private TextDefinition m_Title;
private TextDefinition m_Adjunct;
public TextDefinition Title { get; }
private TextDefinition m_JoinPhrase;
public TextDefinition Adjunct { get; }
private Power[] m_Powers;
public TextDefinition JoinPhrase { get; }
public int PrimaryHue => m_PrimaryHue;
public TextDefinition Title => m_Title;
public TextDefinition Adjunct => m_Adjunct;
public TextDefinition JoinPhrase => m_JoinPhrase;
public Power[] Powers => m_Powers;
public Power[] Powers { get; }
public EthicDefinition( int primaryHue, TextDefinition title, TextDefinition adjunct, TextDefinition joinPhrase, Power[] powers )
{
m_PrimaryHue = primaryHue;
PrimaryHue = primaryHue;
m_Title = title;
m_Adjunct = adjunct;
Title = title;
Adjunct = adjunct;
m_JoinPhrase = joinPhrase;
JoinPhrase = joinPhrase;
m_Powers = powers;
Powers = powers;
}
}
}

View file

@ -2,25 +2,21 @@ namespace Server.Ethics
{
public class PowerDefinition
{
private int m_Power;
public int Power { get; }
private TextDefinition m_Name;
private TextDefinition m_Phrase;
private TextDefinition m_Description;
public TextDefinition Name { get; }
public int Power => m_Power;
public TextDefinition Phrase { get; }
public TextDefinition Name => m_Name;
public TextDefinition Phrase => m_Phrase;
public TextDefinition Description => m_Description;
public TextDefinition Description { get; }
public PowerDefinition( int power, TextDefinition name, TextDefinition phrase, TextDefinition description )
{
m_Power = power;
Power = power;
m_Name = name;
m_Phrase = phrase;
m_Description = description;
Name = name;
Phrase = phrase;
Description = description;
}
}
}