aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMeji <alvaromegias_46@hotmail.com>2021-11-08 22:29:53 +0100
committerGitHub <noreply@github.com>2021-11-08 22:29:53 +0100
commitebc52afa0ace96cd97968c110f558344bdeba43d (patch)
tree9becfe5028f947629db0e879f303130f3ffc774b /src
parent3ce041e541e261d55959e53453eba7be064be227 (diff)
Core/BattlePets: Don't permanently learn battle pet summoning spells (#27201)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 2bd443d295d..c43f441dd6c 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -2147,10 +2147,17 @@ void Spell::EffectLearnSpell()
if (itemEffect->TriggerType != ITEM_SPELLTRIGGER_LEARN_SPELL_ID)
continue;
- player->LearnSpell(itemEffect->SpellID, false);
+ bool dependent = 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));
+ // If the spell summons a battle pet, we fake that it has been learned and the battle pet is added
+ // marking as dependent prevents saving the spell to database (intended)
+ dependent = true;
+ }
+
+ player->LearnSpell(itemEffect->SpellID, dependent);
}
}
@@ -5697,8 +5704,8 @@ void Spell::EffectUncageBattlePet()
if (!speciesEntry)
return;
- Player* plr = m_caster->ToPlayer();
- BattlePetMgr* battlePetMgr = plr->GetSession()->GetBattlePetMgr();
+ Player* player = m_caster->ToPlayer();
+ BattlePetMgr* battlePetMgr = player->GetSession()->GetBattlePetMgr();
if (!battlePetMgr)
return;
@@ -5718,13 +5725,9 @@ void Spell::EffectUncageBattlePet()
battlePetMgr->AddPet(speciesId, displayId, breed, BattlePetBreedQuality(quality), level);
- 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);
+ player->SendPlaySpellVisual(player, SPELL_VISUAL_UNCAGE_PET, 0, 0, 0.f, false);
- plr->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
+ player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
m_CastItem = nullptr;
}