Core/Spells: Reduce number of CastSpell overloads to 1
This commit is contained in:
1 parent
78de91a487
commit
e503f96adb
42 files changed
+275
-251
No files matched your search
@@ -2941,7 +2941,7 @@ bool WorldObject::IsNeutralToAll() const
|
||||
return my_faction->IsNeutralToAll();
|
||||
}
|
||||
|
||||
SpellCastResult WorldObject::CastSpell(SpellCastTargets const& targets, uint32 spellId, CastSpellExtraArgs const& args /*= { }*/)
|
||||
SpellCastResult WorldObject::CastSpell(CastSpellTargetArg const& targets, uint32 spellId, CastSpellExtraArgs const& args /*= { }*/)
|
||||
{
|
||||
SpellInfo const* info = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!info)
|
||||
@@ -2950,6 +2950,12 @@ SpellCastResult WorldObject::CastSpell(SpellCastTargets const& targets, uint32 s
|
||||
return SPELL_FAILED_SPELL_UNAVAILABLE;
|
||||
}
|
||||
|
||||
if (!targets.Targets)
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "CastSpell: Invalid target passed to spell cast %u by %s", spellId, GetGUID().ToString().c_str());
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
|
||||
Spell* spell = new Spell(this, info, args.TriggerFlags, args.OriginalCaster);
|
||||
for (CastSpellExtraArgsInit::SpellValueOverride const& value : args.SpellValueOverrides)
|
||||
spell->SetSpellValue(value);
|
||||
@@ -2968,32 +2974,7 @@ SpellCastResult WorldObject::CastSpell(SpellCastTargets const& targets, uint32 s
|
||||
|
||||
spell->m_customArg = args.CustomArg;
|
||||
|
||||
return spell->prepare(targets, args.TriggeringAura);
|
||||
}
|
||||
|
||||
SpellCastResult WorldObject::CastSpell(WorldObject* target, uint32 spellId, CastSpellExtraArgs const& args /*= { }*/)
|
||||
{
|
||||
SpellCastTargets targets;
|
||||
if (target)
|
||||
{
|
||||
if (Unit* unitTarget = target->ToUnit())
|
||||
targets.SetUnitTarget(unitTarget);
|
||||
else if (GameObject* goTarget = target->ToGameObject())
|
||||
targets.SetGOTarget(goTarget);
|
||||
else
|
||||
{
|
||||
TC_LOG_ERROR("entities.unit", "CastSpell: Invalid target %s passed to spell cast by %s", target->GetGUID().ToString().c_str(), GetGUID().ToString().c_str());
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
}
|
||||
return CastSpell(targets, spellId, args);
|
||||
}
|
||||
|
||||
SpellCastResult WorldObject::CastSpell(Position const& dest, uint32 spellId, CastSpellExtraArgs const& args /*= { }*/)
|
||||
{
|
||||
SpellCastTargets targets;
|
||||
targets.SetDst(dest);
|
||||
return CastSpell(targets, spellId, args);
|
||||
return spell->prepare(*targets.Targets, args.TriggeringAura);
|
||||
}
|
||||
|
||||
// function based on function Unit::CanAttack from 13850 client
|
||||
|
||||
@@ -510,9 +510,7 @@ class TC_GAME_API WorldObject : public Object, public WorldLocation
|
||||
bool IsNeutralToAll() const;
|
||||
|
||||
// CastSpell's third arg can be a variety of things - check out CastSpellExtraArgs' constructors!
|
||||
SpellCastResult CastSpell(SpellCastTargets const& targets, uint32 spellId, CastSpellExtraArgs const& args = { });
|
||||
SpellCastResult CastSpell(WorldObject* target, uint32 spellId, CastSpellExtraArgs const& args = { });
|
||||
SpellCastResult CastSpell(Position const& dest, uint32 spellId, CastSpellExtraArgs const& args = { });
|
||||
SpellCastResult CastSpell(CastSpellTargetArg const& targets, uint32 spellId, CastSpellExtraArgs const& args = { });
|
||||
|
||||
bool IsValidAttackTarget(WorldObject const* target, SpellInfo const* bySpell = nullptr) const;
|
||||
bool IsValidAssistTarget(WorldObject const* target, SpellInfo const* bySpell = nullptr) const;
|
||||
|
||||
@@ -8943,6 +8943,23 @@ bool WorldObjectSpellTrajTargetCheck::operator()(WorldObject* target)
|
||||
|
||||
} //namespace Trinity
|
||||
|
||||
CastSpellTargetArg::CastSpellTargetArg(WorldObject* target)
|
||||
{
|
||||
if (target)
|
||||
{
|
||||
if (Unit* unitTarget = target->ToUnit())
|
||||
{
|
||||
Targets.emplace();
|
||||
Targets->SetUnitTarget(unitTarget);
|
||||
}
|
||||
else if (GameObject* goTarget = target->ToGameObject())
|
||||
{
|
||||
Targets.emplace();
|
||||
Targets->SetGOTarget(goTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CastSpellExtraArgs::CastSpellExtraArgs() = default;
|
||||
CastSpellExtraArgs::CastSpellExtraArgs(CastSpellExtraArgs const& other) = default;
|
||||
CastSpellExtraArgs::CastSpellExtraArgs(CastSpellExtraArgs&& other) noexcept = default;
|
||||
|
||||
@@ -33,8 +33,6 @@ namespace WorldPackets
|
||||
{
|
||||
namespace Spells
|
||||
{
|
||||
struct SpellCastRequest;
|
||||
struct SpellTargetData;
|
||||
struct SpellAmmo;
|
||||
struct SpellCastData;
|
||||
struct SpellHitInfo;
|
||||
@@ -67,7 +65,6 @@ struct SummonPropertiesEntry;
|
||||
enum AuraType : uint32;
|
||||
enum CurrentSpellTypes : uint8;
|
||||
enum LootType : uint8;
|
||||
enum SpellCastTargetFlags : uint32;
|
||||
enum SpellTargetCheckTypes : uint8;
|
||||
enum SpellTargetObjectTypes : uint8;
|
||||
enum SpellValueMod : int32;
|
||||
@@ -136,115 +133,6 @@ enum SpellFinishReason : uint8
|
||||
SPELL_FINISHED_CHANNELING_COMPLETE = 2 // spell channeling has been finished
|
||||
};
|
||||
|
||||
struct TC_GAME_API SpellDestination
|
||||
{
|
||||
SpellDestination();
|
||||
SpellDestination(float x, float y, float z, float orientation = 0.0f, uint32 mapId = MAPID_INVALID);
|
||||
SpellDestination(Position const& pos);
|
||||
SpellDestination(WorldObject const& wObj);
|
||||
|
||||
void Relocate(Position const& pos);
|
||||
void RelocateOffset(Position const& offset);
|
||||
|
||||
WorldLocation _position;
|
||||
ObjectGuid _transportGUID;
|
||||
Position _transportOffset;
|
||||
};
|
||||
|
||||
class TC_GAME_API SpellCastTargets
|
||||
{
|
||||
public:
|
||||
SpellCastTargets();
|
||||
SpellCastTargets(Unit* caster, WorldPackets::Spells::SpellCastRequest const& spellCastRequest);
|
||||
~SpellCastTargets();
|
||||
|
||||
void Read(ByteBuffer& data, Unit* caster);
|
||||
void Write(WorldPackets::Spells::SpellTargetData& data);
|
||||
|
||||
uint32 GetTargetMask() const { return m_targetMask; }
|
||||
void SetTargetMask(uint32 newMask) { m_targetMask = newMask; }
|
||||
|
||||
void SetTargetFlag(SpellCastTargetFlags flag) { m_targetMask |= flag; }
|
||||
|
||||
ObjectGuid GetOrigUnitTargetGUID() const;
|
||||
void SetOrigUnitTarget(Unit* target);
|
||||
|
||||
ObjectGuid GetUnitTargetGUID() const;
|
||||
Unit* GetUnitTarget() const;
|
||||
void SetUnitTarget(Unit* target);
|
||||
|
||||
ObjectGuid GetGOTargetGUID() const;
|
||||
GameObject* GetGOTarget() const;
|
||||
void SetGOTarget(GameObject* target);
|
||||
|
||||
ObjectGuid GetCorpseTargetGUID() const;
|
||||
Corpse* GetCorpseTarget() const;
|
||||
|
||||
WorldObject* GetObjectTarget() const;
|
||||
ObjectGuid GetObjectTargetGUID() const;
|
||||
void RemoveObjectTarget();
|
||||
|
||||
ObjectGuid GetItemTargetGUID() const { return m_itemTargetGUID; }
|
||||
Item* GetItemTarget() const { return m_itemTarget; }
|
||||
uint32 GetItemTargetEntry() const { return m_itemTargetEntry; }
|
||||
void SetItemTarget(Item* item);
|
||||
void SetTradeItemTarget(Player* caster);
|
||||
void UpdateTradeSlotItem();
|
||||
|
||||
SpellDestination const* GetSrc() const;
|
||||
Position const* GetSrcPos() const;
|
||||
void SetSrc(float x, float y, float z);
|
||||
void SetSrc(Position const& pos);
|
||||
void SetSrc(WorldObject const& wObj);
|
||||
void ModSrc(Position const& pos);
|
||||
void RemoveSrc();
|
||||
|
||||
SpellDestination const* GetDst() const;
|
||||
WorldLocation const* GetDstPos() const;
|
||||
void SetDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID);
|
||||
void SetDst(Position const& pos);
|
||||
void SetDst(WorldObject const& wObj);
|
||||
void SetDst(SpellDestination const& spellDest);
|
||||
void SetDst(SpellCastTargets const& spellTargets);
|
||||
void ModDst(Position const& pos);
|
||||
void ModDst(SpellDestination const& spellDest);
|
||||
void RemoveDst();
|
||||
|
||||
bool HasSrc() const;
|
||||
bool HasDst() const;
|
||||
bool HasTraj() const { return m_speed != 0; }
|
||||
|
||||
float GetElevation() const { return m_elevation; }
|
||||
void SetElevation(float elevation) { m_elevation = elevation; }
|
||||
float GetSpeed() const { return m_speed; }
|
||||
void SetSpeed(float speed) { m_speed = speed; }
|
||||
|
||||
float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); }
|
||||
float GetSpeedXY() const { return m_speed * std::cos(m_elevation); }
|
||||
float GetSpeedZ() const { return m_speed * std::sin(m_elevation); }
|
||||
|
||||
void Update(WorldObject* caster);
|
||||
|
||||
private:
|
||||
uint32 m_targetMask;
|
||||
|
||||
// objects (can be used at spell creating and after Update at casting)
|
||||
WorldObject* m_objectTarget;
|
||||
Item* m_itemTarget;
|
||||
|
||||
// object GUID/etc, can be used always
|
||||
ObjectGuid m_origObjectTargetGUID;
|
||||
ObjectGuid m_objectTargetGUID;
|
||||
ObjectGuid m_itemTargetGUID;
|
||||
uint32 m_itemTargetEntry;
|
||||
|
||||
SpellDestination m_src;
|
||||
SpellDestination m_dst;
|
||||
|
||||
float m_elevation, m_speed;
|
||||
std::string m_strTarget;
|
||||
};
|
||||
|
||||
struct SpellValue
|
||||
{
|
||||
explicit SpellValue(SpellInfo const* proto, WorldObject const* caster);
|
||||
|
||||
@@ -21,12 +21,28 @@
|
||||
#include "Define.h"
|
||||
#include "EnumFlag.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "Optional.h"
|
||||
#include "Position.h"
|
||||
#include <any>
|
||||
#include <vector>
|
||||
|
||||
class Item;
|
||||
class AuraEffect;
|
||||
class Corpse;
|
||||
class GameObject;
|
||||
class Item;
|
||||
class Player;
|
||||
class Spell;
|
||||
class Unit;
|
||||
class WorldObject;
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Spells
|
||||
{
|
||||
struct SpellCastRequest;
|
||||
struct SpellTargetData;
|
||||
}
|
||||
}
|
||||
|
||||
enum class SpellInterruptFlags : uint32
|
||||
{
|
||||
@@ -199,6 +215,170 @@ enum TriggerCastFlags : uint32
|
||||
|
||||
DEFINE_ENUM_FLAG(TriggerCastFlags);
|
||||
|
||||
enum SpellCastTargetFlags : uint32
|
||||
{
|
||||
TARGET_FLAG_NONE = 0x00000000,
|
||||
TARGET_FLAG_UNUSED_1 = 0x00000001, // not used
|
||||
TARGET_FLAG_UNIT = 0x00000002, // pguid
|
||||
TARGET_FLAG_UNIT_RAID = 0x00000004, // not sent, used to validate target (if raid member)
|
||||
TARGET_FLAG_UNIT_PARTY = 0x00000008, // not sent, used to validate target (if party member)
|
||||
TARGET_FLAG_ITEM = 0x00000010, // pguid
|
||||
TARGET_FLAG_SOURCE_LOCATION = 0x00000020, // pguid, 3 float
|
||||
TARGET_FLAG_DEST_LOCATION = 0x00000040, // pguid, 3 float
|
||||
TARGET_FLAG_UNIT_ENEMY = 0x00000080, // not sent, used to validate target (if enemy)
|
||||
TARGET_FLAG_UNIT_ALLY = 0x00000100, // not sent, used to validate target (if ally)
|
||||
TARGET_FLAG_CORPSE_ENEMY = 0x00000200, // pguid
|
||||
TARGET_FLAG_UNIT_DEAD = 0x00000400, // not sent, used to validate target (if dead creature)
|
||||
TARGET_FLAG_GAMEOBJECT = 0x00000800, // pguid, used with TARGET_GAMEOBJECT_TARGET
|
||||
TARGET_FLAG_TRADE_ITEM = 0x00001000, // pguid
|
||||
TARGET_FLAG_STRING = 0x00002000, // string
|
||||
TARGET_FLAG_GAMEOBJECT_ITEM = 0x00004000, // not sent, used with TARGET_GAMEOBJECT_ITEM_TARGET
|
||||
TARGET_FLAG_CORPSE_ALLY = 0x00008000, // pguid
|
||||
TARGET_FLAG_UNIT_MINIPET = 0x00010000, // pguid, used to validate target (if non combat pet)
|
||||
TARGET_FLAG_GLYPH_SLOT = 0x00020000, // used in glyph spells
|
||||
TARGET_FLAG_DEST_TARGET = 0x00040000, // sometimes appears with DEST_TARGET spells (may appear or not for a given spell)
|
||||
TARGET_FLAG_EXTRA_TARGETS = 0x00080000, // uint32 counter, loop { vec3 - screen position (?), guid }, not used so far
|
||||
TARGET_FLAG_UNIT_PASSENGER = 0x00100000, // guessed, used to validate target (if vehicle passenger)
|
||||
|
||||
TARGET_FLAG_UNIT_MASK = TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY
|
||||
| TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_DEAD | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER,
|
||||
TARGET_FLAG_GAMEOBJECT_MASK = TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM,
|
||||
TARGET_FLAG_CORPSE_MASK = TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY,
|
||||
TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM
|
||||
};
|
||||
|
||||
struct TC_GAME_API SpellDestination
|
||||
{
|
||||
SpellDestination();
|
||||
SpellDestination(float x, float y, float z, float orientation = 0.0f, uint32 mapId = MAPID_INVALID);
|
||||
SpellDestination(Position const& pos);
|
||||
SpellDestination(WorldObject const& wObj);
|
||||
|
||||
void Relocate(Position const& pos);
|
||||
void RelocateOffset(Position const& offset);
|
||||
|
||||
WorldLocation _position;
|
||||
ObjectGuid _transportGUID;
|
||||
Position _transportOffset;
|
||||
};
|
||||
|
||||
class TC_GAME_API SpellCastTargets
|
||||
{
|
||||
public:
|
||||
SpellCastTargets();
|
||||
SpellCastTargets(Unit* caster, WorldPackets::Spells::SpellCastRequest const& spellCastRequest);
|
||||
~SpellCastTargets();
|
||||
|
||||
void Read(ByteBuffer& data, Unit* caster);
|
||||
void Write(WorldPackets::Spells::SpellTargetData& data);
|
||||
|
||||
uint32 GetTargetMask() const { return m_targetMask; }
|
||||
void SetTargetMask(uint32 newMask) { m_targetMask = newMask; }
|
||||
|
||||
void SetTargetFlag(SpellCastTargetFlags flag) { m_targetMask |= flag; }
|
||||
|
||||
ObjectGuid GetOrigUnitTargetGUID() const;
|
||||
void SetOrigUnitTarget(Unit* target);
|
||||
|
||||
ObjectGuid GetUnitTargetGUID() const;
|
||||
Unit* GetUnitTarget() const;
|
||||
void SetUnitTarget(Unit* target);
|
||||
|
||||
ObjectGuid GetGOTargetGUID() const;
|
||||
GameObject* GetGOTarget() const;
|
||||
void SetGOTarget(GameObject* target);
|
||||
|
||||
ObjectGuid GetCorpseTargetGUID() const;
|
||||
Corpse* GetCorpseTarget() const;
|
||||
|
||||
WorldObject* GetObjectTarget() const;
|
||||
ObjectGuid GetObjectTargetGUID() const;
|
||||
void RemoveObjectTarget();
|
||||
|
||||
ObjectGuid GetItemTargetGUID() const { return m_itemTargetGUID; }
|
||||
Item* GetItemTarget() const { return m_itemTarget; }
|
||||
uint32 GetItemTargetEntry() const { return m_itemTargetEntry; }
|
||||
void SetItemTarget(Item* item);
|
||||
void SetTradeItemTarget(Player* caster);
|
||||
void UpdateTradeSlotItem();
|
||||
|
||||
SpellDestination const* GetSrc() const;
|
||||
Position const* GetSrcPos() const;
|
||||
void SetSrc(float x, float y, float z);
|
||||
void SetSrc(Position const& pos);
|
||||
void SetSrc(WorldObject const& wObj);
|
||||
void ModSrc(Position const& pos);
|
||||
void RemoveSrc();
|
||||
|
||||
SpellDestination const* GetDst() const;
|
||||
WorldLocation const* GetDstPos() const;
|
||||
void SetDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID);
|
||||
void SetDst(Position const& pos);
|
||||
void SetDst(WorldObject const& wObj);
|
||||
void SetDst(SpellDestination const& spellDest);
|
||||
void SetDst(SpellCastTargets const& spellTargets);
|
||||
void ModDst(Position const& pos);
|
||||
void ModDst(SpellDestination const& spellDest);
|
||||
void RemoveDst();
|
||||
|
||||
bool HasSrc() const;
|
||||
bool HasDst() const;
|
||||
bool HasTraj() const { return m_speed != 0; }
|
||||
|
||||
float GetElevation() const { return m_elevation; }
|
||||
void SetElevation(float elevation) { m_elevation = elevation; }
|
||||
float GetSpeed() const { return m_speed; }
|
||||
void SetSpeed(float speed) { m_speed = speed; }
|
||||
|
||||
float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); }
|
||||
float GetSpeedXY() const { return m_speed * std::cos(m_elevation); }
|
||||
float GetSpeedZ() const { return m_speed * std::sin(m_elevation); }
|
||||
|
||||
void Update(WorldObject* caster);
|
||||
|
||||
private:
|
||||
uint32 m_targetMask;
|
||||
|
||||
// objects (can be used at spell creating and after Update at casting)
|
||||
WorldObject* m_objectTarget;
|
||||
Item* m_itemTarget;
|
||||
|
||||
// object GUID/etc, can be used always
|
||||
ObjectGuid m_origObjectTargetGUID;
|
||||
ObjectGuid m_objectTargetGUID;
|
||||
ObjectGuid m_itemTargetGUID;
|
||||
uint32 m_itemTargetEntry;
|
||||
|
||||
SpellDestination m_src;
|
||||
SpellDestination m_dst;
|
||||
|
||||
float m_elevation, m_speed;
|
||||
std::string m_strTarget;
|
||||
};
|
||||
|
||||
struct TC_GAME_API CastSpellTargetArg
|
||||
{
|
||||
CastSpellTargetArg() { Targets.emplace(); }
|
||||
CastSpellTargetArg(std::nullptr_t) { Targets.emplace(); }
|
||||
CastSpellTargetArg(WorldObject* target);
|
||||
CastSpellTargetArg(Item* itemTarget)
|
||||
{
|
||||
Targets.emplace();
|
||||
Targets->SetItemTarget(itemTarget);
|
||||
}
|
||||
CastSpellTargetArg(Position const& dest)
|
||||
{
|
||||
Targets.emplace();
|
||||
Targets->SetDst(dest);
|
||||
}
|
||||
CastSpellTargetArg(SpellCastTargets&& targets)
|
||||
{
|
||||
Targets.emplace(std::move(targets));
|
||||
}
|
||||
|
||||
Optional<SpellCastTargets> Targets; // empty optional used to signal error state
|
||||
};
|
||||
|
||||
struct CastSpellExtraArgsInit
|
||||
{
|
||||
TriggerCastFlags TriggerFlags = TRIGGERED_NONE;
|
||||
|
||||
@@ -635,7 +635,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)
|
||||
args.AddSpellMod(SpellValueMod(SPELLVALUE_BASE_POINT0 + i), damage);
|
||||
|
||||
// original caster guid only for GO cast
|
||||
m_caster->CastSpell(targets, spellInfo->Id, args);
|
||||
m_caster->CastSpell(std::move(targets), spellInfo->Id, args);
|
||||
}
|
||||
|
||||
void Spell::EffectForceCast(SpellEffIndex effIndex)
|
||||
@@ -3286,13 +3286,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
|
||||
if (!m_targets.HasDst())
|
||||
return;
|
||||
|
||||
float x, y, z;
|
||||
float radius = m_spellInfo->Effects[effIndex].CalcRadius();
|
||||
for (uint8 i = 0; i < 15; ++i)
|
||||
{
|
||||
m_caster->GetRandomPoint(*destTarget, radius, x, y, z);
|
||||
m_caster->CastSpell({ x, y, z }, 54522, true);
|
||||
}
|
||||
m_caster->CastSpell(m_caster->GetRandomPoint(*destTarget, radius), 54522, true);
|
||||
break;
|
||||
}
|
||||
case 52173: // Coyote Spirit Despawn
|
||||
|
||||
@@ -44,38 +44,6 @@ struct SpellEntry;
|
||||
struct SpellCastTimesEntry;
|
||||
struct Condition;
|
||||
|
||||
enum SpellCastTargetFlags : uint32
|
||||
{
|
||||
TARGET_FLAG_NONE = 0x00000000,
|
||||
TARGET_FLAG_UNUSED_1 = 0x00000001, // not used
|
||||
TARGET_FLAG_UNIT = 0x00000002, // pguid
|
||||
TARGET_FLAG_UNIT_RAID = 0x00000004, // not sent, used to validate target (if raid member)
|
||||
TARGET_FLAG_UNIT_PARTY = 0x00000008, // not sent, used to validate target (if party member)
|
||||
TARGET_FLAG_ITEM = 0x00000010, // pguid
|
||||
TARGET_FLAG_SOURCE_LOCATION = 0x00000020, // pguid, 3 float
|
||||
TARGET_FLAG_DEST_LOCATION = 0x00000040, // pguid, 3 float
|
||||
TARGET_FLAG_UNIT_ENEMY = 0x00000080, // not sent, used to validate target (if enemy)
|
||||
TARGET_FLAG_UNIT_ALLY = 0x00000100, // not sent, used to validate target (if ally)
|
||||
TARGET_FLAG_CORPSE_ENEMY = 0x00000200, // pguid
|
||||
TARGET_FLAG_UNIT_DEAD = 0x00000400, // not sent, used to validate target (if dead creature)
|
||||
TARGET_FLAG_GAMEOBJECT = 0x00000800, // pguid, used with TARGET_GAMEOBJECT_TARGET
|
||||
TARGET_FLAG_TRADE_ITEM = 0x00001000, // pguid
|
||||
TARGET_FLAG_STRING = 0x00002000, // string
|
||||
TARGET_FLAG_GAMEOBJECT_ITEM = 0x00004000, // not sent, used with TARGET_GAMEOBJECT_ITEM_TARGET
|
||||
TARGET_FLAG_CORPSE_ALLY = 0x00008000, // pguid
|
||||
TARGET_FLAG_UNIT_MINIPET = 0x00010000, // pguid, used to validate target (if non combat pet)
|
||||
TARGET_FLAG_GLYPH_SLOT = 0x00020000, // used in glyph spells
|
||||
TARGET_FLAG_DEST_TARGET = 0x00040000, // sometimes appears with DEST_TARGET spells (may appear or not for a given spell)
|
||||
TARGET_FLAG_EXTRA_TARGETS = 0x00080000, // uint32 counter, loop { vec3 - screen position (?), guid }, not used so far
|
||||
TARGET_FLAG_UNIT_PASSENGER = 0x00100000, // guessed, used to validate target (if vehicle passenger)
|
||||
|
||||
TARGET_FLAG_UNIT_MASK = TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY
|
||||
| TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_DEAD | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER,
|
||||
TARGET_FLAG_GAMEOBJECT_MASK = TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM,
|
||||
TARGET_FLAG_CORPSE_MASK = TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY,
|
||||
TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM
|
||||
};
|
||||
|
||||
enum SpellTargetSelectionCategories
|
||||
{
|
||||
TARGET_SELECT_CATEGORY_NYI,
|
||||
|
||||
@@ -171,7 +171,7 @@ public:
|
||||
TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
|
||||
float x, y, z;
|
||||
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, dist);
|
||||
handler->GetSession()->GetPlayer()->CastSpell({ x, y, z }, spellId, triggered);
|
||||
handler->GetSession()->GetPlayer()->CastSpell(Position{ x, y, z }, spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -260,9 +260,7 @@ public:
|
||||
if (!posX || !posY || !posZ)
|
||||
return false;
|
||||
|
||||
float x = float(atof(posX));
|
||||
float y = float(atof(posY));
|
||||
float z = float(atof(posZ));
|
||||
Position dest(atof(posX), atof(posY), atof(posZ));
|
||||
|
||||
char* triggeredStr = strtok(nullptr, " ");
|
||||
if (triggeredStr)
|
||||
@@ -273,7 +271,7 @@ public:
|
||||
}
|
||||
|
||||
TriggerCastFlags triggered = (triggeredStr != nullptr) ? TRIGGERED_FULL_DEBUG_MASK : TRIGGERED_NONE;
|
||||
caster->CastSpell({ x, y, z }, spellId, triggered);
|
||||
caster->CastSpell(dest, spellId, triggered);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -286,7 +286,7 @@ class spell_bot_twilight_rupture : public SpellScript
|
||||
destY -= 2.f * std::sin(currentAngle);
|
||||
}
|
||||
|
||||
caster->CastSpell({ destX, destY, destZ }, SPELL_TWILIGHT_RUPTURE_MISSILE);
|
||||
caster->CastSpell(Position{ destX, destY, destZ }, SPELL_TWILIGHT_RUPTURE_MISSILE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -784,7 +784,7 @@ struct npc_ignacious final : public ScriptedAI
|
||||
float y = pos.GetPositionY() + sin(angle) * i;
|
||||
float z = pos.GetPositionZ();
|
||||
float floor = me->GetMapHeight(x, y, z);
|
||||
me->CastSpell({ x, y, floor }, SPELL_INFERNO_RUSH_SUMMON, true);
|
||||
me->CastSpell(Position{ x, y, floor }, SPELL_INFERNO_RUSH_SUMMON, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2383,7 +2383,7 @@ class spell_terrastra_eruption final : public SpellScript
|
||||
float x = caster->GetPositionX() + cos(angle + (i * steps)) * dist;
|
||||
float y = caster->GetPositionY() + sin(angle + (i * steps)) * dist;
|
||||
float floor = caster->GetMap()->GetHeight(caster->GetPhaseShift(), x, y, z, true);
|
||||
caster->CastSpell({ x, y, floor }, SPELL_ERUPTION_SUMMON, true);
|
||||
caster->CastSpell(Position{ x, y, floor }, SPELL_ERUPTION_SUMMON, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -763,7 +763,7 @@ struct npc_magmaw_blazing_bone_construct : public ScriptedAI
|
||||
for (uint8 i = 0; i < 20; i++)
|
||||
{
|
||||
Position const pos = me->GetRandomNearPosition(10.0f);
|
||||
me->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_IGNITION, true);
|
||||
me->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_IGNITION, true);
|
||||
}
|
||||
_events.ScheduleEvent(EVENT_ENGAGE_PLAYERS, 1s);
|
||||
}
|
||||
|
||||
+2
-2
@@ -1144,7 +1144,7 @@ class spell_maloriak_magma_jets_periodic : public AuraScript
|
||||
float y = target->GetPositionY() + sin(target->GetOrientation()) * dist;
|
||||
float z = target->GetMapHeight(x, y, target->GetPositionZ() + 5.0f);
|
||||
if (target->IsWithinLOS(x, y, z))
|
||||
target->CastSpell({ x, y, z }, SPELL_MAGMA_JETS_SUMMON_FIRE, true);
|
||||
target->CastSpell(Position{ x, y, z }, SPELL_MAGMA_JETS_SUMMON_FIRE, true);
|
||||
else
|
||||
Remove();
|
||||
}
|
||||
@@ -1192,7 +1192,7 @@ class spell_maloriak_vile_swill: public AuraScript
|
||||
PreventDefaultAction();
|
||||
Unit* target = GetTarget();
|
||||
Position const destination = target->GetRandomPoint(target->GetPosition(), 11.0f);
|
||||
target->CastSpell({ destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ() }, SPELL_VILE_SWILL_SUMMON, true);
|
||||
target->CastSpell(Position{ destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ() }, SPELL_VILE_SWILL_SUMMON, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
+4
-4
@@ -1355,14 +1355,14 @@ struct npc_nefarians_end_shadowblaze : public NullCreatureAI
|
||||
}
|
||||
}
|
||||
|
||||
me->CastSpell({ summonPos.GetPositionX(), summonPos.GetPositionY(), z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
me->CastSpell(Position{ summonPos.GetPositionX(), summonPos.GetPositionY(), z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (me->GetEntry() == NPC_SHADOWBLAZE_FLASHPOINT)
|
||||
{
|
||||
me->CastSpell({ me->GetPositionX() - 5.f, me->GetPositionY(), z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
me->CastSpell({ me->GetPositionX(), me->GetPositionY() + 5.f, z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
me->CastSpell(Position{ me->GetPositionX() - 5.f, me->GetPositionY(), z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
me->CastSpell(Position{ me->GetPositionX(), me->GetPositionY() + 5.f, z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
}
|
||||
else if (_summonedByController)
|
||||
{
|
||||
@@ -1370,7 +1370,7 @@ struct npc_nefarians_end_shadowblaze : public NullCreatureAI
|
||||
{
|
||||
float x = me->GetPositionX() + 5.f;
|
||||
float y = me->GetPositionY() + 5.f;
|
||||
me->CastSpell({ x, y, z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
me->CastSpell(Position{ x, y, z, 0.f }, SPELL_BRUSHFIRE_SUMMON, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ class boss_vanessa_van_cleef : public CreatureScript
|
||||
float y = defiasReinforcementPositions[_currentReinforcement].m_positionY;
|
||||
float z = defiasReinforcementPositions[_currentReinforcement].m_positionZ;
|
||||
|
||||
me->CastSpell({ x, y, z }, defiasReinforcementSpells[_currentReinforcement], true);
|
||||
me->CastSpell(Position{ x, y, z }, defiasReinforcementSpells[_currentReinforcement], true);
|
||||
_currentReinforcement++;
|
||||
|
||||
if (_currentReinforcement == REINFORCEMENT_BLOOD_WIZARD)
|
||||
|
||||
@@ -311,7 +311,7 @@ class spell_godfrey_pistol_barrage : public AuraScript
|
||||
float posX = target->GetPositionX() + cos(ori) * 60;
|
||||
float posY = target->GetPositionY() + sin(ori) * 60;
|
||||
float posZ = target->GetPositionZ();
|
||||
target->CastSpell({ posX, posY, posZ }, spellId, true);
|
||||
target->CastSpell(Position{ posX, posY, posZ }, spellId, true);
|
||||
_useLeftGun = _useLeftGun ? false : true;
|
||||
}
|
||||
|
||||
|
||||
@@ -460,7 +460,7 @@ class spell_janalai_flame_breath_AuraScript : public AuraScript
|
||||
|
||||
float x = 0.f, y = 0.f, z = 0.f;
|
||||
_castDestinations[tickNumber - 1].GetPosition(x, y, z);
|
||||
GetTarget()->CastSpell({ x, y, z }, SPELL_FLAME_BREATH_AREA_EFFECT);
|
||||
GetTarget()->CastSpell(Position{ x, y, z }, SPELL_FLAME_BREATH_AREA_EFFECT);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -186,7 +186,7 @@ struct boss_bloodlord_mandokir : public BossAI
|
||||
float y = me->GetPositionY() + sin(angle + angleOffset) * (i * 6.0f);
|
||||
float z = me->GetPositionZ();
|
||||
angleOffset += 0.3f;
|
||||
me->CastSpell({ x, y, z }, SPELL_DEVASTATING_SLAM_DAMAGE, true);
|
||||
me->CastSpell(Position{ x, y, z }, SPELL_DEVASTATING_SLAM_DAMAGE, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ struct boss_zanzil : public BossAI
|
||||
|
||||
Talk(SAY_ANNOUNCE_ZANZILI_BERSEKER);
|
||||
Talk(SAY_ZANZILI_BERSEKER);
|
||||
me->CastSpell({ nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ() }, SPELL_ZANZILS_RESURRECTION_ELIXIR_BLUE);
|
||||
me->CastSpell(Position{ nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ() }, SPELL_ZANZILS_RESURRECTION_ELIXIR_BLUE);
|
||||
events.ScheduleEvent(EVENT_RESPAWN_BERSERKER, 13s);
|
||||
break;
|
||||
}
|
||||
@@ -310,7 +310,7 @@ struct boss_zanzil : public BossAI
|
||||
|
||||
Talk(SAY_ANNOUNCE_ZANZIL_ZOMBIES);
|
||||
Talk(SAY_ZANZILI_ZOMBIES);
|
||||
me->CastSpell({ nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ() }, SPELL_ZANZILS_RESURRECTION_ELIXIR_RED);
|
||||
me->CastSpell(Position{ nearestPos.GetPositionX(), nearestPos.GetPositionY(), nearestPos.GetPositionZ() }, SPELL_ZANZILS_RESURRECTION_ELIXIR_RED);
|
||||
events.ScheduleEvent(EVENT_RESPAWN_ZOMBIE_GROUP, 13s);
|
||||
break;
|
||||
}
|
||||
@@ -498,7 +498,7 @@ class spell_zanzil_zanzils_resurrection_elixir : public AuraScript
|
||||
if (!object)
|
||||
return;
|
||||
|
||||
GetTarget()->CastSpell({ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ() }, GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, true);
|
||||
GetTarget()->CastSpell(Position{ object->GetPositionX(), object->GetPositionY(), object->GetPositionZ() }, GetSpellInfo()->Effects[EFFECT_1].TriggerSpell, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -466,7 +466,7 @@ struct npc_brazie_the_bonatist_vehicle : public VehicleAI
|
||||
float y = pos.GetPositionY() + sin(angle) * 3;
|
||||
|
||||
if (Player* player = GetPlayer())
|
||||
player->CastSpell({ x, y, pos.GetPositionZ() + 50.0f }, SPELL_CREATE_RANDOM_SUN_POWER, true);
|
||||
player->CastSpell(Position{ x, y, pos.GetPositionZ() + 50.0f }, SPELL_CREATE_RANDOM_SUN_POWER, true);
|
||||
|
||||
switch (_currentLevel)
|
||||
{
|
||||
@@ -507,7 +507,7 @@ struct npc_brazie_the_bonatist_vehicle : public VehicleAI
|
||||
}
|
||||
|
||||
if (Player* player = GetPlayer())
|
||||
player->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), angle }, spellId, true);
|
||||
player->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), angle }, spellId, true);
|
||||
break;
|
||||
}
|
||||
case EVENT_ANNOUNCE_GOOD_JOB:
|
||||
@@ -597,19 +597,19 @@ private:
|
||||
for (uint8 i = 0; i < MAX_TARGET_POSITIONS; i++)
|
||||
{
|
||||
Position pos = LawnMowerPositions[i];
|
||||
charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), LawnmowerOrientation }, SPELL_CREATE_LAWMOWER, true);
|
||||
charmer->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), LawnmowerOrientation }, SPELL_CREATE_LAWMOWER, true);
|
||||
|
||||
pos = GoalStalkerPositions[i];
|
||||
charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GoalStalkerOrientation }, SPELL_CREATE_GOAL_STALKER, true);
|
||||
charmer->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), GoalStalkerOrientation }, SPELL_CREATE_GOAL_STALKER, true);
|
||||
|
||||
pos = SpitterTargetPositions[i];
|
||||
charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SpitterTargetOrientation }, SPELL_CREATE_SPITTER_TARGET, true);
|
||||
charmer->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), SpitterTargetOrientation }, SPELL_CREATE_SPITTER_TARGET, true);
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_EMPTY_SPOT_POSITIONS; i++)
|
||||
{
|
||||
Position pos = EmptySpotPositions[i];
|
||||
charmer->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), EmptySpotOrientation }, SPELL_CREATE_EMPTY_SPOT, true);
|
||||
charmer->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), EmptySpotOrientation }, SPELL_CREATE_EMPTY_SPOT, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -923,7 +923,7 @@ struct npc_brazie_spot : public ScriptedAI
|
||||
float x = pos.GetPositionX() + cos(angle) * 3;
|
||||
float y = pos.GetPositionY() + sin(angle) * 3;
|
||||
|
||||
summoner->CastSpell({ x, y, pos.GetPositionZ() + 50.0f }, SPELL_CREATE_RANDOM_SUN_POWER, true);
|
||||
summoner->CastSpell(Position{ x, y, pos.GetPositionZ() + 50.0f }, SPELL_CREATE_RANDOM_SUN_POWER, true);
|
||||
}
|
||||
}
|
||||
_events.Repeat(17s);
|
||||
|
||||
@@ -1323,7 +1323,7 @@ public:
|
||||
{
|
||||
if (StrikeTimer <= diff)
|
||||
{
|
||||
me->CastSpell({ DummyTarget[0], DummyTarget[1], DummyTarget[2] }, SPELL_GARGOYLE_STRIKE);
|
||||
me->CastSpell(Position{ DummyTarget[0], DummyTarget[1], DummyTarget[2] }, SPELL_GARGOYLE_STRIKE);
|
||||
StrikeTimer = 2000 + rand32() % 1000;
|
||||
} else StrikeTimer -= diff;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ class RelentlessStormTeleportEvent : public BasicEvent
|
||||
float y = RelentlessStormTeleportReferencePos.GetPositionY() + frand(-15.0f, 15.0f);
|
||||
float z = RelentlessStormTeleportReferencePos.GetPositionZ() + frand(-15.0f, 15.0f);
|
||||
|
||||
_owner->CastSpell({ x, y, z }, SPELL_RELENTLESS_STORM_INITIAL_VEHICLE_RIDE_TELEPORT, true);
|
||||
_owner->CastSpell(Position{ x, y, z }, SPELL_RELENTLESS_STORM_INITIAL_VEHICLE_RIDE_TELEPORT, true);
|
||||
return true;
|
||||
}
|
||||
private:
|
||||
@@ -445,7 +445,7 @@ struct boss_alakir : public BossAI
|
||||
|
||||
if (Creature* cloud = DoSummon(NPC_LIGHTNING_CLOUDS_BOTTOM, LightningCloudBottomPos, 0, TEMPSUMMON_MANUAL_DESPAWN))
|
||||
for (uint8 i = 0; i < 48; i++)
|
||||
cloud->CastSpell({ LightningCloudsExtraVisualsBottomPositions[i].GetPositionX(), LightningCloudsExtraVisualsBottomPositions[i].GetPositionY(),
|
||||
cloud->CastSpell(Position{ LightningCloudsExtraVisualsBottomPositions[i].GetPositionX(), LightningCloudsExtraVisualsBottomPositions[i].GetPositionY(),
|
||||
LightningCloudsExtraVisualsBottomPositions[i].GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_SUMMON_EXTRA_VISUALS_BOTTOM);
|
||||
}
|
||||
}
|
||||
@@ -513,7 +513,7 @@ struct boss_alakir : public BossAI
|
||||
|
||||
}, 5s);
|
||||
for (uint8 i = 0; i < 24; i++)
|
||||
summon->CastSpell({ LightningCloudsExtraVisualsPositions[i].GetPositionX(), LightningCloudsExtraVisualsPositions[i].GetPositionY(),
|
||||
summon->CastSpell(Position{ LightningCloudsExtraVisualsPositions[i].GetPositionX(), LightningCloudsExtraVisualsPositions[i].GetPositionY(),
|
||||
summon->GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_SUMMON_EXTRA_VISUALS);
|
||||
break;
|
||||
default:
|
||||
@@ -666,7 +666,7 @@ struct npc_alakir_ice_storm : public ScriptedAI
|
||||
if (!possibleDestinations.empty())
|
||||
{
|
||||
Position dest = Trinity::Containers::SelectRandomContainerElement(possibleDestinations);
|
||||
me->CastSpell({ dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ() }, SPELL_ICE_STORM_CHARGE, true);
|
||||
me->CastSpell(Position{ dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ() }, SPELL_ICE_STORM_CHARGE, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -811,7 +811,7 @@ class spell_alakir_lightning_strike_periodic : public SpellScript
|
||||
float x = caster->GetPositionX() + cos(angle) * 75.0f;
|
||||
float y = caster->GetPositionY() + sin(angle) * 75.0f;
|
||||
float z = caster->GetPositionZ();
|
||||
caster->CastSpell({ x, y, z }, SPELL_LIGHTNING_STRIKE_VISUAL, true);
|
||||
caster->CastSpell(Position{ x, y, z }, SPELL_LIGHTNING_STRIKE_VISUAL, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -995,7 +995,7 @@ class spell_alakir_lightning_clouds_periodic : public AuraScript
|
||||
Unit* target = GetTarget();
|
||||
Position pos = target->GetRandomPoint(target->GetPosition(), 80.0f);
|
||||
pos.m_positionZ = target->GetPositionZ() + frand(-10.0f, 10.0f);
|
||||
target->CastSpell({ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_VISUAL_DEST);
|
||||
target->CastSpell(Position{ pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ() }, SPELL_LIGHTNING_CLOUDS_VISUAL_DEST);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1048,7 +1048,7 @@ class spell_alakir_lightning_clouds_targeting : public SpellScript
|
||||
float y = caster->GetPositionY();
|
||||
float z = GetHitUnit()->GetPositionZ();
|
||||
float o = GetHitUnit()->GetOrientation();
|
||||
caster->CastSpell({ x, y, z, o }, SPELL_SUMMON_LIGHTNING_CLOUDS_SUMMON);
|
||||
caster->CastSpell(Position{ x, y, z, o }, SPELL_SUMMON_LIGHTNING_CLOUDS_SUMMON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ struct npc_asaad_unstable_grounding_field : public NullCreatureAI
|
||||
{
|
||||
float centerX = (_stormTargetPositions[0].GetPositionX() + _stormTargetPositions[1].GetPositionX() + _stormTargetPositions[2].GetPositionX()) / 3.f;
|
||||
float centerY = (_stormTargetPositions[0].GetPositionY() + _stormTargetPositions[1].GetPositionY() + _stormTargetPositions[2].GetPositionY()) / 3.f;
|
||||
me->CastSpell({ centerX, centerY, TRIANGLE_TOP_Z }, SPELL_SUPREMACY_OF_THE_STORM_SUMMON);
|
||||
me->CastSpell(Position{ centerX, centerY, TRIANGLE_TOP_Z }, SPELL_SUPREMACY_OF_THE_STORM_SUMMON);
|
||||
me->DespawnOrUnsummon(1s);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ public:
|
||||
DoCast(player, SPELL_ARCANE_CHANNELING, true);//Arcane Channeling
|
||||
break;
|
||||
case 35:
|
||||
me->CastSpell({ -8088, 1520.43f, 2.67f }, SPELL_TIME_STOP, true);
|
||||
me->CastSpell(Position{ -8088, 1520.43f, 2.67f }, SPELL_TIME_STOP, true);
|
||||
break;
|
||||
case 36:
|
||||
DoCast(player, SPELL_CALL_PRISMATIC_BARRIER, true);
|
||||
@@ -546,7 +546,7 @@ public:
|
||||
break;
|
||||
case 50:
|
||||
Fandral->AI()->Talk(FANDRAL_EMOTE_2);
|
||||
Fandral->CastSpell({ -8127, 1525, 17.5f }, SPELL_THROW_HAMMER, true);
|
||||
Fandral->CastSpell(Position{ -8127, 1525, 17.5f }, SPELL_THROW_HAMMER, true);
|
||||
break;
|
||||
case 51:
|
||||
{
|
||||
|
||||
@@ -726,7 +726,7 @@ class spell_azil_seismic_shard : public SpellScript
|
||||
|
||||
target->ExitVehicle();
|
||||
if (DynamicObject* dynamicObject = GetCaster()->GetDynObject(SPELL_SEISMIC_SHARD_TARGETING))
|
||||
target->CastSpell({ dynamicObject->GetPositionX(), dynamicObject->GetPositionY(), dynamicObject->GetPositionZ() }, SPELL_SEISMIC_SHARD_MISSLE, true);
|
||||
target->CastSpell(Position{ dynamicObject->GetPositionX(), dynamicObject->GetPositionY(), dynamicObject->GetPositionZ() }, SPELL_SEISMIC_SHARD_MISSLE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -188,7 +188,7 @@ class spell_ozruk_rupture : public AuraScript
|
||||
float y = caster->GetPositionY() + sin(angle) * dist;
|
||||
float z = caster->GetMap()->GetStaticHeight(caster->GetPhaseShift(), x, y, caster->GetPositionZ() + 3.0f);
|
||||
if (std::abs(z) < caster->GetPositionZ() + 5.0f)
|
||||
caster->CastSpell({ x, y, z }, SPELL_RUPTURE_SUMMON, true);
|
||||
caster->CastSpell(Position{ x, y, z }, SPELL_RUPTURE_SUMMON, true);
|
||||
angle += 0.2f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ class boss_halion : public CreatureScript
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true, true, -SPELL_TWILIGHT_REALM))
|
||||
{
|
||||
_meteorStrikePos = target->GetPosition();
|
||||
me->CastSpell({ _meteorStrikePos.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ() }, SPELL_METEOR_STRIKE, me->GetGUID());
|
||||
me->CastSpell(Position{ _meteorStrikePos.GetPositionX(), _meteorStrikePos.GetPositionY(), _meteorStrikePos.GetPositionZ() }, SPELL_METEOR_STRIKE, me->GetGUID());
|
||||
Talk(SAY_METEOR_STRIKE);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_METEOR_STRIKE, Seconds(38));
|
||||
@@ -1774,7 +1774,7 @@ class spell_halion_twilight_phasing : public SpellScriptLoader
|
||||
void Phase()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell({ caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ() }, SPELL_SUMMON_TWILIGHT_PORTAL, true);
|
||||
caster->CastSpell(Position{ caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ() }, SPELL_SUMMON_TWILIGHT_PORTAL, true);
|
||||
caster->GetMap()->SummonCreature(NPC_TWILIGHT_HALION, HalionSpawnPos);
|
||||
}
|
||||
|
||||
|
||||
@@ -742,12 +742,10 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
|
||||
|
||||
uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
|
||||
|
||||
float x, y, z;
|
||||
GetExplTargetDest()->GetPosition(x, y, z);
|
||||
// let Rotface handle the cast - caster dies before this executes
|
||||
if (InstanceScript* script = GetCaster()->GetInstanceScript())
|
||||
if (Creature* rotface = script->instance->GetCreature(script->GetGuidData(DATA_ROTFACE)))
|
||||
rotface->CastSpell({ x, y, z }, triggered_spell_id, GetCaster()->GetGUID());
|
||||
rotface->CastSpell(*GetExplTargetDest(), triggered_spell_id, GetCaster()->GetGUID());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -517,7 +517,7 @@ class boss_sindragosa : public CreatureScript
|
||||
destY = float(rand_norm()) * 75.0f + 2450.0f;
|
||||
destZ = 205.0f; // random number close to ground, get exact in next call
|
||||
me->UpdateGroundPositionZ(destX, destY, destZ);
|
||||
me->CastSpell({ destX, destY, destZ }, SPELL_FROST_BOMB_TRIGGER);
|
||||
me->CastSpell(Position{ destX, destY, destZ }, SPELL_FROST_BOMB_TRIGGER);
|
||||
events.ScheduleEvent(EVENT_FROST_BOMB, urand(6000, 8000));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1044,7 +1044,7 @@ public:
|
||||
{
|
||||
if (Creature* trigger = DoSummonFlyer(NPC_MIMIRON_TARGET_BEACON, me, 20, 0, 1000, TEMPSUMMON_TIMED_DESPAWN))
|
||||
{
|
||||
trigger->CastSpell({ me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() }, SPELL_MIMIRON_S_INFERNO, true);
|
||||
trigger->CastSpell(Position{ me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() }, SPELL_MIMIRON_S_INFERNO, true);
|
||||
infernoTimer = 2000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +556,7 @@ class boss_razorscale : public CreatureScript
|
||||
return;
|
||||
case EVENT_DEVOURING:
|
||||
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 200.0f, true))
|
||||
me->CastSpell({ target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() }, SPELL_DEVOURING_FLAME, true);
|
||||
me->CastSpell(Position{ target->GetPositionX(), target->GetPositionY(), target->GetPositionZ() }, SPELL_DEVOURING_FLAME, true);
|
||||
events.ScheduleEvent(EVENT_DEVOURING, 10000, 0, PHASE_FLIGHT);
|
||||
return;
|
||||
case EVENT_SUMMON:
|
||||
|
||||
@@ -99,7 +99,7 @@ public:
|
||||
break;
|
||||
case 1:
|
||||
Talk(SAY_WP_3);
|
||||
me->CastSpell({ 5918.33f, 5372.91f, -98.770f }, SPELL_EXPLODE_CRYSTAL, true);
|
||||
me->CastSpell(Position{ 5918.33f, 5372.91f, -98.770f }, SPELL_EXPLODE_CRYSTAL, true);
|
||||
me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
|
||||
break;
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
Talk(SAY_WP_5);
|
||||
break;
|
||||
case 8:
|
||||
me->CastSpell({ 5887.37f, 5379.39f, -91.289f }, SPELL_EXPLODE_CRYSTAL, true);
|
||||
me->CastSpell(Position{ 5887.37f, 5379.39f, -91.289f }, SPELL_EXPLODE_CRYSTAL, true);
|
||||
me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
|
||||
break;
|
||||
|
||||
@@ -1001,7 +1001,7 @@ public:
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetCaster()->CastSpell({ GetHitDest()->GetPositionX(), GetHitDest()->GetPositionY(), GetHitDest()->GetPositionZ() }, SPELL_ICE_BOMBARDMENT, true);
|
||||
GetCaster()->CastSpell(Position{ GetHitDest()->GetPositionX(), GetHitDest()->GetPositionY(), GetHitDest()->GetPositionZ() }, SPELL_ICE_BOMBARDMENT, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -280,7 +280,7 @@ class spell_dk_death_and_decay : public AuraScript
|
||||
void HandleDummyTick(AuraEffect const* aurEff)
|
||||
{
|
||||
if (DynamicObject* dyn = GetTarget()->GetDynObject(aurEff->GetId()))
|
||||
GetTarget()->CastSpell({ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_DK_DEATH_AND_DECAY_DAMAGE, aurEff);
|
||||
GetTarget()->CastSpell(Position{ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_DK_DEATH_AND_DECAY_DAMAGE, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -400,7 +400,7 @@ class spell_dk_death_grip : public SpellScript
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence
|
||||
target->CastSpell({ pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ() }, damage, true);
|
||||
target->CastSpell(Position{ pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ() }, damage, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1107,7 +1107,7 @@ class spell_dru_solar_beam : public AuraScript
|
||||
void HandleEffectPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
if (DynamicObject* dyn = GetTarget()->GetDynObject(aurEff->GetId()))
|
||||
GetTarget()->CastSpell({ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_DRUID_SOLAR_BEAM_SILENCE, true);
|
||||
GetTarget()->CastSpell(Position{ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_DRUID_SOLAR_BEAM_SILENCE, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1149,7 +1149,7 @@ class spell_dru_effloresence_aoe : public AuraScript
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
if (DynamicObject* dyn = caster->GetDynObject(aurEff->GetId()))
|
||||
caster->CastSpell({ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_DRUID_EFFLORESCENCE_HEAL, { aurEff, caster->GetGUID() });
|
||||
caster->CastSpell(Position{ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_DRUID_EFFLORESCENCE_HEAL, { aurEff, caster->GetGUID() });
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -4879,7 +4879,7 @@ class spell_gen_cauldron_of_battle : public SpellScript
|
||||
{
|
||||
float radius = spell->Effects[EFFECT_0].CalcRadius(target) - target->GetCombatReach();
|
||||
target->GetNearPoint(target, dest.m_positionX, dest.m_positionY, dest.m_positionZ, radius, target->GetOrientation());
|
||||
target->CastSpell({ dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ() }, spellId);
|
||||
target->CastSpell(Position{ dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ() }, spellId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1667,7 +1667,7 @@ class spell_darkmoon_island_ring_toss : public SpellScript
|
||||
if (target->GetExactDist2d(destination) <= 1.0f)
|
||||
caster->CastSpell(target, SPELL_RING_TOSS_HIT, true);
|
||||
else
|
||||
caster->CastSpell({ destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ() }, SPELL_RING_TOSS_MISS, true);
|
||||
caster->CastSpell(Position{ destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ() }, SPELL_RING_TOSS_MISS, true);
|
||||
_hasHit = true;
|
||||
}
|
||||
|
||||
@@ -1678,7 +1678,7 @@ class spell_darkmoon_island_ring_toss : public SpellScript
|
||||
if (!_hasHit)
|
||||
{
|
||||
Position destination = GetExplTargetDest()->GetPosition();
|
||||
caster->CastSpell({destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ()} , SPELL_RING_TOSS_MISS, true);
|
||||
caster->CastSpell(Position{destination.GetPositionX(), destination.GetPositionY(), destination.GetPositionZ()} , SPELL_RING_TOSS_MISS, true);
|
||||
}
|
||||
|
||||
if (!caster->GetPower(POWER_ALTERNATE_POWER))
|
||||
|
||||
@@ -963,7 +963,7 @@ class spell_mage_ring_of_frost : public AuraScript
|
||||
{
|
||||
if (ringOfFrost)
|
||||
if (GetMaxDuration() - (int32)ringOfFrost->GetTimer() >= sSpellMgr->GetSpellInfo(SPELL_MAGE_RING_OF_FROST_DUMMY)->GetDuration())
|
||||
GetTarget()->CastSpell({ ringOfFrost->GetPositionX(), ringOfFrost->GetPositionY(), ringOfFrost->GetPositionZ() }, SPELL_MAGE_RING_OF_FROST_FREEZE, true);
|
||||
GetTarget()->CastSpell(Position{ ringOfFrost->GetPositionX(), ringOfFrost->GetPositionY(), ringOfFrost->GetPositionZ() }, SPELL_MAGE_RING_OF_FROST_FREEZE, true);
|
||||
}
|
||||
|
||||
void Apply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
|
||||
@@ -298,7 +298,7 @@ class spell_pal_consecration : public AuraScript
|
||||
return;
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell({ castPos.GetPositionX(), castPos.GetPositionY(), castPos.GetPositionZ() }, SPELL_PALADIN_CONSECRATION_TRIGGERED, aurEff);
|
||||
caster->CastSpell(Position{ castPos.GetPositionX(), castPos.GetPositionY(), castPos.GetPositionZ() }, SPELL_PALADIN_CONSECRATION_TRIGGERED, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -492,7 +492,7 @@ class spell_pri_leap_of_faith_effect_trigger : public SpellScript
|
||||
SpellCastTargets targets;
|
||||
targets.SetDst(destPos);
|
||||
targets.SetUnitTarget(GetCaster());
|
||||
GetHitUnit()->CastSpell(targets, GetEffectValue());
|
||||
GetHitUnit()->CastSpell(std::move(targets), GetEffectValue());
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1307,7 +1307,7 @@ class spell_pri_holy_word_sanctuary : public AuraScript
|
||||
void HandleDummyTick(AuraEffect const* aurEff)
|
||||
{
|
||||
if (DynamicObject* dyn = GetTarget()->GetDynObject(aurEff->GetId()))
|
||||
GetTarget()->CastSpell({ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_PRIEST_HOLY_WORD_SANCTUARY, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_DISALLOW_PROC_EVENTS)).SetTriggeringAura(aurEff));
|
||||
GetTarget()->CastSpell(Position{ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_PRIEST_HOLY_WORD_SANCTUARY, CastSpellExtraArgs(TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_DISALLOW_PROC_EVENTS)).SetTriggeringAura(aurEff));
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -1858,7 +1858,7 @@ class spell_q13086_cannons_target : public SpellScriptLoader
|
||||
void HandleEffectDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (WorldLocation const* pos = GetExplTargetDest())
|
||||
GetCaster()->CastSpell({ pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ() }, GetEffectValue(), true);
|
||||
GetCaster()->CastSpell(Position{ pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ() }, GetEffectValue(), true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -1321,7 +1321,7 @@ class spell_sha_healing_rain : public AuraScript
|
||||
void HandleEffectPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
if (DynamicObject* dyn = GetTarget()->GetDynObject(aurEff->GetId()))
|
||||
GetTarget()->CastSpell({ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_SHAMAN_HEALING_RAIN_TRIGGERED, true);
|
||||
GetTarget()->CastSpell(Position{ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_SHAMAN_HEALING_RAIN_TRIGGERED, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
@@ -1658,7 +1658,7 @@ class spell_sha_earthquake : public AuraScript
|
||||
void HandleDummyTick(AuraEffect const* aurEff)
|
||||
{
|
||||
if (DynamicObject* dyn = GetTarget()->GetDynObject(aurEff->GetId()))
|
||||
GetTarget()->CastSpell({ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_SHAMAN_EARTHQUAKE_DAMAGE, aurEff);
|
||||
GetTarget()->CastSpell(Position{ dyn->GetPositionX(), dyn->GetPositionY(), dyn->GetPositionZ() }, SPELL_SHAMAN_EARTHQUAKE_DAMAGE, aurEff);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
|
||||
@@ -2273,7 +2273,7 @@ public:
|
||||
}
|
||||
else
|
||||
//me->CastSpell(me, GetFireworkSpell(me->GetEntry()), true);
|
||||
me->CastSpell({ me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() }, GetFireworkSpell(me->GetEntry()), true);
|
||||
me->CastSpell(Position{ me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() }, GetFireworkSpell(me->GetEntry()), true);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -2971,7 +2971,7 @@ enum MageOrb
|
||||
{
|
||||
Position explPos = me->GetPosition();
|
||||
float z = explPos.GetPositionZ() - me->GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
|
||||
summoner->CastSpell({ explPos.GetPositionX(), explPos.GetPositionY(), z }, SPELL_FIRE_POWER_EXPLOSION, true);
|
||||
summoner->CastSpell(Position{ explPos.GetPositionX(), explPos.GetPositionY(), z }, SPELL_FIRE_POWER_EXPLOSION, true);
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
break;
|
||||
@@ -2982,7 +2982,7 @@ enum MageOrb
|
||||
{
|
||||
Position explPos = me->GetPosition();
|
||||
float z = explPos.GetPositionZ() - me->GetFloatValue(UNIT_FIELD_HOVERHEIGHT);
|
||||
summoner->CastSpell({ explPos.GetPositionX(), explPos.GetPositionY(), z }, SPELL_FIRE_POWER_EXPLOSION, true);
|
||||
summoner->CastSpell(Position{ explPos.GetPositionX(), explPos.GetPositionY(), z }, SPELL_FIRE_POWER_EXPLOSION, true);
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user