TrinityCore
Loading...
Searching...
No Matches
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, bool allowServersideObjects=false) 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 ()
 
virtual void Update (uint32 diff)
 
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
 
PhaseShiftGetPhaseShift ()
 
PhaseShift const & GetPhaseShift () const
 
PhaseShiftGetSuppressedPhaseShift ()
 
PhaseShift const & GetSuppressedPhaseShift () const
 
bool InSamePhase (PhaseShift const &phaseShift) const
 
bool InSamePhase (WorldObject const *obj) 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, bool incOwnRadius=true, bool incTargetRadius=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 PlayObjectSound (int32 soundKitId, ObjectGuid targetObject, Player *target=nullptr, int32 broadcastTextId=0)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool implicitDetect=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
 
CreatureFindNearestCreatureWithOptions (float range, FindCreatureOptions const &options) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool spawnedOnly=true) const
 
GameObjectFindNearestGameObjectWithOptions (float range, FindGameObjectOptions const &options) const
 
GameObjectFindNearestUnspawnedGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance) const
 
virtual ObjectGuid GetOwnerGUID () const =0
 
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
 
double ApplyEffectModifiers (SpellInfo const *spellInfo, uint8 effIndex, double value) const
 
int32 CalcSpellDuration (SpellInfo const *spellInfo, std::vector< SpellPowerCost > const *powerCosts) 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 uint32 GetFaction () const =0
 
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)
 
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 GetGameObjectListWithOptionsInGrid (Container &gameObjectContainer, float maxSearchRange, FindGameObjectOptions const &options) const
 
template<typename Container >
void GetCreatureListWithEntryInGrid (Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetCreatureListWithOptionsInGrid (Container &creatureContainer, float maxSearchRange, FindCreatureOptions const &options) 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
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
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
 
ByteBufferPrepareValuesUpdateBuffer (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
virtual void ClearUpdateMask (bool remove)
 
virtual std::string GetNameForLocaleIdx (LocaleConstant locale) const =0
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
virtual void BuildUpdate (UpdateDataMapType &)
 
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 std::string GetDebugInfo () const
 
virtual LootGetLootForPlayer (Player const *player) 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
 
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 *spellInfo, Position const &pos, int32 duration, SpellCastVisual spellVisual, Spell const *spell=nullptr, 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, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint64, 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
 
float GetScaleCurveValue (UF::ScaleCurve const &scaleCurve, float x) const
 
void SetScaleCurve (UF::MutableFieldReference< UF::ScaleCurve, false > &&scaleCurveMutator, Optional< AreaTriggerScaleCurveTemplate > const &curve)
 
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)
 
void SearchUnitInBoundedPlane (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 CanAlwaysSee (WorldObject const *) const
 
virtual bool IsNeverVisibleFor (WorldObject const *seer, bool allowServersideObjects=false) const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *seer) const
 
virtual bool IsInvisibleDueToDespawn (WorldObject const *seer) const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *seer) 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
 
virtual void BuildValuesCreate (ByteBuffer *data, Player const *target) const =0
 
virtual void BuildValuesUpdate (ByteBuffer *data, Player const *target) const =0
 
virtual bool AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
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 *spellInfo, Position const &pos, int32 duration, SpellCastVisual spellVisual, Spell const *spell, AuraEffect const *aurEff)
 
bool CreateServer (Map *map, AreaTriggerTemplate const *areaTriggerTemplate, AreaTriggerSpawn const &position)
 

Detailed Description

Definition at line 42 of file AreaTrigger.h.

Constructor & Destructor Documentation

◆ AreaTrigger()

AreaTrigger::AreaTrigger ( )

Definition at line 46 of file AreaTrigger.cpp.

46 : WorldObject(false), MapObject(), _spawnId(0), _aurEff(nullptr), _maxSearchRadius(0.0f),
47 _duration(0), _totalDuration(0), _timeSinceCreated(0), _previousCheckOrientation(std::numeric_limits<float>::infinity()),
50{
53
56}
@ TYPEID_AREATRIGGER
Definition: ObjectGuid.h:46
@ TYPEMASK_AREATRIGGER
Definition: ObjectGuid.h:66
float _maxSearchRadius
Definition: AreaTrigger.h:170
AreaTriggerCreateProperties const * _areaTriggerCreateProperties
Definition: AreaTrigger.h:188
bool _isRemoved
Definition: AreaTrigger.h:175
ObjectGuid::LowType _spawnId
Definition: AreaTrigger.h:163
int32 _duration
Definition: AreaTrigger.h:171
uint32 _timeSinceCreated
Definition: AreaTrigger.h:173
bool _reachedDestination
Definition: AreaTrigger.h:182
uint32 _movementTime
Definition: AreaTrigger.h:184
float _previousCheckOrientation
Definition: AreaTrigger.h:174
int32 _lastSplineIndex
Definition: AreaTrigger.h:183
AreaTriggerTemplate const * _areaTriggerTemplate
Definition: AreaTrigger.h:189
AuraEffect const * _aurEff
Definition: AreaTrigger.h:167
int32 _totalDuration
Definition: AreaTrigger.h:172
MapObject()
Definition: MapObject.h:41
uint16 m_objectType
Definition: Object.h:386
CreateObjectBits m_updateFlag
Definition: Object.h:389
TypeID m_objectTypeId
Definition: Object.h:388
bool Stationary
Definition: Object.h:87
bool AreaTrigger
Definition: Object.h:93
+ Here is the caller graph for this function:

◆ ~AreaTrigger()

AreaTrigger::~AreaTrigger ( )

Definition at line 58 of file AreaTrigger.cpp.

59{
60}

Member Function Documentation

◆ _UpdateDuration()

void AreaTrigger::_UpdateDuration ( int32  newDuration)
protected

Definition at line 363 of file AreaTrigger.cpp.

364{
365 _duration = newDuration;
366
367 // should be sent in object create packets only
369 {
371 const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::Duration);
372 });
373}
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
Definition: AreaTrigger.h:131
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:272
UF::UpdateFieldHolder m_values
Definition: Object.h:253
void DoWithSuppressingObjectUpdates(Action &&action)
Definition: Object.h:366
void ClearChanged(UpdateField< T, BlockBit, Bit >(Derived::*))
Definition: UpdateField.h:565
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:673
UpdateField< uint32, 0, 9 > Duration
+ 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.

Definition at line 62 of file AreaTrigger.cpp.

63{
65 if (!IsInWorld())
66 {
67 if (m_zoneScript)
69
71 if (_spawnId)
72 GetMap()->GetAreaTriggerBySpawnIdStore().insert(std::make_pair(_spawnId, this));
73
75 }
76}
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:399
AreaTriggerBySpawnIdContainer & GetAreaTriggerBySpawnIdStore()
Definition: Map.h:410
ObjectGuid const & GetGUID() const
Definition: Object.h:159
bool IsInWorld() const
Definition: Object.h:153
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Map * GetMap() const
Definition: Object.h:603
void AddToWorld() override
Definition: Object.cpp:1002
ZoneScript * m_zoneScript
Definition: Object.h:778
virtual void OnAreaTriggerCreate(AreaTrigger *areaTrigger)
Definition: ZoneScript.h:60
+ Here is the call graph for this function:

◆ AI()

AreaTriggerAI * AreaTrigger::AI ( )
inline

Definition at line 74 of file AreaTrigger.h.

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

◆ AI_Destroy()

void AreaTrigger::AI_Destroy ( )

Definition at line 1146 of file AreaTrigger.cpp.

1147{
1148 _ai.reset();
1149}
+ Here is the caller graph for this function:

◆ AI_Initialize()

void AreaTrigger::AI_Initialize ( )

Definition at line 1139 of file AreaTrigger.cpp.

1140{
1141 AI_Destroy();
1143 _ai->OnInitialize();
1144}
void AI_Destroy()
AreaTriggerAI * SelectAreaTriggerAI(AreaTrigger *at)
+ 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.

Definition at line 1167 of file AreaTrigger.cpp.

1168{
1170 std::size_t sizePos = data->wpos();
1171 *data << uint32(0);
1172 *data << uint8(flags);
1173 m_objectData->WriteCreate(*data, flags, this, target);
1174 m_areaTriggerData->WriteCreate(*data, flags, this, target);
1175 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1176}
uint8_t uint8
Definition: Define.h:145
uint32_t uint32
Definition: Define.h:143
uint16 flags
Definition: DisableMgr.cpp:49
size_t wpos() const
Definition: ByteBuffer.h:412
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:254
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:762
UpdateFieldFlag
Definition: UpdateField.h:34
+ Here is the call graph for this function:

◆ BuildValuesUpdate()

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

