TrinityCore
AreaTrigger Class Reference

#include <AreaTrigger.h>

Classes

struct  ValuesUpdateForPlayerWithMaskSender
 

Public Member Functions

 AreaTrigger ()
 
 ~AreaTrigger ()
 
void BuildValuesUpdateForPlayerWithMask (UpdateData *data, UF::ObjectData::Mask const &requestedObjectMask, UF::AreaTriggerData::Mask const &requestedAreaTriggerMask, Player const *target) const
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void AI_Initialize ()
 
void AI_Destroy ()
 
AreaTriggerAIAI ()
 
bool IsServerSide () const
 
bool IsNeverVisibleFor (WorldObject const *seer) const override
 
bool LoadFromDB (ObjectGuid::LowType spawnId, Map *map, bool addToMap, bool allowDuplicate)
 
void Update (uint32 diff) override
 
void Remove ()
 
bool IsRemoved () const
 
uint32 GetSpellId () const
 
AuraEffect const * GetAuraEffect () const
 
uint32 GetTimeSinceCreated () const
 
uint32 GetTimeToTarget () const
 
uint32 GetTimeToTargetScale () const
 
int32 GetDuration () const
 
int32 GetTotalDuration () const
 
void SetDuration (int32 newDuration)
 
void Delay (int32 delaytime)
 
GuidUnorderedSet const & GetInsideUnits () const
 
AreaTriggerCreateProperties const * GetCreateProperties () const
 
AreaTriggerTemplate const * GetTemplate () const
 
uint32 GetScriptId () const
 
ObjectGuid GetOwnerGUID () const override
 
ObjectGuid const & GetCasterGuid () const
 
UnitGetCaster () const
 
UnitGetTarget () const
 
uint32 GetFaction () const override
 
AreaTriggerShapeInfo const & GetShape () const
 
float GetMaxSearchRadius () const
 
Position const & GetRollPitchYaw () const
 
Position const & GetTargetRollPitchYaw () const
 
void InitSplineOffsets (std::vector< Position > const &offsets, uint32 timeToTarget)
 
void InitSplines (std::vector< G3D::Vector3 > splinePoints, uint32 timeToTarget)
 
bool HasSplines () const
 
::Movement::Spline< int32 > const & GetSpline () const
 
uint32 GetElapsedTimeForMovement () const
 
void InitOrbit (AreaTriggerOrbitInfo const &orbit, uint32 timeToTarget)
 
bool HasOrbit () const
 
Optional< AreaTriggerOrbitInfo > const & GetCircularMovementInfo () const
 
void UpdateShape ()
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
bool IsInPhase (WorldObject const *obj) const
 
PhaseShiftGetPhaseShift ()
 
PhaseShift const & GetPhaseShift () const
 
PhaseShiftGetSuppressedPhaseShift ()
 
PhaseShift const & GetSuppressedPhaseShift () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsInWorldPvpZone () const
 
bool IsOutdoors () const
 
ZLiquidStatus GetLiquidStatus () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string newname)
 
std::string GetNameForLocaleIdx (LocaleConstant) const override
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
bool IsWithinLOSInMap (WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
Position GetHitSpherePointFor (Position const &dest) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (Position const &pos1, Position const &pos2, float size=0) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
void SendCombatLogMessage (WorldPackets::CombatLog::CombatLogServerPacket *combatLog) const
 
virtual uint8 GetLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 soundId, Player *target=nullptr)
 
void PlayDirectSound (uint32 soundId, Player *target=nullptr, uint32 broadcastTextId=0)
 
void PlayDirectMusic (uint32 musicId, Player *target=nullptr)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
ZoneScriptFindZoneScript () const
 
ZoneScriptGetZoneScript () const
 
ScenarioGetScenario () const
 
