aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/SpellEffects.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-11-19 21:40:49 +0100
committerShauren <shauren.trinity@gmail.com>2024-11-19 21:40:49 +0100
commit6dd5fb9d88e7a8b7da696bbe7b96947217b1ace2 (patch)
tree69930d805b8de5a6314cd0d24bfd05914bc37ab2 /src/server/game/Spells/SpellEffects.cpp
parent6d78230d6b45d370b9cf3656c84dd59963179bae (diff)
Core/Auras: Implemented mount equipment
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r--src/server/game/Spells/SpellEffects.cpp36
1 files changed, 35 insertions, 1 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 45481f9ee6a..c0af44a549a 100644
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -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)