Implements Object.

Definition at line 1178 of file AreaTrigger.cpp.

1179{
1181 std::size_t sizePos = data->wpos();
1182 *data << uint32(0);
1184
1186 m_objectData->WriteUpdate(*data, flags, this, target);
1187
1189 m_areaTriggerData->WriteUpdate(*data, flags, this, target);
1190
1191 data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
1192}
@ TYPEID_OBJECT
Definition: ObjectGuid.h:35
bool HasChanged(uint32 index) const
Definition: UpdateField.h:691
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:686
+ 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

Definition at line 1194 of file AreaTrigger.cpp.

1196{
1198 if (requestedObjectMask.IsAnySet())
1199 valuesMask.Set(TYPEID_OBJECT);
1200
1201 if (requestedAreaTriggerMask.IsAnySet())
1202 valuesMask.Set(TYPEID_AREATRIGGER);
1203
1204 ByteBuffer& buffer = PrepareValuesUpdateBuffer(data);
1205 std::size_t sizePos = buffer.wpos();
1206 buffer << uint32(0);
1207 buffer << uint32(valuesMask.GetBlock(0));
1208
1209 if (valuesMask[TYPEID_OBJECT])
1210 m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
1211
1212 if (valuesMask[TYPEID_AREATRIGGER])
1213 m_areaTriggerData->WriteUpdate(buffer, requestedAreaTriggerMask, true, this, target);
1214
1215 buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
1216
1217 data->AddUpdateBlock();
1218}
ByteBuffer & PrepareValuesUpdateBuffer(UpdateData *data) const
Definition: Object.cpp:218
void AddUpdateBlock()
Definition: UpdateData.h:49
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
void Set(uint32 index)
Definition: UpdateMask.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateOrbitPosition()

Position AreaTrigger::CalculateOrbitPosition ( ) const
protected

Definition at line 1010 of file AreaTrigger.cpp.

1011{
1013 if (!centerPos)
1014 return GetPosition();
1015
1016 AreaTriggerOrbitInfo const& cmi = *_orbitInfo;
1017
1018 // AreaTrigger make exactly "Duration / TimeToTarget" loops during his life time
1019 float pathProgress = float(cmi.ElapsedTimeForMovement) / float(cmi.TimeToTarget);
1020
1021 // We already made one circle and can't loop
1022 if (!cmi.CanLoop)
1023 pathProgress = std::min(1.f, pathProgress);
1024
1025 float radius = cmi.Radius;
1026 if (G3D::fuzzyNe(cmi.BlendFromRadius, radius))
1027 {
1028 float blendCurve = (cmi.BlendFromRadius - radius) / radius;
1029 // 4.f Defines four quarters
1030 blendCurve = RoundToInterval(blendCurve, 1.f, 4.f) / 4.f;
1031 float blendProgress = std::min(1.f, pathProgress / blendCurve);
1032 radius = G3D::lerp(cmi.BlendFromRadius, cmi.Radius, blendProgress);
1033 }
1034
1035 // Adapt Path progress depending of circle direction
1036 if (!cmi.CounterClockwise)
1037 pathProgress *= -1;
1038
1039 float angle = cmi.InitialAngle + 2.f * float(M_PI) * pathProgress;
1040 float x = centerPos->GetPositionX() + (radius * std::cos(angle));
1041 float y = centerPos->GetPositionY() + (radius * std::sin(angle));
1042 float z = centerPos->GetPositionZ() + cmi.ZOffset;
1043
1044 return { x, y, z, angle };
1045}
#define M_PI
Definition: Common.h:115
T RoundToInterval(T &num, T floor, T ceil)
Definition: Util.h:94
Position const centerPos
Position const * GetOrbitCenterPosition() const
Optional< AreaTriggerOrbitInfo > _orbitInfo
Definition: AreaTrigger.h:186
float GetPositionZ() const
Definition: Position.h:78
Position GetPosition() const
Definition: Position.h:84
float GetPositionX() const
Definition: Position.h:76
float GetPositionY() const
Definition: Position.h:77
+ 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

Definition at line 734 of file AreaTrigger.cpp.

735{
736 float testX = pos->GetPositionX();
737 float testY = pos->GetPositionY();
738
739 //this method uses the ray tracing algorithm to determine if the point is in the polygon
740 bool locatedInPolygon = false;
741
742 for (std::size_t vertex = 0; vertex < _polygonVertices.size(); ++vertex)
743 {
744 std::size_t nextVertex;
745
746 //repeat loop for all sets of points
747 if (vertex == (_polygonVertices.size() - 1))
748 {
749 //if i is the last vertex, let j be the first vertex
750 nextVertex = 0;
751 }
752 else
753 {
754 //for all-else, let j=(i+1)th vertex
755 nextVertex = vertex + 1;
756 }
757
758 float vertX_i = GetPositionX() + _polygonVertices[vertex].GetPositionX();
759 float vertY_i = GetPositionY() + _polygonVertices[vertex].GetPositionY();
760 float vertX_j = GetPositionX() + _polygonVertices[nextVertex].GetPositionX();
761 float vertY_j = GetPositionY() + _polygonVertices[nextVertex].GetPositionY();
762
763 // following statement checks if testPoint.Y is below Y-coord of i-th vertex
764 bool belowLowY = vertY_i > testY;
765 // following statement checks if testPoint.Y is below Y-coord of i+1-th vertex
766 bool belowHighY = vertY_j > testY;
767
768 /* following statement is true if testPoint.Y satisfies either (only one is possible)
769 -->(i).Y < testPoint.Y < (i+1).Y OR
770 -->(i).Y > testPoint.Y > (i+1).Y
771
772 (Note)
773 Both of the conditions indicate that a point is located within the edges of the Y-th coordinate
774 of the (i)-th and the (i+1)- th vertices of the polygon. If neither of the above
775 conditions is satisfied, then it is assured that a semi-infinite horizontal line draw
776 to the right from the testpoint will NOT cross the line that connects vertices i and i+1
777 of the polygon
778 */
779 bool withinYsEdges = belowLowY != belowHighY;
780
781 if (withinYsEdges)
782 {
783 // this is the slope of the line that connects vertices i and i+1 of the polygon
784 float slopeOfLine = (vertX_j - vertX_i) / (vertY_j - vertY_i);
785
786 // this looks up the x-coord of a point lying on the above line, given its y-coord
787 float pointOnLine = (slopeOfLine* (testY - vertY_i)) + vertX_i;
788
789 //checks to see if x-coord of testPoint is smaller than the point on the line with the same y-coord
790 bool isLeftToLine = testX < pointOnLine;
791
792 if (isLeftToLine)
793 {
794 //this statement changes true to false (and vice-versa)
795 locatedInPolygon = !locatedInPolygon;
796 }//end if (isLeftToLine)
797 }//end if (withinYsEdges
798 }
799
800 return locatedInPolygon;
801}
std::vector< Position > _polygonVertices
Definition: AreaTrigger.h:179
+ Here is the call graph for this function:

◆ ClearUpdateMask()

void AreaTrigger::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

Definition at line 1231 of file AreaTrigger.cpp.

1232{
1235}
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:782
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:680
+ Here is the call graph for this function:

◆ Create()

bool AreaTrigger::Create ( uint32  areaTriggerCreatePropertiesId,
Unit caster,
Unit target,
SpellInfo const *  spellInfo,
Position const &  pos,
int32  duration,
SpellCastVisual  spellVisual,
Spell const *  spell,
AuraEffect const *  aurEff 
)
private

Definition at line 104 of file AreaTrigger.cpp.

