18#ifndef TRINITYCORE_AREATRIGGER_H
19#define TRINITYCORE_AREATRIGGER_H
38 template<
typename length_type>
65 void operator()(
Player const* player)
const;
76 bool IsCustom()
const {
return _areaTriggerTemplate->Id.IsCustom; }
83 float GetStationaryX()
const override {
return _stationaryPosition.GetPositionX(); }
84 float GetStationaryY()
const override {
return _stationaryPosition.GetPositionY(); }
85 float GetStationaryZ()
const override {
return _stationaryPosition.GetPositionZ(); }
86 float GetStationaryO()
const override {
return _stationaryPosition.GetOrientation(); }
91 bool Create(
AreaTriggerCreatePropertiesId areaTriggerCreatePropertiesId,
Map* map,
Position const& pos,
int32 duration,
AreaTriggerSpawn const* spawnData =
nullptr,
Unit* caster =
nullptr,
Unit* target =
nullptr,
SpellCastVisual spellVisual = { 0, 0 },
SpellInfo const* spellInfo =
nullptr,
Spell* spell =
nullptr,
AuraEffect const* aurEff =
nullptr);
107 void SetOverrideScaleCurve(
float overrideScale);
109 void ClearOverrideScaleCurve();
111 void SetExtraScaleCurve(
float extraScale);
113 void ClearExtraScaleCurve();
115 void SetOverrideMoveCurve(
float x,
float y,
float z);
116 void SetOverrideMoveCurve(std::array<DBCPosition2D, 2>
const& xCurvePoints, std::array<DBCPosition2D, 2>
const& yCurvePoints, std::array<DBCPosition2D, 2>
const& zCurvePoints,
118 void ClearOverrideMoveCurve();
134 void SetDuration(
int32 newDuration);
135 void Delay(
int32 delaytime) { SetDuration(GetDuration() - delaytime); }
141 uint32 GetScriptId()
const;
146 Unit* GetCaster()
const;
147 Unit* GetTarget()
const;
152 float GetMaxSearchRadius()
const;
155 void InitSplineOffsets(std::vector<Position>
const& offsets,
uint32 timeToTarget);
156 void InitSplines(std::vector<G3D::Vector3> splinePoints,
uint32 timeToTarget);
157 bool HasSplines()
const;
162 bool HasOrbit()
const;
165 bool HasOverridePosition()
const;
172 void _UpdateDuration(
int32 newDuration);
174 float CalcCurrentScale()
const;
176 float GetProgress()
const;
179 float GetScaleCurveValueAtProgress(
UF::ScaleCurve const& scaleCurve,
float x)
const;
186 void UpdateTargetList();
187 void SearchUnits(std::vector<Unit*>& targetList,
float radius,
bool check3D);
188 void SearchUnitInSphere(std::vector<Unit*>& targetList);
189 void SearchUnitInBox(std::vector<Unit*>& targetList);
190 void SearchUnitInPolygon(std::vector<Unit*>& targetList);
191 void SearchUnitInCylinder(std::vector<Unit*>& targetList);
192 void SearchUnitInDisk(std::vector<Unit*>& targetList);
193 void SearchUnitInBoundedPlane(std::vector<Unit*>& targetList);
194 void HandleUnitEnterExit(std::vector<Unit*>
const& targetList);
196 void DoActions(
Unit* unit);
197 void UndoActions(
Unit* unit);
199 void UpdatePolygonVertices();
200 void UpdateOrbitPosition(
uint32 diff);
201 void UpdateSplinePosition(
uint32 diff);
202 void UpdateOverridePosition();
204 Position const* GetOrbitCenterPosition()
const;
205 Position CalculateOrbitPosition()
const;
207 void DebugVisualizePosition();
226 std::unique_ptr<::Movement::Spline<int32>>
_spline;
238 std::unique_ptr<AreaTriggerAI>
_ai;
std::unordered_set< ObjectGuid > GuidUnorderedSet
std::optional< T > Optional
Optional helper class to wrap optional values within.
float GetStationaryY() const override
GuidUnorderedSet const & GetInsideUnits() const
AreaTriggerCreateProperties const * _areaTriggerCreateProperties
uint32 GetTimeToTargetExtraScale() const
std::vector< Position > _polygonVertices
ObjectGuid::LowType _spawnId
bool HasActionSetFlag(AreaTriggerActionSetFlag flag) const
void SetHeightIgnoresScale(bool heightIgnoresScale)
ObjectGuid GetOwnerGUID() const override
uint32 GetTimeSinceCreated() const
void SetTimeToTargetPos(uint32 timeToTargetPos)
float GetStationaryZ() const override
float GetStationaryO() const override
AreaTriggerShapeInfo const & GetShape() const
ObjectGuid const & GetCasterGuid() const
void RelocateStationaryPosition(Position const &pos)
int32 GetTotalDuration() const
Position _stationaryPosition
UF::UpdateField< UF::AreaTriggerData, 0, TYPEID_AREATRIGGER > m_areaTriggerData
std::unique_ptr< AreaTriggerAI > _ai
uint32 GetTimeToTargetPos() const
bool IsServerSide() const
uint32 GetSpellId() const
void SetTimeToTarget(uint32 timeToTarget)
uint32 GetTimeToTarget() const
GuidUnorderedSet _insideUnits
uint32 GetTimeToTargetScale() const
bool IsStaticSpawn() const
Optional< AreaTriggerOrbitInfo > const & GetOrbit() const
std::unique_ptr<::Movement::Spline< int32 > > _spline
uint32 GetElapsedTimeForMovement() const
AreaTriggerTemplate const * _areaTriggerTemplate
void SetTimeToTargetScale(uint32 timeToTargetScale)
Position _targetRollPitchYaw
Optional< AreaTriggerOrbitInfo > _orbitInfo
AuraEffect const * _aurEff
AuraEffect const * GetAuraEffect() const
::Movement::Spline< int32 > const & GetSpline() const
ObjectGuid GetCreatorGUID() const override
Position const & GetTargetRollPitchYaw() const
Position const & GetRollPitchYaw() const
void SetTimeToTargetExtraScale(uint32 timeToTargetExtraScale)
int32 GetDuration() const
AreaTriggerCreateProperties const * GetCreateProperties() const
void Delay(int32 delaytime)
float _verticesUpdatePreviousOrientation
float GetStationaryX() const override
AreaTriggerShapeInfo _shape
virtual void BuildValuesCreate(ByteBuffer *data, Player const *target) const =0
virtual void ClearUpdateMask(bool remove)
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
virtual void BuildValuesUpdate(ByteBuffer *data, Player const *target) const =0
void AddToWorld() override
void RemoveFromWorld() override
virtual uint32 GetFaction() const =0
virtual bool IsNeverVisibleFor(WorldObject const *seer, bool allowServersideObjects=false) const
virtual void Update(uint32 diff)
std::unique_ptr< VignetteData > Create(VignetteEntry const *vignetteData, WorldObject const *owner)
void Remove(VignetteData &vignette, WorldObject const *owner)
UF::ObjectData::Base ObjectMask
UF::AreaTriggerData::Base AreaTriggerMask
ValuesUpdateForPlayerWithMaskSender(AreaTrigger const *owner)
AreaTrigger const * Owner
UpdateField< uint32, 0, 12 > TimeToTargetExtraScale
UpdateField< bool, 0, 1 > HeightIgnoresScale
UpdateField< uint32, 0, 13 > TimeToTargetPos
UpdateField< uint32, 0, 11 > TimeToTargetScale
UpdateField< uint32, 0, 10 > TimeToTarget