aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Object/Object.cpp112
-rw-r--r--src/server/game/Entities/Object/Object.h11
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp89
-rw-r--r--src/server/game/Entities/Unit/Unit.h8
4 files changed, 123 insertions, 97 deletions
diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp
index e2c6d6a224c..4e1ea49930a 100644
--- a/src/server/game/Entities/Object/Object.cpp
+++ b/src/server/game/Entities/Object/Object.cpp
@@ -41,6 +41,7 @@
#include "ReputationMgr.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
+#include "SpellPackets.h"
#include "TemporarySummon.h"
#include "Totem.h"
#include "Transport.h"
@@ -2609,6 +2610,117 @@ SpellCastResult WorldObject::CastSpell(CastSpellTargetArg const& targets, uint32
return spell->prepare(*targets.Targets, args.TriggeringAura);
}
+void WorldObject::SendPlaySpellVisual(WorldObject* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/)
+{
+ WorldPackets::Spells::PlaySpellVisual playSpellVisual;
+ playSpellVisual.Source = GetGUID();
+ playSpellVisual.Target = target->GetGUID();
+ playSpellVisual.TargetPosition = target->GetPosition();
+ playSpellVisual.SpellVisualID = spellVisualId;
+ playSpellVisual.TravelSpeed = travelSpeed;
+ playSpellVisual.MissReason = missReason;
+ playSpellVisual.ReflectStatus = reflectStatus;
+ playSpellVisual.SpeedAsTime = speedAsTime;
+ SendMessageToSet(playSpellVisual.Write(), true);
+}
+
+void WorldObject::SendPlaySpellVisual(Position const& targetPosition, float launchDelay, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/)
+{
+ WorldPackets::Spells::PlaySpellVisual playSpellVisual;
+ playSpellVisual.Source = GetGUID();
+ playSpellVisual.TargetPosition = targetPosition;
+ playSpellVisual.LaunchDelay = launchDelay;
+ playSpellVisual.SpellVisualID = spellVisualId;
+ playSpellVisual.TravelSpeed = travelSpeed;
+ playSpellVisual.MissReason = missReason;
+ playSpellVisual.ReflectStatus = reflectStatus;
+ playSpellVisual.SpeedAsTime = speedAsTime;
+ SendMessageToSet(playSpellVisual.Write(), true);
+}
+
+void WorldObject::SendCancelSpellVisual(uint32 id)
+{
+ WorldPackets::Spells::CancelSpellVisual cancelSpellVisual;
+ cancelSpellVisual.Source = GetGUID();
+ cancelSpellVisual.SpellVisualID = id;
+ SendMessageToSet(cancelSpellVisual.Write(), true);
+}
+
+void WorldObject::SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime /*= false*/, bool withSourceOrientation /*= false*/)
+{
+ WorldPackets::Spells::PlayOrphanSpellVisual playOrphanSpellVisual;
+ playOrphanSpellVisual.SourceLocation = GetPosition();
+ if (withSourceOrientation)
+ {
+ if (IsGameObject())
+ {
+ QuaternionData rotation = ToGameObject()->GetWorldRotation();
+ rotation.toEulerAnglesZYX(playOrphanSpellVisual.SourceRotation.Pos.m_positionZ,
+ playOrphanSpellVisual.SourceRotation.Pos.m_positionY,
+ playOrphanSpellVisual.SourceRotation.Pos.m_positionX);
+ }
+ else
+ playOrphanSpellVisual.SourceRotation = Position(0.0f, 0.0f, GetOrientation());
+ }
+
+ playOrphanSpellVisual.Target = target; // exclusive with TargetLocation
+ playOrphanSpellVisual.SpellVisualID = spellVisualId;
+ playOrphanSpellVisual.TravelSpeed = travelSpeed;
+ playOrphanSpellVisual.SpeedAsTime = speedAsTime;
+ playOrphanSpellVisual.LaunchDelay = 0.0f;
+ SendMessageToSet(playOrphanSpellVisual.Write(), true);
+}
+
+void WorldObject::SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime /*= false*/, bool withSourceOrientation /*= false*/)
+{
+ WorldPackets::Spells::PlayOrphanSpellVisual playOrphanSpellVisual;
+ playOrphanSpellVisual.SourceLocation = GetPosition();
+ if (withSourceOrientation)
+ {
+ if (IsGameObject())
+ {
+ QuaternionData rotation = ToGameObject()->GetWorldRotation();
+ rotation.toEulerAnglesZYX(playOrphanSpellVisual.SourceRotation.Pos.m_positionZ,
+ playOrphanSpellVisual.SourceRotation.Pos.m_positionY,
+ playOrphanSpellVisual.SourceRotation.Pos.m_positionX);
+ }
+ else
+ playOrphanSpellVisual.SourceRotation = Position(0.0f, 0.0f, GetOrientation());
+ }
+
+ playOrphanSpellVisual.TargetLocation = targetLocation; // exclusive with Target
+ playOrphanSpellVisual.SpellVisualID = spellVisualId;
+ playOrphanSpellVisual.TravelSpeed = travelSpeed;
+ playOrphanSpellVisual.SpeedAsTime = speedAsTime;
+ playOrphanSpellVisual.LaunchDelay = 0.0f;
+ SendMessageToSet(playOrphanSpellVisual.Write(), true);
+}
+
+void WorldObject::SendCancelOrphanSpellVisual(uint32 id)
+{
+ WorldPackets::Spells::CancelOrphanSpellVisual cancelOrphanSpellVisual;
+ cancelOrphanSpellVisual.SpellVisualID = id;
+ SendMessageToSet(cancelOrphanSpellVisual.Write(), true);
+}
+
+void WorldObject::SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const
+{
+ WorldPackets::Spells::PlaySpellVisualKit playSpellVisualKit;
+ playSpellVisualKit.Unit = GetGUID();
+ playSpellVisualKit.KitRecID = id;
+ playSpellVisualKit.KitType = type;
+ playSpellVisualKit.Duration = duration;
+ SendMessageToSet(playSpellVisualKit.Write(), true);
+}
+
+void WorldObject::SendCancelSpellVisualKit(uint32 id)
+{
+ WorldPackets::Spells::CancelSpellVisualKit cancelSpellVisualKit;
+ cancelSpellVisualKit.Source = GetGUID();
+ cancelSpellVisualKit.SpellVisualKitID = id;
+ SendMessageToSet(cancelSpellVisualKit.Write(), true);
+}
+
// function based on function Unit::CanAttack from 13850 client
bool WorldObject::IsValidAttackTarget(WorldObject const* target, SpellInfo const* bySpell /*= nullptr*/) const
{
diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h
index df65dc7665c..2138d83bc78 100644
--- a/src/server/game/Entities/Object/Object.h
+++ b/src/server/game/Entities/Object/Object.h
@@ -624,6 +624,17 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
// CastSpell's third arg can be a variety of things - check out CastSpellExtraArgs' constructors!
SpellCastResult CastSpell(CastSpellTargetArg const& targets, uint32 spellId, CastSpellExtraArgs const& args = { });
+ void SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
+ void SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
+ void SendCancelOrphanSpellVisual(uint32 id);
+
+ void SendPlaySpellVisual(WorldObject* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
+ void SendPlaySpellVisual(Position const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
+ void SendCancelSpellVisual(uint32 id);
+
+ void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const;
+ void SendCancelSpellVisualKit(uint32 id);
+
bool IsValidAttackTarget(WorldObject const* target, SpellInfo const* bySpell = nullptr) const;
bool IsValidAssistTarget(WorldObject const* target, SpellInfo const* bySpell = nullptr) const;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 418f7355caf..a01de0e7ba6 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -11311,95 +11311,6 @@ void Unit::SetAuraStack(uint32 spellId, Unit* target, uint32 stack)
aura->SetStackAmount(stack);
}
-void Unit::SendCancelOrphanSpellVisual(uint32 id)
-{
- WorldPackets::Spells::CancelOrphanSpellVisual cancelOrphanSpellVisual;
- cancelOrphanSpellVisual.SpellVisualID = id;
- SendMessageToSet(cancelOrphanSpellVisual.Write(), true);
-}
-
-void Unit::SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime /*= false*/, bool withSourceOrientation /*= false*/)
-{
- WorldPackets::Spells::PlayOrphanSpellVisual playOrphanSpellVisual;
- playOrphanSpellVisual.SourceLocation = GetPosition();
- if (withSourceOrientation)
- playOrphanSpellVisual.SourceRotation = Position(0.0f, 0.0f, GetOrientation());
- playOrphanSpellVisual.Target = target; // exclusive with TargetLocation
- playOrphanSpellVisual.SpellVisualID = spellVisualId;
- playOrphanSpellVisual.TravelSpeed = travelSpeed;
- playOrphanSpellVisual.SpeedAsTime = speedAsTime;
- playOrphanSpellVisual.LaunchDelay = 0.0f;
- SendMessageToSet(playOrphanSpellVisual.Write(), true);
-}
-
-void Unit::SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime /*= false*/, bool withSourceOrientation /*= false*/)
-{
- WorldPackets::Spells::PlayOrphanSpellVisual playOrphanSpellVisual;
- playOrphanSpellVisual.SourceLocation = GetPosition();
- if (withSourceOrientation)
- playOrphanSpellVisual.SourceRotation = Position(0.0f, 0.0f, GetOrientation());
- playOrphanSpellVisual.TargetLocation = targetLocation; // exclusive with Target
- playOrphanSpellVisual.SpellVisualID = spellVisualId;
- playOrphanSpellVisual.TravelSpeed = travelSpeed;
- playOrphanSpellVisual.SpeedAsTime = speedAsTime;
- playOrphanSpellVisual.LaunchDelay = 0.0f;
- SendMessageToSet(playOrphanSpellVisual.Write(), true);
-}
-
-void Unit::SendCancelSpellVisual(uint32 id)
-{
- WorldPackets::Spells::CancelSpellVisual cancelSpellVisual;
- cancelSpellVisual.Source = GetGUID();
- cancelSpellVisual.SpellVisualID = id;
- SendMessageToSet(cancelSpellVisual.Write(), true);
-}
-
-void Unit::SendPlaySpellVisual(Unit* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/)
-{
- WorldPackets::Spells::PlaySpellVisual playSpellVisual;
- playSpellVisual.Source = GetGUID();
- playSpellVisual.Target = target->GetGUID();
- playSpellVisual.TargetPosition = target->GetPosition();
- playSpellVisual.SpellVisualID = spellVisualId;
- playSpellVisual.TravelSpeed = travelSpeed;
- playSpellVisual.MissReason = missReason;
- playSpellVisual.ReflectStatus = reflectStatus;
- playSpellVisual.SpeedAsTime = speedAsTime;
- SendMessageToSet(playSpellVisual.Write(), true);
-}
-
-void Unit::SendPlaySpellVisual(Position const& targetPosition, float launchDelay, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime /*= false*/)
-{
- WorldPackets::Spells::PlaySpellVisual playSpellVisual;
- playSpellVisual.Source = GetGUID();
- playSpellVisual.TargetPosition = targetPosition;
- playSpellVisual.LaunchDelay = launchDelay;
- playSpellVisual.SpellVisualID = spellVisualId;
- playSpellVisual.TravelSpeed = travelSpeed;
- playSpellVisual.MissReason = missReason;
- playSpellVisual.ReflectStatus = reflectStatus;
- playSpellVisual.SpeedAsTime = speedAsTime;
- SendMessageToSet(playSpellVisual.Write(), true);
-}
-
-void Unit::SendCancelSpellVisualKit(uint32 id)
-{
- WorldPackets::Spells::CancelSpellVisualKit cancelSpellVisualKit;
- cancelSpellVisualKit.Source = GetGUID();
- cancelSpellVisualKit.SpellVisualKitID = id;
- SendMessageToSet(cancelSpellVisualKit.Write(), true);
-}
-
-void Unit::SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const
-{
- WorldPackets::Spells::PlaySpellVisualKit playSpellVisualKit;
- playSpellVisualKit.Unit = GetGUID();
- playSpellVisualKit.KitRecID = id;
- playSpellVisualKit.KitType = type;
- playSpellVisualKit.Duration = duration;
- SendMessageToSet(playSpellVisualKit.Write(), true);
-}
-
void Unit::CancelSpellMissiles(uint32 spellId, bool reverseMissile /*= false*/)
{
bool hasMissile = false;
diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
index 837004de029..ba205ddec2a 100644
--- a/src/server/game/Entities/Unit/Unit.h
+++ b/src/server/game/Entities/Unit/Unit.h
@@ -1162,14 +1162,6 @@ class TC_GAME_API Unit : public WorldObject
Aura* AddAura(SpellInfo const* spellInfo, uint32 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
- void SendCancelOrphanSpellVisual(uint32 id);
- void SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
- void SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
- void SendCancelSpellVisual(uint32 id);
- void SendPlaySpellVisual(Unit* target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
- void SendPlaySpellVisual(Position const& targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime = false);
- void SendCancelSpellVisualKit(uint32 id);
- void SendPlaySpellVisualKit(uint32 id, uint32 type, uint32 duration) const;
void CancelSpellMissiles(uint32 spellId, bool reverseMissile = false);
void DeMorph();