105{
106 _targetGuid = target ? target->GetGUID() : ObjectGuid::Empty;
107 _aurEff = aurEff;
108
109 SetMap(caster->GetMap());
110 Relocate(pos);
111 if (!IsPositionValid())
112 {
113 TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (areaTriggerCreatePropertiesId {}) not created. Invalid coordinates (X: {} Y: {})", areaTriggerCreatePropertiesId, GetPositionX(), GetPositionY());
114 return false;
115 }
116
117 _areaTriggerCreateProperties = sAreaTriggerDataStore->GetAreaTriggerCreateProperties(areaTriggerCreatePropertiesId);
119 {
120 TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (areaTriggerCreatePropertiesId {}) not created. Invalid areatrigger create properties id ({})", areaTriggerCreatePropertiesId, areaTriggerCreatePropertiesId);
121 return false;
122 }
123
125
127
128 Object::_Create(ObjectGuid::Create<HighGuid::AreaTrigger>(GetMapId(), GetTemplate() ? GetTemplate()->Id.Id : 0, caster->GetMap()->GenerateLowGuid<HighGuid::AreaTrigger>()));
129
130 if (GetTemplate())
131 SetEntry(GetTemplate()->Id.Id);
132
133 SetDuration(duration);
134
135 SetObjectScale(1.0f);
136
139
140 auto areaTriggerData = m_values.ModifyValue(&AreaTrigger::m_areaTriggerData);
141 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::Caster), caster->GetGUID());
142 if (spell)
143 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::CreatingEffectGUID), spell->m_castId);
144
145 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellID), spellInfo->Id);
146 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), spellInfo->Id);
148 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), spellVisual.ScriptVisualID);
149 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::TimeToTargetScale), GetCreateProperties()->TimeToTargetScale != 0 ? GetCreateProperties()->TimeToTargetScale : *m_areaTriggerData->Duration);
151 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::DecalPropertiesID), GetCreateProperties()->DecalPropertiesId);
152
153 SetScaleCurve(areaTriggerData.ModifyValue(&UF::AreaTriggerData::ExtraScaleCurve), GetCreateProperties()->ExtraScale);
154
156 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::VisualAnim).ModifyValue(&UF::VisualAnim::AnimKitID), GetCreateProperties()->AnimKitId);
157 if (GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_UNK3))
158 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::VisualAnim).ModifyValue(&UF::VisualAnim::Field_C), true);
159
161
162 if (target && GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
163 {
165 }
166
169
170 UpdateShape();
171
173
174 if (GetCreateProperties()->OrbitInfo)
175 {
177 if (target && GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
178 orbit.PathTarget = target->GetGUID();
179 else
180 orbit.Center = pos;
181
182 InitOrbit(orbit, timeToTarget);
183 }
184 else if (GetCreateProperties()->HasSplines())
185 {
186 InitSplineOffsets(GetCreateProperties()->SplinePoints, timeToTarget);
187 }
188
189 // movement on transport of areatriggers on unit is handled by themself
190 TransportBase* transport = m_movementInfo.transport.guid.IsEmpty() ? caster->GetTransport() : nullptr;
191 if (transport)
192 {
193 float x, y, z, o;
194 pos.GetPosition(x, y, z, o);
195 transport->CalculatePassengerOffset(x, y, z, &o);
197
198 // This object must be added to transport before adding to map for the client to properly display it
199 transport->AddPassenger(this);
200 }
201
203
204 // Relocate areatriggers with circular movement again
205 if (HasOrbit())
207
208 if (!GetMap()->AddToMap(this))
209 {
210 // Returning false will cause the object to be deleted - remove from transport
211 if (transport)
212 transport->RemovePassenger(this);
213 return false;
214 }
215
216 caster->_RegisterAreaTrigger(this);
217
218 _ai->OnCreate(spell);
219
220 return true;
221}
#define sAreaTriggerDataStore
@ AREATRIGGER_FLAG_HAS_ATTACHED
@ AREATRIGGER_FLAG_UNK3
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
Optional< AreaTriggerOrbitInfo > OrbitInfo
AreaTriggerTemplate const * Template
AreaTriggerTemplate const * GetTemplate() const
bool HasSplines() const
void InitSplineOffsets(std::vector< Position > const &offsets, uint32 timeToTarget)
void InitOrbit(AreaTriggerOrbitInfo const &orbit, uint32 timeToTarget)
float GetMaxSearchRadius() const
Definition: AreaTrigger.h:116
ObjectGuid _targetGuid
Definition: AreaTrigger.h:165
void AI_Initialize()
void UpdateShape()
void SetDuration(int32 newDuration)
Position CalculateOrbitPosition() const
bool HasOrbit() const
AreaTriggerCreateProperties const * GetCreateProperties() const
Definition: AreaTrigger.h:104
void SetScaleCurve(UF::MutableFieldReference< UF::ScaleCurve, false > &&scaleCurveMutator, Optional< AreaTriggerScaleCurveTemplate > const &curve)
AreaTriggerShapeInfo _shape
Definition: AreaTrigger.h:169
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:496
static ObjectGuid const Empty
Definition: ObjectGuid.h:272
bool IsEmpty() const
Definition: ObjectGuid.h:317
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:101
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:158
void SetEntry(uint32 entry)
Definition: Object.h:161
virtual void SetObjectScale(float scale)
Definition: Object.h:164
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
virtual TransportBase * RemovePassenger(WorldObject *passenger)=0
virtual void CalculatePassengerOffset(float &x, float &y, float &z, float *o=nullptr) const =0
This method transforms supplied global coordinates into local offsets.
virtual void AddPassenger(WorldObject *passenger)=0
void _RegisterAreaTrigger(AreaTrigger *areaTrigger)
Definition: Unit.cpp:5221
uint32 GetMapId() const
Definition: Position.h:185
void SetZoneScript()
Definition: Object.cpp:1998
TransportBase * GetTransport() const
Definition: Object.h:728
virtual void SetMap(Map *map)
Definition: Object.cpp:1781
void UpdatePositionData()
Definition: Object.cpp:984
MovementInfo m_movementInfo
Definition: Object.h:739
Optional< TaggedPosition< Position::XYZ > > Center
Optional< ObjectGuid > PathTarget
struct MovementInfo::TransportInfo transport
bool IsPositionValid() const
Definition: Position.cpp:42
void Relocate(float x, float y)
Definition: Position.h:63
uint32 ScriptVisualID
Definition: SpellDefines.h:505
uint32 SpellXSpellVisualID
Definition: SpellDefines.h:504
UpdateField< UF::VisualAnim, 0, 25 > VisualAnim
UpdateField< ObjectGuid, 0, 8 > Caster
UpdateField< UF::SpellCastVisual, 0, 16 > SpellVisual
UpdateField< float, 0, 17 > BoundsRadius2D
UpdateField< uint32, 0, 11 > TimeToTargetScale
UpdateField< int32, 0, 15 > SpellForVisuals
UpdateField< uint32, 0, 18 > DecalPropertiesID
UpdateField< int32, 0, 14 > SpellID
UpdateField< ObjectGuid, 0, 19 > CreatingEffectGUID
UpdateField< UF::ScaleCurve, 0, 4 > ExtraScaleCurve
UpdateField< uint32, 0, 3 > AnimKitID
UpdateField< bool, 0, 1 > Field_C
UpdateField< uint32, 0, 2 > AnimationDataID
+ 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 *  spellInfo,
Position const &  pos,
int32  duration,
SpellCastVisual  spellVisual,
Spell const *  spell = nullptr,
AuraEffect const *  aurEff = nullptr 
)
static

Definition at line 223 of file AreaTrigger.cpp.

224{
225 AreaTrigger* at = new AreaTrigger();
226 if (!at->Create(areaTriggerCreatePropertiesId, caster, target, spellInfo, pos, duration, spellVisual, spell, aurEff))
227 {
228 delete at;
229 return nullptr;
230 }
231
232 return at;
233}
bool Create(uint32 areaTriggerCreatePropertiesId, Unit *caster, Unit *target, SpellInfo const *spellInfo, Position const &pos, int32 duration, SpellCastVisual spellVisual, Spell const *spell, AuraEffect const *aurEff)
+ 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

Definition at line 235 of file AreaTrigger.cpp.

236{
237 return ObjectGuid::Create<HighGuid::AreaTrigger>(map->GetId(), areaTriggerId, map->GenerateLowGuid<HighGuid::AreaTrigger>());
238}
uint32 GetId() const
Definition: Map.cpp:3175
+ Here is the call graph for this function:

◆ CreateServer()

bool AreaTrigger::CreateServer ( Map map,
AreaTriggerTemplate const *  areaTriggerTemplate,
AreaTriggerSpawn const &  position 
)
private

Definition at line 255 of file AreaTrigger.cpp.

