Core/Spells: corrected refunding runes - they don't get put on a cooldown and don't send cooldowns for spells which had their runes refunded

Port From (https://github.com/TrinityCore/TrinityCore/commit/1dc2e8fdc565ea35a4f6b442261da8566e81ca86)
This commit is contained in:
Hondacrx
2025-06-04 09:14:40 -04:00
parent 3d4118962e
commit 00af1579bb
+9 -3
View File
@@ -4050,8 +4050,11 @@ namespace Game.Spells
if (m_caster.IsPlayer() && m_caster.ToPlayer().GetClass() == Class.Deathknight &&
HasPowerTypeCost(PowerType.Runes) && !_triggeredCastFlags.HasAnyFlag(TriggerCastFlags.IgnorePowerCost))
{
castFlags |= SpellCastFlags.NoGCD; // same as in SMSG_SPELL_START
castFlags |= SpellCastFlags.RuneList; // rune cooldowns list
castFlags |= SpellCastFlags.NoGCD; // not needed, but it's being sent according to sniffs
// Only send rune cooldowns when there has been a change
if (m_runesState != m_caster.ToPlayer().GetRunesState())
castFlags |= SpellCastFlags.RuneList; // rune cooldowns list
}
if (m_targets.HasTraj())
@@ -4843,12 +4846,15 @@ namespace Game.Spells
Player player = m_caster.ToPlayer();
m_runesState = player.GetRunesState(); // store previous state
if (!didHit)
return;
int runeCost = m_powerCost.Sum(cost => cost.Power == PowerType.Runes ? cost.Amount : 0);
for (byte i = 0; i < player.GetMaxPower(PowerType.Runes); ++i)
{
if (player.GetRuneCooldown(i) == 0 && runeCost > 0)
{
player.SetRuneCooldown(i, didHit ? player.GetRuneBaseCooldown() : RuneCooldowns.Miss);
player.SetRuneCooldown(i, player.GetRuneBaseCooldown());
--runeCost;
}
}