aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorMeji <alvaromegias_46@hotmail.com>2021-10-17 00:11:48 +0200
committerGitHub <noreply@github.com>2021-10-17 00:11:48 +0200
commit7c15ec00c7c1a4d5bd3ce37de6776b8a407b65b7 (patch)
tree860493b02fa7eca369cd6a9360d9a44b7c57e7c4 /src/server/game/Spells/SpellEffects.cpp
parentba4fa060d765a35507f1a73287504c3f2e440fdb (diff)
Core/BattlePets: Fixes when adding pets (#27076)
* Add pet when learning it for the first time (summon spell not known). * Removed code that adds battle pet if its summon spell is known (Learn cageable pet -> Cage pet -> Log out -> Log in -> Pet is added). * When uncaging check that the species has a summon spell before trying to learn it.
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 6cb02a20306..a7008eefae2 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2146,6 +2146,9 @@ void Spell::EffectLearnSpell()
continue;
player->LearnSpell(itemEffect->SpellID, false);
+
+ if (BattlePetSpeciesEntry const* speciesEntry = sSpellMgr->GetBattlePetSpecies(uint32(itemEffect->SpellID)))
+ player->GetSession()->GetBattlePetMgr()->AddPet(speciesEntry->ID, BattlePetMgr::SelectPetDisplay(speciesEntry), BattlePetMgr::RollPetBreed(speciesEntry->ID), BattlePetMgr::GetDefaultPetQuality(speciesEntry->ID));
}
}
@@ -5713,8 +5716,9 @@ void Spell::EffectUncageBattlePet()
battlePetMgr->AddPet(speciesId, displayId, breed, BattlePetBreedQuality(quality), level);
- if (!plr->HasSpell(speciesEntry->SummonSpellID))
- plr->LearnSpell(speciesEntry->SummonSpellID, false);
+ if (speciesEntry->SummonSpellID)
+ if (!plr->HasSpell(speciesEntry->SummonSpellID))
+ plr->LearnSpell(speciesEntry->SummonSpellID, false);
plr->SendPlaySpellVisual(plr, SPELL_VISUAL_UNCAGE_PET, 0, 0, 0.f, false);