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

@ -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; }
}
}