TempSummonSummonCreature (uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonCreature (uint32 entry, float x, float y, float z, float o=0, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonPersonalClone (Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, Player *privateObjectOwner=nullptr)
 
GameObjectSummonGameObject (uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon *> *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool spawnedOnly=true) const
 
GameObjectFindNearestUnspawnedGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance) const
 
virtual ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
UnitGetOwner () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
PlayerGetSpellModOwner () const
 
int32 CalculateSpellDamage (Unit const *target, SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float ApplyEffectModifiers (SpellInfo const *spellInfo, uint8 effIndex, float value) const
 
int32 CalcSpellDuration (SpellInfo const *spellInfo) const
 
int32 ModSpellDuration (SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
 
void ModSpellDurationTime (SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
 
virtual float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, SpellInfo const *spellInfo) const
 
virtual SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
virtual void SetFaction (uint32)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (WorldObject const *target) const
 
bool IsNeutralToAll () const
 
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
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
virtual uint32 GetCastSpellXSpellVisualId (SpellInfo const *spellInfo) const
 
template<typename Container >
void GetGameObjectListWithEntryInGrid (Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetCreatureListWithEntryInGrid (Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetPlayerListInGrid (Container &playerContainer, float maxSearchRange, bool alive=true) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
virtual void UpdateObjectVisibilityOnDestroy ()
 
void UpdatePositionData ()
 
void BuildUpdate (UpdateDataMapType &) override
 
bool AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
void SetFarVisible (bool on)
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
TransportBaseGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
Position const & GetTransOffset () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (TransportBase *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetFloorZ () const
 
virtual float GetCollisionHeight () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
std::string GetDebugInfo () const override
 
virtual uint16 GetAIAnimKitId () const
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
bool IsPrivateObject () const
 
ObjectGuid GetPrivateObjectOwner () const
 
void SetPrivateObjectOwner (ObjectGuid const &owner)
 
bool CheckPrivateObjectOwnerVisibility (WorldObject const *seer) const
 
SmoothPhasingGetOrCreateSmoothPhasing ()
 
SmoothPhasingGetSmoothPhasing ()
 
SmoothPhasing const * GetSmoothPhasing () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid const & GetGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
void SetDynamicFlag (uint32 flag)
 
void RemoveDynamicFlag (uint32 flag)
 
void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player const *target) const
 
void BuildValuesUpdateBlockForPlayerWithFlag (UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
 
void BuildDestroyUpdateBlock (UpdateData *data) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
ByteBuffer PrepareValuesUpdateBuffer () const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsAreaTrigger () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger const * ToAreaTrigger () const
 
bool IsSceneObject () const
 
SceneObjectToSceneObject ()
 
SceneObject const * ToSceneObject () const
 
bool IsConversation () const
 
ConversationToConversation ()
 
Conversation const * ToConversation () const
 
template<typename T >
void ForceUpdateFieldChange (UF::UpdateFieldSetter< T > const &)
 
virtual void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const *loc)
 
void WorldRelocate (uint32 mapId, Position const &pos)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a) const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float o)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Streamer< XY > PositionXYStream ()
 
ConstStreamer< XY > PositionXYStream () const
 
Streamer< XYZ > PositionXYZStream ()
 
ConstStreamer< XYZ > PositionXYZStream () const
 
Streamer< XYZO > PositionXYZOStream ()
 
ConstStreamer< XYZO > PositionXYZOStream () const
 
Streamer< PackedXYZ > PositionPackedXYZStream ()
 
ConstStreamer< PackedXYZ > PositionPackedXYZStream () const
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float ToAbsoluteAngle (float relAngle) const
 
float ToRelativeAngle (float absAngle) const
 
float GetRelativeAngle (float x, float y) const
 
float GetRelativeAngle (Position const &pos) const
 
float GetRelativeAngle (Position const *pos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const &pos, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool IsWithinDoubleVerticalCylinder (Position const *center, float radius, float height) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float objSize, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< AreaTrigger >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< AreaTrigger > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static AreaTriggerCreateAreaTrigger (uint32 areaTriggerCreatePropertiesId, Unit *caster, Unit *target, SpellInfo const *spell, Position const &pos, int32 duration, SpellCastVisual spellVisual, ObjectGuid const &castId=ObjectGuid::Empty, AuraEffect const *aurEff=nullptr)
 
static ObjectGuid CreateNewMovementForceId (Map *map, uint32 areaTriggerId)
 
- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
static PlayerToPlayer (Object *o)
 
static Player const * ToPlayer (Object const *o)
 
static CreatureToCreature (Object *o)
 
static Creature const * ToCreature (Object const *o)
 
static UnitToUnit (Object *o)
 
static Unit const * ToUnit (Object const *o)
 
static GameObjectToGameObject (Object *o)
 
static GameObject const * ToGameObject (Object const *o)
 
static CorpseToCorpse (Object *o)
 
static Corpse const * ToCorpse (Object const *o)
 
static DynamicObjectToDynObject (Object *o)
 
static DynamicObject const * ToDynObject (Object const *o)
 
static AreaTriggerToAreaTrigger (Object *o)
 
static AreaTrigger const * ToAreaTrigger (Object const *o)
 
static SceneObjectToSceneObject (Object *o)
 
static SceneObject const * ToSceneObject (Object const *o)
 
static ConversationToConversation (Object *o)
 
static Conversation const * ToConversation (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGERm_areaTriggerData
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
UF::UpdateFieldHolder m_values
 
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECTm_objectData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Protected Member Functions

void BuildValuesCreate (ByteBuffer *data, Player const *target) const override
 
void BuildValuesUpdate (ByteBuffer *data, Player const *target) const override
 
void ClearUpdateMask (bool remove) override
 
void _UpdateDuration (int32 newDuration)
 
float GetProgress () const
 
void UpdateTargetList ()
 
void SearchUnits (std::vector< Unit *> &targetList, float radius, bool check3D)
 
void SearchUnitInSphere (std::vector< Unit *> &targetList)
 
void SearchUnitInBox (std::vector< Unit *> &targetList)
 
void SearchUnitInPolygon (std::vector< Unit *> &targetList)
 
void SearchUnitInCylinder (std::vector< Unit *> &targetList)
 
void SearchUnitInDisk (std::vector< Unit *> &targetList)
 
bool CheckIsInPolygon2D (Position const *pos) const
 
void HandleUnitEnterExit (std::vector< Unit *> const &targetList)
 
void DoActions (Unit *unit)
 
void UndoActions (Unit *unit)
 
void UpdatePolygonOrientation ()
 
void UpdateOrbitPosition (uint32 diff)
 
void UpdateSplinePosition (uint32 diff)
 
Position const * GetOrbitCenterPosition () const
 
Position CalculateOrbitPosition () const
 
void DebugVisualizePosition ()
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool CanNeverSee (WorldObject const *obj) const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _Create (ObjectGuid const &guid)
 
template<typename T >
void SetUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void SetUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
void RemoveUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void RemoveDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void ClearDynamicUpdateFieldValues (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
void RemoveOptionalUpdateFieldValue (UF::OptionalUpdateFieldSetter< T > setter)
 
template<typename T >
void SetUpdateFieldStatValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void ApplyModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type mod, bool apply)
 
template<typename T >
void ApplyPercentModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, float percent, bool apply)
 
template<typename Action >
void DoWithSuppressingObjectUpdates (Action &&action)
 
void BuildMovementUpdate (ByteBuffer *data, CreateObjectBits flags, Player *target) const
 
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 

Protected Attributes

ObjectGuid::LowType _spawnId
 
ObjectGuid _targetGuid
 
AuraEffect const * _aurEff
 
AreaTriggerShapeInfo _shape
 
float _maxSearchRadius
 
int32 _duration
 
int32 _totalDuration
 
uint32 _timeSinceCreated
 
float _previousCheckOrientation
 
bool _isRemoved
 
Position _rollPitchYaw
 
Position _targetRollPitchYaw
 
std::vector< Position_polygonVertices
 
std::unique_ptr<::Movement::Spline< int32 > > _spline
 
bool _reachedDestination
 
int32 _lastSplineIndex
 
uint32 _movementTime
 
Optional< AreaTriggerOrbitInfo_orbitInfo
 
AreaTriggerCreateProperties const * _areaTriggerCreateProperties
 
AreaTriggerTemplate const * _areaTriggerTemplate
 
GuidUnorderedSet _insideUnits
 
std::unique_ptr< AreaTriggerAI_ai
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
bool const m_isWorldObject
 
ZoneScriptm_zoneScript
 
TransportBasem_transport
 
uint32 m_zoneId
 
uint32 m_areaId
 
float m_staticFloorZ
 
bool m_outdoors
 
ZLiquidStatus m_liquidStatus
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
CreateObjectBits m_updateFlag
 
bool m_objectUpdated
 

Private Member Functions

bool Create (uint32 areaTriggerCreatePropertiesId, Unit *caster, Unit *target, SpellInfo const *spell, Position const &pos, int32 duration, SpellCastVisual spellVisual, ObjectGuid const &castId, AuraEffect const *aurEff)
 
bool CreateServer (Map *map, AreaTriggerTemplate const *areaTriggerTemplate, AreaTriggerSpawn const &position)
 

Constructor & Destructor Documentation

◆ AreaTrigger()

AreaTrigger::AreaTrigger ( )
42  : WorldObject(false), MapObject(), _spawnId(0), _aurEff(nullptr), _maxSearchRadius(0.0f),
43  _duration(0), _totalDuration(0), _timeSinceCreated(0), _previousCheckOrientation(std::numeric_limits<float>::infinity()),
46 {
49 
50  m_updateFlag.Stationary = true;
52 }
int32 _duration
Definition: AreaTrigger.h:167
int32 _totalDuration
Definition: AreaTrigger.h:168
bool _reachedDestination
Definition: AreaTrigger.h:178
int32 _lastSplineIndex
Definition: AreaTrigger.h:179
CreateObjectBits m_updateFlag
Definition: Object.h:385
uint32 _movementTime
Definition: AreaTrigger.h:180
float _maxSearchRadius
Definition: AreaTrigger.h:166
uint16 m_objectType
Definition: Object.h:382
AuraEffect const * _aurEff
Definition: AreaTrigger.h:163
TypeID m_objectTypeId
Definition: Object.h:384
Definition: ObjectGuid.h:45
ObjectGuid::LowType _spawnId
Definition: AreaTrigger.h:159
MapObject()
Definition: MapObject.h:41
bool AreaTrigger
Definition: Object.h:91
uint32 _timeSinceCreated
Definition: AreaTrigger.h:169
WorldObject(bool isWorldObject)
Definition: Object.cpp:824
AreaTriggerCreateProperties const * _areaTriggerCreateProperties
Definition: AreaTrigger.h:184
Definition: ObjectGuid.h:65
bool _isRemoved
Definition: AreaTrigger.h:171
AreaTriggerTemplate const * _areaTriggerTemplate
Definition: AreaTrigger.h:185
float _previousCheckOrientation
Definition: AreaTrigger.h:170
bool Stationary
Definition: Object.h:85
+ Here is the caller graph for this function:

◆ ~AreaTrigger()

AreaTrigger::~AreaTrigger ( )
55 {
56 }

Member Function Documentation

◆ _UpdateDuration()

void AreaTrigger::_UpdateDuration ( int32  newDuration)
protected
346 {
347  _duration = newDuration;
348 
349  // should be sent in object create packets only
351  {
353  const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::Duration);
354  });
355 }
UpdateField< uint32, 0, 4 > Duration
Definition: UpdateFields.h:886
int32 _duration
Definition: AreaTrigger.h:167
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
void ClearChanged(UpdateField< T, BlockBit, Bit >(Derived::*))
Definition: UpdateField.h:549
Definition: UpdateFields.h:881
UF::UpdateFieldHolder m_values
Definition: Object.h:251
void DoWithSuppressingObjectUpdates(Action &&action)
Definition: Object.h:362
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddToWorld()

void AreaTrigger::AddToWorld ( )
overridevirtual
  • Register the AreaTrigger for guid lookup and for caster

Reimplemented from Object.

59 {
61  if (!IsInWorld())
62  {
64  if (_spawnId)
65  GetMap()->GetAreaTriggerBySpawnIdStore().insert(std::make_pair(_spawnId, this));
66 
68  }
69 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:116
bool IsInWorld() const
Definition: Object.h:151
Map * GetMap() const
Definition: Object.h:555
void AddToWorld() override
Definition: Object.cpp:919
ObjectGuid const & GetGUID() const
Definition: Object.h:157
ObjectGuid::LowType _spawnId
Definition: AreaTrigger.h:159
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
Definition: Map.h:504
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:493
Definition: AreaTrigger.h:42
+ Here is the call graph for this function:

◆ AI()

AreaTriggerAI* AreaTrigger::AI ( )
inline
74 { return _ai.get(); }
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
+ Here is the caller graph for this function:

◆ AI_Destroy()

void AreaTrigger::AI_Destroy ( )
1002 {
1003  _ai.reset();
1004 }
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
+ Here is the caller graph for this function:

◆ AI_Initialize()

void AreaTrigger::AI_Initialize ( )
995 {
996  AI_Destroy();
998  _ai->OnInitialize();
999 }
AreaTriggerAI * SelectAreaTriggerAI(AreaTrigger *at)
Definition: CreatureAISelector.cpp:170
void AI_Destroy()
Definition: AreaTrigger.cpp:1001
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildValuesCreate()

void AreaTrigger::BuildValuesCreate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

1007 {
1009  std::size_t sizePos = data->wpos();
1010  *data << uint32(0);
1011  *data << uint8(flags);
1012  m_objectData->WriteCreate(*data, flags, this, target);
1013  m_areaTriggerData->WriteCreate(*data, flags, this, target);
1014  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1015 }
size_t wpos() const
Definition: ByteBuffer.h:412
uint16 flags
Definition: DisableMgr.cpp:49
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
uint32_t uint32
Definition: Define.h:143
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:736
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
uint8_t uint8
Definition: Define.h:145
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ BuildValuesUpdate()

void AreaTrigger::BuildValuesUpdate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

1018 {
1020  std::size_t sizePos = data->wpos();
1021  *data << uint32(0);
1023 
1025  m_objectData->WriteUpdate(*data, flags, this, target);
1026 
1028  m_areaTriggerData->WriteUpdate(*data, flags, this, target);
1029 
1030  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1031 }
size_t wpos() const
Definition: ByteBuffer.h:412
uint16 flags
Definition: DisableMgr.cpp:49
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:670
Definition: ObjectGuid.h:45
bool HasChanged(uint32 index) const
Definition: UpdateField.h:675
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
uint32_t uint32
Definition: Define.h:143
Definition: ObjectGuid.h:34
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:736
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
UF::UpdateFieldHolder m_values
Definition: Object.h:251
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ BuildValuesUpdateForPlayerWithMask()

void AreaTrigger::BuildValuesUpdateForPlayerWithMask ( UpdateData data,
UF::ObjectData::Mask const &  requestedObjectMask,
UF::AreaTriggerData::Mask const &  requestedAreaTriggerMask,
Player const *  target 
) const
1035 {
1037  if (requestedObjectMask.IsAnySet())
1038  valuesMask.Set(TYPEID_OBJECT);
1039 
1040  if (requestedAreaTriggerMask.IsAnySet())
1041  valuesMask.Set(TYPEID_AREATRIGGER);
1042 
1044  std::size_t sizePos = buffer.wpos();
1045  buffer << uint32(0);
1046  buffer << uint32(valuesMask.GetBlock(0));
1047 
1048  if (valuesMask[TYPEID_OBJECT])
1049  m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
1050 
1051  if (valuesMask[TYPEID_AREATRIGGER])
1052  m_areaTriggerData->WriteUpdate(buffer, requestedAreaTriggerMask, true, this, target);
1053 
1054  buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
1055 
1056  data->AddUpdateBlock(buffer);
1057 }
size_t wpos() const
Definition: ByteBuffer.h:412
Definition: ByteBuffer.h:61
void AddUpdateBlock(ByteBuffer const &block)
Definition: UpdateData.cpp:40
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
Definition: ObjectGuid.h:45
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
void Set(uint32 index)
Definition: UpdateMask.h:84
uint32_t uint32
Definition: Define.h:143
ByteBuffer PrepareValuesUpdateBuffer() const
Definition: Object.cpp:233
Definition: ObjectGuid.h:34
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ CalculateOrbitPosition()

Position AreaTrigger::CalculateOrbitPosition ( ) const
protected
866 {
868  if (!centerPos)
869  return GetPosition();
870 
871  AreaTriggerOrbitInfo const& cmi = *_orbitInfo;
872 
873  // AreaTrigger make exactly "Duration / TimeToTarget" loops during his life time
874  float pathProgress = float(cmi.ElapsedTimeForMovement) / float(cmi.TimeToTarget);
875 
876  // We already made one circle and can't loop
877  if (!cmi.CanLoop)
878  pathProgress = std::min(1.f, pathProgress);
879 
880  float radius = cmi.Radius;
881  if (G3D::fuzzyNe(cmi.BlendFromRadius, radius))
882  {
883  float blendCurve = (cmi.BlendFromRadius - radius) / radius;
884  // 4.f Defines four quarters
885  blendCurve = RoundToInterval(blendCurve, 1.f, 4.f) / 4.f;
886  float blendProgress = std::min(1.f, pathProgress / blendCurve);
887  radius = G3D::lerp(cmi.BlendFromRadius, cmi.Radius, blendProgress);
888  }
889 
890  // Adapt Path progress depending of circle direction
891  if (!cmi.CounterClockwise)
892  pathProgress *= -1;
893 
894  float angle = cmi.InitialAngle + 2.f * float(M_PI) * pathProgress;
895  float x = centerPos->GetPositionX() + (radius * std::cos(angle));
896  float y = centerPos->GetPositionY() + (radius * std::sin(angle));
897  float z = centerPos->GetPositionZ() + cmi.ZOffset;
898 
899  return { x, y, z, angle };
900 }
T RoundToInterval(T &num, T floor, T ceil)
Definition: Util.h:92
float InitialAngle
Definition: AreaTriggerTemplate.h:197
bool CounterClockwise
Definition: AreaTriggerTemplate.h:190
Position const centerPos
Definition: boss_blood_queen_lana_thel.cpp:131
Position GetPosition() const
Definition: Position.h:85
Position const * GetOrbitCenterPosition() const
Definition: AreaTrigger.cpp:850
float BlendFromRadius
Definition: AreaTriggerTemplate.h:196
#define M_PI
Definition: Common.h:157
float GetPositionY() const
Definition: Position.h:78
int32 ElapsedTimeForMovement
Definition: AreaTriggerTemplate.h:193
float GetPositionZ() const
Definition: Position.h:79
Definition: AreaTriggerTemplate.h:186
float GetPositionX() const
Definition: Position.h:77
float Radius
Definition: AreaTriggerTemplate.h:195
bool CanLoop
Definition: AreaTriggerTemplate.h:191
Definition: Position.h:27
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:182
uint32 TimeToTarget
Definition: AreaTriggerTemplate.h:192
float ZOffset
Definition: AreaTriggerTemplate.h:198
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CheckIsInPolygon2D()

bool AreaTrigger::CheckIsInPolygon2D ( Position const *  pos) const
protected
601 {
602  float testX = pos->GetPositionX();
603  float testY = pos->GetPositionY();
604 
605  //this method uses the ray tracing algorithm to determine if the point is in the polygon
606  bool locatedInPolygon = false;
607 
608  for (std::size_t vertex = 0; vertex < _polygonVertices.size(); ++vertex)
609  {
610  std::size_t nextVertex;
611 
612  //repeat loop for all sets of points
613  if (vertex == (_polygonVertices.size() - 1))
614  {
615  //if i is the last vertex, let j be the first vertex
616  nextVertex = 0;
617  }
618  else
619  {
620  //for all-else, let j=(i+1)th vertex
621  nextVertex = vertex + 1;
622  }
623 
624  float vertX_i = GetPositionX() + _polygonVertices[vertex].GetPositionX();
625  float vertY_i = GetPositionY() + _polygonVertices[vertex].GetPositionY();
626  float vertX_j = GetPositionX() + _polygonVertices[nextVertex].GetPositionX();
627  float vertY_j = GetPositionY() + _polygonVertices[nextVertex].GetPositionY();
628 
629  // following statement checks if testPoint.Y is below Y-coord of i-th vertex
630  bool belowLowY = vertY_i > testY;
631  // following statement checks if testPoint.Y is below Y-coord of i+1-th vertex
632  bool belowHighY = vertY_j > testY;
633 
634  /* following statement is true if testPoint.Y satisfies either (only one is possible)
635  -->(i).Y < testPoint.Y < (i+1).Y OR
636  -->(i).Y > testPoint.Y > (i+1).Y
637 
638  (Note)
639  Both of the conditions indicate that a point is located within the edges of the Y-th coordinate
640  of the (i)-th and the (i+1)- th vertices of the polygon. If neither of the above
641  conditions is satisfied, then it is assured that a semi-infinite horizontal line draw
642  to the right from the testpoint will NOT cross the line that connects vertices i and i+1
643  of the polygon
644  */
645  bool withinYsEdges = belowLowY != belowHighY;
646 
647  if (withinYsEdges)
648  {
649  // this is the slope of the line that connects vertices i and i+1 of the polygon
650  float slopeOfLine = (vertX_j - vertX_i) / (vertY_j - vertY_i);
651 
652  // this looks up the x-coord of a point lying on the above line, given its y-coord
653  float pointOnLine = (slopeOfLine* (testY - vertY_i)) + vertX_i;
654 
655  //checks to see if x-coord of testPoint is smaller than the point on the line with the same y-coord
656  bool isLeftToLine = testX < pointOnLine;
657 
658  if (isLeftToLine)
659  {
660  //this statement changes true to false (and vice-versa)
661  locatedInPolygon = !locatedInPolygon;
662  }//end if (isLeftToLine)
663  }//end if (withinYsEdges
664  }
665 
666  return locatedInPolygon;
667 }
float GetPositionY() const
Definition: Position.h:78
float GetPositionX() const
Definition: Position.h:77
std::vector< Position > _polygonVertices
Definition: AreaTrigger.h:175
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ClearUpdateMask()

void AreaTrigger::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

1071 {
1073  Object::ClearUpdateMask(remove);
1074 }
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:756
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:664
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
UF::UpdateFieldHolder m_values
Definition: Object.h:251
+ Here is the call graph for this function:

◆ Create()

bool AreaTrigger::Create ( uint32  areaTriggerCreatePropertiesId,
Unit caster,
Unit target,
SpellInfo const *  spell,
Position const &  pos,
int32  duration,
SpellCastVisual  spellVisual,
ObjectGuid const &  castId,
AuraEffect const *  aurEff 
)
private
95 {
96  _targetGuid = target ? target->GetGUID() : ObjectGuid::Empty;
97  _aurEff = aurEff;
98 
99  SetMap(caster->GetMap());
100  Relocate(pos);
101  if (!IsPositionValid())
102  {
103  TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (areaTriggerCreatePropertiesId %u) not created. Invalid coordinates (X: %f Y: %f)", areaTriggerCreatePropertiesId, GetPositionX(), GetPositionY());
104  return false;
105  }
106 
107  _areaTriggerCreateProperties = sAreaTriggerDataStore->GetAreaTriggerCreateProperties(areaTriggerCreatePropertiesId);
109  {
110  TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (areaTriggerCreatePropertiesId %u) not created. Invalid areatrigger create properties id (%u)", areaTriggerCreatePropertiesId, areaTriggerCreatePropertiesId);
111  return false;
112  }
113 
115 
116  Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), GetTemplate() ? GetTemplate()->Id.Id : 0, caster->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>()));
117 
118  if (GetTemplate())
120 
121  SetDuration(duration);
122 
123  SetObjectScale(1.0f);
124 
127 
128  auto areaTriggerData = m_values.ModifyValue(&AreaTrigger::m_areaTriggerData);
129  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::Caster), caster->GetGUID());
130  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::CreatingEffectGUID), castId);
131 
132  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellID), spell->Id);
133  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), spell->Id);
135  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), spellVisual.ScriptVisualID);
139 
140  if (GetCreateProperties()->ExtraScale.Data.Structured.StartTimeOffset)
143  {
144  Position point(GetCreateProperties()->ExtraScale.Data.Structured.Points[0], GetCreateProperties()->ExtraScale.Data.Structured.Points[1]);
145  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve).ModifyValue(&UF::ScaleCurve::Points, 0), point);
146  }
148  {
149  Position point(GetCreateProperties()->ExtraScale.Data.Structured.Points[2], GetCreateProperties()->ExtraScale.Data.Structured.Points[3]);
150  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve).ModifyValue(&UF::ScaleCurve::Points, 1), point);
151  }
154  if (GetCreateProperties()->ExtraScale.Data.Structured.OverrideActive)
156 
160  SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::VisualAnim).ModifyValue(&UF::VisualAnim::Field_C), true);
161 
162  PhasingHandler::InheritPhaseShift(this, caster);
163 
164  if (target && GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
165  {
166  m_movementInfo.transport.guid = target->GetGUID();
167  }
168 
170  SetZoneScript();
171 
172  UpdateShape();
173 
175 
176  if (GetCreateProperties()->OrbitInfo)
177  {
179  if (target && GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
180  orbit.PathTarget = target->GetGUID();
181  else
182  orbit.Center = pos;
183 
184  InitOrbit(orbit, timeToTarget);
185  }
186  else if (GetCreateProperties()->HasSplines())
187  {
188  InitSplineOffsets(GetCreateProperties()->SplinePoints, timeToTarget);
189  }
190 
191  // movement on transport of areatriggers on unit is handled by themself
192  TransportBase* transport = m_movementInfo.transport.guid.IsEmpty() ? caster->GetTransport() : nullptr;
193  if (transport)
194  {
195  float x, y, z, o;
196  pos.GetPosition(x, y, z, o);
197  transport->CalculatePassengerOffset(x, y, z, &o);
198  m_movementInfo.transport.pos.Relocate(x, y, z, o);
199 
200  // This object must be added to transport before adding to map for the client to properly display it
201  transport->AddPassenger(this);
202  }
203 
204  AI_Initialize();
205 
206  // Relocate areatriggers with circular movement again
207  if (HasOrbit())
209 
210  if (!GetMap()->AddToMap(this))
211  {
212  // Returning false will cause the object to be deleted - remove from transport
213  if (transport)
214  transport->RemovePassenger(this);
215  return false;
216  }
217 
218  caster->_RegisterAreaTrigger(this);
219 
220  _ai->OnCreate();
221 
222  return true;
223 }
#define sAreaTriggerDataStore
Definition: AreaTriggerDataStore.h:44
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
virtual void CalculatePassengerOffset(float &x, float &y, float &z, float *o=nullptr) const =0
This method transforms supplied global coordinates into local offsets.
static ObjectGuid const Empty
Definition: ObjectGuid.h:265
uint32 Raw[MAX_AREATRIGGER_SCALE]
Definition: AreaTriggerTemplate.h:115
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:116
Position CalculateOrbitPosition() const
Definition: AreaTrigger.cpp:865
void SetDuration(int32 newDuration)
Definition: AreaTrigger.cpp:336
uint32 DecalPropertiesId
Definition: AreaTriggerTemplate.h:234
UpdateField< float, 0, 11 > BoundsRadius2D
Definition: UpdateFields.h:893
uint32 TimeToTargetScale
Definition: AreaTriggerTemplate.h:237
UpdateField< ObjectGuid, 0, 3 > Caster
Definition: UpdateFields.h:885
MovementInfo m_movementInfo
Definition: Object.h:690
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
Definition: AreaTriggerTemplate.h:34
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
virtual void SetMap(Map *map)
Definition: Object.cpp:1698
void UpdatePositionData()
Definition: Object.cpp:901
UpdateField< bool, 0, 1 > OverrideActive
Definition: UpdateFields.h:859
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
Definition: PhasingHandler.cpp:256
Optional< ObjectGuid > PathTarget
Definition: AreaTriggerTemplate.h:188
float GetMaxSearchRadius() const
Definition: AreaTriggerTemplate.cpp:102
AreaTriggerScaleInfo ExtraScale
Definition: AreaTriggerTemplate.h:240
AreaTriggerId Id
Definition: AreaTriggerTemplate.h:209
float _maxSearchRadius
Definition: AreaTrigger.h:166
int32 ScriptVisualID
Definition: UpdateFields.h:213
void SetEntry(uint32 entry)
Definition: Object.h:159
void UpdateShape()
Definition: AreaTrigger.cpp:669
virtual TransportBase * RemovePassenger(WorldObject *passenger)=0
struct MovementInfo::TransportInfo transport
bool HasFlag(uint32 flag) const
Definition: AreaTriggerTemplate.h:207
int32 AnimKitId
Definition: AreaTriggerTemplate.h:232
Definition: VehicleDefines.h:153
UpdateField< int32, 0, 9 > SpellForVisuals
Definition: UpdateFields.h:891
AuraEffect const * _aurEff
Definition: AreaTrigger.h:163
float GetPositionY() const
Definition: Position.h:78
Map * GetMap() const
Definition: Object.h:555
UpdateField< uint32, 0, 2 > StartTimeOffset
Definition: UpdateFields.h:860
int32 AnimId
Definition: AreaTriggerTemplate.h:231
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
Optional< AreaTriggerOrbitInfo > OrbitInfo
Definition: AreaTriggerTemplate.h:247
UpdateField< UF::VisualAnim, 0, 17 > VisualAnim
Definition: UpdateFields.h:899
void Relocate(float x, float y)
Definition: Position.h:64
union AreaTriggerScaleInfo::@196 Data
ObjectGuid _targetGuid
Definition: AreaTrigger.h:161
struct AreaTriggerScaleInfo::@196::@197 Structured
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
uint32 Id
Definition: AreaTriggerTemplate.h:78
UpdateField< ObjectGuid, 0, 13 > CreatingEffectGUID
Definition: UpdateFields.h:895
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
AreaTriggerShapeInfo Shape
Definition: AreaTriggerTemplate.h:242
uint32 ScriptVisualID
Definition: SpellDefines.h:487
uint32_t uint32
Definition: Define.h:143
void InitOrbit(AreaTriggerOrbitInfo const &orbit, uint32 timeToTarget)
Definition: AreaTrigger.cpp:818
UpdateField< int32, 0, 8 > SpellID
Definition: UpdateFields.h:890
UpdateField< uint32, 0, 6 > TimeToTargetScale
Definition: UpdateFields.h:888
int32 SpellXSpellVisualID
Definition: UpdateFields.h:212
Definition: AreaTriggerTemplate.h:186
void _RegisterAreaTrigger(AreaTrigger *areaTrigger)
Definition: Unit.cpp:5173
UpdateField< uint32, 0, 3 > AnimKitID
Definition: UpdateFields.h:873
Position pos
Definition: MovementInfo.h:51
float GetPositionX() const
Definition: Position.h:77
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
bool IsEmpty() const
Definition: ObjectGuid.h:310
uint32 GetMapId() const
Definition: Position.h:186
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
virtual void SetObjectScale(float scale)
Definition: Object.h:162
UpdateField< UF::SpellCastVisual, 0, 10 > SpellVisual
Definition: UpdateFields.h:892
void SetZoneScript()
Definition: Object.cpp:1913
bool HasOrbit() const
Definition: AreaTrigger.cpp:845
AreaTriggerCreateProperties const * _areaTriggerCreateProperties
Definition: AreaTrigger.h:184
bool HasSplines() const
Definition: AreaTrigger.cpp:813
Definition: Position.h:27
void AI_Initialize()
Definition: AreaTrigger.cpp:994
Optional< TaggedPosition< Position::XYZ > > Center
Definition: AreaTriggerTemplate.h:189
UpdateField< uint32, 0, 3 > ParameterCurve
Definition: UpdateFields.h:861
uint32 SpellXSpellVisualID
Definition: SpellDefines.h:486
AreaTriggerCreateProperties const * GetCreateProperties() const
Definition: AreaTrigger.h:104
ObjectGuid guid
Definition: MovementInfo.h:50
UpdateField< bool, 0, 1 > Field_C
Definition: UpdateFields.h:871
AreaTriggerTemplate const * Template
Definition: AreaTriggerTemplate.h:224
AreaTriggerTemplate const * _areaTriggerTemplate
Definition: AreaTrigger.h:185
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:600
virtual void AddPassenger(WorldObject *passenger)=0
UpdateField< uint32, 0, 2 > AnimationDataID
Definition: UpdateFields.h:872
UpdateFieldArray< TaggedPosition< Position::XY >, 2, 4, 5 > Points
Definition: UpdateFields.h:862
UF::UpdateFieldHolder m_values
Definition: Object.h:251
uint32 TimeToTarget
Definition: AreaTriggerTemplate.h:236
UpdateField< uint32, 0, 12 > DecalPropertiesID
Definition: UpdateFields.h:894
bool IsPositionValid() const
Definition: Position.cpp:42
void InitSplineOffsets(std::vector< Position > const &offsets, uint32 timeToTarget)
Definition: AreaTrigger.cpp:749
UpdateField< UF::ScaleCurve, 0, 2 > ExtraScaleCurve
Definition: UpdateFields.h:884
TransportBase * GetTransport() const
Definition: Object.h:679
Definition: AreaTriggerTemplate.h:40
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateAreaTrigger()

AreaTrigger * AreaTrigger::CreateAreaTrigger ( uint32  areaTriggerCreatePropertiesId,
Unit caster,
Unit target,
SpellInfo const *  spell,
Position const &  pos,
int32  duration,
SpellCastVisual  spellVisual,
ObjectGuid const &  castId = ObjectGuid::Empty,
AuraEffect const *  aurEff = nullptr 
)
static
226 {
227  AreaTrigger* at = new AreaTrigger();
228  if (!at->Create(areaTriggerCreatePropertiesId, caster, target, spell, pos, duration, spellVisual, castId, aurEff))
229  {
230  delete at;
231  return nullptr;
232  }
233 
234  return at;
235 }
bool Create(uint32 areaTriggerCreatePropertiesId, Unit *caster, Unit *target, SpellInfo const *spell, Position const &pos, int32 duration, SpellCastVisual spellVisual, ObjectGuid const &castId, AuraEffect const *aurEff)
Definition: AreaTrigger.cpp:94
AreaTrigger()
Definition: AreaTrigger.cpp:42
Definition: AreaTrigger.h:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CreateNewMovementForceId()

ObjectGuid AreaTrigger::CreateNewMovementForceId ( Map map,
uint32  areaTriggerId 
)
static
238 {
239  return ObjectGuid::Create<HighGuid::AreaTrigger>(map->GetId(), areaTriggerId, map->GenerateLowGuid<HighGuid::AreaTrigger>());
240 }
uint32 GetId() const
Definition: Map.cpp:4410
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:600
+ Here is the call graph for this function:

◆ CreateServer()

bool AreaTrigger::CreateServer ( Map map,
AreaTriggerTemplate const *  areaTriggerTemplate,
AreaTriggerSpawn const &  position 
)
private
258 {
259  SetMap(map);
260  Relocate(position.spawnPoint);
261  if (!IsPositionValid())
262  {
263  TC_LOG_ERROR("entities.areatrigger", "AreaTriggerServer (id %u) not created. Invalid coordinates (X: %f Y: %f)",
264  areaTriggerTemplate->Id.Id, GetPositionX(), GetPositionY());
265  return false;
266  }
267 
268  _areaTriggerTemplate = areaTriggerTemplate;
269 
270  Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), areaTriggerTemplate->Id.Id, GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>()));
271 
272  SetEntry(areaTriggerTemplate->Id.Id);
273 
274  SetObjectScale(1.0f);
275 
276  _shape = position.Shape;
278 
279  if (position.phaseUseFlags || position.phaseId || position.phaseGroup)
280  PhasingHandler::InitDbPhaseShift(GetPhaseShift(), position.phaseUseFlags, position.phaseId, position.phaseGroup);
281 
282  UpdateShape();
283 
284  AI_Initialize();
285 
286  _ai->OnCreate();
287 
288  return true;
289 }
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:116
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
virtual void SetMap(Map *map)
Definition: Object.cpp:1698
float _maxSearchRadius
Definition: AreaTrigger.h:166
void SetEntry(uint32 entry)
Definition: Object.h:159
void UpdateShape()
Definition: AreaTrigger.cpp:669
float GetPositionY() const
Definition: Position.h:78
Map * GetMap() const
Definition: Object.h:555
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
void Relocate(float x, float y)
Definition: Position.h:64
PhaseShift & GetPhaseShift()
Definition: Object.h:470
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
Definition: PhasingHandler.cpp:516
float GetPositionX() const
Definition: Position.h:77
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
float GetMaxSearchRadius() const
Definition: AreaTriggerTemplate.cpp:35
uint32 GetMapId() const
Definition: Position.h:186
virtual void SetObjectScale(float scale)
Definition: Object.h:162
void AI_Initialize()
Definition: AreaTrigger.cpp:994
AreaTriggerTemplate const * _areaTriggerTemplate
Definition: AreaTrigger.h:185
bool IsPositionValid() const
Definition: Position.cpp:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugVisualizePosition()

