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{
42 Sphere = 0,
43 Box = 1,
44 Unk = 2,
45 Polygon = 3,
46 Cylinder = 4,
47 Disk = 5,
48 BoundedPlane = 6,
49 Max
50};
51
53{
58};
59
61{
69};
70
72{
73 None = 0x00000,
74 HasAbsoluteOrientation = 0x00001,
75 HasDynamicShape = 0x00002,
76 HasAttached = 0x00004,
77 HasFaceMovementDir = 0x00008,
78 HasFollowsTerrain = 0x00010, // NYI
79 Unk1 = 0x00020,
80 HasTargetRollPitchYaw = 0x00040, // NYI
81 HasAnimId = 0x00080, // DEPRECATED
82 Unk3 = 0x00100,
83 HasAnimKitId = 0x00200, // DEPRECATED
84 HasCircularMovement = 0x00400, // DEPRECATED
85 Unk5 = 0x00800,
86};
87
89
91{
93 bool IsCustom = false;
94
95 friend bool operator==(AreaTriggerId const& left, AreaTriggerId const& right) = default;
96};
97
99
101{
105};
106
108{
110
112 std::array<DBCPosition2D, 2> Points;
113};
114
116{
118
120 std::variant<float, AreaTriggerScaleCurvePointsTemplate> Curve;
121};
122
124{
126
127 bool IsSphere() const { return Type == AreaTriggerShapeType::Sphere; }
128 bool IsBox() const { return Type == AreaTriggerShapeType::Box; }
129 bool IsPolygon() const { return Type == AreaTriggerShapeType::Polygon; }
131 bool IsDisk() const { return Type == AreaTriggerShapeType::Disk; }
133 float GetMaxSearchRadius() const;
134
136
137 std::vector<TaggedPosition<Position::XY>> PolygonVertices;
138 std::vector<TaggedPosition<Position::XY>> PolygonVerticesTarget;
139
140 union
141 {
142 struct
143 {
146
147 // AreaTriggerShapeType::Sphere
148 struct
149 {
150 float Radius;
153
154 // AreaTriggerShapeType::Box
155 struct
156 {
157 float Extents[3];
160
161 // AreaTriggerShapeType::Polygon
162 struct
163 {
164 float Height;
167
168 // AreaTriggerShapeType::Cylinder
169 struct
170 {
171 float Radius;
172 float RadiusTarget;
173 float Height;
174 float HeightTarget;
178
179 // AreaTriggerShapeType::Disk
180 struct
181 {
186 float Height;
187 float HeightTarget;
188 float LocationZOffset;
191
192 // AreaTriggerShapeType::BoundedPlane
193 struct
194 {
195 float Extents[2];
196 float ExtentsTarget[2];
198 };
199};
200
202{
205 bool CounterClockwise = false;
206 bool CanLoop = false;
210 float Radius = 0.0f;
211 float BlendFromRadius = 0.0f;
212 float InitialAngle = 0.0f;
213 float ZOffset = 0.0f;
214};
215
217{
218public:
221
224 std::vector<AreaTriggerAction> Actions;
225};
226
228{
229public:
232
233 bool HasSplines() const;
234
238
243
246
248
251
254
256
257 std::vector<Position> SplinePoints;
259
261};
262
264{
266
269};
270
271#endif
DEFINE_ENUM_FLAG(AreaTriggerFlag)
AreaTriggerCreatePropertiesFlag
#define MAX_AREATRIGGER_ENTITY_DATA
AreaTriggerActionTypes
@ AREATRIGGER_ACTION_ADDAURA
@ AREATRIGGER_ACTION_TELEPORT
@ AREATRIGGER_ACTION_MAX
@ AREATRIGGER_ACTION_CAST
AreaTriggerFlag
AreaTriggerId AreaTriggerCreatePropertiesId
AreaTriggerShapeType
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:862
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint32_t uint32
Definition: Define.h:142
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
@ SPAWN_TYPE_AREATRIGGER
Definition: SpawnData.h:36
EnumFlag< AreaTriggerCreatePropertiesFlag > Flags
AreaTriggerCreatePropertiesId Id
Optional< AreaTriggerOrbitInfo > OrbitInfo
Optional< AreaTriggerScaleCurveTemplate > OverrideScale
AreaTriggerTemplate const * Template
std::vector< Position > SplinePoints
Optional< AreaTriggerScaleCurveTemplate > ExtraScale
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
float GetMaxSearchRadius() const
struct AreaTriggerShapeInfo::@199::@203 BoxDatas
struct AreaTriggerShapeInfo::@199::@207 BoundedPlaneDatas
std::vector< TaggedPosition< Position::XY > > PolygonVertices
AreaTriggerShapeType Type
struct AreaTriggerShapeInfo::@199::@202 SphereDatas
std::vector< TaggedPosition< Position::XY > > PolygonVerticesTarget
struct AreaTriggerShapeInfo::@199::@205 CylinderDatas
struct AreaTriggerShapeInfo::@199::@204 PolygonDatas
struct AreaTriggerShapeInfo::@199::@201 DefaultDatas
struct AreaTriggerShapeInfo::@199::@206 DiskDatas
Optional< int32 > SpellForVisuals
AreaTriggerCreatePropertiesId Id