256{
257 SetMap(map);
258 Relocate(position.spawnPoint);
259 if (!IsPositionValid())
260 {
261 TC_LOG_ERROR("entities.areatrigger", "AreaTriggerServer (id {}) not created. Invalid coordinates (X: {} Y: {})",
262 areaTriggerTemplate->Id.Id, GetPositionX(), GetPositionY());
263 return false;
264 }
265
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 SetDuration(-1);
276
277 auto areaTriggerData = m_values.ModifyValue(&AreaTrigger::m_areaTriggerData);
279 if (position.SpellForVisuals)
280 {
281 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(*position.SpellForVisuals, DIFFICULTY_NONE);
282 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::SpellForVisuals), *position.SpellForVisuals);
285 }
286
287 if (IsServerSide())
288 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::DecalPropertiesID), 24); // blue decal, for .debug areatrigger visibility
289
291
292 SetUpdateFieldValue(areaTriggerData.ModifyValue(&UF::AreaTriggerData::VisualAnim).ModifyValue(&UF::VisualAnim::AnimationDataID), -1);
293
294 _shape = position.Shape;
296
297 if (position.phaseUseFlags || position.phaseId || position.phaseGroup)
298 PhasingHandler::InitDbPhaseShift(GetPhaseShift(), position.phaseUseFlags, position.phaseId, position.phaseGroup);
299
300 UpdateShape();
301
303
304 _ai->OnCreate(nullptr);
305
306 return true;
307}
@ DIFFICULTY_NONE
Definition: DBCEnums.h:818
#define sSpellMgr
Definition: SpellMgr.h:825
bool IsServerSide() const
Definition: AreaTrigger.h:76
static void InitDbPhaseShift(PhaseShift &phaseShift, uint8 phaseUseFlags, uint16 phaseId, uint32 phaseGroupId)
uint32 GetSpellXSpellVisualId(WorldObject const *caster=nullptr, WorldObject const *viewer=nullptr) const
Definition: SpellInfo.cpp:4456
PhaseShift & GetPhaseShift()
Definition: Object.h:504
float GetMaxSearchRadius() const
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DebugVisualizePosition()

void AreaTrigger::DebugVisualizePosition ( )
protected

Definition at line 1131 of file AreaTrigger.cpp.

1132{
1133 if (Unit* caster = GetCaster())
1134 if (Player* player = caster->ToPlayer())
1135 if (player->isDebugAreaTriggers)
1136 player->SummonCreature(1, *this, TEMPSUMMON_TIMED_DESPAWN, Milliseconds(GetTimeToTarget()));
1137}
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
uint32 GetTimeToTarget() const
Definition: AreaTrigger.h:95
Unit * GetCaster() const
static Player * ToPlayer(Object *o)
Definition: Object.h:200
Definition: Unit.h:747
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Delay()

void AreaTrigger::Delay ( int32  delaytime)
inline

Definition at line 100 of file AreaTrigger.h.

100{ SetDuration(GetDuration() - delaytime); }
int32 GetDuration() const
Definition: AreaTrigger.h:97

◆ DoActions()

void AreaTrigger::DoActions ( Unit unit)
protected

Definition at line 841 of file AreaTrigger.cpp.

842{
843 Unit* caster = IsServerSide() ? unit : GetCaster();
844
845 if (caster && GetTemplate())
846 {
847 for (AreaTriggerAction const& action : GetTemplate()->Actions)
848 {
849 if (IsServerSide() || UnitFitToActionRequirement(unit, caster, action))
850 {
851 switch (action.ActionType)
852 {
854 caster->CastSpell(unit, action.Param, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
855 .SetOriginalCastId(m_areaTriggerData->CreatingEffectGUID->IsCast() ? *m_areaTriggerData->CreatingEffectGUID : ObjectGuid::Empty));
856 break;
858 caster->AddAura(action.Param, unit);
859 break;
861 {
862 if (WorldSafeLocsEntry const* safeLoc = sObjectMgr->GetWorldSafeLoc(action.Param))
863 {
864 if (Player* player = caster->ToPlayer())
865 {
866 if (player->GetMapId() != safeLoc->Loc.GetMapId())
867 {
868 if (WorldSafeLocsEntry const* instanceEntrance = player->GetInstanceEntrance(safeLoc->Loc.GetMapId()))
869 safeLoc = instanceEntrance;
870 }
871 player->TeleportTo(safeLoc->Loc);
872 }
873 }
874 break;
875 }
876 default:
877 break;
878 }
879 }
880 }
881 }
882}
@ AREATRIGGER_ACTION_ADDAURA
@ AREATRIGGER_ACTION_TELEPORT
@ AREATRIGGER_ACTION_CAST
bool UnitFitToActionRequirement(Unit *unit, Unit *caster, AreaTriggerAction const &action)
Actions
#define sObjectMgr
Definition: ObjectMgr.h:1952
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:11675
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2881
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetAuraEffect()

AuraEffect const * AreaTrigger::GetAuraEffect ( ) const
inline

Definition at line 93 of file AreaTrigger.h.

93{ return _aurEff; }

◆ GetCaster()

Unit * AreaTrigger::GetCaster ( ) const

Definition at line 692 of file AreaTrigger.cpp.

693{
694 return ObjectAccessor::GetUnit(*this, GetCasterGuid());
695}
ObjectGuid const & GetCasterGuid() const
Definition: AreaTrigger.h:109
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetCasterGuid()

ObjectGuid const & AreaTrigger::GetCasterGuid ( ) const
inline

Definition at line 109 of file AreaTrigger.h.

109{ return m_areaTriggerData->Caster; }
+ Here is the caller graph for this function:

◆ GetCircularMovementInfo()

Optional< AreaTriggerOrbitInfo > const & AreaTrigger::GetCircularMovementInfo ( ) const
inline

Definition at line 127 of file AreaTrigger.h.

127{ return _orbitInfo; }

◆ GetCreateProperties()

AreaTriggerCreateProperties const * AreaTrigger::GetCreateProperties ( ) const
inline

Definition at line 104 of file AreaTrigger.h.

+ Here is the caller graph for this function:

◆ GetDuration()

int32 AreaTrigger::GetDuration ( ) const
inline

Definition at line 97 of file AreaTrigger.h.

97{ return _duration; }
+ Here is the caller graph for this function:

◆ GetElapsedTimeForMovement()

uint32 AreaTrigger::GetElapsedTimeForMovement ( ) const
inline

Definition at line 123 of file AreaTrigger.h.

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.

Definition at line 702 of file AreaTrigger.cpp.

703{
704 if (Unit const* caster = GetCaster())
705 return caster->GetFaction();
706
707 return 0;
708}
+ Here is the call graph for this function:

◆ GetInsideUnits()

GuidUnorderedSet const & AreaTrigger::GetInsideUnits ( ) const
inline

Definition at line 102 of file AreaTrigger.h.

102{ return _insideUnits; }
GuidUnorderedSet _insideUnits
Definition: AreaTrigger.h:190
+ Here is the caller graph for this function:

◆ GetMaxSearchRadius()

float AreaTrigger::GetMaxSearchRadius ( ) const
inline

Definition at line 116 of file AreaTrigger.h.

116{ return _maxSearchRadius; }
+ Here is the caller graph for this function:

◆ GetOrbitCenterPosition()

Position const * AreaTrigger::GetOrbitCenterPosition ( ) const
protected

Definition at line 995 of file AreaTrigger.cpp.

996{
997 if (!_orbitInfo)
998 return nullptr;
999
1000 if (_orbitInfo->PathTarget)
1001 if (WorldObject* center = ObjectAccessor::GetWorldObject(*this, *_orbitInfo->PathTarget))
1002 return center;
1003
1004 if (_orbitInfo->Center)
1005 return &_orbitInfo->Center->Pos;
1006
1007 return nullptr;
1008}
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetOwnerGUID()

ObjectGuid AreaTrigger::GetOwnerGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

Definition at line 108 of file AreaTrigger.h.

108{ return GetCasterGuid(); }

◆ GetProgress()

float AreaTrigger::GetProgress ( ) const
protected

Definition at line 375 of file AreaTrigger.cpp.

376{
378}
uint32 GetTimeToTargetScale() const
Definition: AreaTrigger.h:96
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetRollPitchYaw()

Position const & AreaTrigger::GetRollPitchYaw ( ) const
inline

Definition at line 117 of file AreaTrigger.h.

117{ return _rollPitchYaw; }
Position _rollPitchYaw
Definition: AreaTrigger.h:177
+ Here is the caller graph for this function:

◆ GetScaleCurveValue()

float AreaTrigger::GetScaleCurveValue ( UF::ScaleCurve const &  scaleCurve,
float  x 
) const
protected

Definition at line 380 of file AreaTrigger.cpp.

381{
382 ASSERT(*scaleCurve.OverrideActive, "ScaleCurve must be active to evaluate it");
383
384 // unpack ParameterCurve
385 if (*scaleCurve.ParameterCurve & 1)
386 return advstd::bit_cast<float>(*scaleCurve.ParameterCurve & ~1);
387
388 std::array<DBCPosition2D, 2> points;
389 for (std::size_t i = 0; i < scaleCurve.Points.size(); ++i)
390 points[i] = { .X = scaleCurve.Points[i].Pos.GetPositionX(), .Y = scaleCurve.Points[i].Pos.GetPositionY() };
391
392 CurveInterpolationMode mode = CurveInterpolationMode(*scaleCurve.ParameterCurve >> 1 & 0x7);
393 std::size_t pointCount = *scaleCurve.ParameterCurve >> 24 & 0xFF;
394
395 return sDB2Manager.GetCurveValueAt(mode, std::span(points.begin(), pointCount), x);
396}
#define sDB2Manager
Definition: DB2Stores.h:522
CurveInterpolationMode
Definition: DBCEnums.h:806
#define ASSERT
Definition: Errors.h:68
+ Here is the call graph for this function:

◆ GetScriptId()

uint32 AreaTrigger::GetScriptId ( ) const

Definition at line 681 of file AreaTrigger.cpp.

682{
683 if (_spawnId)
684 return ASSERT_NOTNULL(sAreaTriggerDataStore->GetAreaTriggerSpawn(_spawnId))->scriptId;
685
688
689 return 0;
690}
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetShape()

AreaTriggerShapeInfo const & AreaTrigger::GetShape ( ) const
inline

Definition at line 115 of file AreaTrigger.h.

115{ return _shape; }
+ Here is the caller graph for this function:

◆ GetSpellId()

uint32 AreaTrigger::GetSpellId ( ) const
inline

Definition at line 92 of file AreaTrigger.h.

92{ return m_areaTriggerData->SpellID; }
+ Here is the caller graph for this function:

◆ GetSpline()

::Movement::Spline< int32 > const & AreaTrigger::GetSpline ( ) const
inline

Definition at line 122 of file AreaTrigger.h.

122{ return *_spline; }
std::unique_ptr<::Movement::Spline< int32 > > _spline
Definition: AreaTrigger.h:180
+ Here is the caller graph for this function:

◆ GetTarget()

Unit * AreaTrigger::GetTarget ( ) const

Definition at line 697 of file AreaTrigger.cpp.

698{
700}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetTargetRollPitchYaw()

Position const & AreaTrigger::GetTargetRollPitchYaw ( ) const
inline

Definition at line 118 of file AreaTrigger.h.

118{ return _targetRollPitchYaw; }
Position _targetRollPitchYaw
Definition: AreaTrigger.h:178
+ Here is the caller graph for this function:

◆ GetTemplate()

AreaTriggerTemplate const * AreaTrigger::GetTemplate ( ) const

Definition at line 676 of file AreaTrigger.cpp.

677{
679}
+ Here is the caller graph for this function:

◆ GetTimeSinceCreated()

uint32 AreaTrigger::GetTimeSinceCreated ( ) const
inline

Definition at line 94 of file AreaTrigger.h.

94{ return _timeSinceCreated; }
+ Here is the caller graph for this function:

◆ GetTimeToTarget()

uint32 AreaTrigger::GetTimeToTarget ( ) const
inline

Definition at line 95 of file AreaTrigger.h.

95{ return m_areaTriggerData->TimeToTarget; }
+ Here is the caller graph for this function:

◆ GetTimeToTargetScale()

uint32 AreaTrigger::GetTimeToTargetScale ( ) const
inline

Definition at line 96 of file AreaTrigger.h.

96{ return m_areaTriggerData->TimeToTargetScale; }
+ Here is the caller graph for this function:

◆ GetTotalDuration()

int32 AreaTrigger::GetTotalDuration ( ) const
inline

Definition at line 98 of file AreaTrigger.h.

98{ return _totalDuration; }

◆ HandleUnitEnterExit()

void AreaTrigger::HandleUnitEnterExit ( std::vector< Unit * > const &  targetList)
protected

Definition at line 623 of file AreaTrigger.cpp.

624{
625 GuidUnorderedSet exitUnits(std::move(_insideUnits));
626
627 std::vector<Unit*> enteringUnits;
628
629 for (Unit* unit : newTargetList)
630 {
631 if (exitUnits.erase(unit->GetGUID()) == 0) // erase(key_type) returns number of elements erased
632 enteringUnits.push_back(unit);
633
634 _insideUnits.insert(unit->GetGUID());
635 }
636
637 // Handle after _insideUnits have been reinserted so we can use GetInsideUnits() in hooks
638 for (Unit* unit : enteringUnits)
639 {
640 if (Player* player = unit->ToPlayer())
641 {
642 if (player->isDebugAreaTriggers)
644
645 player->UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_AREA_TRIGGER_ENTER, GetEntry(), 1);
646 }
647
648 DoActions(unit);
649
650 _ai->OnUnitEnter(unit);
651 }
652
653 for (ObjectGuid const& exitUnitGuid : exitUnits)
654 {
655 if (Unit* leavingUnit = ObjectAccessor::GetUnit(*this, exitUnitGuid))
656 {
657 if (Player* player = leavingUnit->ToPlayer())
658 {
659 if (player->isDebugAreaTriggers)
661
662 player->UpdateQuestObjectiveProgress(QUEST_OBJECTIVE_AREA_TRIGGER_EXIT, GetEntry(), 1);
663 }
664
665 UndoActions(leavingUnit);
666
667 _ai->OnUnitExit(leavingUnit);
668 }
669 }
670
673 std::count_if(_insideUnits.begin(), _insideUnits.end(), [](ObjectGuid const& guid) { return guid.IsPlayer(); }));
674}
@ LANG_DEBUG_AREATRIGGER_LEFT
Definition: Language.h:1018
@ LANG_DEBUG_AREATRIGGER_ENTERED
Definition: Language.h:979
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition: ObjectGuid.h:394
@ QUEST_OBJECTIVE_AREA_TRIGGER_EXIT
Definition: QuestDef.h:351
@ QUEST_OBJECTIVE_AREA_TRIGGER_ENTER
Definition: QuestDef.h:350
void UndoActions(Unit *unit)
void DoActions(Unit *unit)
void PSendSysMessage(const char *fmt, Args &&... args)
Definition: Chat.h:57
uint32 GetEntry() const
Definition: Object.h:160
UpdateField< uint32, 0, 21 > NumPlayersInside
UpdateField< uint32, 0, 20 > NumUnitsInside
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ HasOrbit()

bool AreaTrigger::HasOrbit ( ) const

Definition at line 990 of file AreaTrigger.cpp.

991{
992 return _orbitInfo.has_value();
993}
+ Here is the caller graph for this function:

◆ HasSplines()

bool AreaTrigger::HasSplines ( ) const

Definition at line 956 of file AreaTrigger.cpp.

957{
958 return bool(_spline);
959}
+ 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

Definition at line 961 of file AreaTrigger.cpp.

962{
963 // Circular movement requires either a center position or an attached unit
964 ASSERT(orbit.Center.has_value() || orbit.PathTarget.has_value());
965
966 // should be sent in object create packets only
968 {
970 const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::TimeToTarget);
971 });
972
974
975 _orbitInfo = orbit;
976
977 _orbitInfo->TimeToTarget = timeToTarget;
978 _orbitInfo->ElapsedTimeForMovement = 0;
979
980 if (IsInWorld())
981 {
983 reshape.TriggerGUID = GetGUID();
985
986 SendMessageToSet(reshape.Write(), true);
987 }
988}
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1731
Optional< AreaTriggerOrbitInfo > AreaTriggerOrbit
UpdateField< ObjectGuid, 0, 22 > OrbitPathTarget
UpdateField< uint32, 0, 10 > TimeToTarget
+ 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 
)

Definition at line 892 of file AreaTrigger.cpp.

893{
894 float angleSin = std::sin(GetOrientation());
895 float angleCos = std::cos(GetOrientation());
896
897 // This is needed to rotate the spline, following caster orientation
898 std::vector<G3D::Vector3> rotatedPoints;
899 rotatedPoints.reserve(offsets.size());
900 for (Position const& offset : offsets)
901 {
902 float x = GetPositionX() + (offset.GetPositionX() * angleCos - offset.GetPositionY() * angleSin);
903 float y = GetPositionY() + (offset.GetPositionY() * angleCos + offset.GetPositionX() * angleSin);
904 float z = GetPositionZ();
905
906 UpdateAllowedPositionZ(x, y, z);
907 z += offset.GetPositionZ();
908
909 rotatedPoints.emplace_back(x, y, z);
910 }
911
912 InitSplines(std::move(rotatedPoints), timeToTarget);
913}
void InitSplines(std::vector< G3D::Vector3 > splinePoints, uint32 timeToTarget)
void UpdateAllowedPositionZ(float x, float y, float &z, float *groundZ=nullptr) const
Definition: Object.cpp:1358
float GetOrientation() const
Definition: Position.h:79
+ 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 
)

Definition at line 915 of file AreaTrigger.cpp.

