TrinityCore
SpawnData.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 TRINITY_SPAWNDATA_H
19#define TRINITY_SPAWNDATA_H
20
21#include "DBCEnums.h"
22#include "Position.h"
23#include <vector>
24
25class AreaTrigger;
26class Creature;
27class GameObject;
28class Pool;
29struct PoolTemplate;
30
31// EnumUtils: DESCRIBE THIS
33{
34 SPAWN_TYPE_CREATURE = 0, // TITLE Creature
35 SPAWN_TYPE_GAMEOBJECT = 1, // TITLE Gameobject
36 SPAWN_TYPE_AREATRIGGER = 2,// TITLE AreaTrigger
39};
40
42{
46
49};
50
52{
60
63};
64
66{
68 std::string name;
71};
72
73namespace Trinity { namespace Impl {
74 template <typename T>
75 struct SpawnObjectTypeForImpl { static_assert(!std::is_same<T,T>::value, "This type does not have an associated spawn type!"); };
76 template <> struct SpawnObjectTypeForImpl<Creature> { static constexpr SpawnObjectType value = SPAWN_TYPE_CREATURE; };
77 template <> struct SpawnObjectTypeForImpl<GameObject> { static constexpr SpawnObjectType value = SPAWN_TYPE_GAMEOBJECT; };
78 template <> struct SpawnObjectTypeForImpl<AreaTrigger> { static constexpr SpawnObjectType value = SPAWN_TYPE_AREATRIGGER; };
79}}
80
81struct SpawnData;
83{
84 static constexpr bool TypeInMask(SpawnObjectType type, SpawnObjectTypeMask mask) { return ((1 << type) & mask); }
85 static constexpr bool TypeHasData(SpawnObjectType type) { return (type < NUM_SPAWN_TYPES_WITH_DATA); }
86 static constexpr bool TypeIsValid(SpawnObjectType type) { return (type < NUM_SPAWN_TYPES); }
87 template <typename T>
89
90 SpawnData const* ToSpawnData() const { return TypeHasData(type) ? reinterpret_cast<SpawnData const*>(this) : nullptr; }
91
95 bool dbData = true;
97
98 protected:
100};
101
103{
104 uint32 id = 0; // entry in respective _template table
112 std::vector<Difficulty> spawnDifficulties;
114 std::string StringId;
115
116 protected:
118};
119
121{
123 LINKED_RESPAWN_CREATURE_TO_GO = 1, // Creature is dependant on GameObject
125 LINKED_RESPAWN_GO_TO_CREATURE = 3, // GameObject is dependant on Creature
126};
127
128#endif
uint8_t uint8
Definition: Define.h:144
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint32_t uint32
Definition: Define.h:142
#define MAPID_INVALID
Definition: Position.h:176
SpawnGroupFlags
Definition: SpawnData.h:52
@ SPAWNGROUP_FLAG_DYNAMIC_SPAWN_RATE
Definition: SpawnData.h:57
@ SPAWNGROUP_FLAGS_ALL
Definition: SpawnData.h:61
@ SPAWNGROUP_FLAG_MANUAL_SPAWN
Definition: SpawnData.h:56
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
Definition: SpawnData.h:55
@ SPAWNGROUP_FLAG_NONE
Definition: SpawnData.h:53
@ SPAWNGROUP_FLAG_DESPAWN_ON_CONDITION_FAILURE
Definition: SpawnData.h:59
@ SPAWNGROUP_FLAG_SYSTEM
Definition: SpawnData.h:54
@ SPAWNGROUP_FLAG_ESCORTQUESTNPC
Definition: SpawnData.h:58
LinkedRespawnType
Definition: SpawnData.h:121
@ LINKED_RESPAWN_CREATURE_TO_GO
Definition: SpawnData.h:123
@ LINKED_RESPAWN_GO_TO_GO
Definition: SpawnData.h:124
@ LINKED_RESPAWN_CREATURE_TO_CREATURE
Definition: SpawnData.h:122
@ LINKED_RESPAWN_GO_TO_CREATURE
Definition: SpawnData.h:125
SpawnObjectTypeMask
Definition: SpawnData.h:42
@ SPAWN_TYPEMASK_AREATRIGGER
Definition: SpawnData.h:45
@ SPAWN_TYPEMASK_CREATURE
Definition: SpawnData.h:43
@ SPAWN_TYPEMASK_WITH_DATA
Definition: SpawnData.h:47
@ SPAWN_TYPEMASK_GAMEOBJECT
Definition: SpawnData.h:44
@ SPAWN_TYPEMASK_ALL
Definition: SpawnData.h:48
SpawnObjectType
Definition: SpawnData.h:33
@ SPAWN_TYPE_GAMEOBJECT
Definition: SpawnData.h:35
@ SPAWN_TYPE_AREATRIGGER
Definition: SpawnData.h:36
@ NUM_SPAWN_TYPES
Definition: SpawnData.h:38
@ SPAWN_TYPE_CREATURE
Definition: SpawnData.h:34
@ NUM_SPAWN_TYPES_WITH_DATA
Definition: SpawnData.h:37
Definition: PoolMgr.h:48
uint32 scriptId
Definition: SpawnData.h:113
uint8 phaseUseFlags
Definition: SpawnData.h:106
uint32 phaseId
Definition: SpawnData.h:107
Position spawnPoint
Definition: SpawnData.h:105
int32 spawntimesecs
Definition: SpawnData.h:111
int32 terrainSwapMap
Definition: SpawnData.h:109
uint32 phaseGroup
Definition: SpawnData.h:108
uint32 poolId
Definition: SpawnData.h:110
std::string StringId
Definition: SpawnData.h:114
std::vector< Difficulty > spawnDifficulties
Definition: SpawnData.h:112
SpawnData(SpawnObjectType t)
Definition: SpawnData.h:117
std::string name
Definition: SpawnData.h:68
SpawnGroupFlags flags
Definition: SpawnData.h:70
static constexpr SpawnObjectType TypeFor
Definition: SpawnData.h:88
SpawnObjectType const type
Definition: SpawnData.h:92
static constexpr bool TypeHasData(SpawnObjectType type)
Definition: SpawnData.h:85
SpawnGroupTemplateData const * spawnGroupData
Definition: SpawnData.h:96
static constexpr bool TypeIsValid(SpawnObjectType type)
Definition: SpawnData.h:86
uint64 spawnId
Definition: SpawnData.h:93
SpawnData const * ToSpawnData() const
Definition: SpawnData.h:90
uint32 mapId
Definition: SpawnData.h:94
static constexpr bool TypeInMask(SpawnObjectType type, SpawnObjectTypeMask mask)
Definition: SpawnData.h:84
SpawnMetadata(SpawnObjectType t)
Definition: SpawnData.h:99