Fix/Enhance warlock pet spells (#860)

This commit is contained in:
Yunfan Li
2025-01-11 01:41:56 +08:00
committed by GitHub
parent 6695415170
commit 46534e3abe

View File

@@ -24,6 +24,21 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
{ {
return false; return false;
} }
// hack on high level spell after low level initialization
std::vector<unsigned int> shouldRemove;
for (unsigned int& m_autospell : pet->m_autospells)
{
if (!pet->HasSpell(m_autospell))
{
shouldRemove.push_back(m_autospell);
}
}
for (unsigned int spellId : shouldRemove)
{
auto autospellItr = std::find(pet->m_autospells.begin(), pet->m_autospells.end(), spellId);
if (autospellItr != pet->m_autospells.end())
pet->m_autospells.erase(autospellItr);
}
bool toggled = false; bool toggled = false;
for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr) for (PetSpellMap::const_iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end(); ++itr)
{ {
@@ -32,13 +47,14 @@ bool TogglePetSpellAutoCastAction::Execute(Event event)
uint32 spellId = itr->first; uint32 spellId = itr->first;
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId); const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo->IsPassive()) if (!spellInfo->IsAutocastable())
continue; continue;
bool shouldApply = true; bool shouldApply = true;
// imp's spell, felhunte's intelligence, cat stealth // spellId == 4511 || spellId == 54424 || spellId == 57564 || spellId == 57565 ||
if (spellId == 4511 || spellId == 1742 || spellId == 54424 || spellId == 57564 || spellId == 57565 || // spellId == 57566 || spellId == 57567 ||
spellId == 57566 || spellId == 57567 || spellId == 24450) // cat stealth, prowl
if (spellId == 1742 || spellId == 24450)
{ {
shouldApply = false; shouldApply = false;
} }