916{
917 if (splinePoints.size() < 2)
918 return;
919
920 _movementTime = 0;
921
922 _spline = std::make_unique<::Movement::Spline<int32>>();
923 _spline->init_spline(&splinePoints[0], splinePoints.size(), ::Movement::SplineBase::ModeLinear);
924 _spline->initLengths();
925
926 // should be sent in object create packets only
928 {
930 const_cast<UF::AreaTriggerData&>(*m_areaTriggerData).ClearChanged(&UF::AreaTriggerData::TimeToTarget);
931 });
932
933 if (IsInWorld())
934 {
936 {
938 reshape.TriggerGUID = GetGUID();
939 SendMessageToSet(reshape.Write(), true);
940 }
941
943 reshape.TriggerGUID = GetGUID();
944 reshape.AreaTriggerSpline.emplace();
945 reshape.AreaTriggerSpline->ElapsedTimeForMovement = GetElapsedTimeForMovement();
946 reshape.AreaTriggerSpline->TimeToTarget = timeToTarget;
947 for (G3D::Vector3 const& vec : splinePoints)
948 reshape.AreaTriggerSpline->Points.emplace_back(vec.x, vec.y, vec.z);
949
950 SendMessageToSet(reshape.Write(), true);
951 }
952
953 _reachedDestination = false;
954}
uint32 GetElapsedTimeForMovement() const
Definition: AreaTrigger.h:123
Optional< AreaTriggerSplineInfo > AreaTriggerSpline
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ IsNeverVisibleFor()

bool AreaTrigger::IsNeverVisibleFor ( WorldObject const *  seer,
bool  allowServersideObjects = false 
) const
overridevirtual

Reimplemented from WorldObject.

Definition at line 1151 of file AreaTrigger.cpp.

1152{
1153 if (WorldObject::IsNeverVisibleFor(seer, allowServersideObjects))
1154 return true;
1155
1156 if (IsServerSide() && !allowServersideObjects)
1157 {
1158 if (Player const* seerPlayer = seer->ToPlayer())
1159 return !seerPlayer->isDebugAreaTriggers;
1160
1161 return true;
1162 }
1163
1164 return false;
1165}
virtual bool IsNeverVisibleFor(WorldObject const *seer, bool allowServersideObjects=false) const
Definition: Object.h:798
+ Here is the call graph for this function:

◆ IsRemoved()

bool AreaTrigger::IsRemoved ( ) const
inline

Definition at line 91 of file AreaTrigger.h.

91{ return _isRemoved; }
+ Here is the caller graph for this function:

◆ IsServerSide()

bool AreaTrigger::IsServerSide ( ) const
inline

Definition at line 76 of file AreaTrigger.h.

+ Here is the caller graph for this function:

◆ LoadFromDB()

bool AreaTrigger::LoadFromDB ( ObjectGuid::LowType  spawnId,
Map map,
bool  addToMap,
bool  allowDuplicate 
)

Definition at line 240 of file AreaTrigger.cpp.

241{
242 _spawnId = spawnId;
243
244 AreaTriggerSpawn const* position = sAreaTriggerDataStore->GetAreaTriggerSpawn(spawnId);
245 if (!position)
246 return false;
247
248 AreaTriggerTemplate const* areaTriggerTemplate = sAreaTriggerDataStore->GetAreaTriggerTemplate(position->Id);
249 if (!areaTriggerTemplate)
250 return false;
251
252 return CreateServer(map, areaTriggerTemplate, *position);
253}
bool CreateServer(Map *map, AreaTriggerTemplate const *areaTriggerTemplate, AreaTriggerSpawn const &position)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Remove()

void AreaTrigger::Remove ( )

Definition at line 346 of file AreaTrigger.cpp.

347{
348 if (IsInWorld())
349 {
350 AddObjectToRemoveList(); // calls RemoveFromWorld
351 }
352}
void AddObjectToRemoveList()
Definition: Object.cpp:1811
+ 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.

Definition at line 78 of file AreaTrigger.cpp.

79{
81 if (IsInWorld())
82 {
83 if (m_zoneScript)
85
86 _isRemoved = true;
87
88 if (Unit* caster = GetCaster())
89 caster->_UnregisterAreaTrigger(this);
90
91 _ai->OnRemove();
92
93 // Handle removal of all units, calling OnUnitExit & deleting auras if needed
95
97
98 if (_spawnId)
99 Trinity::Containers::MultimapErasePair(GetMap()->GetAreaTriggerBySpawnIdStore(), _spawnId, this);
101 }
102}
void HandleUnitEnterExit(std::vector< Unit * > const &targetList)
bool Remove(KEY_TYPE const &handle)
void RemoveFromWorld() override
Definition: Object.cpp:1008
virtual void OnAreaTriggerRemove(AreaTrigger *areaTrigger)
Definition: ZoneScript.h:61
void MultimapErasePair(M< K, V, Rest... > &multimap, K const &key, V const &value)
Definition: MapUtils.h:39
+ Here is the call graph for this function:

◆ SearchUnitInBoundedPlane()

void AreaTrigger::SearchUnitInBoundedPlane ( std::vector< Unit * > &  targetList)
protected

Definition at line 609 of file AreaTrigger.cpp.

610{
611 SearchUnits(targetList, GetMaxSearchRadius(), false);
612
613 Position const& boxCenter = GetPosition();
614 float extentsX = _shape.BoxDatas.Extents[0];
615 float extentsY = _shape.BoxDatas.Extents[1];
616
617 targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [boxCenter, extentsX, extentsY](Unit const* unit) -> bool
618 {
619 return !unit->IsWithinBox(boxCenter, extentsX, extentsY, MAP_SIZE);
620 }), targetList.end());
621}
void SearchUnits(std::vector< Unit * > &targetList, float radius, bool check3D)
struct AreaTriggerShapeInfo::@196::@200 BoxDatas
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SearchUnitInBox()

void AreaTrigger::SearchUnitInBox ( std::vector< Unit * > &  targetList)
protected

Definition at line 535 of file AreaTrigger.cpp.

536{
537 SearchUnits(targetList, GetMaxSearchRadius(), false);
538
539 Position const& boxCenter = GetPosition();
540 float extentsX = _shape.BoxDatas.Extents[0];
541 float extentsY = _shape.BoxDatas.Extents[1];
542 float extentsZ = _shape.BoxDatas.Extents[2];
543
544 targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [boxCenter, extentsX, extentsY, extentsZ](Unit* unit) -> bool
545 {
546 return !unit->IsWithinBox(boxCenter, extentsX, extentsY, extentsZ/2);
547 }), targetList.end());
548}
+ 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

Definition at line 566 of file AreaTrigger.cpp.

567{
568 SearchUnits(targetList, GetMaxSearchRadius(), false);
569
570 float height = _shape.CylinderDatas.Height;
571 float minZ = GetPositionZ() - height;
572 float maxZ = GetPositionZ() + height;
573
574 targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [minZ, maxZ](Unit* unit) -> bool
575 {
576 return unit->GetPositionZ() < minZ
577 || unit->GetPositionZ() > maxZ;
578 }), targetList.end());
579}
struct AreaTriggerShapeInfo::@196::@202 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

Definition at line 581 of file AreaTrigger.cpp.

582{
583 float innerRadius = _shape.DiskDatas.InnerRadius;
584 float outerRadius = _shape.DiskDatas.OuterRadius;
585 float height = _shape.DiskDatas.Height;
586
588 {
589 float progress = GetProgress();
590 if (GetCreateProperties()->MorphCurveId)
591 progress = sDB2Manager.GetCurveValueAt(GetCreateProperties()->MorphCurveId, progress);
592
593 innerRadius = G3D::lerp(_shape.DiskDatas.InnerRadius, _shape.DiskDatas.InnerRadiusTarget, progress);
594 outerRadius = G3D::lerp(_shape.DiskDatas.OuterRadius, _shape.DiskDatas.OuterRadiusTarget, progress);
595 height = G3D::lerp(_shape.DiskDatas.Height, _shape.DiskDatas.HeightTarget, progress);
596 }
597
598 SearchUnits(targetList, outerRadius, false);
599
600 float minZ = GetPositionZ() - height;
601 float maxZ = GetPositionZ() + height;
602
603 targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [this, innerRadius, minZ, maxZ](Unit const* unit) -> bool
604 {
605 return unit->IsInDist2d(this, innerRadius) || unit->GetPositionZ() < minZ || unit->GetPositionZ() > maxZ;
606 }), targetList.end());
607}
@ AREATRIGGER_FLAG_HAS_DYNAMIC_SHAPE
float GetProgress() const
struct AreaTriggerShapeInfo::@196::@203 DiskDatas
+ 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

Definition at line 550 of file AreaTrigger.cpp.

