TrinityCore
Loading...
Searching...
No Matches
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 "Position.h"
22
23class Creature;
24class GameObject;
25class Pool;
26struct PoolTemplate;
27
28// EnumUtils: DESCRIBE THIS
36
45
57
65
66namespace Trinity { namespace Impl {
67 template <typename T>
68 struct SpawnObjectTypeForImpl { static_assert(!std::is_same<T,T>::value, "This type does not have an associated spawn type!"); };
69 template <> struct SpawnObjectTypeForImpl<Creature> { static constexpr SpawnObjectType value = SPAWN_TYPE_CREATURE; };
70 template <> struct SpawnObjectTypeForImpl<GameObject> { static constexpr SpawnObjectType value = SPAWN_TYPE_GAMEOBJECT; };
71}}
72
73struct SpawnData;
75{
76 static constexpr bool TypeInMask(SpawnObjectType type, SpawnObjectTypeMask mask) { return ((1 << type) & mask); }
77 static constexpr bool TypeHasData(SpawnObjectType type) { return (type < NUM_SPAWN_TYPES_WITH_DATA); }
78 static constexpr bool TypeIsValid(SpawnObjectType type) { return (type < NUM_SPAWN_TYPES); }
79 template <typename T>
81
82 SpawnData const* ToSpawnData() const { return TypeHasData(type) ? reinterpret_cast<SpawnData const*>(this) : nullptr; }
83
87 bool dbData = true;
89
90 protected:
92};
93
94struct SpawnData : public SpawnMetadata
95{
96 uint32 id = 0; // entry in respective _template table
102 std::string StringId;
103
104 protected:
106};
107
109{
111 LINKED_RESPAWN_CREATURE_TO_GO = 1, // Creature is dependant on GameObject
113 LINKED_RESPAWN_GO_TO_CREATURE = 3, // GameObject is dependant on Creature
114};
115
116#endif
uint8_t uint8
Definition Define.h:135
int32_t int32
Definition Define.h:129
uint32_t uint32
Definition Define.h:133
#define MAPID_INVALID
Definition Position.h:165
SpawnGroupFlags
Definition SpawnData.h:47
@ SPAWNGROUP_FLAG_DYNAMIC_SPAWN_RATE
Definition SpawnData.h:52
@ SPAWNGROUP_FLAGS_ALL
Definition SpawnData.h:55
@ SPAWNGROUP_FLAG_MANUAL_SPAWN
Definition SpawnData.h:51
@ SPAWNGROUP_FLAG_COMPATIBILITY_MODE
Definition SpawnData.h:50
@ SPAWNGROUP_FLAG_NONE
Definition SpawnData.h:48
@ SPAWNGROUP_FLAG_SYSTEM
Definition SpawnData.h:49
@ SPAWNGROUP_FLAG_ESCORTQUESTNPC
Definition SpawnData.h:53
LinkedRespawnType
Definition SpawnData.h:109
@ LINKED_RESPAWN_CREATURE_TO_GO
Definition SpawnData.h:111
@ LINKED_RESPAWN_GO_TO_GO
Definition SpawnData.h:112
@ LINKED_RESPAWN_CREATURE_TO_CREATURE
Definition SpawnData.h:110
@ LINKED_RESPAWN_GO_TO_CREATURE
Definition SpawnData.h:113
SpawnObjectTypeMask
Definition SpawnData.h:38
@ SPAWN_TYPEMASK_CREATURE
Definition SpawnData.h:39
@ SPAWN_TYPEMASK_WITH_DATA
Definition SpawnData.h:42
@ SPAWN_TYPEMASK_GAMEOBJECT
Definition SpawnData.h:40
@ SPAWN_TYPEMASK_ALL
Definition SpawnData.h:43
SpawnObjectType
Definition SpawnData.h:30
@ SPAWN_TYPE_GAMEOBJECT
Definition SpawnData.h:32
@ NUM_SPAWN_TYPES
Definition SpawnData.h:34
@ SPAWN_TYPE_CREATURE
Definition SpawnData.h:31
@ NUM_SPAWN_TYPES_WITH_DATA
Definition SpawnData.h:33
Definition PoolMgr.h:39
uint32 scriptId
Definition SpawnData.h:101
uint32 phaseMask
Definition SpawnData.h:98
uint8 spawnMask
Definition SpawnData.h:100
Position spawnPoint
Definition SpawnData.h:97
int32 spawntimesecs
Definition SpawnData.h:99
std::string StringId
Definition SpawnData.h:102
SpawnData(SpawnObjectType t)
Definition SpawnData.h:105
SpawnGroupFlags flags
Definition SpawnData.h:63
static constexpr SpawnObjectType TypeFor
Definition SpawnData.h:80
SpawnObjectType const type
Definition SpawnData.h:84
uint32 spawnId
Definition SpawnData.h:85
static constexpr bool TypeHasData(SpawnObjectType type)
Definition SpawnData.h:77
SpawnGroupTemplateData const * spawnGroupData
Definition SpawnData.h:88
static constexpr bool TypeIsValid(SpawnObjectType type)
Definition SpawnData.h:78
SpawnData const * ToSpawnData() const
Definition SpawnData.h:82
uint32 mapId
Definition SpawnData.h:86
static constexpr bool TypeInMask(SpawnObjectType type, SpawnObjectTypeMask mask)
Definition SpawnData.h:76
SpawnMetadata(SpawnObjectType t)
Definition SpawnData.h:91