diff options
| author | Duarte Duarte <dnpd.dd@gmail.com> | 2015-02-12 02:37:42 +0000 |
|---|---|---|
| committer | Duarte Duarte <dnpd.dd@gmail.com> | 2015-02-12 02:37:42 +0000 |
| commit | 20aa605485a0772910766255a8e5e4ba2f2d92bc (patch) | |
| tree | 9dcde00afcaa7cb6638e0fb813ef48bc7ab8f8ff /src/server/game/Spells/Spell.cpp | |
| parent | 6678635cc7e4df00a265d19653dbbfc2ef5c8eec (diff) | |
Core/Packets: Update and enable CMSG_USE_ITEM
Ref #14115
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
| -rw-r--r-- | src/server/game/Spells/Spell.cpp | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6e70c4ef696..46becb8139c 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -110,43 +110,46 @@ void SpellDestination::RelocateOffset(Position const& offset) } SpellCastTargets::SpellCastTargets() : m_targetMask(0), m_objectTarget(nullptr), m_itemTarget(nullptr), - m_itemTargetEntry(0), m_elevation(0.0f), m_speed(0.0f) + m_itemTargetEntry(0), m_pitch(0.0f), m_speed(0.0f) { } -SpellCastTargets::SpellCastTargets(Unit* caster, WorldPackets::Spells::SpellTargetData const& spellTargetData) : - m_targetMask(spellTargetData.Flags), m_objectTarget(nullptr), m_itemTarget(nullptr), - m_objectTargetGUID(spellTargetData.Unit), m_itemTargetGUID(spellTargetData.Item), - m_itemTargetEntry(0), m_elevation(0.0f), m_speed(0.0f), m_strTarget(spellTargetData.Name) +SpellCastTargets::SpellCastTargets(Unit* caster, WorldPackets::Spells::SpellCastRequest const& spellCastRequest) : + m_targetMask(spellCastRequest.Target.Flags), m_objectTarget(nullptr), m_itemTarget(nullptr), + m_objectTargetGUID(spellCastRequest.Target.Unit), m_itemTargetGUID(spellCastRequest.Target.Item), + m_itemTargetEntry(0), m_pitch(0.0f), m_speed(0.0f), m_strTarget(spellCastRequest.Target.Name) { - if (spellTargetData.SrcLocation.HasValue) + if (spellCastRequest.Target.SrcLocation.HasValue) { - m_src._transportGUID = spellTargetData.SrcLocation.Value.Transport; + m_src._transportGUID = spellCastRequest.Target.SrcLocation.Value.Transport; Position* pos; if (!m_src._transportGUID.IsEmpty()) pos = &m_src._transportOffset; else pos = &m_src._position; - pos->Relocate(spellTargetData.SrcLocation.Value.Location); - if (spellTargetData.Orientation.HasValue) - pos->SetOrientation(spellTargetData.Orientation.Value); + pos->Relocate(spellCastRequest.Target.SrcLocation.Value.Location); + if (spellCastRequest.Target.Orientation.HasValue) + pos->SetOrientation(spellCastRequest.Target.Orientation.Value); } - if (spellTargetData.DstLocation.HasValue) + if (spellCastRequest.Target.DstLocation.HasValue) { - m_dst._transportGUID = spellTargetData.DstLocation.Value.Transport; + m_dst._transportGUID = spellCastRequest.Target.DstLocation.Value.Transport; Position* pos; if (!m_dst._transportGUID.IsEmpty()) pos = &m_dst._transportOffset; else pos = &m_dst._position; - pos->Relocate(spellTargetData.DstLocation.Value.Location); - if (spellTargetData.Orientation.HasValue) - pos->SetOrientation(spellTargetData.Orientation.Value); + pos->Relocate(spellCastRequest.Target.DstLocation.Value.Location); + if (spellCastRequest.Target.Orientation.HasValue) + pos->SetOrientation(spellCastRequest.Target.Orientation.Value); } + SetPitch(spellCastRequest.MissileTrajectory.Pitch); + SetSpeed(spellCastRequest.MissileTrajectory.Speed); + Update(caster); } @@ -535,7 +538,7 @@ void SpellCastTargets::OutDebug() const if (m_targetMask & TARGET_FLAG_STRING) TC_LOG_INFO("spells", "String: %s", m_strTarget.c_str()); TC_LOG_INFO("spells", "speed: %f", m_speed); - TC_LOG_INFO("spells", "elevation: %f", m_elevation); + TC_LOG_INFO("spells", "pitch: %f", m_pitch); } SpellValue::SpellValue(Difficulty diff, SpellInfo const* proto) @@ -1582,7 +1585,7 @@ void Spell::SelectImplicitTrajTargets(SpellEffIndex effIndex) targets.sort(Trinity::ObjectDistanceOrderPred(m_caster)); - float b = tangent(m_targets.GetElevation()); + float b = tangent(m_targets.GetPitch()); float a = (srcToDestDelta - dist2d * b) / (dist2d * dist2d); if (a > -0.0001f) a = 0; @@ -4117,7 +4120,7 @@ void Spell::SendSpellGo() if (castFlags & CAST_FLAG_ADJUST_MISSILE) { castData.MissileTrajectory.TravelTime = m_delayMoment; - castData.MissileTrajectory.Pitch = m_targets.GetElevation(); + castData.MissileTrajectory.Pitch = m_targets.GetPitch(); } /*WorldPacket data(SMSG_SPELL_GO, 50); // guess size |
