Core/Spells: Implemented spell effect 204 (SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY)

Port From (https://github.com/TrinityCore/TrinityCore/commit/c4fee8c5cf85aeddc45aad18d7a944efa59022bd)
This commit is contained in:
hondacrx
2022-01-05 20:38:57 -05:00
parent 13f73adf73
commit 5e0fd36ada
4 changed files with 128 additions and 0 deletions
+30
View File
@@ -5083,6 +5083,36 @@ namespace Game.Spells
player.GetSession().GetBattlePetMgr().UnlockSlot(BattlePetSlots.Slot0);
}
[SpellEffectHandler(SpellEffectName.ChangeBattlepetQuality)]
void EffectChangeBattlePetQuality()
{
if (effectHandleMode != SpellEffectHandleMode.HitTarget)
return;
Player playerCaster = m_caster.ToPlayer();
if (playerCaster == null)
return;
if (unitTarget == null || !unitTarget.IsCreature())
return;
var quality = BattlePetBreedQuality.Poor;
switch (damage)
{
case 85:
quality = BattlePetBreedQuality.Rare;
break;
case 75:
quality = BattlePetBreedQuality.Uncommon;
break;
default:
// Ignore Epic Battle-Stones
break;
}
playerCaster.GetSession().GetBattlePetMgr().ChangeBattlePetQuality(unitTarget.GetBattlePetCompanionGUID(), quality);
}
[SpellEffectHandler(SpellEffectName.LaunchQuestChoice)]
void EffectLaunchQuestChoice()
{