mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
fix(Core): Hunter Readiness crash fix (#12987)
Co-authored-by: Angelo Venturini <nefertum.dev@protonmail.com>
This commit is contained in:
@@ -655,13 +655,12 @@ class spell_hun_readiness : public SpellScript
|
||||
|
||||
SpellCooldowns& cooldowns = caster->GetSpellCooldownMap();
|
||||
|
||||
SpellCooldowns::iterator itr, next;
|
||||
for (itr = cooldowns.begin(); itr != cooldowns.end(); itr = next)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
std::set<std::pair<uint32, bool>> spellsToRemove;
|
||||
std::set<uint32> categoriesToRemove;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
|
||||
for (const auto& [spellId, cooldown] : cooldowns)
|
||||
{
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (spellInfo
|
||||
&& spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER
|
||||
&& spellInfo->Id != SPELL_HUNTER_READINESS
|
||||
@@ -669,12 +668,18 @@ class spell_hun_readiness : public SpellScript
|
||||
&& spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU)
|
||||
{
|
||||
if (spellInfo->RecoveryTime > 0)
|
||||
caster->RemoveSpellCooldown(spellInfo->Id, itr->second.needSendToClient);
|
||||
spellsToRemove.insert(std::make_pair(spellInfo->Id, cooldown.needSendToClient));
|
||||
|
||||
if (spellInfo->CategoryRecoveryTime > 0)
|
||||
caster->RemoveCategoryCooldown(spellInfo->GetCategory());
|
||||
categoriesToRemove.insert(spellInfo->GetCategory());
|
||||
}
|
||||
}
|
||||
|
||||
// we can't remove spell cooldowns while iterating.
|
||||
for (const auto& [spellId, sendToClient] : spellsToRemove)
|
||||
caster->RemoveSpellCooldown(spellId, sendToClient);
|
||||
for (const auto& category : categoriesToRemove)
|
||||
caster->RemoveCategoryCooldown(category);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
Reference in New Issue
Block a user