void AreaTrigger::DebugVisualizePosition ( )
protected
987 {
988  if (Unit* caster = GetCaster())
989  if (Player* player = caster->ToPlayer())
990  if (player->isDebugAreaTriggers)
991  player->SummonCreature(1, *this, TEMPSUMMON_TIMED_DESPAWN, Milliseconds(GetTimeToTarget()));
992 }
static Player * ToPlayer(Object *o)
Definition: Object.h:198
Unit * GetCaster() const
Definition: AreaTrigger.cpp:558
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:24
uint32 GetTimeToTarget() const
Definition: AreaTrigger.h:95
Definition: Unit.h:746
Definition: ObjectDefines.h:63
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Delay()

void AreaTrigger::Delay ( int32  delaytime)
inline
100 { SetDuration(GetDuration() - delaytime); }
int32 GetDuration() const
Definition: AreaTrigger.h:97
void SetDuration(int32 newDuration)
Definition: AreaTrigger.cpp:336

◆ DoActions()

void AreaTrigger::DoActions ( Unit unit)
protected
708 {
709  Unit* caster = IsServerSide() ? unit : GetCaster();
710 
711  if (caster && GetTemplate())
712  {
713  for (AreaTriggerAction const& action : GetTemplate()->Actions)
714  {
715  if (IsServerSide() || UnitFitToActionRequirement(unit, caster, action))
716  {
717  switch (action.ActionType)
718  {
720  caster->CastSpell(unit, action.Param, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
721  .SetOriginalCastId(m_areaTriggerData->CreatingEffectGUID->IsCast() ? *m_areaTriggerData->CreatingEffectGUID : ObjectGuid::Empty));
722  break;
724  caster->AddAura(action.Param, unit);
725  break;
727  {
728  if (WorldSafeLocsEntry const* safeLoc = sObjectMgr->GetWorldSafeLoc(action.Param))
729  if (Player* player = caster->ToPlayer())
730  player->TeleportTo(safeLoc->Loc);
731  break;
732  }
733  default:
734  break;
735  }
736  }
737  }
738  }
739 }
static Player * ToPlayer(Object *o)
Definition: Object.h:198
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
Definition: AreaTriggerTemplate.h:82
Definition: AreaTriggerTemplate.h:61
static ObjectGuid const Empty
Definition: ObjectGuid.h:265
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11575
Definition: ObjectMgr.h:827
Unit * GetCaster() const
Definition: AreaTrigger.cpp:558
#define sObjectMgr
Definition: ObjectMgr.h:1967
Definition: AreaTriggerTemplate.h:59
Actions
Definition: BattlegroundIC.h:201
Definition: SpellDefines.h:434
Definition: AreaTriggerTemplate.h:60
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:260
Definition: Unit.h:746
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2730
Definition: Player.h:1131
bool UnitFitToActionRequirement(Unit *unit, Unit *caster, AreaTriggerAction const &action)
Definition: AreaTrigger.cpp:675
bool IsServerSide() const
Definition: AreaTrigger.h:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraEffect()

