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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,55 +62,53 @@ namespace Server.Items
|
|||
|
||||
public class PresetMapEntry
|
||||
{
|
||||
private int m_Name;
|
||||
private int m_Width, m_Height;
|
||||
private Rectangle2D m_Bounds;
|
||||
public int Name { get; }
|
||||
|
||||
public int Name => m_Name;
|
||||
public int Width => m_Width;
|
||||
public int Height => m_Height;
|
||||
public Rectangle2D Bounds => m_Bounds;
|
||||
public int Width { get; }
|
||||
|
||||
public int Height { get; }
|
||||
|
||||
public Rectangle2D Bounds { get; }
|
||||
|
||||
public PresetMapEntry( int name, int width, int height, int xLeft, int yTop, int xRight, int yBottom )
|
||||
{
|
||||
m_Name = name;
|
||||
m_Width = width;
|
||||
m_Height = height;
|
||||
m_Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop );
|
||||
Name = name;
|
||||
Width = width;
|
||||
Height = height;
|
||||
Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop );
|
||||
}
|
||||
|
||||
private static PresetMapEntry[] m_Table = {
|
||||
new PresetMapEntry( 1041189, 200, 200, 1092, 1396, 1736, 1924 ), // map of Britain
|
||||
new PresetMapEntry( 1041203, 200, 200, 0256, 1792, 1736, 2560 ), // map of Britain to Skara Brae
|
||||
new PresetMapEntry( 1041192, 200, 200, 1024, 1280, 2304, 3072 ), // map of Britain to Trinsic
|
||||
new PresetMapEntry( 1041183, 200, 200, 2500, 1900, 3000, 2400 ), // map of Buccaneer's Den
|
||||
new PresetMapEntry( 1041198, 200, 200, 2560, 1792, 3840, 2560 ), // map of Buccaneer's Den to Magincia
|
||||
new PresetMapEntry( 1041194, 200, 200, 2560, 1792, 3840, 3072 ), // map of Buccaneer's Den to Ocllo
|
||||
new PresetMapEntry( 1041181, 200, 200, 1088, 3572, 1528, 4056 ), // map of Jhelom
|
||||
new PresetMapEntry( 1041186, 200, 200, 3530, 2022, 3818, 2298 ), // map of Magincia
|
||||
new PresetMapEntry( 1041199, 200, 200, 3328, 1792, 3840, 2304 ), // map of Magincia to Ocllo
|
||||
new PresetMapEntry( 1041182, 200, 200, 2360, 0356, 2706, 0702 ), // map of Minoc
|
||||
new PresetMapEntry( 1041190, 200, 200, 0000, 0256, 2304, 3072 ), // map of Minoc to Yew
|
||||
new PresetMapEntry( 1041191, 200, 200, 2467, 0572, 2878, 0746 ), // map of Minoc to Vesper
|
||||
new PresetMapEntry( 1041188, 200, 200, 4156, 0808, 4732, 1528 ), // map of Moonglow
|
||||
new PresetMapEntry( 1041201, 200, 200, 3328, 0768, 4864, 1536 ), // map of Moonglow to Nujelm
|
||||
new PresetMapEntry( 1041185, 200, 200, 3446, 1030, 3832, 1424 ), // map of Nujelm
|
||||
new PresetMapEntry( 1041197, 200, 200, 3328, 1024, 3840, 2304 ), // map of Nujelm to Magincia
|
||||
new PresetMapEntry( 1041187, 200, 200, 3582, 2456, 3770, 2742 ), // map of Ocllo
|
||||
new PresetMapEntry( 1041184, 200, 200, 2714, 3329, 3100, 3639 ), // map of Serpent's Hold
|
||||
new PresetMapEntry( 1041200, 200, 200, 2560, 2560, 3840, 3840 ), // map of Serpent's Hold to Ocllo
|
||||
new PresetMapEntry( 1041180, 200, 200, 0524, 2064, 0960, 2452 ), // map of Skara Brae
|
||||
new PresetMapEntry( 1041204, 200, 200, 0000, 0000, 5199, 4095 ), // map of The World
|
||||
new PresetMapEntry( 1041177, 200, 200, 1792, 2630, 2118, 2952 ), // map of Trinsic
|
||||
new PresetMapEntry( 1041193, 200, 200, 1792, 1792, 3072, 3072 ), // map of Trinsic to Buccaneer's Den
|
||||
new PresetMapEntry( 1041195, 200, 200, 0256, 1792, 2304, 4095 ), // map of Trinsic to Jhelom
|
||||
new PresetMapEntry( 1041178, 200, 200, 2636, 0592, 3064, 1012 ), // map of Vesper
|
||||
new PresetMapEntry( 1041196, 200, 200, 2636, 0592, 3840, 1536 ), // map of Vesper to Nujelm
|
||||
new PresetMapEntry( 1041179, 200, 200, 0236, 0741, 0766, 1269 ), // map of Yew
|
||||
new PresetMapEntry( 1041202, 200, 200, 0000, 0512, 1792, 2048 ) // map of Yew to Britain
|
||||
};
|
||||
|
||||
public static PresetMapEntry[] Table => m_Table;
|
||||
public static PresetMapEntry[] Table { get; } =
|
||||
{
|
||||
new PresetMapEntry( 1041189, 200, 200, 1092, 1396, 1736, 1924 ), // map of Britain
|
||||
new PresetMapEntry( 1041203, 200, 200, 0256, 1792, 1736, 2560 ), // map of Britain to Skara Brae
|
||||
new PresetMapEntry( 1041192, 200, 200, 1024, 1280, 2304, 3072 ), // map of Britain to Trinsic
|
||||
new PresetMapEntry( 1041183, 200, 200, 2500, 1900, 3000, 2400 ), // map of Buccaneer's Den
|
||||
new PresetMapEntry( 1041198, 200, 200, 2560, 1792, 3840, 2560 ), // map of Buccaneer's Den to Magincia
|
||||
new PresetMapEntry( 1041194, 200, 200, 2560, 1792, 3840, 3072 ), // map of Buccaneer's Den to Ocllo
|
||||
new PresetMapEntry( 1041181, 200, 200, 1088, 3572, 1528, 4056 ), // map of Jhelom
|
||||
new PresetMapEntry( 1041186, 200, 200, 3530, 2022, 3818, 2298 ), // map of Magincia
|
||||
new PresetMapEntry( 1041199, 200, 200, 3328, 1792, 3840, 2304 ), // map of Magincia to Ocllo
|
||||
new PresetMapEntry( 1041182, 200, 200, 2360, 0356, 2706, 0702 ), // map of Minoc
|
||||
new PresetMapEntry( 1041190, 200, 200, 0000, 0256, 2304, 3072 ), // map of Minoc to Yew
|
||||
new PresetMapEntry( 1041191, 200, 200, 2467, 0572, 2878, 0746 ), // map of Minoc to Vesper
|
||||
new PresetMapEntry( 1041188, 200, 200, 4156, 0808, 4732, 1528 ), // map of Moonglow
|
||||
new PresetMapEntry( 1041201, 200, 200, 3328, 0768, 4864, 1536 ), // map of Moonglow to Nujelm
|
||||
new PresetMapEntry( 1041185, 200, 200, 3446, 1030, 3832, 1424 ), // map of Nujelm
|
||||
new PresetMapEntry( 1041197, 200, 200, 3328, 1024, 3840, 2304 ), // map of Nujelm to Magincia
|
||||
new PresetMapEntry( 1041187, 200, 200, 3582, 2456, 3770, 2742 ), // map of Ocllo
|
||||
new PresetMapEntry( 1041184, 200, 200, 2714, 3329, 3100, 3639 ), // map of Serpent's Hold
|
||||
new PresetMapEntry( 1041200, 200, 200, 2560, 2560, 3840, 3840 ), // map of Serpent's Hold to Ocllo
|
||||
new PresetMapEntry( 1041180, 200, 200, 0524, 2064, 0960, 2452 ), // map of Skara Brae
|
||||
new PresetMapEntry( 1041204, 200, 200, 0000, 0000, 5199, 4095 ), // map of The World
|
||||
new PresetMapEntry( 1041177, 200, 200, 1792, 2630, 2118, 2952 ), // map of Trinsic
|
||||
new PresetMapEntry( 1041193, 200, 200, 1792, 1792, 3072, 3072 ), // map of Trinsic to Buccaneer's Den
|
||||
new PresetMapEntry( 1041195, 200, 200, 0256, 1792, 2304, 4095 ), // map of Trinsic to Jhelom
|
||||
new PresetMapEntry( 1041178, 200, 200, 2636, 0592, 3064, 1012 ), // map of Vesper
|
||||
new PresetMapEntry( 1041196, 200, 200, 2636, 0592, 3840, 1536 ), // map of Vesper to Nujelm
|
||||
new PresetMapEntry( 1041179, 200, 200, 0236, 0741, 0766, 1269 ), // map of Yew
|
||||
new PresetMapEntry( 1041202, 200, 200, 0000, 0512, 1792, 2048 ) // map of Yew to Britain
|
||||
};
|
||||
}
|
||||
|
||||
public enum PresetMapType
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ namespace Server.Items
|
|||
private Mobile m_CompletedBy;
|
||||
private Mobile m_Decoder;
|
||||
private Map m_Map;
|
||||
private Point2D m_Location;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Level{ get => m_Level;
|
||||
|
|
@ -38,9 +37,7 @@ namespace Server.Items
|
|||
set{ m_Map = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Point2D ChestLocation{ get => m_Location;
|
||||
set => m_Location = value;
|
||||
}
|
||||
public Point2D ChestLocation { get; set; }
|
||||
|
||||
private static Point2D[] m_Locations;
|
||||
private static Point2D[] m_HavenLocations;
|
||||
|
|
@ -207,9 +204,9 @@ namespace Server.Items
|
|||
m_Map = map;
|
||||
|
||||
if ( level == 0 )
|
||||
m_Location = GetRandomHavenLocation();
|
||||
ChestLocation = GetRandomHavenLocation();
|
||||
else
|
||||
m_Location = GetRandomLocation();
|
||||
ChestLocation = GetRandomLocation();
|
||||
|
||||
Width = 300;
|
||||
Height = 300;
|
||||
|
|
@ -217,8 +214,8 @@ namespace Server.Items
|
|||
int width = 600;
|
||||
int height = 600;
|
||||
|
||||
int x1 = m_Location.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 );
|
||||
int y1 = m_Location.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 );
|
||||
int x1 = ChestLocation.X - Utility.RandomMinMax( width / 4, (width / 4) * 3 );
|
||||
int y1 = ChestLocation.Y - Utility.RandomMinMax( height / 4, (height / 4) * 3 );
|
||||
|
||||
if ( x1 < 0 )
|
||||
x1 = 0;
|
||||
|
|
@ -241,7 +238,7 @@ namespace Server.Items
|
|||
Bounds = new Rectangle2D( x1, y1, width, height );
|
||||
Protected = true;
|
||||
|
||||
AddWorldPin( m_Location.X, m_Location.Y );
|
||||
AddWorldPin( ChestLocation.X, ChestLocation.Y );
|
||||
}
|
||||
|
||||
public TreasureMap( Serial serial ) : base( serial )
|
||||
|
|
@ -360,7 +357,7 @@ namespace Server.Items
|
|||
else
|
||||
maxRange = 1;
|
||||
|
||||
Point2D loc = m_Map.m_Location;
|
||||
Point2D loc = m_Map.ChestLocation;
|
||||
int x = loc.X, y = loc.Y;
|
||||
|
||||
Point3D chest3D0 = new Point3D( loc, 0 );
|
||||
|
|
@ -858,7 +855,7 @@ namespace Server.Items
|
|||
writer.Write( m_Completed );
|
||||
writer.Write( m_Decoder );
|
||||
writer.Write( m_Map );
|
||||
writer.Write( m_Location );
|
||||
writer.Write( ChestLocation );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -881,7 +878,7 @@ namespace Server.Items
|
|||
m_Completed = reader.ReadBool();
|
||||
m_Decoder = reader.ReadMobile();
|
||||
m_Map = reader.ReadMap();
|
||||
m_Location = reader.ReadPoint2D();
|
||||
ChestLocation = reader.ReadPoint2D();
|
||||
|
||||
if ( version == 0 && m_Completed )
|
||||
m_CompletedBy = m_Decoder;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue