diff options
author | Necropola <necropola@rain-fighters.net> | 2017-08-06 03:15:04 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2020-08-22 20:02:34 +0200 |
commit | 5e3170d58e82693e7ceb29d4d9c5346906bdd98b (patch) | |
tree | fa9706eb1f25a05bec5d981666fda08f62ab18e1 | |
parent | ed4788190d52f8739b89fe2e4ef1a5e991631077 (diff) |
Core/Pet: Fix an issue that was causing lower ranks of pet spells to remain in DB (#20112)
(cherry picked from commit ecf59786085cb8750bf48bbfa4f4f3d49b924dbd)
-rw-r--r-- | src/server/game/Entities/Pet/Pet.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index e0669360574..5c58ab5069f 100644 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -1324,24 +1324,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) + else { - // can be in case spell loading but learned at some previous spell loading - itr->second.state = PETSPELL_UNCHANGED; + 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); + if (active == ACT_ENABLED) + ToggleAutocast(spellInfo, true); + else if (active == ACT_DISABLED) + ToggleAutocast(spellInfo, false); + } return false; } - else - return false; } PetSpell newspell; |