AuraEffect const* AreaTrigger::GetAuraEffect ( ) const
inline
93 { return _aurEff; }
AuraEffect const * _aurEff
Definition: AreaTrigger.h:163

◆ GetCaster()

Unit * AreaTrigger::GetCaster ( ) const
559 {
560  return ObjectAccessor::GetUnit(*this, GetCasterGuid());
561 }
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:206
ObjectGuid const & GetCasterGuid() const
Definition: AreaTrigger.h:109
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCasterGuid()

ObjectGuid const& AreaTrigger::GetCasterGuid ( ) const
inline
109 { return m_areaTriggerData->Caster; }
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
+ Here is the caller graph for this function:

◆ GetCircularMovementInfo()

Optional<AreaTriggerOrbitInfo> const& AreaTrigger::GetCircularMovementInfo ( ) const
inline
127 { return _orbitInfo; }
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:182
+ Here is the caller graph for this function:

◆ GetCreateProperties()

AreaTriggerCreateProperties const* AreaTrigger::GetCreateProperties ( ) const
inline
AreaTriggerCreateProperties const * _areaTriggerCreateProperties
Definition: AreaTrigger.h:184
+ Here is the caller graph for this function:

◆ GetDuration()

int32 AreaTrigger::GetDuration ( ) const
inline
97 { return _duration; }
int32 _duration
Definition: AreaTrigger.h:167
+ Here is the caller graph for this function:

