Core/Spells: Moved SpellVisual functions from Unit to WorldObject
Port From (https://github.com/TrinityCore/TrinityCore/commit/54f607641ac9008a588b8ff635a9ed7ee7a5f976)
This commit is contained in:
@@ -2221,7 +2221,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return CastSpell(targets, spellId, args);
|
||||
}
|
||||
|
||||
@@ -2232,6 +2232,118 @@ namespace Game.Entities
|
||||
CastSpell(targets, spellId, args);
|
||||
}
|
||||
|
||||
public void SendPlaySpellVisual(WorldObject target, uint spellVisualId, ushort missReason, ushort reflectStatus, float travelSpeed, bool speedAsTime = false)
|
||||
{
|
||||
PlaySpellVisual playSpellVisual = new();
|
||||
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, true);
|
||||
}
|
||||
|
||||
public void SendPlaySpellVisual(Position targetPosition, float launchDelay, uint spellVisualId, ushort missReason, ushort reflectStatus, float travelSpeed, bool speedAsTime = false)
|
||||
{
|
||||
PlaySpellVisual playSpellVisual = new();
|
||||
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, true);
|
||||
}
|
||||
|
||||
void SendCancelSpellVisual(uint id)
|
||||
{
|
||||
CancelSpellVisual cancelSpellVisual = new();
|
||||
cancelSpellVisual.Source = GetGUID();
|
||||
cancelSpellVisual.SpellVisualID = id;
|
||||
SendMessageToSet(cancelSpellVisual, true);
|
||||
}
|
||||
|
||||
void SendPlayOrphanSpellVisual(ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
{
|
||||
PlayOrphanSpellVisual playOrphanSpellVisual = new();
|
||||
playOrphanSpellVisual.SourceLocation = GetPosition();
|
||||
if (withSourceOrientation)
|
||||
{
|
||||
if (IsGameObject())
|
||||
{
|
||||
var rotation = ToGameObject().GetWorldRotation();
|
||||
rotation.toEulerAnglesZYX(out playOrphanSpellVisual.SourceRotation.Z,
|
||||
out playOrphanSpellVisual.SourceRotation.Y,
|
||||
out playOrphanSpellVisual.SourceRotation.X);
|
||||
}
|
||||
else
|
||||
playOrphanSpellVisual.SourceRotation = new 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, true);
|
||||
}
|
||||
|
||||
void SendPlayOrphanSpellVisual(Position targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
{
|
||||
PlayOrphanSpellVisual playOrphanSpellVisual = new();
|
||||
playOrphanSpellVisual.SourceLocation = GetPosition();
|
||||
if (withSourceOrientation)
|
||||
{
|
||||
if (IsGameObject())
|
||||
{
|
||||
var rotation = ToGameObject().GetWorldRotation();
|
||||
rotation.toEulerAnglesZYX(out playOrphanSpellVisual.SourceRotation.Z,
|
||||
out playOrphanSpellVisual.SourceRotation.Y,
|
||||
out playOrphanSpellVisual.SourceRotation.X);
|
||||
}
|
||||
else
|
||||
playOrphanSpellVisual.SourceRotation = new 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, true);
|
||||
}
|
||||
|
||||
void SendCancelOrphanSpellVisual(uint id)
|
||||
{
|
||||
CancelOrphanSpellVisual cancelOrphanSpellVisual = new();
|
||||
cancelOrphanSpellVisual.SpellVisualID = id;
|
||||
SendMessageToSet(cancelOrphanSpellVisual, true);
|
||||
}
|
||||
|
||||
public void SendPlaySpellVisualKit(uint id, uint type, uint duration)
|
||||
{
|
||||
PlaySpellVisualKit playSpellVisualKit = new();
|
||||
playSpellVisualKit.Unit = GetGUID();
|
||||
playSpellVisualKit.KitRecID = id;
|
||||
playSpellVisualKit.KitType = type;
|
||||
playSpellVisualKit.Duration = duration;
|
||||
SendMessageToSet(playSpellVisualKit, true);
|
||||
}
|
||||
|
||||
void SendCancelSpellVisualKit(uint id)
|
||||
{
|
||||
CancelSpellVisualKit cancelSpellVisualKit = new();
|
||||
cancelSpellVisualKit.Source = GetGUID();
|
||||
cancelSpellVisualKit.SpellVisualKitID = id;
|
||||
SendMessageToSet(cancelSpellVisualKit, true);
|
||||
}
|
||||
|
||||
|
||||
// function based on function Unit::CanAttack from 13850 client
|
||||
public bool IsValidAttackTarget(WorldObject target, SpellInfo bySpell = null)
|
||||
{
|
||||
|
||||
@@ -1042,95 +1042,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
void SendCancelOrphanSpellVisual(uint id)
|
||||
{
|
||||
CancelOrphanSpellVisual cancelOrphanSpellVisual = new();
|
||||
cancelOrphanSpellVisual.SpellVisualID = id;
|
||||
SendMessageToSet(cancelOrphanSpellVisual, true);
|
||||
}
|
||||
|
||||
void SendPlayOrphanSpellVisual(ObjectGuid target, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
{
|
||||
PlayOrphanSpellVisual playOrphanSpellVisual = new();
|
||||
playOrphanSpellVisual.SourceLocation = GetPosition();
|
||||
if (withSourceOrientation)
|
||||
playOrphanSpellVisual.SourceRotation = new Vector3(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, true);
|
||||
}
|
||||
|
||||
void SendPlayOrphanSpellVisual(Vector3 targetLocation, uint spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false)
|
||||
{
|
||||
PlayOrphanSpellVisual playOrphanSpellVisual = new();
|
||||
playOrphanSpellVisual.SourceLocation = GetPosition();
|
||||
if (withSourceOrientation)
|
||||
playOrphanSpellVisual.SourceRotation = new Vector3(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, true);
|
||||
}
|
||||
|
||||
void SendCancelSpellVisual(uint id)
|
||||
{
|
||||
CancelSpellVisual cancelSpellVisual = new();
|
||||
cancelSpellVisual.Source = GetGUID();
|
||||
cancelSpellVisual.SpellVisualID = id;
|
||||
SendMessageToSet(cancelSpellVisual, true);
|
||||
}
|
||||
|
||||
public void SendPlaySpellVisual(Unit target, uint spellVisualId, uint missReason, uint reflectStatus, float travelSpeed, bool speedAsTime = false)
|
||||
{
|
||||
PlaySpellVisual playSpellVisual = new();
|
||||
playSpellVisual.Source = GetGUID();
|
||||
playSpellVisual.Target = target.GetGUID();
|
||||
playSpellVisual.TargetPosition = target.GetPosition();
|
||||
playSpellVisual.SpellVisualID = spellVisualId;
|
||||
playSpellVisual.TravelSpeed = travelSpeed;
|
||||
playSpellVisual.MissReason = (ushort)missReason;
|
||||
playSpellVisual.ReflectStatus = (ushort)reflectStatus;
|
||||
playSpellVisual.SpeedAsTime = speedAsTime;
|
||||
SendMessageToSet(playSpellVisual, true);
|
||||
}
|
||||
|
||||
public void SendPlaySpellVisual(Vector3 targetPosition, float launchDelay, uint spellVisualId, uint missReason, uint reflectStatus, float travelSpeed, bool speedAsTime = false)
|
||||
{
|
||||
PlaySpellVisual playSpellVisual = new();
|
||||
playSpellVisual.Source = GetGUID();
|
||||
playSpellVisual.TargetPosition = targetPosition;
|
||||
playSpellVisual.LaunchDelay = launchDelay;
|
||||
playSpellVisual.SpellVisualID = spellVisualId;
|
||||
playSpellVisual.TravelSpeed = travelSpeed;
|
||||
playSpellVisual.MissReason = (ushort)missReason;
|
||||
playSpellVisual.ReflectStatus = (ushort)reflectStatus;
|
||||
playSpellVisual.SpeedAsTime = speedAsTime;
|
||||
SendMessageToSet(playSpellVisual, true);
|
||||
}
|
||||
|
||||
void SendCancelSpellVisualKit(uint id)
|
||||
{
|
||||
CancelSpellVisualKit cancelSpellVisualKit = new();
|
||||
cancelSpellVisualKit.Source = GetGUID();
|
||||
cancelSpellVisualKit.SpellVisualKitID = id;
|
||||
SendMessageToSet(cancelSpellVisualKit, true);
|
||||
}
|
||||
|
||||
public void SendPlaySpellVisualKit(uint id, uint type, uint duration)
|
||||
{
|
||||
PlaySpellVisualKit playSpellVisualKit = new();
|
||||
playSpellVisualKit.Unit = GetGUID();
|
||||
playSpellVisualKit.KitRecID = id;
|
||||
playSpellVisualKit.KitType = type;
|
||||
playSpellVisualKit.Duration = duration;
|
||||
SendMessageToSet(playSpellVisualKit, true);
|
||||
}
|
||||
|
||||
void CancelSpellMissiles(uint spellId, bool reverseMissile = false)
|
||||
{
|
||||
bool hasMissile = false;
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace Scripts.Spells.Warrior
|
||||
{
|
||||
int timeOffset = (int)(6 * i * aurEff.GetPeriod() / 25);
|
||||
Vector4 loc = GetTarget().MoveSpline.ComputePosition(timeOffset);
|
||||
GetTarget().SendPlaySpellVisual(new Vector3(loc.X, loc.Y, loc.Z), 0.0f, Misc.SpellVisualBlazingCharge, 0, 0, 1.0f, true);
|
||||
GetTarget().SendPlaySpellVisual(new Position(loc.X, loc.Y, loc.Z), 0.0f, Misc.SpellVisualBlazingCharge, 0, 0, 1.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user