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; }
82 float GetStationaryX()
const override {
return _stationaryPosition.GetPositionX(); }
83 float GetStationaryY()
const override {
return _stationaryPosition.GetPositionY(); }
84 float GetStationaryZ()
const override {
return _stationaryPosition.GetPositionZ(); }
85 float GetStationaryO()
const override {
return _stationaryPosition.GetOrientation(); }
89 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);
105 void SetOverrideScaleCurve(
float overrideScale);
107 void ClearOverrideScaleCurve();
109 void SetExtraScaleCurve(
float extraScale);
111 void ClearExtraScaleCurve();
113 void SetOverrideMoveCurve(
float x,
float y,
float z);
114 void SetOverrideMoveCurve(std::array<DBCPosition2D, 2>
const& xCurvePoints, std::array<DBCPosition2D, 2>
const& yCurvePoints, std::array<DBCPosition2D, 2>
const& zCurvePoints,
116 void ClearOverrideMoveCurve();
132 void SetDuration(
int32 newDuration);
133 void Delay(
int32 delaytime) { SetDuration(GetDuration() - delaytime); }
139 uint32 GetScriptId()
const;
144 Unit* GetCaster()
const;
145 Unit* GetTarget()
const;
150 float GetMaxSearchRadius()
const;
153 void InitSplineOffsets(std::vector<Position>
const& offsets,
uint32 timeToTarget);
154 void InitSplines(std::vector<G3D::Vector3> splinePoints,
uint32 timeToTarget);
155 bool HasSplines()
const;
160 bool HasOrbit()
const;
163 bool HasOverridePosition()
const;
170 void _UpdateDuration(
int32 newDuration);
172 float CalcCurrentScale()
const;
174 float GetProgress()
const;
177 float GetScaleCurveValueAtProgress(
UF::ScaleCurve const& scaleCurve,
float x)
const;
184 void UpdateTargetList();
185 void SearchUnits(std::vector<Unit*>& targetList,
float radius,
bool check3D);
186 void SearchUnitInSphere(std::vector<Unit*>& targetList);
187 void SearchUnitInBox(std::vector<Unit*>& targetList);
188 void SearchUnitInPolygon(std::vector<Unit*>& targetList);
189 void SearchUnitInCylinder(std::vector<Unit*>& targetList);
190 void SearchUnitInDisk(std::vector<Unit*>& targetList);
191 void SearchUnitInBoundedPlane(std::vector<Unit*>& targetList);
192 bool CheckIsInPolygon2D(
Position const* pos)
const;
193 void HandleUnitEnterExit(std::vector<Unit*>
const& targetList);
195 void DoActions(
Unit* unit);
196 void UndoActions(
Unit* unit);
198 void UpdatePolygonVertices();
199 void UpdateOrbitPosition(
uint32 diff);
200 void UpdateSplinePosition(
uint32 diff);
201 void UpdateOverridePosition();
203 Position const* GetOrbitCenterPosition()
const;
204 Position CalculateOrbitPosition()
const;
206 void DebugVisualizePosition();
225 std::unique_ptr<::Movement::Spline<int32>>
_spline;
237 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
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