◆ GetElapsedTimeForMovement()

uint32 AreaTrigger::GetElapsedTimeForMovement ( ) const
inline
123 { return GetTimeSinceCreated(); }
uint32 GetTimeSinceCreated() const
Definition: AreaTrigger.h:94
+ Here is the caller graph for this function:

◆ GetFaction()

uint32 AreaTrigger::GetFaction ( ) const
overridevirtual

Implements WorldObject.

569 {
570  if (Unit const* caster = GetCaster())
571  return caster->GetFaction();
572 
573  return 0;
574 }
Unit * GetCaster() const
Definition: AreaTrigger.cpp:558
Definition: Unit.h:746
+ Here is the call graph for this function:

◆ GetInsideUnits()

GuidUnorderedSet const& AreaTrigger::GetInsideUnits ( ) const
inline
102 { return _insideUnits; }
GuidUnorderedSet _insideUnits
Definition: AreaTrigger.h:186

◆ GetMaxSearchRadius()

float AreaTrigger::GetMaxSearchRadius ( ) const
inline
116 { return _maxSearchRadius; }
float _maxSearchRadius
Definition: AreaTrigger.h:166
+ Here is the caller graph for this function:

◆ GetOrbitCenterPosition()

Position const * AreaTrigger::GetOrbitCenterPosition ( ) const
protected
851 {
852  if (!_orbitInfo)
853  return nullptr;
854 
855  if (_orbitInfo->PathTarget)
856  if (WorldObject* center = ObjectAccessor::GetWorldObject(*this, *_orbitInfo->PathTarget))
857  return center;
858 
859  if (_orbitInfo->Center)
860  return &_orbitInfo->Center->Pos;
861 
862  return nullptr;
863 }
Definition: Object.h:430
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
Definition: ObjectAccessor.cpp:101
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:182
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid AreaTrigger::GetOwnerGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

108 { return GetCasterGuid(); }
ObjectGuid const & GetCasterGuid() const
Definition: AreaTrigger.h:109

◆ GetProgress()

float AreaTrigger::GetProgress ( ) const
protected
358 {
359  return GetTimeSinceCreated() < GetTimeToTargetScale() ? float(GetTimeSinceCreated()) / float(GetTimeToTargetScale()) : 1.0f;
360 }
uint32 GetTimeToTargetScale() const
Definition: AreaTrigger.h:96
uint32 GetTimeSinceCreated() const
Definition: AreaTrigger.h:94
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRollPitchYaw()

Position const& AreaTrigger::GetRollPitchYaw ( ) const
inline
117 { return _rollPitchYaw; }
Position _rollPitchYaw
Definition: AreaTrigger.h:173
+ Here is the caller graph for this function:

◆ GetScriptId()

uint32 AreaTrigger::GetScriptId ( ) const
548 {
549  if (_spawnId)
550  return ASSERT_NOTNULL(sAreaTriggerDataStore->GetAreaTriggerSpawn(_spawnId))->scriptId;
551 
552  if (GetCreateProperties())
553  return GetCreateProperties()->ScriptId;
554 
555  return 0;
556 }
#define sAreaTriggerDataStore
Definition: AreaTriggerDataStore.h:44
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:84
ObjectGuid::LowType _spawnId
Definition: AreaTrigger.h:159
uint32 ScriptId
Definition: AreaTriggerTemplate.h:249
AreaTriggerCreateProperties const * GetCreateProperties() const
Definition: AreaTrigger.h:104
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetShape()

AreaTriggerShapeInfo const& AreaTrigger::GetShape ( ) const
inline
115 { return _shape; }
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
+ Here is the caller graph for this function:

◆ GetSpellId()

uint32 AreaTrigger::GetSpellId ( ) const
inline
92 { return m_areaTriggerData->SpellID; }
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
+ Here is the caller graph for this function:

◆ GetSpline()

::Movement::Spline<int32> const& AreaTrigger::GetSpline ( ) const
inline
122 { return *_spline; }
std::unique_ptr<::Movement::Spline< int32 > > _spline
Definition: AreaTrigger.h:176
+ Here is the caller graph for this function:

◆ GetTarget()

Unit * AreaTrigger::GetTarget ( ) const
564 {
565  return ObjectAccessor::GetUnit(*this, _targetGuid);
566 }
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:206
ObjectGuid _targetGuid
Definition: AreaTrigger.h:161
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTargetRollPitchYaw()

Position const& AreaTrigger::GetTargetRollPitchYaw ( ) const
inline
118 { return _targetRollPitchYaw; }
Position _targetRollPitchYaw
Definition: AreaTrigger.h:174
+ Here is the caller graph for this function:

◆ GetTemplate()

AreaTriggerTemplate const * AreaTrigger::GetTemplate ( ) const
543 {
544  return _areaTriggerTemplate;
545 }
AreaTriggerTemplate const * _areaTriggerTemplate
Definition: AreaTrigger.h:185
+ Here is the caller graph for this function:

◆ GetTimeSinceCreated()

uint32 AreaTrigger::GetTimeSinceCreated ( ) const
inline
94 { return _timeSinceCreated; }
uint32 _timeSinceCreated
Definition: AreaTrigger.h:169
+ Here is the caller graph for this function:

◆ GetTimeToTarget()

uint32 AreaTrigger::GetTimeToTarget ( ) const
inline
95 { return m_areaTriggerData->TimeToTarget; }
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
+ Here is the caller graph for this function:

◆ GetTimeToTargetScale()

uint32 AreaTrigger::GetTimeToTargetScale ( ) const
inline
96 { return m_areaTriggerData->TimeToTargetScale; }
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
+ Here is the caller graph for this function:

◆ GetTotalDuration()

int32 AreaTrigger::GetTotalDuration ( ) const
inline
98 { return _totalDuration; }
int32 _totalDuration
Definition: AreaTrigger.h:168

◆ HandleUnitEnterExit()

