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{
46};
47
49{
57};
58
60{
61 None = 0x00000,
62 HasAbsoluteOrientation = 0x00001,
63 HasDynamicShape = 0x00002,
64 HasAttached = 0x00004,
65 HasFaceMovementDir = 0x00008,
66 HasFollowsTerrain = 0x00010, // NYI
67 AlwaysExterior = 0x00020,
68 HasTargetRollPitchYaw = 0x00040, // NYI
69 HasAnimId = 0x00080, // DEPRECATED
70 VisualAnimIsDecay = 0x00100,
71 HasAnimKitId = 0x00200, // DEPRECATED
72 HasCircularMovement = 0x00400, // DEPRECATED
73 Unk5 = 0x00800,
74};
75
77
79{
81 bool IsCustom = false;
82
83 friend bool operator==(AreaTriggerId const& left, AreaTriggerId const& right) = default;
84};
85
87
89{
93};
94
96{
98
100 std::array<DBCPosition2D, 2> Points;
101};
102
104{
106
108 std::variant<float, AreaTriggerScaleCurvePointsTemplate> Curve;
109};
110
112{
114
115 bool IsSphere() const { return Type == AreaTriggerShapeType::Sphere; }
116 bool IsBox() const { return Type == AreaTriggerShapeType::Box; }
117 bool IsPolygon() const { return Type == AreaTriggerShapeType::Polygon; }
119 bool IsDisk() const { return Type == AreaTriggerShapeType::Disk; }
121 float GetMaxSearchRadius() const;
122
124
125 std::vector<TaggedPosition<Position::XY>> PolygonVertices;
126 std::vector<TaggedPosition<Position::XY>> PolygonVerticesTarget;
127
128 union
129 {
130 struct
131 {
134
135 // AreaTriggerShapeType::Sphere
136 struct
137 {
138 float Radius;
141
142 // AreaTriggerShapeType::Box
143 struct
144 {
145 float Extents[3];
148
149 // AreaTriggerShapeType::Polygon
150 struct
151 {
152 float Height;
155
156 // AreaTriggerShapeType::Cylinder
157 struct
158 {
159 float Radius;
160 float RadiusTarget;
161 float Height;
162 float HeightTarget;
166
167 // AreaTriggerShapeType::Disk
168 struct
169 {
174 float Height;
175 float HeightTarget;
176 float LocationZOffset;
179
180 // AreaTriggerShapeType::BoundedPlane
181 struct
182 {
183 float Extents[2];
184 float ExtentsTarget[2];
186 };
187};
188
190{
193 bool CounterClockwise = false;
194 bool CanLoop = false;
198 float Radius = 0.0f;
199 float BlendFromRadius = 0.0f;
200 float InitialAngle = 0.0f;
201 float ZOffset = 0.0f;
202};
203
205{
206public:
209
210 AreaTriggerId Id = { .Id = 0, .IsCustom = false };
214 std::vector<AreaTriggerAction> Actions;
215};
216
218{
219public:
222
223 bool HasSplines() const;
224
225 AreaTriggerCreatePropertiesId Id = { .Id = 0, .IsCustom = false };
228
233
236
238
240
242
245
247
248 float Speed = 1.0f;
249 std::vector<Position> SplinePoints;
251
253};
254
256{
258
260};
261
262#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
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:907
AreaTriggerShapeType
Definition: DBCEnums.h:202
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:37
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