551{
552 SearchUnits(targetList, GetMaxSearchRadius(), false);
553
554 float height = _shape.PolygonDatas.Height;
555 float minZ = GetPositionZ() - height;
556 float maxZ = GetPositionZ() + height;
557
558 targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [this, minZ, maxZ](Unit* unit) -> bool
559 {
560 return !CheckIsInPolygon2D(unit)
561 || unit->GetPositionZ() < minZ
562 || unit->GetPositionZ() > maxZ;
563 }), targetList.end());
564}
struct AreaTriggerShapeInfo::@196::@201 PolygonDatas
+ 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

Definition at line 519 of file AreaTrigger.cpp.

520{
521 float radius = _shape.SphereDatas.Radius;
523 {
524 if (GetCreateProperties()->MorphCurveId)
525 {
526 radius = G3D::lerp(_shape.SphereDatas.Radius,
528 sDB2Manager.GetCurveValueAt(GetCreateProperties()->MorphCurveId, GetProgress()));
529 }
530 }
531
532 SearchUnits(targetList, radius, true);
533}
struct AreaTriggerShapeInfo::@196::@199 SphereDatas
+ 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

Definition at line 504 of file AreaTrigger.cpp.

505{
506 Trinity::AnyUnitInObjectRangeCheck check(this, radius, check3D);
507 if (IsServerSide())
508 {
511 }
512 else
513 {
515 Cell::VisitAllObjects(this, searcher, GetMaxSearchRadius());
516 }
517}
static void VisitAllObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:203
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:191
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDuration()

void AreaTrigger::SetDuration ( int32  newDuration)

Definition at line 354 of file AreaTrigger.cpp.

355{
356 _duration = newDuration;
357 _totalDuration = newDuration;
358
359 // negative duration (permanent areatrigger) sent as 0
361}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetScaleCurve()

void AreaTrigger::SetScaleCurve ( UF::MutableFieldReference< UF::ScaleCurve, false > &&  scaleCurveMutator,
Optional< AreaTriggerScaleCurveTemplate > const &  curve 
)
protected

Definition at line 398 of file AreaTrigger.cpp.

399{
400 if (!curve)
401 {
403 return;
404 }
405
407 SetUpdateFieldValue(scaleCurveMutator.ModifyValue(&UF::ScaleCurve::StartTimeOffset), curve->StartTimeOffset);
408
409 Position point;
410 // ParameterCurve packing information
411 // (not_using_points & 1) | ((interpolation_mode & 0x7) << 1) | ((first_point_offset & 0xFFFFF) << 4) | ((point_count & 0xFF) << 24)
412 // if not_using_points is set then the entire field is simply read as a float (ignoring that lowest bit)
413
414 if (float const* simpleFloat = std::get_if<float>(&curve->Curve))
415 {
416 uint32 packedCurve = advstd::bit_cast<uint32>(*simpleFloat);
417 packedCurve |= 1;
418
419 SetUpdateFieldValue(scaleCurveMutator.ModifyValue(&UF::ScaleCurve::ParameterCurve), packedCurve);
420
421 // clear points
422 for (std::size_t i = 0; i < UF::size<decltype(UF::ScaleCurve::Points)>(); ++i)
423 SetUpdateFieldValue(scaleCurveMutator.ModifyValue(&UF::ScaleCurve::Points, i), point);
424 }
425 else if (AreaTriggerScaleCurvePointsTemplate const* curvePoints = std::get_if<AreaTriggerScaleCurvePointsTemplate>(&curve->Curve))
426 {
427 CurveInterpolationMode mode = curvePoints->Mode;
428 if (curvePoints->Points[1].X < curvePoints->Points[0].X)
429 mode = CurveInterpolationMode::Constant;
430
431 switch (mode)
432 {
433 case CurveInterpolationMode::CatmullRom:
434 // catmullrom requires at least 4 points, impossible here
435 mode = CurveInterpolationMode::Cosine;
436 break;
437 case CurveInterpolationMode::Bezier3:
438 case CurveInterpolationMode::Bezier4:
439 case CurveInterpolationMode::Bezier:
440 // bezier requires more than 2 points, impossible here
441 mode = CurveInterpolationMode::Linear;
442 break;
443 default:
444 break;
445 }
446
447 uint32 pointCount = 2;
448 if (mode == CurveInterpolationMode::Constant)
449 pointCount = 1;
450
451 uint32 packedCurve = (uint32(mode) << 1) | (pointCount << 24);
452 SetUpdateFieldValue(scaleCurveMutator.ModifyValue(&UF::ScaleCurve::ParameterCurve), packedCurve);
453
454 for (std::size_t i = 0; i < curvePoints->Points.size(); ++i)
455 {
456 point.Relocate(curvePoints->Points[i].X, curvePoints->Points[i].Y);
457 SetUpdateFieldValue(scaleCurveMutator.ModifyValue(&UF::ScaleCurve::Points, i), point);
458 }
459 }
460}
std::enable_if_t< std::is_base_of_v< HasChangesMaskTag, U >, std::conditional_t< std::is_base_of_v< IsUpdateFieldStructureTag, V >, MutableFieldReference< V, PublicSet >, std::conditional_t< std::is_base_of_v< IsUpdateFieldHolderTag, V >, MutableNestedFieldReference< V, PublicSet >, std::conditional_t< PublicSet, UpdateFieldPublicSetter< V >, UpdateFieldSetter< V > > > > > ModifyValue(UpdateField< V, BlockBit, Bit >(T::*field))
Definition: UpdateField.h:262
UpdateFieldArray< TaggedPosition< Position::XY >, 2, 4, 5 > Points
UpdateField< uint32, 0, 3 > ParameterCurve
UpdateField< uint32, 0, 2 > StartTimeOffset
UpdateField< bool, 0, 1 > OverrideActive
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UndoActions()

void AreaTrigger::UndoActions ( Unit unit)
protected

Definition at line 884 of file AreaTrigger.cpp.

885{
886 if (GetTemplate())
887 for (AreaTriggerAction const& action : GetTemplate()->Actions)
888 if (action.ActionType == AREATRIGGER_ACTION_CAST || action.ActionType == AREATRIGGER_ACTION_ADDAURA)
889 unit->RemoveAurasDueToSpell(action.Param, GetCasterGuid());
890}
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3735
+ 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.

Definition at line 309 of file AreaTrigger.cpp.

310{
312 _timeSinceCreated += diff;
313
314 if (!IsServerSide())
315 {
316 // "If" order matter here, Orbit > Attached > Splines
317 if (HasOrbit())
318 {
320 }
321 else if (GetTemplate() && GetTemplate()->HasFlag(AREATRIGGER_FLAG_HAS_ATTACHED))
322 {
323 if (Unit* target = GetTarget())
324 GetMap()->AreaTriggerRelocation(this, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation());
325 }
326 else
328 }
329
330 if (GetDuration() != -1)
331 {
332 if (GetDuration() > int32(diff))
334 else
335 {
336 Remove(); // expired
337 return;
338 }
339 }
340
341 _ai->OnUpdate(diff);
342
344}
int32_t int32
Definition: Define.h:139
void UpdateTargetList()
void UpdateSplinePosition(uint32 diff)
Unit * GetTarget() const
void UpdateOrbitPosition(uint32 diff)
void _UpdateDuration(int32 newDuration)
void AreaTriggerRelocation(AreaTrigger *at, float x, float y, float z, float orientation)
Definition: Map.cpp:1134
virtual void Update(uint32 diff)
Definition: Object.cpp:890
+ Here is the call graph for this function:

◆ UpdateOrbitPosition()

void AreaTrigger::UpdateOrbitPosition ( uint32  diff)
protected

Definition at line 1047 of file AreaTrigger.cpp.

1048{
1049 if (_orbitInfo->StartDelay > GetElapsedTimeForMovement())
1050 return;
1051
1052 _orbitInfo->ElapsedTimeForMovement = GetElapsedTimeForMovement() - _orbitInfo->StartDelay;
1053
1055
1057#ifdef TRINITY_DEBUG
1059#endif
1060}
void DebugVisualizePosition()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdatePolygonOrientation()

void AreaTrigger::UpdatePolygonOrientation ( )
protected

Definition at line 710 of file AreaTrigger.cpp.

711{
712 float newOrientation = GetOrientation();
713
714 // No need to recalculate, orientation didn't change
715 if (G3D::fuzzyEq(_previousCheckOrientation, newOrientation))
716 return;
717
718 _polygonVertices.assign(GetCreateProperties()->PolygonVertices.begin(), GetCreateProperties()->PolygonVertices.end());
719
720 float angleSin = std::sin(newOrientation);
721 float angleCos = std::cos(newOrientation);
722
723 // This is needed to rotate the vertices, following orientation
724 for (Position& vertice : _polygonVertices)
725 {
726 float x = vertice.GetPositionX() * angleCos - vertice.GetPositionY() * angleSin;
727 float y = vertice.GetPositionY() * angleCos + vertice.GetPositionX() * angleSin;
728 vertice.Relocate(x, y);
729 }
730
731 _previousCheckOrientation = newOrientation;
732}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateShape()