void AreaTrigger::HandleUnitEnterExit ( std::vector< Unit *> const &  targetList)
protected
494 {
495  GuidUnorderedSet exitUnits(std::move(_insideUnits));
496 
497  std::vector<Unit*> enteringUnits;
498 
499  for (Unit* unit : newTargetList)
500  {
501  if (exitUnits.erase(unit->GetGUID()) == 0) // erase(key_type) returns number of elements erased
502  enteringUnits.push_back(unit);
503 
504  _insideUnits.insert(unit->GetGUID());
505  }
506 
507  // Handle after _insideUnits have been reinserted so we can use GetInsideUnits() in hooks
508  for (Unit* unit : enteringUnits)
509  {
510  if (Player* player = unit->ToPlayer())
511  {
512  if (player->isDebugAreaTriggers)
513  ChatHandler(player->GetSession()).PSendSysMessage(LANG_DEBUG_AREATRIGGER_ENTERED, GetEntry());
514 
515  player->UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_AREA_TRIGGER_ENTER, GetEntry(), 1);
516  }
517 
518  DoActions(unit);
519 
520  _ai->OnUnitEnter(unit);
521  }
522 
523  for (ObjectGuid const& exitUnitGuid : exitUnits)
524  {
525  if (Unit* leavingUnit = ObjectAccessor::GetUnit(*this, exitUnitGuid))
526  {
527  if (Player* player = leavingUnit->ToPlayer())
528  {
529  if (player->isDebugAreaTriggers)
530  ChatHandler(player->GetSession()).PSendSysMessage(LANG_DEBUG_AREATRIGGER_LEFT, GetEntry());
531 
532  player->UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_AREA_TRIGGER_EXIT, GetEntry(), 1);
533  }
534 
535  UndoActions(leavingUnit);
536 
537  _ai->OnUnitExit(leavingUnit);
538  }
539  }
540 }
void DoActions(Unit *unit)
Definition: AreaTrigger.cpp:707
static Player * ToPlayer(Object *o)
Definition: Object.h:198
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:389
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:206
GuidUnorderedSet _insideUnits
Definition: AreaTrigger.h:186
void UndoActions(Unit *unit)
Definition: AreaTrigger.cpp:741
Definition: Language.h:1016
Definition: QuestDef.h:332
Definition: Language.h:978
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
uint32 GetEntry() const
Definition: Object.h:158
Definition: Chat.h:37
Definition: QuestDef.h:331
Definition: ObjectGuid.h:258
Definition: Unit.h:746
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasOrbit()

bool AreaTrigger::HasOrbit ( ) const
846 {
847  return _orbitInfo.has_value();
848 }
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:182
+ Here is the caller graph for this function:

◆ HasSplines()

bool AreaTrigger::HasSplines ( ) const
814 {
815  return bool(_spline);
816 }
std::unique_ptr<::Movement::Spline< int32 > > _spline
Definition: AreaTrigger.h:176
+ Here is the caller graph for this function:

◆ InitOrbit()

void AreaTrigger::InitOrbit ( AreaTriggerOrbitInfo const &  orbit,
uint32  timeToTarget 
)
Todo:
: research the right value, in sniffs both timers are nearly identical
819 {
820  // Circular movement requires either a center position or an attached unit
821  ASSERT(orbit.Center.has_value() || orbit.PathTarget.has_value());
822 
823  // should be sent in object create packets only
825  {
827  const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::TimeToTarget);
828  });
829 
830  _orbitInfo = orbit;
831 
832  _orbitInfo->TimeToTarget = timeToTarget;
833  _orbitInfo->ElapsedTimeForMovement = 0;
834 
835  if (IsInWorld())
836  {
838  reshape.TriggerGUID = GetGUID();
839  reshape.AreaTriggerOrbit = _orbitInfo;
840 
841  SendMessageToSet(reshape.Write(), true);
842  }
843 }
Optional< AreaTriggerOrbitInfo > AreaTriggerOrbit
Definition: AreaTriggerPackets.h:82
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
bool IsInWorld() const
Definition: Object.h:151
Definition: AreaTriggerPackets.h:74
WorldPacket const * Write() override
Definition: AreaTriggerPackets.cpp:82
ObjectGuid TriggerGUID
Definition: AreaTriggerPackets.h:84
ObjectGuid const & GetGUID() const
Definition: Object.h:157
UpdateField< uint32, 0, 5 > TimeToTarget
Definition: UpdateFields.h:887
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
void ClearChanged(UpdateField< T, BlockBit, Bit >(Derived::*))
Definition: UpdateField.h:549
#define ASSERT
Definition: Errors.h:68
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:182
Definition: UpdateFields.h:881
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1648
UF::UpdateFieldHolder m_values
Definition: Object.h:251
void DoWithSuppressingObjectUpdates(Action &&action)
Definition: Object.h:362
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitSplineOffsets()

void AreaTrigger::InitSplineOffsets ( std::vector< Position > const &  offsets,
uint32  timeToTarget 
)
750 {
751  float angleSin = std::sin(GetOrientation());
752  float angleCos = std::cos(GetOrientation());
753 
754  // This is needed to rotate the spline, following caster orientation
755  std::vector<G3D::Vector3> rotatedPoints;
756  rotatedPoints.reserve(offsets.size());
757  for (Position const& offset : offsets)
758  {
759  float x = GetPositionX() + (offset.GetPositionX() * angleCos - offset.GetPositionY() * angleSin);
760  float y = GetPositionY() + (offset.GetPositionY() * angleCos + offset.GetPositionX() * angleSin);
761  float z = GetPositionZ();
762 
763  UpdateAllowedPositionZ(x, y, z);
764  z += offset.GetPositionZ();
765 
766  rotatedPoints.emplace_back(x, y, z);
767  }
768 
769  InitSplines(std::move(rotatedPoints), timeToTarget);
770 }
float GetOrientation() const
Definition: Position.h:80
float GetPositionY() const
Definition: Position.h:78
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition: Object.cpp:1275
void InitSplines(std::vector< G3D::Vector3 > splinePoints, uint32 timeToTarget)
Definition: AreaTrigger.cpp:772
float GetPositionZ() const
Definition: Position.h:79
float GetPositionX() const
Definition: Position.h:77
Definition: Position.h:27
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ InitSplines()

void AreaTrigger::InitSplines ( std::vector< G3D::Vector3 >  splinePoints,
uint32  timeToTarget 
)
773 {
774  if (splinePoints.size() < 2)
775  return;
776 
777  _movementTime = 0;
778 
779  _spline = std::make_unique<::Movement::Spline<int32>>();
780  _spline->init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear);
781  _spline->initLengths();
782 
783  // should be sent in object create packets only
785  {
787  const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::TimeToTarget);
788  });
789 
790  if (IsInWorld())
791  {
793  {
795  reshape.TriggerGUID = GetGUID();
796  SendMessageToSet(reshape.Write(), true);
797  }
798 
800  reshape.TriggerGUID = GetGUID();
801  reshape.AreaTriggerSpline.emplace();
802  reshape.AreaTriggerSpline->ElapsedTimeForMovement = GetElapsedTimeForMovement();
803  reshape.AreaTriggerSpline->TimeToTarget = timeToTarget;
804  for (G3D::Vector3 const& vec : splinePoints)
805  reshape.AreaTriggerSpline->Points.emplace_back(vec.x, vec.y, vec.z);
806 
807  SendMessageToSet(reshape.Write(), true);
808  }
809 
810  _reachedDestination = false;
811 }
bool _reachedDestination
Definition: AreaTrigger.h:178
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
bool IsInWorld() const
Definition: Object.h:151
uint32 _movementTime
Definition: AreaTrigger.h:180
Definition: AreaTriggerPackets.h:74
WorldPacket const * Write() override
Definition: AreaTriggerPackets.cpp:82
uint32 GetElapsedTimeForMovement() const
Definition: AreaTrigger.h:123
std::unique_ptr<::Movement::Spline< int32 > > _spline
Definition: AreaTrigger.h:176
Definition: Spline.h:37
ObjectGuid TriggerGUID
Definition: AreaTriggerPackets.h:84
ObjectGuid const & GetGUID() const
Definition: Object.h:157
UpdateField< uint32, 0, 5 > TimeToTarget
Definition: UpdateFields.h:887
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
void ClearChanged(UpdateField< T, BlockBit, Bit >(Derived::*))
Definition: UpdateField.h:549
Definition: UpdateFields.h:881
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1648
UF::UpdateFieldHolder m_values
Definition: Object.h:251
void DoWithSuppressingObjectUpdates(Action &&action)
Definition: Object.h:362
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsNeverVisibleFor()

bool AreaTrigger::IsNeverVisibleFor ( WorldObject const *  seer) const
inlineoverridevirtual

Reimplemented from WorldObject.

78 { return WorldObject::IsNeverVisibleFor(seer) || IsServerSide(); }
virtual bool IsNeverVisibleFor(WorldObject const *) const
Definition: Object.h:748
bool IsServerSide() const
Definition: AreaTrigger.h:76
+ Here is the call graph for this function:

◆ IsRemoved()

bool AreaTrigger::IsRemoved ( ) const
inline
91 { return _isRemoved; }
bool _isRemoved
Definition: AreaTrigger.h:171

◆ IsServerSide()

bool AreaTrigger::IsServerSide ( ) const
inline
AreaTriggerId Id
Definition: AreaTriggerTemplate.h:209
bool IsServerSide
Definition: AreaTriggerTemplate.h:79
AreaTriggerTemplate const * _areaTriggerTemplate
Definition: AreaTrigger.h:185
+ Here is the caller graph for this function:

◆ LoadFromDB()

bool AreaTrigger::LoadFromDB ( ObjectGuid::LowType  spawnId,
Map map,
bool  addToMap,
bool  allowDuplicate 
)
243 {
244  _spawnId = spawnId;
245 
246  AreaTriggerSpawn const* position = sAreaTriggerDataStore->GetAreaTriggerSpawn(spawnId);
247  if (!position)
248  return false;
249 
250  AreaTriggerTemplate const* areaTriggerTemplate = sAreaTriggerDataStore->GetAreaTriggerTemplate(position->Id);
251  if (!areaTriggerTemplate)
252  return false;
253 
254  return CreateServer(map, areaTriggerTemplate, *position);
255 }
#define sAreaTriggerDataStore
Definition: AreaTriggerDataStore.h:44
bool CreateServer(Map *map, AreaTriggerTemplate const *areaTriggerTemplate, AreaTriggerSpawn const &position)
Definition: AreaTrigger.cpp:257
Definition: AreaTriggerTemplate.h:252
ObjectGuid::LowType _spawnId
Definition: AreaTrigger.h:159
AreaTriggerId Id
Definition: AreaTriggerTemplate.h:256
Definition: AreaTriggerTemplate.h:201
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Remove()

void AreaTrigger::Remove ( )
329 {
330  if (IsInWorld())
331  {
332  AddObjectToRemoveList(); // calls RemoveFromWorld
333  }
334 }
bool IsInWorld() const
Definition: Object.h:151
void AddObjectToRemoveList()
Definition: Object.cpp:1728
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveFromWorld()

void AreaTrigger::RemoveFromWorld ( )
overridevirtual
  • Remove the AreaTrigger from the accessor and from all lists of objects in world

Reimplemented from Object.

