ace/Source/ACE.Server/Entity/AttackQueue.cs
gmriggs ef34dd1fcf
handling multiple attack sequences sent by acclient (#2623)
* filling gaps for attack done

* handling multiple attack sequences sent by acclient

* adding hold height button technique to missile
2020-01-21 06:01:43 -05:00

47 lines
1 KiB
C#

using System.Collections.Generic;
using log4net;
using ACE.Server.WorldObjects;
namespace ACE.Server.Entity
{
public class AttackQueue
{
private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public Player Player;
public Queue<float> PowerAccuracy;
public AttackQueue(Player player)
{
Player = player;
PowerAccuracy = new Queue<float>();
}
public void Add(float powerAccuracy)
{
PowerAccuracy.Enqueue(powerAccuracy);
}
public float Fetch()
{
if (PowerAccuracy.Count > 1)
PowerAccuracy.Dequeue();
if (!PowerAccuracy.TryPeek(out var powerAccuracy))
{
//log.Error($"{Player.Name}.AttackQueue.Fetch() - empty queue");
return 0.5f;
}
return powerAccuracy;
}
public void Clear()
{
PowerAccuracy.Clear();
}
}
}