chore(content): Cleans up abilities and some spell timers (#427)

- [X] Exposes Index/Count on the timer.
- [X] Cleans up abilities
- [X] Combines some spell context/info objects with their timers to reduce allocations
- [X] Fixes a bug where immolating weapon both finishes effect or stops in the wrong order due to a race condition.
This commit is contained in:
Kamron Batman 2021-01-23 16:40:53 -08:00 committed by GitHub
parent 9ef7752beb
commit 178f71c6dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 469 additions and 677 deletions

View file

@ -24,9 +24,7 @@ namespace Server
private static readonly Queue<Timer> m_Queue = new();
private static int m_QueueCountAtSlice;
private readonly int m_Count;
private long m_Delay;
private int m_Index;
private long m_Interval;
private List<Timer> m_List;
private long m_Next;
@ -44,7 +42,7 @@ namespace Server
{
m_Delay = (long)delay.TotalMilliseconds;
m_Interval = (long)interval.TotalMilliseconds;
m_Count = count;
Count = count;
if (!m_PrioritySet)
{
@ -94,6 +92,10 @@ namespace Server
set => m_Interval = (long)value.TotalMilliseconds;
}
public int Index { get; private set; }
public int Count { get; }
public bool Running
{
get => m_Running;
@ -365,7 +367,7 @@ namespace Server
if (tce.m_IsAdd)
{
timer.m_Next = curTicks + timer.m_Delay;
timer.m_Index = 0;
timer.Index = 0;
}
if (newIndex >= 0)
@ -425,7 +427,7 @@ namespace Server
m_Queue.Enqueue(t);
}
if (t.m_Count != 0 && ++t.m_Index >= t.m_Count)
if (t.Count != 0 && ++t.Index >= t.Count)
{
t.Stop();
}