Core/Spells: Implemented battle pet experience related spell effects and auras (#27488)

* Spell effect 286 (SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE)
* Aura type 420 (SPELL_AURA_MOD_BATTLE_PET_XP_PCT)
This commit is contained in:
Meji
2021-12-30 20:38:29 +01:00
committed by GitHub
parent 9cc3cd128c
commit 9354b4ac8e
10 changed files with 125 additions and 7 deletions
+16 -1
View File
@@ -367,7 +367,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectNULL, //283 SPELL_EFFECT_COMPLETE_CAMPAIGN
&Spell::EffectSendChatMessage, //284 SPELL_EFFECT_SEND_CHAT_MESSAGE
&Spell::EffectNULL, //285 SPELL_EFFECT_MODIFY_KEYSTONE_2
&Spell::EffectNULL, //286 SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE
&Spell::EffectGrantBattlePetExperience, //286 SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE
&Spell::EffectNULL, //287 SPELL_EFFECT_SET_GARRISON_FOLLOWER_LEVEL
};
@@ -5722,3 +5722,18 @@ void Spell::EffectSendChatMessage()
ChatMsg chatType = ChatMsg(effectInfo->MiscValueB);
unitCaster->Talk(broadcastTextId, chatType, CreatureTextMgr::GetRangeForChatType(chatType), unitTarget);
}
void Spell::EffectGrantBattlePetExperience()
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)
return;
Player* playerCaster = m_caster->ToPlayer();
if (!playerCaster)
return;
if (!unitTarget || !unitTarget->IsCreature())
return;
playerCaster->GetSession()->GetBattlePetMgr()->GrantBattlePetExperience(unitTarget->GetBattlePetCompanionGUID(), damage, BattlePets::BattlePetXpSource::SpellEffect);
}