mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Pet: Fix an issue that was causing lower ranks of pet spells to remain in DB (#20112)
This commit is contained in:
@@ -1306,24 +1306,22 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
|
||||
if (itr != m_spells.end())
|
||||
{
|
||||
if (itr->second.state == PETSPELL_REMOVED)
|
||||
{
|
||||
m_spells.erase(itr);
|
||||
state = PETSPELL_CHANGED;
|
||||
}
|
||||
else if (state == PETSPELL_UNCHANGED && itr->second.state != PETSPELL_UNCHANGED)
|
||||
{
|
||||
// can be in case spell loading but learned at some previous spell loading
|
||||
itr->second.state = PETSPELL_UNCHANGED;
|
||||
|
||||
if (active == ACT_ENABLED)
|
||||
ToggleAutocast(spellInfo, true);
|
||||
else if (active == ACT_DISABLED)
|
||||
ToggleAutocast(spellInfo, false);
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state == PETSPELL_UNCHANGED && itr->second.state != PETSPELL_UNCHANGED)
|
||||
{
|
||||
// can be in case spell loading but learned at some previous spell loading
|
||||
itr->second.state = PETSPELL_UNCHANGED;
|
||||
|
||||
if (active == ACT_ENABLED)
|
||||
ToggleAutocast(spellInfo, true);
|
||||
else if (active == ACT_DISABLED)
|
||||
ToggleAutocast(spellInfo, false);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
PetSpell newspell;
|
||||
|
||||
Reference in New Issue
Block a user