72 {
74  if (IsInWorld())
75  {
76  _isRemoved = true;
77 
78  if (Unit* caster = GetCaster())
79  caster->_UnregisterAreaTrigger(this);
80 
81  // Handle removal of all units, calling OnUnitExit & deleting auras if needed
83 
84  _ai->OnRemove();
85 
87 
88  if (_spawnId)
89  Trinity::Containers::MultimapErasePair(GetMap()->GetAreaTriggerBySpawnIdStore(), _spawnId, this);
91  }
92 }
void HandleUnitEnterExit(std::vector< Unit *> const &targetList)
Definition: AreaTrigger.cpp:493
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition: Containers.h:266
bool IsInWorld() const
Definition: Object.h:151
Unit * GetCaster() const
Definition: AreaTrigger.cpp:558
Map * GetMap() const
Definition: Object.h:555
ObjectGuid const & GetGUID() const
Definition: Object.h:157
ObjectGuid::LowType _spawnId
Definition: AreaTrigger.h:159
void RemoveFromWorld() override
Definition: Object.cpp:925
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:493
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
bool _isRemoved
Definition: AreaTrigger.h:171
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:122
Definition: Unit.h:746
Definition: AreaTrigger.h:42
+ Here is the call graph for this function:

◆ SearchUnitInBox()

void AreaTrigger::SearchUnitInBox ( std::vector< Unit *> &  targetList)
protected
433 {
434  SearchUnits(targetList, GetMaxSearchRadius(), false);
435 
436  Position const& boxCenter = GetPosition();
437  float extentsX = _shape.BoxDatas.Extents[0];
438  float extentsY = _shape.BoxDatas.Extents[1];
439  float extentsZ = _shape.BoxDatas.Extents[2];
440 
441  targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [boxCenter, extentsX, extentsY, extentsZ](Unit* unit) -> bool
442  {
443  return !unit->IsWithinBox(boxCenter, extentsX, extentsY, extentsZ);
444  }), targetList.end());
445 }
Position GetPosition() const
Definition: Position.h:85
void SearchUnits(std::vector< Unit *> &targetList, float radius, bool check3D)
Definition: AreaTrigger.cpp:401
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
Definition: Position.h:27
Definition: Unit.h:746
struct AreaTriggerShapeInfo::@199::@203 BoxDatas
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SearchUnitInCylinder()

void AreaTrigger::SearchUnitInCylinder ( std::vector< Unit *> &  targetList)
protected
464 {
465  SearchUnits(targetList, GetMaxSearchRadius(), false);
466 
467  float height = _shape.CylinderDatas.Height;
468  float minZ = GetPositionZ() - height;
469  float maxZ = GetPositionZ() + height;
470 
471  targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [minZ, maxZ](Unit* unit) -> bool
472  {
473  return unit->GetPositionZ() < minZ
474  || unit->GetPositionZ() > maxZ;
475  }), targetList.end());
476 }
void SearchUnits(std::vector< Unit *> &targetList, float radius, bool check3D)
Definition: AreaTrigger.cpp:401
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
float GetPositionZ() const
Definition: Position.h:79
Definition: Unit.h:746
struct AreaTriggerShapeInfo::@199::@205 CylinderDatas
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SearchUnitInDisk()

void AreaTrigger::SearchUnitInDisk ( std::vector< Unit *> &  targetList)
protected
479 {
480  SearchUnits(targetList, GetMaxSearchRadius(), false);
481 
482  float innerRadius = _shape.DiskDatas.InnerRadius;
483  float height = _shape.DiskDatas.Height;
484  float minZ = GetPositionZ() - height;
485  float maxZ = GetPositionZ() + height;
486 
487  targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [this, innerRadius, minZ, maxZ](Unit const* unit) -> bool
488  {
489  return unit->IsInDist2d(this, innerRadius) || unit->GetPositionZ() < minZ || unit->GetPositionZ() > maxZ;
490  }), targetList.end());
491 }
struct AreaTriggerShapeInfo::@199::@206 DiskDatas
void SearchUnits(std::vector< Unit *> &targetList, float radius, bool check3D)
Definition: AreaTrigger.cpp:401
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
float GetPositionZ() const
Definition: Position.h:79
Definition: Unit.h:746
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SearchUnitInPolygon()

void AreaTrigger::SearchUnitInPolygon ( std::vector< Unit *> &  targetList)
protected
448 {
449  SearchUnits(targetList, GetMaxSearchRadius(), false);
450 
451  float height = _shape.PolygonDatas.Height;
452  float minZ = GetPositionZ() - height;
453  float maxZ = GetPositionZ() + height;
454 
455  targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [this, minZ, maxZ](Unit* unit) -> bool
456  {
457  return !CheckIsInPolygon2D(unit)
458  || unit->GetPositionZ() < minZ
459  || unit->GetPositionZ() > maxZ;
460  }), targetList.end());
461 }
void SearchUnits(std::vector< Unit *> &targetList, float radius, bool check3D)
Definition: AreaTrigger.cpp:401
struct AreaTriggerShapeInfo::@199::@204 PolygonDatas
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
bool CheckIsInPolygon2D(Position const *pos) const
Definition: AreaTrigger.cpp:600
float GetPositionZ() const
Definition: Position.h:79
Definition: Unit.h:746
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SearchUnitInSphere()

void AreaTrigger::SearchUnitInSphere ( std::vector< Unit *> &  targetList)
protected
417 {
418  float radius = _shape.SphereDatas.Radius;
420  {
421  if (GetCreateProperties()->MorphCurveId)
422  {
423  radius = G3D::lerp(_shape.SphereDatas.Radius,
424  _shape.SphereDatas.RadiusTarget,
425  sDB2Manager.GetCurveValueAt(GetCreateProperties()->MorphCurveId, GetProgress()));
426  }
427  }
428 
429  SearchUnits(targetList, radius, true);
430 }
#define sDB2Manager
Definition: DB2Stores.h:479
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
Definition: AreaTriggerTemplate.h:33
void SearchUnits(std::vector< Unit *> &targetList, float radius, bool check3D)
Definition: AreaTrigger.cpp:401
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
struct AreaTriggerShapeInfo::@199::@202 SphereDatas
AreaTriggerCreateProperties const * GetCreateProperties() const
Definition: AreaTrigger.h:104
float GetProgress() const
Definition: AreaTrigger.cpp:357
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SearchUnits()

void AreaTrigger::SearchUnits ( std::vector< Unit *> &  targetList,
float  radius,
bool  check3D 
)
protected
402 {
403  Trinity::AnyUnitInObjectRangeCheck check(this, radius, check3D);
404  if (IsServerSide())
405  {
406  Trinity::PlayerListSearcher<Trinity::AnyUnitInObjectRangeCheck> searcher(this, targetList, check);
407  Cell::VisitWorldObjects(this, searcher, GetMaxSearchRadius());
408  }
409  else
410  {
411  Trinity::UnitListSearcher<Trinity::AnyUnitInObjectRangeCheck> searcher(this, targetList, check);
412  Cell::VisitAllObjects(this, searcher, GetMaxSearchRadius());
413  }
414 }
Definition: GridNotifiers.h:1102
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:191
Definition: GridNotifiers.h:610
Definition: GridNotifiers.h:508
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:203
bool IsServerSide() const
Definition: AreaTrigger.h:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDuration()

void AreaTrigger::SetDuration ( int32  newDuration)
337 {
338  _duration = newDuration;
339  _totalDuration = newDuration;
340 
341  // negative duration (permanent areatrigger) sent as 0
343 }
UpdateField< uint32, 0, 4 > Duration
Definition: UpdateFields.h:886
int32 _duration
Definition: AreaTrigger.h:167
int32 _totalDuration
Definition: AreaTrigger.h:168
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
UF::UpdateFieldHolder m_values
Definition: Object.h:251
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UndoActions()

void AreaTrigger::UndoActions ( Unit unit)
protected
742 {
743  if (GetTemplate())
744  for (AreaTriggerAction const& action : GetTemplate()->Actions)
745  if (action.ActionType == AREATRIGGER_ACTION_CAST || action.ActionType == AREATRIGGER_ACTION_ADDAURA)
746  unit->RemoveAurasDueToSpell(action.Param, GetCasterGuid());
747 }
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
Definition: AreaTriggerTemplate.h:82
ObjectGuid const & GetCasterGuid() const
Definition: AreaTrigger.h:109
Definition: AreaTriggerTemplate.h:59
Actions
Definition: BattlegroundIC.h:201
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3686
Definition: AreaTriggerTemplate.h:60
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Update()

void AreaTrigger::Update ( uint32  diff)
overridevirtual

Reimplemented from WorldObject.

