Fixes formatting (#200)

This commit is contained in:
Kamron Batman 2020-08-25 18:53:35 -07:00 • committed by GitHub
parent 1f651992d7
commit 86b7b3aed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
209 changed files with 51326 additions and 50397 deletions

View file

@ -25,178 +25,179 @@ using System.IO;
namespace Server
{
public class AggressorInfo {
private static readonly Queue<AggressorInfo> m_Pool = new Queue<AggressorInfo>();
private Mobile m_Attacker, m_Defender;
private bool m_CanReportMurder;
private bool m_CriminalAggression;
private DateTime m_LastCombatTime;
private bool m_Queued;
private bool m_Reported;
private AggressorInfo(Mobile attacker, Mobile defender, bool criminal)
public class AggressorInfo
{
m_Attacker = attacker;
m_Defender = defender;
private static readonly Queue<AggressorInfo> m_Pool = new Queue<AggressorInfo>();
private Mobile m_Attacker, m_Defender;
private bool m_CanReportMurder;
private bool m_CriminalAggression;
private DateTime m_LastCombatTime;
m_CanReportMurder = criminal;
m_CriminalAggression = criminal;
private bool m_Queued;
private bool m_Reported;
Refresh();
private AggressorInfo(Mobile attacker, Mobile defender, bool criminal)
{
m_Attacker = attacker;
m_Defender = defender;
m_CanReportMurder = criminal;
m_CriminalAggression = criminal;
Refresh();
}
public static TimeSpan ExpireDelay { get; set; } = TimeSpan.FromMinutes(2.0);
public bool Expired
{
get
{
if (m_Queued)
DumpAccess();
return m_Attacker.Deleted || m_Defender.Deleted || DateTime.UtcNow >= m_LastCombatTime + ExpireDelay;
}
}
public bool CriminalAggression
{
get
{
if (m_Queued)
DumpAccess();
return m_CriminalAggression;
}
set
{
if (m_Queued)
DumpAccess();
m_CriminalAggression = value;
}
}
public Mobile Attacker
{
get
{
if (m_Queued)
DumpAccess();
return m_Attacker;
}
}
public Mobile Defender
{
get
{
if (m_Queued)
DumpAccess();
return m_Defender;
}
}
public DateTime LastCombatTime
{
get
{
if (m_Queued)
DumpAccess();
return m_LastCombatTime;
}
}
public bool Reported
{
get
{
if (m_Queued)
DumpAccess();
return m_Reported;
}
set
{
if (m_Queued)
DumpAccess();
m_Reported = value;
}
}
public bool CanReportMurder
{
get
{
if (m_Queued)
DumpAccess();
return m_CanReportMurder;
}
set
{
if (m_Queued)
DumpAccess();
m_CanReportMurder = value;
}
}
public static AggressorInfo Create(Mobile attacker, Mobile defender, bool criminal)
{
AggressorInfo info;
if (m_Pool.Count > 0)
{
info = m_Pool.Dequeue();
info.m_Attacker = attacker;
info.m_Defender = defender;
info.m_CanReportMurder = criminal;
info.m_CriminalAggression = criminal;
info.m_Queued = false;
info.Refresh();
}
else
{
info = new AggressorInfo(attacker, defender, criminal);
}
return info;
}
public void Free()
{
if (m_Queued)
return;
m_Queued = true;
m_Pool.Enqueue(this);
}
public static void DumpAccess()
{
using var op = new StreamWriter("warnings.log", true);
op.WriteLine("Warning: Access to queued AggressorInfo:");
op.WriteLine(new StackTrace());
op.WriteLine();
op.WriteLine();
}
public void Refresh()
{
if (m_Queued)
DumpAccess();
m_LastCombatTime = DateTime.UtcNow;
m_Reported = false;
}
}
public static TimeSpan ExpireDelay { get; set; } = TimeSpan.FromMinutes(2.0);
public bool Expired
{
get
{
if (m_Queued)
DumpAccess();
return m_Attacker.Deleted || m_Defender.Deleted || DateTime.UtcNow >= m_LastCombatTime + ExpireDelay;
}
}
public bool CriminalAggression
{
get
{
if (m_Queued)
DumpAccess();
return m_CriminalAggression;
}
set
{
if (m_Queued)
DumpAccess();
m_CriminalAggression = value;
}
}
public Mobile Attacker
{
get
{
if (m_Queued)
DumpAccess();
return m_Attacker;
}
}
public Mobile Defender
{
get
{
if (m_Queued)
DumpAccess();
return m_Defender;
}
}
public DateTime LastCombatTime
{
get
{
if (m_Queued)
DumpAccess();
return m_LastCombatTime;
}
}
public bool Reported
{
get
{
if (m_Queued)
DumpAccess();
return m_Reported;
}
set
{
if (m_Queued)
DumpAccess();
m_Reported = value;
}
}
public bool CanReportMurder
{
get
{
if (m_Queued)
DumpAccess();
return m_CanReportMurder;
}
set
{
if (m_Queued)
DumpAccess();
m_CanReportMurder = value;
}
}
public static AggressorInfo Create(Mobile attacker, Mobile defender, bool criminal)
{
AggressorInfo info;
if (m_Pool.Count > 0)
{
info = m_Pool.Dequeue();
info.m_Attacker = attacker;
info.m_Defender = defender;
info.m_CanReportMurder = criminal;
info.m_CriminalAggression = criminal;
info.m_Queued = false;
info.Refresh();
}
else
{
info = new AggressorInfo(attacker, defender, criminal);
}
return info;
}
public void Free()
{
if (m_Queued)
return;
m_Queued = true;
m_Pool.Enqueue(this);
}
public static void DumpAccess()
{
using var op = new StreamWriter("warnings.log", true);
op.WriteLine("Warning: Access to queued AggressorInfo:");
op.WriteLine(new StackTrace());
op.WriteLine();
op.WriteLine();
}
public void Refresh()
{
if (m_Queued)
DumpAccess();
m_LastCombatTime = DateTime.UtcNow;
m_Reported = false;
}
}
}