void AreaTrigger::UpdateShape ( )

Definition at line 803 of file AreaTrigger.cpp.

804{
805 if (_shape.IsPolygon())
807}
void UpdatePolygonOrientation()
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateSplinePosition()

void AreaTrigger::UpdateSplinePosition ( uint32  diff)
protected

Definition at line 1062 of file AreaTrigger.cpp.

1063{
1065 return;
1066
1067 if (!HasSplines())
1068 return;
1069
1070 _movementTime += diff;
1071
1073 {
1074 _reachedDestination = true;
1075 _lastSplineIndex = int32(_spline->last());
1076
1077 G3D::Vector3 lastSplinePosition = _spline->getPoint(_lastSplineIndex);
1078 GetMap()->AreaTriggerRelocation(this, lastSplinePosition.x, lastSplinePosition.y, lastSplinePosition.z, GetOrientation());
1079#ifdef TRINITY_DEBUG
1081#endif
1082
1083 _ai->OnSplineIndexReached(_lastSplineIndex);
1084 _ai->OnDestinationReached();
1085 return;
1086 }
1087
1088 float currentTimePercent = float(_movementTime) / float(GetTimeToTarget());
1089
1090 if (currentTimePercent <= 0.f)
1091 return;
1092
1093 if (GetCreateProperties()->MoveCurveId)
1094 {
1095 float progress = sDB2Manager.GetCurveValueAt(GetCreateProperties()->MoveCurveId, currentTimePercent);
1096 if (progress < 0.f || progress > 1.f)
1097 {
1098 TC_LOG_ERROR("entities.areatrigger", "AreaTrigger (Id: {}, AreaTriggerCreatePropertiesId: {}) has wrong progress ({}) caused by curve calculation (MoveCurveId: {})",
1099 GetEntry(), GetCreateProperties()->Id, progress, GetCreateProperties()->MorphCurveId);
1100 }
1101 else
1102 currentTimePercent = progress;
1103 }
1104
1105 int lastPositionIndex = 0;
1106 float percentFromLastPoint = 0;
1107 _spline->computeIndex(currentTimePercent, lastPositionIndex, percentFromLastPoint);
1108
1109 G3D::Vector3 currentPosition;
1110 _spline->evaluate_percent(lastPositionIndex, percentFromLastPoint, currentPosition);
1111
1112 float orientation = GetOrientation();
1114 {
1115 G3D::Vector3 const& nextPoint = _spline->getPoint(lastPositionIndex + 1);
1116 orientation = GetAbsoluteAngle(nextPoint.x, nextPoint.y);
1117 }
1118
1119 GetMap()->AreaTriggerRelocation(this, currentPosition.x, currentPosition.y, currentPosition.z, orientation);
1120#ifdef TRINITY_DEBUG
1122#endif
1123
1124 if (_lastSplineIndex != lastPositionIndex)
1125 {
1126 _lastSplineIndex = lastPositionIndex;
1127 _ai->OnSplineIndexReached(_lastSplineIndex);
1128 }
1129}
@ AREATRIGGER_FLAG_HAS_FACE_MOVEMENT_DIR
float GetAbsoluteAngle(float x, float y) const
Definition: Position.h:125
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UpdateTargetList()

void AreaTrigger::UpdateTargetList ( )
protected

Definition at line 462 of file AreaTrigger.cpp.

463{
464 std::vector<Unit*> targetList;
465
466 switch (_shape.Type)
467 {
469 SearchUnitInSphere(targetList);
470 break;
472 SearchUnitInBox(targetList);
473 break;
475 SearchUnitInPolygon(targetList);
476 break;
478 SearchUnitInCylinder(targetList);
479 break;
481 SearchUnitInDisk(targetList);
482 break;
484 SearchUnitInBoundedPlane(targetList);
485 break;
486 default:
487 break;
488 }
489
490 if (GetTemplate())
491 {
492 if (ConditionContainer const* conditions = sConditionMgr->GetConditionsForAreaTrigger(GetTemplate()->Id.Id, GetTemplate()->Id.IsServerSide))
493 {
494 targetList.erase(std::remove_if(targetList.begin(), targetList.end(), [conditions](Unit* target)
495 {
496 return !sConditionMgr->IsObjectMeetToConditions(target, *conditions);
497 }), targetList.end());
498 }
499 }
500
501 HandleUnitEnterExit(targetList);
502}
@ AREATRIGGER_TYPE_BOX
@ AREATRIGGER_TYPE_SPHERE
@ AREATRIGGER_TYPE_CYLINDER
@ AREATRIGGER_TYPE_DISK
@ AREATRIGGER_TYPE_POLYGON
@ AREATRIGGER_TYPE_BOUNDED_PLANE
#define sConditionMgr
Definition: ConditionMgr.h:353
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:267
void SearchUnitInBoundedPlane(std::vector< Unit * > &targetList)
void SearchUnitInCylinder(std::vector< Unit * > &targetList)
void SearchUnitInDisk(std::vector< Unit * > &targetList)
void SearchUnitInPolygon(std::vector< Unit * > &targetList)
void SearchUnitInSphere(std::vector< Unit * > &targetList)
void SearchUnitInBox(std::vector< Unit * > &targetList)
+ 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

Definition at line 192 of file AreaTrigger.h.

◆ _areaTriggerCreateProperties

AreaTriggerCreateProperties const* AreaTrigger::_areaTriggerCreateProperties
protected

Definition at line 188 of file AreaTrigger.h.

◆ _areaTriggerTemplate

AreaTriggerTemplate const* AreaTrigger::_areaTriggerTemplate
protected

Definition at line 189 of file AreaTrigger.h.

◆ _aurEff

AuraEffect const* AreaTrigger::_aurEff
protected

Definition at line 167 of file AreaTrigger.h.

◆ _duration

int32 AreaTrigger::_duration
protected

Definition at line 171 of file AreaTrigger.h.

◆ _insideUnits

GuidUnorderedSet AreaTrigger::_insideUnits
protected

Definition at line 190 of file AreaTrigger.h.

◆ _isRemoved

bool AreaTrigger::_isRemoved
protected

Definition at line 175 of file AreaTrigger.h.

◆ _lastSplineIndex

int32 AreaTrigger::_lastSplineIndex
protected

Definition at line 183 of file AreaTrigger.h.

◆ _maxSearchRadius

float AreaTrigger::_maxSearchRadius
protected

Definition at line 170 of file AreaTrigger.h.

◆ _movementTime

uint32 AreaTrigger::_movementTime
protected

Definition at line 184 of file AreaTrigger.h.

◆ _orbitInfo

Optional<AreaTriggerOrbitInfo> AreaTrigger::_orbitInfo
protected

Definition at line 186 of file AreaTrigger.h.

◆ _polygonVertices

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

Definition at line 179 of file AreaTrigger.h.

◆ _previousCheckOrientation

float AreaTrigger::_previousCheckOrientation
protected

Definition at line 174 of file AreaTrigger.h.

◆ _reachedDestination

bool AreaTrigger::_reachedDestination
protected

Definition at line 182 of file AreaTrigger.h.

◆ _rollPitchYaw

Position AreaTrigger::_rollPitchYaw
protected

Definition at line 177 of file AreaTrigger.h.

◆ _shape

AreaTriggerShapeInfo AreaTrigger::_shape
protected

Definition at line 169 of file AreaTrigger.h.

◆ _spawnId

ObjectGuid::LowType AreaTrigger::_spawnId
protected

Definition at line 163 of file AreaTrigger.h.

◆ _spline

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

Definition at line 180 of file AreaTrigger.h.

◆ _targetGuid

ObjectGuid AreaTrigger::_targetGuid
protected

Definition at line 165 of file AreaTrigger.h.

◆ _targetRollPitchYaw

Position AreaTrigger::_targetRollPitchYaw
protected

Definition at line 178 of file AreaTrigger.h.

◆ _timeSinceCreated

uint32 AreaTrigger::_timeSinceCreated
protected

Definition at line 173 of file AreaTrigger.h.

◆ _totalDuration

int32 AreaTrigger::_totalDuration
protected

Definition at line 172 of file AreaTrigger.h.

◆ m_areaTriggerData

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

Definition at line 131 of file AreaTrigger.h.


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