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
|
|
@ -23,7 +23,6 @@ namespace Server.Targeting
|
|||
public class LandTarget : IPoint3D
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private int m_TileID;
|
||||
|
||||
public LandTarget( Point3D location, Map map )
|
||||
{
|
||||
|
|
@ -32,18 +31,18 @@ namespace Server.Targeting
|
|||
if ( map != null )
|
||||
{
|
||||
m_Location.Z = map.GetAverageZ( m_Location.X, m_Location.Y );
|
||||
m_TileID = map.Tiles.GetLandTile( m_Location.X, m_Location.Y ).ID & TileData.MaxLandValue;
|
||||
TileID = map.Tiles.GetLandTile( m_Location.X, m_Location.Y ).ID & TileData.MaxLandValue;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public string Name => TileData.LandTable[m_TileID].Name;
|
||||
public string Name => TileData.LandTable[TileID].Name;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public TileFlag Flags => TileData.LandTable[m_TileID].Flags;
|
||||
public TileFlag Flags => TileData.LandTable[TileID].Flags;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public int TileID => m_TileID;
|
||||
public int TileID { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public Point3D Location => m_Location;
|
||||
|
|
|
|||
|
|
@ -24,20 +24,9 @@ namespace Server.Targeting
|
|||
{
|
||||
public abstract class MultiTarget : Target
|
||||
{
|
||||
private int m_MultiID;
|
||||
private Point3D m_Offset;
|
||||
public int MultiID { get; set; }
|
||||
|
||||
public int MultiID
|
||||
{
|
||||
get => m_MultiID;
|
||||
set => m_MultiID = value;
|
||||
}
|
||||
|
||||
public Point3D Offset
|
||||
{
|
||||
get => m_Offset;
|
||||
set => m_Offset = value;
|
||||
}
|
||||
public Point3D Offset { get; set; }
|
||||
|
||||
protected MultiTarget( int multiID, Point3D offset )
|
||||
: this( multiID, offset, 10, true, TargetFlags.None )
|
||||
|
|
@ -47,8 +36,8 @@ namespace Server.Targeting
|
|||
protected MultiTarget( int multiID, Point3D offset, int range, bool allowGround, TargetFlags flags )
|
||||
: base( range, allowGround, flags )
|
||||
{
|
||||
m_MultiID = multiID;
|
||||
m_Offset = offset;
|
||||
MultiID = multiID;
|
||||
Offset = offset;
|
||||
}
|
||||
|
||||
public override Packet GetPacketFor( NetState ns )
|
||||
|
|
|
|||
|
|
@ -23,23 +23,22 @@ namespace Server.Targeting
|
|||
public class StaticTarget : IPoint3D
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private int m_ItemID;
|
||||
|
||||
public StaticTarget( Point3D location, int itemID )
|
||||
{
|
||||
m_Location = location;
|
||||
m_ItemID = itemID & TileData.MaxItemValue;
|
||||
m_Location.Z += TileData.ItemTable[m_ItemID].CalcHeight;
|
||||
ItemID = itemID & TileData.MaxItemValue;
|
||||
m_Location.Z += TileData.ItemTable[ItemID].CalcHeight;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public Point3D Location => m_Location;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public string Name => TileData.ItemTable[m_ItemID].Name;
|
||||
public string Name => TileData.ItemTable[ItemID].Name;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public TileFlag Flags => TileData.ItemTable[m_ItemID].Flags;
|
||||
public TileFlag Flags => TileData.ItemTable[ItemID].Flags;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public int X => m_Location.X;
|
||||
|
|
@ -51,6 +50,6 @@ namespace Server.Targeting
|
|||
public int Z => m_Location.Z;
|
||||
|
||||
[CommandProperty( AccessLevel.Counselor )]
|
||||
public int ItemID => m_ItemID;
|
||||
public int ItemID { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -27,33 +27,18 @@ namespace Server.Targeting
|
|||
{
|
||||
private static int m_NextTargetID;
|
||||
|
||||
private static bool m_TargetIDValidation = true;
|
||||
public static bool TargetIDValidation { get; set; } = true;
|
||||
|
||||
public static bool TargetIDValidation
|
||||
{
|
||||
get => m_TargetIDValidation;
|
||||
set => m_TargetIDValidation = value;
|
||||
}
|
||||
|
||||
private int m_TargetID;
|
||||
private int m_Range;
|
||||
private bool m_AllowGround;
|
||||
private bool m_CheckLOS;
|
||||
private bool m_AllowNonlocal;
|
||||
private bool m_DisallowMultis;
|
||||
private TargetFlags m_Flags;
|
||||
private DateTime m_TimeoutTime;
|
||||
|
||||
public DateTime TimeoutTime => m_TimeoutTime;
|
||||
public DateTime TimeoutTime { get; private set; }
|
||||
|
||||
protected Target( int range, bool allowGround, TargetFlags flags )
|
||||
{
|
||||
m_TargetID = ++m_NextTargetID;
|
||||
m_Range = range;
|
||||
m_AllowGround = allowGround;
|
||||
m_Flags = flags;
|
||||
TargetID = ++m_NextTargetID;
|
||||
Range = range;
|
||||
AllowGround = allowGround;
|
||||
Flags = flags;
|
||||
|
||||
m_CheckLOS = true;
|
||||
CheckLOS = true;
|
||||
}
|
||||
|
||||
public static void Cancel( Mobile m )
|
||||
|
|
@ -71,7 +56,7 @@ namespace Server.Targeting
|
|||
|
||||
public void BeginTimeout( Mobile from, TimeSpan delay )
|
||||
{
|
||||
m_TimeoutTime = DateTime.UtcNow + delay;
|
||||
TimeoutTime = DateTime.UtcNow + delay;
|
||||
|
||||
m_TimeoutTimer?.Stop();
|
||||
|
||||
|
|
@ -128,25 +113,13 @@ namespace Server.Targeting
|
|||
}
|
||||
}
|
||||
|
||||
public bool CheckLOS
|
||||
{
|
||||
get => m_CheckLOS;
|
||||
set => m_CheckLOS = value;
|
||||
}
|
||||
public bool CheckLOS { get; set; }
|
||||
|
||||
public bool DisallowMultis
|
||||
{
|
||||
get => m_DisallowMultis;
|
||||
set => m_DisallowMultis = value;
|
||||
}
|
||||
public bool DisallowMultis { get; set; }
|
||||
|
||||
public bool AllowNonlocal
|
||||
{
|
||||
get => m_AllowNonlocal;
|
||||
set => m_AllowNonlocal = value;
|
||||
}
|
||||
public bool AllowNonlocal { get; set; }
|
||||
|
||||
public int TargetID => m_TargetID;
|
||||
public int TargetID { get; }
|
||||
|
||||
public virtual Packet GetPacketFor( NetState ns )
|
||||
{
|
||||
|
|
@ -227,7 +200,7 @@ namespace Server.Targeting
|
|||
|
||||
object root = item.RootParent;
|
||||
|
||||
if ( !m_AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player )
|
||||
if ( !AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player )
|
||||
{
|
||||
OnNonlocalTarget( from, item );
|
||||
OnTargetFinish( from );
|
||||
|
|
@ -244,7 +217,7 @@ namespace Server.Targeting
|
|||
return;
|
||||
}
|
||||
|
||||
if ( map == null || map != from.Map || ( m_Range != -1 && !from.InRange( loc, m_Range ) ) )
|
||||
if ( map == null || map != from.Map || ( Range != -1 && !from.InRange( loc, Range ) ) )
|
||||
{
|
||||
OnTargetOutOfRange( from, targeted );
|
||||
}
|
||||
|
|
@ -252,7 +225,7 @@ namespace Server.Targeting
|
|||
{
|
||||
if ( !from.CanSee( targeted ) )
|
||||
OnCantSeeTarget( from, targeted );
|
||||
else if ( m_CheckLOS && !from.InLOS( targeted ) )
|
||||
else if ( CheckLOS && !from.InLOS( targeted ) )
|
||||
OnTargetOutOfLOS( from, targeted );
|
||||
else if ( item?.InSecureTrade == true )
|
||||
OnTargetInSecureTrade( from, targeted );
|
||||
|
|
@ -320,22 +293,10 @@ namespace Server.Targeting
|
|||
{
|
||||
}
|
||||
|
||||
public int Range
|
||||
{
|
||||
get => m_Range;
|
||||
set => m_Range = value;
|
||||
}
|
||||
public int Range { get; set; }
|
||||
|
||||
public bool AllowGround
|
||||
{
|
||||
get => m_AllowGround;
|
||||
set => m_AllowGround = value;
|
||||
}
|
||||
public bool AllowGround { get; set; }
|
||||
|
||||
public TargetFlags Flags
|
||||
{
|
||||
get => m_Flags;
|
||||
set => m_Flags = value;
|
||||
}
|
||||
public TargetFlags Flags { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue