Core/Auras: Implemented mount equipment

This commit is contained in:
Shauren
2024-11-19 21:40:49 +01:00
parent 6d78230d6b
commit 6dd5fb9d88
18 changed files with 199 additions and 11 deletions

View File

@@ -356,7 +356,7 @@ NonDefaultConstructible<SpellEffectHandlerFn> SpellEffectHandlers[TOTAL_SPELL_EF
&Spell::EffectLearnAzeriteEssencePower, //265 SPELL_EFFECT_LEARN_AZERITE_ESSENCE_POWER
&Spell::EffectNULL, //266 SPELL_EFFECT_SET_ITEM_BONUS_LIST_GROUP_ENTRY
&Spell::EffectCreatePrivateConversation, //267 SPELL_EFFECT_CREATE_PRIVATE_CONVERSATION
&Spell::EffectNULL, //268 SPELL_EFFECT_APPLY_MOUNT_EQUIPMENT
&Spell::EffectApplyMountEquipment, //268 SPELL_EFFECT_APPLY_MOUNT_EQUIPMENT
&Spell::EffectNULL, //269 SPELL_EFFECT_INCREASE_ITEM_BONUS_LIST_GROUP_STEP
&Spell::EffectNULL, //270 SPELL_EFFECT_270
&Spell::EffectUnused, //271 SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
@@ -5926,6 +5926,40 @@ void Spell::EffectCreatePrivateConversation()
Conversation::CreateConversation(effectInfo->MiscValue, unitTarget, destTarget->GetPosition(), unitTarget->GetGUID(), GetSpellInfo());
}
void Spell::EffectApplyMountEquipment()
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET)
return;
Player* playerTarget = unitTarget->ToPlayer();
if (!playerTarget)
return;
for (MountEquipmentEntry const* mountEquipment : sMountEquipmentStore)
{
if (mountEquipment->LearnedBySpell == effectInfo->TriggerSpell)
{
playerTarget->LearnSpell(mountEquipment->LearnedBySpell, false, 0, true);
Unit::AuraEffectList const& mountAuras = playerTarget->GetAuraEffectsByType(SPELL_AURA_MOUNTED);
if (!mountAuras.empty())
if (MountEntry const* mountEntry = sDB2Manager.GetMount(mountAuras.front()->GetId()))
if (!mountEntry->GetFlags().HasFlag(MountFlags::MountEquipmentEffectsSuppressed))
playerTarget->CastSpell(playerTarget, mountEquipment->BuffSpell, true);
}
else
{
playerTarget->RemoveOwnedAura(mountEquipment->BuffSpell);
playerTarget->RemoveSpell(mountEquipment->LearnedBySpell, false, false, true);
}
}
WorldPackets::Spells::ApplyMountEquipmentResult applyMountEquipmentResult;
applyMountEquipmentResult.ItemGUID = m_castItemGUID;
applyMountEquipmentResult.ItemID = m_castItemEntry;
applyMountEquipmentResult.Result = WorldPackets::Spells::ApplyMountEquipmentResult::Success;
playerTarget->SendDirectMessage(applyMountEquipmentResult.Write());
}
void Spell::EffectSendChatMessage()
{
if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)