292 {
293  WorldObject::Update(diff);
294  _timeSinceCreated += diff;
295 
296  if (!IsServerSide())
297  {
298  // "If" order matter here, Orbit > Attached > Splines
299  if (HasOrbit())
300  {
301  UpdateOrbitPosition(diff);
302  }
303  else if (GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
304  {
305  if (Unit* target = GetTarget())
306  GetMap()->AreaTriggerRelocation(this, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation());
307  }
308  else
309  UpdateSplinePosition(diff);
310 
311  if (GetDuration() != -1)
312  {
313  if (GetDuration() > int32(diff))
314  _UpdateDuration(_duration - diff);
315  else
316  {
317  Remove(); // expired
318  return;
319  }
320  }
321  }
322 
323  _ai->OnUpdate(diff);
324 
326 }
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
int32 _duration
Definition: AreaTrigger.h:167
int32 GetDuration() const
Definition: AreaTrigger.h:97
void _UpdateDuration(int32 newDuration)
Definition: AreaTrigger.cpp:345
Definition: AreaTriggerTemplate.h:34
void UpdateTargetList()
Definition: AreaTrigger.cpp:362
virtual void Update(uint32)
Definition: Object.h:437
Map * GetMap() const
Definition: Object.h:555
int32_t int32
Definition: Define.h:139
void Remove()
Definition: AreaTrigger.cpp:328
uint32 _timeSinceCreated
Definition: AreaTrigger.h:169
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
Definition: Map.cpp:1345
bool HasOrbit() const
Definition: AreaTrigger.cpp:845
Unit * GetTarget() const
Definition: AreaTrigger.cpp:563
Definition: Unit.h:746
void UpdateOrbitPosition(uint32 diff)
Definition: AreaTrigger.cpp:902
bool IsServerSide() const
Definition: AreaTrigger.h:76
void UpdateSplinePosition(uint32 diff)
Definition: AreaTrigger.cpp:917
+ Here is the call graph for this function:

◆ UpdateOrbitPosition()

void AreaTrigger::UpdateOrbitPosition ( uint32  diff)
protected
903 {
904  if (_orbitInfo->StartDelay > GetElapsedTimeForMovement())
905  return;
906 
907  _orbitInfo->ElapsedTimeForMovement = GetElapsedTimeForMovement() - _orbitInfo->StartDelay;
908 
910 
912 #ifdef TRINITY_DEBUG
914 #endif
915 }
Position CalculateOrbitPosition() const
Definition: AreaTrigger.cpp:865
float GetOrientation() const
Definition: Position.h:80
uint32 GetElapsedTimeForMovement() const
Definition: AreaTrigger.h:123
float GetPositionY() const
Definition: Position.h:78
Map * GetMap() const
Definition: Object.h:555
void DebugVisualizePosition()
Definition: AreaTrigger.cpp:986
float GetPositionZ() const
Definition: Position.h:79
float GetPositionX() const
Definition: Position.h:77
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
Definition: Map.cpp:1345
Definition: Position.h:27
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:182
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdatePolygonOrientation()

void AreaTrigger::UpdatePolygonOrientation ( )
protected
577 {
578  float newOrientation = GetOrientation();
579 
580  // No need to recalculate, orientation didn't change
581  if (G3D::fuzzyEq(_previousCheckOrientation, newOrientation))
582  return;
583 
584  _polygonVertices.assign(GetCreateProperties()->PolygonVertices.begin(), GetCreateProperties()->PolygonVertices.end());
585 
586  float angleSin = std::sin(newOrientation);
587  float angleCos = std::cos(newOrientation);
588 
589  // This is needed to rotate the vertices, following orientation
590  for (Position& vertice : _polygonVertices)
591  {
592  float x = vertice.GetPositionX() * angleCos - vertice.GetPositionY() * angleSin;
593  float y = vertice.GetPositionY() * angleCos + vertice.GetPositionX() * angleSin;
594  vertice.Relocate(x, y);
595  }
596 
597  _previousCheckOrientation = newOrientation;
598 }
std::vector< TaggedPosition< Position::XY > > PolygonVertices
Definition: AreaTriggerTemplate.h:243
float GetOrientation() const
Definition: Position.h:80
Definition: Position.h:27
AreaTriggerCreateProperties const * GetCreateProperties() const
Definition: AreaTrigger.h:104
std::vector< Position > _polygonVertices
Definition: AreaTrigger.h:175
float _previousCheckOrientation
Definition: AreaTrigger.h:170
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateShape()

void AreaTrigger::UpdateShape ( )
670 {
671  if (_shape.IsPolygon())
673 }
void UpdatePolygonOrientation()
Definition: AreaTrigger.cpp:576
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
bool IsPolygon() const
Definition: AreaTriggerTemplate.h:125
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateSplinePosition()

void AreaTrigger::UpdateSplinePosition ( uint32  diff)
protected
918 {
920  return;
921 
922  if (!HasSplines())
923  return;
924 
925  _movementTime += diff;
926 
928  {
929  _reachedDestination = true;
930  _lastSplineIndex = int32(_spline->last());
931 
932  G3D::Vector3 lastSplinePosition = _spline->getPoint(_lastSplineIndex);
933  GetMap()->AreaTriggerRelocation(this, lastSplinePosition.x, lastSplinePosition.y, lastSplinePosition.z, GetOrientation());
934 #ifdef TRINITY_DEBUG
936 #endif
937 
938  _ai->OnSplineIndexReached(_lastSplineIndex);
939  _ai->OnDestinationReached();
940  return;
941  }
942 
943  float currentTimePercent = float(_movementTime) / float(GetTimeToTarget());
944 
945  if (currentTimePercent <= 0.f)
946  return;
947 
948  if (GetCreateProperties()->MoveCurveId)
949  {
950  float progress = sDB2Manager.GetCurveValueAt(GetCreateProperties()->MoveCurveId, currentTimePercent);
951  if (progress < 0.f || progress > 1.f)
952  {
953  TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (Id: %u, AreaTriggerCreatePropertiesId: %u) has wrong progress (%f) caused by curve calculation (MoveCurveId: %u)",
954  GetEntry(), GetCreateProperties()->Id, progress, GetCreateProperties()->MorphCurveId);
955  }
956  else
957  currentTimePercent = progress;
958  }
959 
960  int lastPositionIndex = 0;
961  float percentFromLastPoint = 0;
962  _spline->computeIndex(currentTimePercent, lastPositionIndex, percentFromLastPoint);
963 
964  G3D::Vector3 currentPosition;
965  _spline->evaluate_percent(lastPositionIndex, percentFromLastPoint, currentPosition);
966 
967  float orientation = GetOrientation();
969  {
970  G3D::Vector3 const& nextPoint = _spline->getPoint(lastPositionIndex + 1);
971  orientation = GetAbsoluteAngle(nextPoint.x, nextPoint.y);
972  }
973 
974  GetMap()->AreaTriggerRelocation(this, currentPosition.x, currentPosition.y, currentPosition.z, orientation);
975 #ifdef TRINITY_DEBUG
977 #endif
978 
979  if (_lastSplineIndex != lastPositionIndex)
980  {
981  _lastSplineIndex = lastPositionIndex;
982  _ai->OnSplineIndexReached(_lastSplineIndex);
983  }
984 }
#define sDB2Manager
Definition: DB2Stores.h:479
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
Definition: AreaTriggerTemplate.h:35
bool _reachedDestination
Definition: AreaTrigger.h:178
int32 _lastSplineIndex
Definition: AreaTrigger.h:179
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
float GetOrientation() const
Definition: Position.h:80
uint32 _movementTime
Definition: AreaTrigger.h:180
std::unique_ptr<::Movement::Spline< int32 > > _spline
Definition: AreaTrigger.h:176
Map * GetMap() const
Definition: Object.h:555
void DebugVisualizePosition()
Definition: AreaTrigger.cpp:986
uint32 GetTimeToTarget() const
Definition: AreaTrigger.h:95
int32_t int32
Definition: Define.h:139
std::unique_ptr< AreaTriggerAI > _ai
Definition: AreaTrigger.h:188
uint32 GetEntry() const
Definition: Object.h:158
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
Definition: Map.cpp:1345
bool HasSplines() const
Definition: AreaTrigger.cpp:813
AreaTriggerCreateProperties const * GetCreateProperties() const
Definition: AreaTrigger.h:104
float GetAbsoluteAngle(float x, float y) const
Definition: Position.h:126
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateTargetList()

void AreaTrigger::UpdateTargetList ( )
protected
363 {
364  std::vector<Unit*> targetList;
365 
366  switch (_shape.Type)
367  {
369  SearchUnitInSphere(targetList);
370  break;
372  SearchUnitInBox(targetList);
373  break;
375  SearchUnitInPolygon(targetList);
376  break;
378  SearchUnitInCylinder(targetList);
379  break;
381  SearchUnitInDisk(targetList);
382  break;
383  default:
384  break;
385  }
386 
387  if (GetTemplate())
388  {
389  if (ConditionContainer const* conditions = sConditionMgr->GetConditionsForAreaTrigger(GetTemplate()->Id.Id, GetTemplate()->Id.IsServerSide))
390  {
391  targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [conditions](Unit* target)
392  {
393  return !sConditionMgr->IsObjectMeetToConditions(target, *conditions);
394  }), targetList.end());
395  }
396  }
397 
398  HandleUnitEnterExit(targetList);
399 }
void HandleUnitEnterExit(std::vector< Unit *> const &targetList)
Definition: AreaTrigger.cpp:493
AreaTriggerTemplate const * GetTemplate() const
Definition: AreaTrigger.cpp:542
void SearchUnitInPolygon(std::vector< Unit *> &targetList)
Definition: AreaTrigger.cpp:447
Definition: AreaTriggerTemplate.h:52
AreaTriggerId Id
Definition: AreaTriggerTemplate.h:209
Definition: AreaTriggerTemplate.h:51
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:165
void SearchUnitInBox(std::vector< Unit *> &targetList)
Definition: AreaTrigger.cpp:432
void SearchUnitInSphere(std::vector< Unit *> &targetList)
Definition: AreaTrigger.cpp:416
#define sConditionMgr
Definition: ConditionMgr.h:350
Definition: AreaTriggerTemplate.h:48
Definition: AreaTriggerTemplate.h:53
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:265
AreaTriggerTypes Type
Definition: AreaTriggerTemplate.h:130
Definition: Unit.h:746
Definition: AreaTriggerTemplate.h:49
void SearchUnitInCylinder(std::vector< Unit *> &targetList)
Definition: AreaTrigger.cpp:463
void SearchUnitInDisk(std::vector< Unit *> &targetList)
Definition: AreaTrigger.cpp:478
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _ai

std::unique_ptr<AreaTriggerAI> AreaTrigger::_ai
protected

◆ _areaTriggerCreateProperties

AreaTriggerCreateProperties const* AreaTrigger::_areaTriggerCreateProperties
protected

◆ _areaTriggerTemplate

AreaTriggerTemplate const* AreaTrigger::_areaTriggerTemplate
protected

◆ _aurEff

AuraEffect const* AreaTrigger::_aurEff
protected

◆ _duration

int32 AreaTrigger::_duration
protected

◆ _insideUnits

GuidUnorderedSet AreaTrigger::_insideUnits
protected

◆ _isRemoved

bool AreaTrigger::_isRemoved
protected

◆ _lastSplineIndex

int32 AreaTrigger::_lastSplineIndex
protected

◆ _maxSearchRadius

float AreaTrigger::_maxSearchRadius
protected

◆ _movementTime

uint32 AreaTrigger::_movementTime
protected

◆ _orbitInfo

Optional<AreaTriggerOrbitInfo> AreaTrigger::_orbitInfo
protected

◆ _polygonVertices

std::vector<Position> AreaTrigger::_polygonVertices
protected

◆ _previousCheckOrientation

float AreaTrigger::_previousCheckOrientation
protected

◆ _reachedDestination

bool AreaTrigger::_reachedDestination
protected

◆ _rollPitchYaw

Position AreaTrigger::_rollPitchYaw
protected

◆ _shape

AreaTriggerShapeInfo AreaTrigger::_shape
protected

◆ _spawnId

ObjectGuid::LowType AreaTrigger::_spawnId
protected

◆ _spline

std::unique_ptr<::Movement::Spline<int32> > AreaTrigger::_spline
protected

◆ _targetGuid

ObjectGuid AreaTrigger::_targetGuid
protected

◆ _targetRollPitchYaw

Position AreaTrigger::_targetRollPitchYaw
protected

◆ _timeSinceCreated

uint32 AreaTrigger::_timeSinceCreated
protected

◆ _totalDuration

int32 AreaTrigger::_totalDuration
protected

◆ m_areaTriggerData

UF::UpdateField<UF::AreaTriggerData, 0, TYPEID_AREATRIGGER> AreaTrigger::m_areaTriggerData

The documentation for this class was generated from the following files: