TrinityCore
instance_lost_city_of_the_tolvir.cpp
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#include "ScriptMgr.h"
19#include "Containers.h"
20#include "Creature.h"
21#include "CreatureAI.h"
22#include "EventMap.h"
23#include "InstanceScript.h"
25#include "Map.h"
26
27static constexpr ObjectData const creatureData[] =
28{
34 { 0, 0 } // End
35};
36
37static constexpr DungeonEncounterData const encounters[] =
38{
39 { BOSS_GENERAL_HUSAM, {{ 1052 }} },
40 { BOSS_LOCKMAW, {{ 1054 }} },
41 { BOSS_HIGH_PROPHET_BARIM, {{ 1053 }} },
42 { BOSS_SIAMAT, {{ 1055 }} }
43};
44
46{
48};
49
51{
54};
55
57{
58public:
60
62 {
64 {
69 }
70
71 void OnCreatureCreate(Creature* creature) override
72 {
74
75 switch (creature->GetEntry())
76 {
77 case NPC_ADD_STALKER:
78 _lockmawAddStalkerGUIDs.push_back(creature->GetGUID());
79 break;
81 case NPC_AUGH_ADD_1:
82 case NPC_AUGH_ADD_2:
83 // Some adds are spawned by Add Stalkers so we have to register them via instance script for Lockmaw to clean up
84 if (Creature* lockmaw = GetCreature(BOSS_LOCKMAW))
85 if (CreatureAI* ai = lockmaw->AI())
86 ai->JustSummoned(creature);
87 break;
88 default:
89 break;
90 }
91 }
92
93 bool SetBossState(uint32 id, EncounterState state) override
94 {
95 if (!InstanceScript::SetBossState(id, state))
96 return false;
97
98 switch (id)
99 {
100 case BOSS_LOCKMAW:
101 if (state == DONE && (instance->IsHeroic() || instance->IsTimewalking()))
103 break;
104 default:
105 break;
106 }
107
109 EnableSiamat();
110
111 return true;
112 }
113
114 void SetData(uint32 type, uint32 value) override
115 {
116 switch (type)
117 {
120 break;
122 _heroicAughDespawned = value != 0 ? true : false;
123 break;
124 default:
125 break;
126 }
127 }
128
129 uint32 GetData(uint32 type) const override
130 {
131 switch (type)
132 {
134 return static_cast<uint8>(_heroicAughDespawned);
135 default:
136 return 0;
137 }
138
139 return 0;
140 }
141
142 void Update(uint32 diff) override
143 {
145
146 _events.Update(diff);
147 while (uint32 eventId = _events.ExecuteEvent())
148 {
149 switch (eventId)
150 {
153 break;
154 default:
155 break;
156 }
157 }
158 }
159
160 void AfterDataLoad() override
161 {
163 EnableSiamat();
164 }
165
166 ObjectGuid GetGuidData(uint32 type) const override
167 {
168 switch (type)
169 {
174 if (_lockmawAddStalkerGUIDs.size() >= (type - DATA_ADD_STALKER_1 + 1))
176 else
177 return ObjectGuid::Empty;
178 default:
179 return InstanceScript::GetGuidData(type);
180 }
181
182 return InstanceScript::GetGuidData(type);
183 }
184 private:
186 std::vector<ObjectGuid> _lockmawAddStalkerGUIDs;
188
190 {
192 }
193 };
194
196 {
198 }
199};
200
202{
204}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
EncounterState
@ DONE
#define DataHeader
uint32 const EncounterCount
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
virtual void OnCreatureCreate(Creature *creature) override
Creature * GetCreature(uint32 type)
void LoadDungeonEncounterData(T const &encounters)
virtual ObjectGuid GetGuidData(uint32 type) const override
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
virtual void Update(uint32)
void SetHeaders(std::string const &dataHeaders)
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition: Map.cpp:2348
bool IsTimewalking() const
Definition: Map.cpp:3325
bool IsHeroic() const
Definition: Map.cpp:3282
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
InstanceScript * GetInstanceScript(InstanceMap *map) const override
void AddSC_instance_lost_city_of_the_tolvir()
static constexpr ObjectData const creatureData[]
static constexpr DungeonEncounterData const encounters[]
#define LCTScriptName
@ NPC_GENERAL_HUSAM
@ NPC_ADD_STALKER
@ NPC_FRENZIED_CROCOLISK
@ NPC_AUGH_ADD_2
@ NPC_DUST_FLAIL
@ NPC_HIGH_PROPHET_BARIM
@ NPC_AUGH_ADD_1
@ DATA_DUST_FLAIL
@ DATA_HEROIC_AUGH_DESPAWNED
@ DATA_ADD_STALKER_2
@ DATA_ADD_STALKER_1
@ BOSS_HIGH_PROPHET_BARIM
@ DATA_ADD_STALKER_3
@ DATA_SHUFFLE_ADD_STALKERS
@ BOSS_GENERAL_HUSAM
@ DATA_ADD_STALKER_4
void RandomShuffle(Iterator begin, Iterator end)
Reorder the elements of the iterator range randomly.
Definition: Containers.h:170