Core/Auras: Implemented mount equipment

Port From (https://github.com/TrinityCore/TrinityCore/commit/6dd5fb9d88e7a8b7da696bbe7b96947217b1ace2)
This commit is contained in:
Hondacrx
2025-02-17 15:06:19 -05:00
parent f3b2f98c78
commit 4d2dbbcf16
8 changed files with 154 additions and 7 deletions
+37
View File
@@ -5681,6 +5681,43 @@ namespace Game.Spells
Conversation.CreateConversation((uint)effectInfo.MiscValue, unitTarget, destTarget.GetPosition(), unitTarget.GetGUID(), GetSpellInfo());
}
[SpellEffectHandler(SpellEffectName.ApplyMountEquipment)]
void EffectApplyMountEquipment()
{
if (effectHandleMode != SpellEffectHandleMode.LaunchTarget)
return;
Player playerTarget = unitTarget.ToPlayer();
if (playerTarget == null)
return;
foreach (var (_, mountEquipment) in CliDB.MountEquipmentStorage)
{
if (mountEquipment.LearnedBySpell == effectInfo.TriggerSpell)
{
playerTarget.LearnSpell(mountEquipment.LearnedBySpell, false, 0, true);
var mountAuras = playerTarget.GetAuraEffectsByType(AuraType.Mounted);
if (!mountAuras.Empty())
{
var mountEntry = Global.DB2Mgr.GetMount(mountAuras.FirstOrDefault().GetId());
if (mountEntry != null && !mountEntry.HasFlag(MountFlags.MountEquipmentEffectsSuppressed))
playerTarget.CastSpell(playerTarget, (uint)mountEquipment.BuffSpell, true);
}
}
else
{
playerTarget.RemoveOwnedAura((uint)mountEquipment.BuffSpell);
playerTarget.RemoveSpell(mountEquipment.LearnedBySpell, false, false, true);
}
}
ApplyMountEquipmentResult applyMountEquipmentResult = new();
applyMountEquipmentResult.ItemGUID = m_castItemGUID;
applyMountEquipmentResult.ItemID = m_castItemEntry;
applyMountEquipmentResult.Result = ApplyMountEquipmentResult.ApplyResult.Success;
playerTarget.SendPacket(applyMountEquipmentResult);
}
[SpellEffectHandler(SpellEffectName.SendChatMessage)]
void EffectSendChatMessage()
{