aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorModoX <moardox@gmail.com>2024-01-08 21:19:44 +0100
committerGitHub <noreply@github.com>2024-01-08 21:19:44 +0100
commite8849ca5a14719e7d395db7907bac26705f25dbf (patch)
tree9bf65b8b84739bc7b266a94c857ef4a3c00279d3
parent277b72ec31c7bbbc7b39b34a816c6a012cc1dcf3 (diff)
Core/Spells: Added option to override orientation for target types using spell_target_position table (#29551)
-rw-r--r--sql/updates/world/master/2024_01_08_01_world.sql1
-rw-r--r--src/server/game/Spells/SpellMgr.cpp17
2 files changed, 12 insertions, 6 deletions
diff --git a/sql/updates/world/master/2024_01_08_01_world.sql b/sql/updates/world/master/2024_01_08_01_world.sql
new file mode 100644
index 00000000000..94fc92549a4
--- /dev/null
+++ b/sql/updates/world/master/2024_01_08_01_world.sql
@@ -0,0 +1 @@
+ALTER TABLE `spell_target_position` ADD COLUMN `Orientation` float NULL AFTER `PositionZ`;
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp
index dbed0212b50..ecc2af47afb 100644
--- a/src/server/game/Spells/SpellMgr.cpp
+++ b/src/server/game/Spells/SpellMgr.cpp
@@ -1144,8 +1144,8 @@ void SpellMgr::LoadSpellTargetPositions()
mSpellTargetPositions.clear(); // need for reload case
- // 0 1 2 3 4 5
- QueryResult result = WorldDatabase.Query("SELECT ID, EffectIndex, MapID, PositionX, PositionY, PositionZ FROM spell_target_position");
+ // 0 1 2 3 4 5 6
+ QueryResult result = WorldDatabase.Query("SELECT ID, EffectIndex, MapID, PositionX, PositionY, PositionZ, Orientation FROM spell_target_position");
if (!result)
{
TC_LOG_INFO("server.loading", ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty.");
@@ -1193,11 +1193,16 @@ void SpellMgr::LoadSpellTargetPositions()
continue;
}
- // target facing is in degrees for 6484 & 9268... (blizz sucks)
- if (spellInfo->GetEffect(effIndex).PositionFacing > 2 * M_PI)
- st.target_Orientation = spellInfo->GetEffect(effIndex).PositionFacing * float(M_PI) / 180;
+ if (!fields[6].IsNull())
+ st.target_Orientation = fields[6].GetFloat();
else
- st.target_Orientation = spellInfo->GetEffect(effIndex).PositionFacing;
+ {
+ // target facing is in degrees for 6484 & 9268... (blizz sucks)
+ if (spellInfo->GetEffect(effIndex).PositionFacing > 2 * float(M_PI))
+ st.target_Orientation = spellInfo->GetEffect(effIndex).PositionFacing * float(M_PI) / 180;
+ else
+ st.target_Orientation = spellInfo->GetEffect(effIndex).PositionFacing;
+ }
auto hasTarget = [&](Targets target)
{