From 9546ef12eb829915106c67b2fc575d64621356b6 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Mon, 5 Feb 2024 17:27:35 -0500 Subject: [PATCH] Core/Spells: Added option to override orientation for target types using spell_target_position table Port From (https://github.com/TrinityCore/TrinityCore/commit/e8849ca5a14719e7d395db7907bac26705f25dbf) --- Source/Game/Spells/SpellManager.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/Game/Spells/SpellManager.cs b/Source/Game/Spells/SpellManager.cs index ac9f0e753..d703c3c7c 100644 --- a/Source/Game/Spells/SpellManager.cs +++ b/Source/Game/Spells/SpellManager.cs @@ -989,8 +989,8 @@ namespace Game.Entities mSpellTargetPositions.Clear(); // need for reload case - // 0 1 2 3 4 5 - SQLResult result = DB.World.Query("SELECT ID, EffectIndex, MapID, PositionX, PositionY, PositionZ FROM spell_target_position"); + // 0 1 2 3 4 5 6 + SQLResult result = DB.World.Query("SELECT ID, EffectIndex, MapID, PositionX, PositionY, PositionZ, Orientation FROM spell_target_position"); if (result.IsEmpty()) { Log.outInfo(LogFilter.ServerLoading, "Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); @@ -1035,11 +1035,16 @@ namespace Game.Entities continue; } - // target facing is in degrees for 6484 & 9268... (blizz sucks) - if (spellInfo.GetEffect(effIndex).PositionFacing > 2 * Math.PI) - st.target_Orientation = spellInfo.GetEffect(effIndex).PositionFacing * (float)Math.PI / 180; + if (!result.IsNull(6)) + st.target_Orientation = result.Read(6); else - st.target_Orientation = spellInfo.GetEffect(effIndex).PositionFacing; + { + // target facing is in degrees for 6484 & 9268... (blizz sucks) + if (spellInfo.GetEffect(effIndex).PositionFacing > 2 * MathF.PI) + st.target_Orientation = spellInfo.GetEffect(effIndex).PositionFacing * MathF.PI / 180; + else + st.target_Orientation = spellInfo.GetEffect(effIndex).PositionFacing; + } bool hasTarget(Targets target) {