Core/Pet: Fix an issue that was causing lower ranks of pet spells to remain in DB

Port From (https://github.com/TrinityCore/TrinityCore/commit/5e3170d58e82693e7ceb29d4d9c5346906bdd98b)
This commit is contained in:
hondacrx
2020-08-24 11:18:57 -04:00
parent 7cf9b6183e
commit 1b33551fab
+14 -16
View File
@@ -1028,24 +1028,22 @@ namespace Game.Entities
if (petSpell != null)
{
if (petSpell.state == PetSpellState.Removed)
{
m_spells.Remove(spellId);
state = PetSpellState.Changed;
}
else if (state == PetSpellState.Unchanged && petSpell.state != PetSpellState.Unchanged)
{
// can be in case spell loading but learned at some previous spell loading
petSpell.state = PetSpellState.Unchanged;
if (active == ActiveStates.Enabled)
ToggleAutocast(spellInfo, true);
else if (active == ActiveStates.Disabled)
ToggleAutocast(spellInfo, false);
return false;
}
else
return false;
{
if (state == PetSpellState.Unchanged && petSpell.state != PetSpellState.Unchanged)
{
// can be in case spell loading but learned at some previous spell loading
petSpell.state = PetSpellState.Unchanged;
if (active == ActiveStates.Enabled)
ToggleAutocast(spellInfo, true);
else if (active == ActiveStates.Disabled)
ToggleAutocast(spellInfo, false);
return false;
}
}
}
PetSpell newspell = new PetSpell();