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
|
|
@ -8,54 +8,31 @@ namespace Server.Items
|
|||
[Flippable( 0x14EB, 0x14EC )]
|
||||
public class MapItem : Item, ICraftable
|
||||
{
|
||||
private Rectangle2D m_Bounds;
|
||||
|
||||
private int m_Width, m_Height;
|
||||
|
||||
private bool m_Protected;
|
||||
private bool m_Editable;
|
||||
|
||||
private List<Point2D> m_Pins = new List<Point2D>();
|
||||
|
||||
private const int MaxUserPins = 50;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Protected
|
||||
{
|
||||
get => m_Protected;
|
||||
set => m_Protected = value;
|
||||
}
|
||||
public bool Protected { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D Bounds
|
||||
{
|
||||
get => m_Bounds;
|
||||
set => m_Bounds = value;
|
||||
}
|
||||
public Rectangle2D Bounds { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Width
|
||||
{
|
||||
get => m_Width;
|
||||
set => m_Width = value;
|
||||
}
|
||||
public int Width { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Height
|
||||
{
|
||||
get => m_Height;
|
||||
set => m_Height = value;
|
||||
}
|
||||
public int Height { get; set; }
|
||||
|
||||
public List<Point2D> Pins => m_Pins;
|
||||
public List<Point2D> Pins { get; } = new List<Point2D>();
|
||||
|
||||
[Constructible]
|
||||
public MapItem() : base( 0x14EC )
|
||||
{
|
||||
Weight = 1.0;
|
||||
|
||||
m_Width = 200;
|
||||
m_Height = 200;
|
||||
Width = 200;
|
||||
Height = 200;
|
||||
}
|
||||
|
||||
public virtual void CraftInit( Mobile from )
|
||||
|
|
@ -99,8 +76,8 @@ namespace Server.Items
|
|||
from.Send( new MapDetails( this ) );
|
||||
from.Send( new MapDisplay( this ) );
|
||||
|
||||
for ( int i = 0; i < m_Pins.Count; ++i )
|
||||
from.Send( new MapAddPin( this, m_Pins[i] ) );
|
||||
for ( int i = 0; i < Pins.Count; ++i )
|
||||
from.Send( new MapAddPin( this, Pins[i] ) );
|
||||
|
||||
from.Send( new MapSetEditable( this, ValidateEdit( from ) ) );
|
||||
}
|
||||
|
|
@ -109,7 +86,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( !ValidateEdit( from ) )
|
||||
return;
|
||||
if ( m_Pins.Count >= MaxUserPins )
|
||||
if ( Pins.Count >= MaxUserPins )
|
||||
return;
|
||||
|
||||
Validate( ref x, ref y );
|
||||
|
|
@ -137,7 +114,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( !ValidateEdit( from ) )
|
||||
return;
|
||||
if ( m_Pins.Count >= MaxUserPins )
|
||||
if ( Pins.Count >= MaxUserPins )
|
||||
return;
|
||||
|
||||
Validate( ref x, ref y );
|
||||
|
|
@ -164,13 +141,13 @@ namespace Server.Items
|
|||
{
|
||||
if ( x < 0 )
|
||||
x = 0;
|
||||
else if ( x >= m_Width )
|
||||
x = m_Width - 1;
|
||||
else if ( x >= Width )
|
||||
x = Width - 1;
|
||||
|
||||
if ( y < 0 )
|
||||
y = 0;
|
||||
else if ( y >= m_Height )
|
||||
y = m_Height - 1;
|
||||
else if ( y >= Height )
|
||||
y = Height - 1;
|
||||
}
|
||||
|
||||
public virtual bool ValidateEdit( Mobile from )
|
||||
|
|
@ -184,7 +161,7 @@ namespace Server.Items
|
|||
return false;
|
||||
if ( from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return true;
|
||||
if ( !Movable || m_Protected || !from.InRange( GetWorldLocation(), 2 ) )
|
||||
if ( !Movable || Protected || !from.InRange( GetWorldLocation(), 2 ) )
|
||||
return false;
|
||||
|
||||
object root = RootParent;
|
||||
|
|
@ -197,14 +174,14 @@ namespace Server.Items
|
|||
|
||||
public void ConvertToWorld( int x, int y, out int worldX, out int worldY )
|
||||
{
|
||||
worldX = ( ( m_Bounds.Width * x ) / Width ) + m_Bounds.X;
|
||||
worldY = ( ( m_Bounds.Height * y ) / Height ) + m_Bounds.Y;
|
||||
worldX = ( ( Bounds.Width * x ) / Width ) + Bounds.X;
|
||||
worldY = ( ( Bounds.Height * y ) / Height ) + Bounds.Y;
|
||||
}
|
||||
|
||||
public void ConvertToMap( int x, int y, out int mapX, out int mapY )
|
||||
{
|
||||
mapX = ( ( x - m_Bounds.X ) * Width ) / m_Bounds.Width;
|
||||
mapY = ( ( y - m_Bounds.Y ) * Width ) / m_Bounds.Height;
|
||||
mapX = ( ( x - Bounds.X ) * Width ) / Bounds.Width;
|
||||
mapY = ( ( y - Bounds.Y ) * Width ) / Bounds.Height;
|
||||
}
|
||||
|
||||
public virtual void AddWorldPin( int x, int y )
|
||||
|
|
@ -217,32 +194,32 @@ namespace Server.Items
|
|||
|
||||
public virtual void AddPin( int x, int y )
|
||||
{
|
||||
m_Pins.Add( new Point2D( x, y ) );
|
||||
Pins.Add( new Point2D( x, y ) );
|
||||
}
|
||||
|
||||
public virtual void RemovePin( int index )
|
||||
{
|
||||
if ( index > 0 && index < m_Pins.Count )
|
||||
m_Pins.RemoveAt( index );
|
||||
if ( index > 0 && index < Pins.Count )
|
||||
Pins.RemoveAt( index );
|
||||
}
|
||||
|
||||
public virtual void InsertPin( int index, int x, int y )
|
||||
{
|
||||
if ( index < 0 || index >= m_Pins.Count )
|
||||
m_Pins.Add( new Point2D( x, y ) );
|
||||
if ( index < 0 || index >= Pins.Count )
|
||||
Pins.Add( new Point2D( x, y ) );
|
||||
else
|
||||
m_Pins.Insert( index, new Point2D( x, y ) );
|
||||
Pins.Insert( index, new Point2D( x, y ) );
|
||||
}
|
||||
|
||||
public virtual void ChangePin( int index, int x, int y )
|
||||
{
|
||||
if ( index >= 0 && index < m_Pins.Count )
|
||||
m_Pins[index] = new Point2D( x, y );
|
||||
if ( index >= 0 && index < Pins.Count )
|
||||
Pins[index] = new Point2D( x, y );
|
||||
}
|
||||
|
||||
public virtual void ClearPins()
|
||||
{
|
||||
m_Pins.Clear();
|
||||
Pins.Clear();
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -251,16 +228,16 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( m_Bounds );
|
||||
writer.Write( Bounds );
|
||||
|
||||
writer.Write( m_Width );
|
||||
writer.Write( m_Height );
|
||||
writer.Write( Width );
|
||||
writer.Write( Height );
|
||||
|
||||
writer.Write( m_Protected );
|
||||
writer.Write( Protected );
|
||||
|
||||
writer.Write( m_Pins.Count );
|
||||
for ( int i = 0; i < m_Pins.Count; ++i )
|
||||
writer.Write( m_Pins[i] );
|
||||
writer.Write( Pins.Count );
|
||||
for ( int i = 0; i < Pins.Count; ++i )
|
||||
writer.Write( Pins[i] );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -273,16 +250,16 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Bounds = reader.ReadRect2D();
|
||||
Bounds = reader.ReadRect2D();
|
||||
|
||||
m_Width = reader.ReadInt();
|
||||
m_Height = reader.ReadInt();
|
||||
Width = reader.ReadInt();
|
||||
Height = reader.ReadInt();
|
||||
|
||||
m_Protected = reader.ReadBool();
|
||||
Protected = reader.ReadBool();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
for ( int i = 0; i < count; i++ )
|
||||
m_Pins.Add( reader.ReadPoint2D() );
|
||||
Pins.Add( reader.ReadPoint2D() );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue