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
|
|
@ -22,32 +22,24 @@ namespace Server.Items
|
|||
{
|
||||
public override int LabelNumber => 1075198; // Dawn<77>s Music Box
|
||||
|
||||
private List<MusicName> m_Tracks;
|
||||
|
||||
public List<MusicName> Tracks => m_Tracks;
|
||||
|
||||
private SecureLevel m_Level;
|
||||
public List<MusicName> Tracks { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get => m_Level;
|
||||
set => m_Level = value;
|
||||
}
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public DawnsMusicBox() : base( 0x2AF9 )
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
m_Tracks = new List<MusicName>();
|
||||
Tracks = new List<MusicName>();
|
||||
|
||||
while ( m_Tracks.Count < 4 )
|
||||
while ( Tracks.Count < 4 )
|
||||
{
|
||||
MusicName name = RandomTrack( DawnsMusicRarity.Common );
|
||||
|
||||
if ( !m_Tracks.Contains( name ) )
|
||||
m_Tracks.Add( name );
|
||||
if ( !Tracks.Contains( name ) )
|
||||
Tracks.Add( name );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -60,8 +52,8 @@ namespace Server.Items
|
|||
if ( !(newItem is DawnsMusicBox box) )
|
||||
return;
|
||||
|
||||
box.m_Tracks = new List<MusicName>();
|
||||
box.m_Tracks.AddRange( m_Tracks );
|
||||
box.Tracks = new List<MusicName>();
|
||||
box.Tracks.AddRange( Tracks );
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
|
|
@ -72,9 +64,9 @@ namespace Server.Items
|
|||
int uncommonSongs = 0;
|
||||
int rareSongs = 0;
|
||||
|
||||
for ( int i = 0; i < m_Tracks.Count; i++ )
|
||||
for ( int i = 0; i < Tracks.Count; i++ )
|
||||
{
|
||||
DawnsMusicInfo info = GetInfo( m_Tracks[ i ] );
|
||||
DawnsMusicInfo info = GetInfo( Tracks[ i ] );
|
||||
|
||||
switch ( info.Rarity )
|
||||
{
|
||||
|
|
@ -169,12 +161,12 @@ namespace Server.Items
|
|||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( (int) m_Tracks.Count );
|
||||
writer.Write( (int) Tracks.Count );
|
||||
|
||||
for ( int i = 0; i < m_Tracks.Count; i++ )
|
||||
writer.Write( (int) m_Tracks[ i ] );
|
||||
for ( int i = 0; i < Tracks.Count; i++ )
|
||||
writer.Write( (int) Tracks[ i ] );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.Write( (int) Level );
|
||||
writer.Write( (int) m_ItemID );
|
||||
}
|
||||
|
||||
|
|
@ -185,12 +177,12 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
m_Tracks = new List<MusicName>();
|
||||
Tracks = new List<MusicName>();
|
||||
|
||||
for ( int i = 0; i < count; i++ )
|
||||
m_Tracks.Add( (MusicName) reader.ReadInt() );
|
||||
Tracks.Add( (MusicName) reader.ReadInt() );
|
||||
|
||||
m_Level = (SecureLevel) reader.ReadInt();
|
||||
Level = (SecureLevel) reader.ReadInt();
|
||||
m_ItemID = reader.ReadInt();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,14 +11,8 @@ namespace Server.Items
|
|||
|
||||
public static DawnsMusicGear RandomRare => new DawnsMusicGear( DawnsMusicBox.RandomTrack( DawnsMusicRarity.Rare ) );
|
||||
|
||||
private MusicName m_Music;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public MusicName Music
|
||||
{
|
||||
get => m_Music;
|
||||
set => m_Music = value;
|
||||
}
|
||||
public MusicName Music { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public DawnsMusicGear() : this( DawnsMusicBox.RandomTrack( DawnsMusicRarity.Common ) )
|
||||
|
|
@ -28,7 +22,7 @@ namespace Server.Items
|
|||
[Constructible]
|
||||
public DawnsMusicGear( MusicName music ) : base( 0x1053 )
|
||||
{
|
||||
m_Music = music;
|
||||
Music = music;
|
||||
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
|
@ -39,7 +33,7 @@ namespace Server.Items
|
|||
|
||||
public override void AddNameProperty( ObjectPropertyList list )
|
||||
{
|
||||
DawnsMusicInfo info = DawnsMusicBox.GetInfo( m_Music );
|
||||
DawnsMusicInfo info = DawnsMusicBox.GetInfo( Music );
|
||||
|
||||
if ( info != null )
|
||||
{
|
||||
|
|
@ -67,7 +61,7 @@ namespace Server.Items
|
|||
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( (int) m_Music );
|
||||
writer.Write( (int) Music );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -80,7 +74,7 @@ namespace Server.Items
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Music = (MusicName) reader.ReadInt();
|
||||
Music = (MusicName) reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -97,7 +91,7 @@ namespace Server.Items
|
|||
else
|
||||
rarity = DawnsMusicRarity.Common;
|
||||
|
||||
m_Music = DawnsMusicBox.RandomTrack( rarity );
|
||||
Music = DawnsMusicBox.RandomTrack( rarity );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,18 +9,14 @@
|
|||
|
||||
public class DawnsMusicInfo
|
||||
{
|
||||
private int m_Name;
|
||||
public int Name { get; }
|
||||
|
||||
public int Name => m_Name;
|
||||
|
||||
private DawnsMusicRarity m_Rarity;
|
||||
|
||||
public DawnsMusicRarity Rarity => m_Rarity;
|
||||
public DawnsMusicRarity Rarity { get; }
|
||||
|
||||
public DawnsMusicInfo( int name, DawnsMusicRarity rarity )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Rarity = rarity;
|
||||
Name = name;
|
||||
Rarity = rarity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue