Core/Spells: Implement spell queue
Port From (https://github.com/TrinityCore/TrinityCore/commit/27019a62a4294f8dd48d975f85b1907c5adee0e3)
This commit is contained in:
@@ -537,7 +537,7 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
if (cooldownEntry.CooldownEnd <= now)
|
||||
{
|
||||
{
|
||||
_categoryCooldowns.Remove(cooldownEntry.CategoryId);
|
||||
_spellCooldowns.Remove(cooldownEntry.SpellId);
|
||||
}
|
||||
@@ -697,7 +697,7 @@ namespace Game.Spells
|
||||
{
|
||||
return GetRemainingCategoryCooldown(spellInfo.GetCategory());
|
||||
}
|
||||
|
||||
|
||||
public void LockSpellSchool(SpellSchoolMask schoolMask, TimeSpan lockoutTime)
|
||||
{
|
||||
DateTime now = GameTime.GetSystemTime();
|
||||
@@ -921,6 +921,18 @@ namespace Game.Spells
|
||||
_globalCooldowns[spellInfo.StartRecoveryCategory] = new DateTime();
|
||||
}
|
||||
|
||||
public TimeSpan GetRemainingGlobalCooldown(SpellInfo spellInfo)
|
||||
{
|
||||
if (!_globalCooldowns.TryGetValue(spellInfo.StartRecoveryCategory, out DateTime end))
|
||||
return TimeSpan.Zero;
|
||||
|
||||
DateTime now = GameTime.GetDateAndTime();
|
||||
if (end < now)
|
||||
return TimeSpan.Zero;
|
||||
|
||||
return end - now;
|
||||
}
|
||||
|
||||
public Player GetPlayerOwner()
|
||||
{
|
||||
return _owner.GetCharmerOrOwnerPlayerOrPlayerItself();
|
||||
@@ -952,7 +964,7 @@ namespace Game.Spells
|
||||
player.SendPacket(setSpellCharges);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void GetCooldownDurations(SpellInfo spellInfo, uint itemId, ref uint categoryId)
|
||||
{
|
||||
TimeSpan notUsed = TimeSpan.Zero;
|
||||
|
||||
Reference in New Issue
Block a user