TrinityCore
Loading...
Searching...
No Matches
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
48
59
61{
62 None = 0x00000,
63 HasAbsoluteOrientation = 0x00001,
64 HasDynamicShape = 0x00002,
65 HasAttached = 0x00004, // DEPRECATED
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
95
97{
98 struct Sphere
99 {
101 : Radius(0.0f), RadiusTarget(0.0f) { }
102 explicit Sphere(std::array<float, MAX_AREATRIGGER_ENTITY_DATA> const& raw)
103 : Radius(raw[0]), RadiusTarget(raw[1]) { }
104
105 float Radius;
107
108 float GetMaxSearchRadius() const;
109 };
110
111 struct Box
112 {
114 : Extents(), ExtentsTarget() { }
115 explicit Box(std::array<float, MAX_AREATRIGGER_ENTITY_DATA> const& raw)
116 : Extents(raw[0], raw[1], raw[2]), ExtentsTarget(raw[3], raw[4], raw[5]) { }
117
120
121 float GetMaxSearchRadius() const;
122 };
123
124 struct Polygon
125 {
128 explicit Polygon(std::array<float, MAX_AREATRIGGER_ENTITY_DATA> const& raw)
129 : PolygonVertices(), PolygonVerticesTarget(), Height(raw[0]), HeightTarget(raw[1]) { }
130
131 std::vector<TaggedPosition<Position::XY>> PolygonVertices;
132 std::vector<TaggedPosition<Position::XY>> PolygonVerticesTarget;
133 float Height;
135
136 float GetMaxSearchRadius() const;
137 };
138
139 struct Cylinder
140 {
142 : Radius(0.0f), RadiusTarget(0.0f), Height(0.0f), HeightTarget(0.0f), LocationZOffset(0.0f), LocationZOffsetTarget(0.0f) { }
143 explicit Cylinder(std::array<float, MAX_AREATRIGGER_ENTITY_DATA> const& raw)
144 : Radius(raw[0]), RadiusTarget(raw[1]), Height(raw[2]), HeightTarget(raw[3]), LocationZOffset(raw[4]), LocationZOffsetTarget(raw[5]) { }
145
146 float Radius;
148 float Height;
152
153 float GetMaxSearchRadius() const;
154 };
155
156 struct Disk
157 {
159 : InnerRadius(0.0f), InnerRadiusTarget(0.0f), OuterRadius(0.0f), OuterRadiusTarget(0.0f),
160 Height(0.0f), HeightTarget(0.0f), LocationZOffset(0.0f), LocationZOffsetTarget(0.0f) { }
161 explicit Disk(std::array<float, MAX_AREATRIGGER_ENTITY_DATA> const& raw)
162 : InnerRadius(raw[0]), InnerRadiusTarget(raw[1]), OuterRadius(raw[2]), OuterRadiusTarget(raw[3]),
163 Height(raw[4]), HeightTarget(raw[5]), LocationZOffset(raw[6]), LocationZOffsetTarget(raw[7]) { }
164
169 float Height;
173
174 float GetMaxSearchRadius() const;
175 };
176
178 {
181 explicit BoundedPlane(std::array<float, MAX_AREATRIGGER_ENTITY_DATA> const& raw)
182 : Extents(raw[0], raw[1]), ExtentsTarget(raw[2], raw[3]) { }
183
186
187 float GetMaxSearchRadius() const;
188 };
189
190 std::variant<Sphere, Box, Polygon, Cylinder, Disk, BoundedPlane> Data;
191
192 bool IsSphere() const { return std::holds_alternative<Sphere>(Data); }
193 bool IsBox() const { return std::holds_alternative<Box>(Data); }
194 bool IsPolygon() const { return std::holds_alternative<Polygon>(Data); }
195 bool IsCylinder() const { return std::holds_alternative<Cylinder>(Data); }
196 bool IsDisk() const { return std::holds_alternative<Disk>(Data); }
197 bool IsBoundedPlane() const { return std::holds_alternative<BoundedPlane>(Data); }
198 float GetMaxSearchRadius() const;
199};
200
213
226
260
267
268#endif
AreaTriggerCreatePropertiesFlag
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
int32_t int32
Definition Define.h:150
uint32_t uint32
Definition Define.h:154
#define DEFINE_ENUM_FLAG(enumType)
Definition EnumFlag.h:26
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
std::vector< Position > SplineInfo
std::variant< std::monostate, SplineInfo, AreaTriggerOrbitInfo > Movement
AreaTriggerTemplate const * Template
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
TaggedPosition< Position::XY > ExtentsTarget
BoundedPlane(std::array< float, MAX_AREATRIGGER_ENTITY_DATA > const &raw)
TaggedPosition< Position::XY > Extents
Box(std::array< float, MAX_AREATRIGGER_ENTITY_DATA > const &raw)
TaggedPosition< Position::XYZ > ExtentsTarget
TaggedPosition< Position::XYZ > Extents
Cylinder(std::array< float, MAX_AREATRIGGER_ENTITY_DATA > const &raw)
Disk(std::array< float, MAX_AREATRIGGER_ENTITY_DATA > const &raw)
Polygon(std::array< float, MAX_AREATRIGGER_ENTITY_DATA > const &raw)
std::vector< TaggedPosition< Position::XY > > PolygonVerticesTarget
std::vector< TaggedPosition< Position::XY > > PolygonVertices
Sphere(std::array< float, MAX_AREATRIGGER_ENTITY_DATA > const &raw)
std::variant< Sphere, Box, Polygon, Cylinder, Disk, BoundedPlane > Data
AreaTriggerCreatePropertiesId Id