diff options
author | Shauren <shauren.trinity@gmail.com> | 2025-01-20 19:27:44 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2025-01-20 19:27:44 +0100 |
commit | 0e36fd93601f10949c848c1fc30ee3b70f2cecfa (patch) | |
tree | 16b7dec2365367ae30e7017e04bbf02612f00aa2 /src/server/game/Spells/SpellMgr.cpp | |
parent | 56fb627c7dd151190412468370db083ef3b044ad (diff) |
Core/Spells: Replace SpellTargetPosition structure with WorldLocation
Diffstat (limited to 'src/server/game/Spells/SpellMgr.cpp')
-rw-r--r-- | src/server/game/Spells/SpellMgr.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index cf6734b2df4..dc7c9d35cc3 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1173,21 +1173,16 @@ void SpellMgr::LoadSpellTargetPositions() uint32 spellId = fields[0].GetUInt32(); SpellEffIndex effIndex = SpellEffIndex(fields[1].GetUInt8()); - SpellTargetPosition st; + SpellTargetPosition st(fields[2].GetUInt16(), fields[3].GetFloat(), fields[4].GetFloat(), fields[5].GetFloat()); - st.target_mapId = fields[2].GetUInt16(); - st.target_X = fields[3].GetFloat(); - st.target_Y = fields[4].GetFloat(); - st.target_Z = fields[5].GetFloat(); - - MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); + MapEntry const* mapEntry = sMapStore.LookupEntry(st.GetMapId()); if (!mapEntry) { - TC_LOG_ERROR("sql.sql", "Spell (Id: {}, EffectIndex: {}) is using a non-existant MapID (ID: {}).", spellId, uint32(effIndex), st.target_mapId); + TC_LOG_ERROR("sql.sql", "Spell (Id: {}, EffectIndex: {}) is using a non-existant MapID (ID: {}).", spellId, uint32(effIndex), st.GetMapId()); continue; } - if (st.target_X == 0 && st.target_Y == 0 && st.target_Z == 0) + if (st.GetPositionX() == 0 && st.GetPositionY() == 0 && st.GetPositionZ() == 0) { TC_LOG_ERROR("sql.sql", "Spell (Id: {}, EffectIndex: {}): target coordinates not provided.", spellId, uint32(effIndex)); continue; @@ -1207,14 +1202,14 @@ void SpellMgr::LoadSpellTargetPositions() } if (!fields[6].IsNull()) - st.target_Orientation = fields[6].GetFloat(); + st.SetOrientation(fields[6].GetFloat()); else { - // target facing is in degrees for 6484 & 9268... (blizz sucks) + // target facing is in degrees for 6484 & 9268... if (spellInfo->GetEffect(effIndex).PositionFacing > 2 * float(M_PI)) - st.target_Orientation = spellInfo->GetEffect(effIndex).PositionFacing * float(M_PI) / 180; + st.SetOrientation(spellInfo->GetEffect(effIndex).PositionFacing * float(M_PI) / 180); else - st.target_Orientation = spellInfo->GetEffect(effIndex).PositionFacing; + st.SetOrientation(spellInfo->GetEffect(effIndex).PositionFacing); } auto hasTarget = [&](Targets target) |