Core/Auras: Implemented mount equipment
Port From (https://github.com/TrinityCore/TrinityCore/commit/6dd5fb9d88e7a8b7da696bbe7b96947217b1ace2)
This commit is contained in:
@@ -2169,7 +2169,7 @@ namespace Game.Spells
|
||||
var mountDisplays = Global.DB2Mgr.GetMountDisplays(mountEntry.Id);
|
||||
if (mountDisplays != null)
|
||||
{
|
||||
if (mountEntry.IsSelfMount())
|
||||
if (mountEntry.HasFlag(MountFlags.IsSelfMount))
|
||||
{
|
||||
displayId = SharedConst.DisplayIdHiddenMount;
|
||||
}
|
||||
@@ -2191,6 +2191,17 @@ namespace Game.Spells
|
||||
// TODO: CREATE TABLE mount_vehicle (mountId, vehicleCreatureId) for future mounts that are vehicles (new mounts no longer have proper data in MiscValue)
|
||||
//if (MountVehicle const* mountVehicle = sObjectMgr->GetMountVehicle(mountEntry->Id))
|
||||
// creatureEntry = mountVehicle->VehicleCreatureId;
|
||||
|
||||
if (mode.HasFlag(AuraEffectHandleModes.Real) && !mountEntry.HasFlag(MountFlags.MountEquipmentEffectsSuppressed))
|
||||
{
|
||||
Player playerTarget = target.ToPlayer();
|
||||
if (playerTarget != null)
|
||||
{
|
||||
var mountEquipment = CliDB.MountEquipmentStorage.Values.FirstOrDefault(record => playerTarget.HasSpell(record.LearnedBySpell));
|
||||
if (mountEquipment != null)
|
||||
playerTarget.CastSpell(playerTarget, (uint)mountEquipment.BuffSpell, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(creatureEntry);
|
||||
@@ -2234,7 +2245,11 @@ namespace Game.Spells
|
||||
// need to remove ALL arura related to mounts, this will stop client crash with broom stick
|
||||
// and never endless flying after using Headless Horseman's Mount
|
||||
if (mode.HasAnyFlag(AuraEffectHandleModes.Real))
|
||||
{
|
||||
target.RemoveAurasByType(AuraType.Mounted);
|
||||
foreach (var (_, mountEquipmentStore) in CliDB.MountEquipmentStorage)
|
||||
target.RemoveOwnedAura((uint)mountEquipmentStore.BuffSpell);
|
||||
}
|
||||
|
||||
if (mode.HasAnyFlag(AuraEffectHandleModes.ChangeAmountMask))
|
||||
{
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user