TrinityCore
AreaTriggerTemplate.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_AREATRIGGER_TEMPLATE_H
19#define TRINITYCORE_AREATRIGGER_TEMPLATE_H
20
21#include "Define.h"
22#include "EnumFlag.h"
23#include "ObjectGuid.h"
24#include "Optional.h"
25#include "SpawnData.h"
26#include <variant>
27#include <vector>
28
29#define MAX_AREATRIGGER_ENTITY_DATA 8
30#define MAX_AREATRIGGER_SCALE 7
31
33{
34 None = 0x00,
35 IsServerSide = 0x01
36};
37
39
41{
47};
48
50{
58};
59
61{
62 None = 0x00000,
63 HasAbsoluteOrientation = 0x00001,
64 HasDynamicShape = 0x00002,
65 HasAttached = 0x00004,
66 HasFaceMovementDir = 0x00008,
67 HasFollowsTerrain = 0x00010, // NYI
68 AlwaysExterior = 0x00020,
69 HasTargetRollPitchYaw = 0x00040, // NYI
70 HasAnimId = 0x00080, // DEPRECATED
71 VisualAnimIsDecay = 0x00100,
72 HasAnimKitId = 0x00200, // DEPRECATED
73 HasCircularMovement = 0x00400, // DEPRECATED
74 Unk5 = 0x00800,
75};
76
78
80{
82 bool IsCustom = false;
83
84 friend bool operator==(AreaTriggerId const& left, AreaTriggerId const& right) = default;
85};
86
88
90{
94};
95
97{
99
101 std::array<DBCPosition2D, 2> Points;
102};
103
105{
107
109 std::variant<float, AreaTriggerScaleCurvePointsTemplate> Curve;
110};
111
113{
115
116 bool IsSphere() const { return Type == AreaTriggerShapeType::Sphere; }
117 bool IsBox() const { return Type == AreaTriggerShapeType::Box; }
118 bool IsPolygon() const { return Type == AreaTriggerShapeType::Polygon; }
120 bool IsDisk() const { return Type == AreaTriggerShapeType::Disk; }
122 float GetMaxSearchRadius() const;
123
125
126 std::vector<TaggedPosition<Position::XY>> PolygonVertices;
127 std::vector<TaggedPosition<Position::XY>> PolygonVerticesTarget;
128
129 union
130 {
131 struct
132 {
135
136 // AreaTriggerShapeType::Sphere
137 struct
138 {
139 float Radius;
142
143 // AreaTriggerShapeType::Box
144 struct
145 {
146 float Extents[3];
149
150 // AreaTriggerShapeType::Polygon
151 struct
152 {
153 float Height;
156
157 // AreaTriggerShapeType::Cylinder
158 struct
159 {
160 float Radius;
161 float RadiusTarget;
162 float Height;
163 float HeightTarget;
167
168 // AreaTriggerShapeType::Disk
169 struct
170 {
175 float Height;
176 float HeightTarget;
177 float LocationZOffset;
180
181 // AreaTriggerShapeType::BoundedPlane
182 struct
183 {
184 float Extents[2];
185 float ExtentsTarget[2];
187 };
188};
189
191{
194 bool CounterClockwise = false;
195 bool CanLoop = false;
199 float Radius = 0.0f;
200 float BlendFromRadius = 0.0f;
201 float InitialAngle = 0.0f;
202 float ZOffset = 0.0f;
203};
204
206{
207public:
210
211 AreaTriggerId Id = { .Id = 0, .IsCustom = false };
215 std::vector<AreaTriggerAction> Actions;
216};
217
219{
220public:
223
224 bool HasSplines() const;
225
226 AreaTriggerCreatePropertiesId Id = { .Id = 0, .IsCustom = false };
229
234
237
239
241
243
246
248
249 float Speed = 1.0f;
250 std::vector<Position> SplinePoints;
252
254};
255
257{
259
261};
262
263#endif
DEFINE_ENUM_FLAG(AreaTriggerFlag)
AreaTriggerCreatePropertiesFlag
#define MAX_AREATRIGGER_ENTITY_DATA
AreaTriggerActionTypes
@ AREATRIGGER_ACTION_ADDAURA
@ AREATRIGGER_ACTION_TELEPORT
@ AREATRIGGER_ACTION_TAVERN
@ AREATRIGGER_ACTION_MAX
@ AREATRIGGER_ACTION_CAST
AreaTriggerFlag
AreaTriggerId AreaTriggerCreatePropertiesId
AreaTriggerActionUserTypes
@ AREATRIGGER_ACTION_USER_ENEMY
@ AREATRIGGER_ACTION_USER_ANY
@ AREATRIGGER_ACTION_USER_FRIEND
@ AREATRIGGER_ACTION_USER_CASTER
@ AREATRIGGER_ACTION_USER_MAX
@ AREATRIGGER_ACTION_USER_RAID
@ AREATRIGGER_ACTION_USER_PARTY
CurveInterpolationMode
Definition: DBCEnums.h:914
AreaTriggerShapeType
Definition: DBCEnums.h:202
int32_t int32
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:148
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
@ SPAWN_TYPE_AREATRIGGER
Definition: SpawnData.h:38
EnumFlag< AreaTriggerCreatePropertiesFlag > Flags
AreaTriggerCreatePropertiesId Id
Optional< AreaTriggerOrbitInfo > OrbitInfo
Optional< AreaTriggerScaleCurveTemplate > OverrideScale
AreaTriggerTemplate const * Template
std::vector< Position > SplinePoints
Optional< AreaTriggerScaleCurveTemplate > ExtraScale
EnumFlag< AreaTriggerActionSetFlag > ActionSetFlags
std::vector< AreaTriggerAction > Actions
EnumFlag< AreaTriggerFlag > Flags
AreaTriggerActionTypes ActionType
AreaTriggerActionUserTypes TargetType
friend bool operator==(AreaTriggerId const &left, AreaTriggerId const &right)=default
Optional< TaggedPosition< Position::XYZ > > Center
Optional< ObjectGuid > PathTarget
std::array< DBCPosition2D, 2 > Points
std::variant< float, AreaTriggerScaleCurvePointsTemplate > Curve
struct AreaTriggerShapeInfo::@189::@193 BoxDatas
struct AreaTriggerShapeInfo::@189::@196 DiskDatas
float GetMaxSearchRadius() const
std::vector< TaggedPosition< Position::XY > > PolygonVertices
struct AreaTriggerShapeInfo::@189::@197 BoundedPlaneDatas
AreaTriggerShapeType Type
std::vector< TaggedPosition< Position::XY > > PolygonVerticesTarget
struct AreaTriggerShapeInfo::@189::@192 SphereDatas
struct AreaTriggerShapeInfo::@189::@191 DefaultDatas
struct AreaTriggerShapeInfo::@189::@195 CylinderDatas
struct AreaTriggerShapeInfo::@189::@194 PolygonDatas
AreaTriggerCreatePropertiesId Id