TrinityCore
Loading...
Searching...
No Matches
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
35
36static constexpr DungeonEncounterData encounters[] =
37{
38 { BOSS_GENERAL_HUSAM, {{ 1052 }} },
39 { BOSS_LOCKMAW, {{ 1054 }} },
40 { BOSS_HIGH_PROPHET_BARIM, {{ 1053 }} },
41 { BOSS_SIAMAT, {{ 1055 }} }
42};
43
48
54
56{
57public:
59
61 {
69
70 void OnCreatureCreate(Creature* creature) override
71 {
73
74 switch (creature->GetEntry())
75 {
76 case NPC_ADD_STALKER:
77 _lockmawAddStalkerGUIDs.push_back(creature->GetGUID());
78 break;
80 case NPC_AUGH_ADD_1:
81 case NPC_AUGH_ADD_2:
82 // Some adds are spawned by Add Stalkers so we have to register them via instance script for Lockmaw to clean up
83 if (Creature* lockmaw = GetCreature(BOSS_LOCKMAW))
84 if (CreatureAI* ai = lockmaw->AI())
85 ai->JustSummoned(creature);
86 break;
87 default:
88 break;
89 }
90 }
91
92 bool SetBossState(uint32 id, EncounterState state) override
93 {
94 if (!InstanceScript::SetBossState(id, state))
95 return false;
96
97 switch (id)
98 {
99 case BOSS_LOCKMAW:
100 if (state == DONE && (instance->IsHeroic() || instance->IsTimewalking()))
102 break;
103 default:
104 break;
105 }
106
108 EnableSiamat();
109
110 return true;
111 }
112
113 void SetData(uint32 type, uint32 value) override
114 {
115 switch (type)
116 {
119 break;
121 _heroicAughDespawned = value != 0 ? true : false;
122 break;
123 default:
124 break;
125 }
126 }
127
128 uint32 GetData(uint32 type) const override
129 {
130 switch (type)
131 {
133 return static_cast<uint8>(_heroicAughDespawned);
134 default:
135 return 0;
136 }
137
138 return 0;
139 }
140
141 void Update(uint32 diff) override
142 {
144
145 _events.Update(diff);
146 while (uint32 eventId = _events.ExecuteEvent())
147 {
148 switch (eventId)
149 {
152 break;
153 default:
154 break;
155 }
156 }
157 }
158
164
165 ObjectGuid GetGuidData(uint32 type) const override
166 {
167 switch (type)
168 {
173 if (_lockmawAddStalkerGUIDs.size() >= (type - DATA_ADD_STALKER_1 + 1))
175 else
176 return ObjectGuid::Empty;
177 default:
178 return InstanceScript::GetGuidData(type);
179 }
180
181 return InstanceScript::GetGuidData(type);
182 }
183 private:
185 std::vector<ObjectGuid> _lockmawAddStalkerGUIDs;
187
192 };
193
198};
199
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ DONE
#define DataHeader
uint32 const EncounterCount
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
uint32 ExecuteEvent()
Definition EventMap.cpp:77
void Update(uint32 time)
Definition EventMap.h:61
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
virtual void OnCreatureCreate(Creature *creature) override
Creature * GetCreature(uint32 type)
virtual ObjectGuid GetGuidData(uint32 type) const override
void LoadObjectData(std::span< ObjectData const > creatureData, std::span< ObjectData const > gameObjectData)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
EncounterState GetBossState(uint32 id) const
virtual void Update(uint32)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2350
bool IsTimewalking() const
Definition Map.cpp:3354
bool IsHeroic() const
Definition Map.cpp:3311
static ObjectGuid const Empty
Definition ObjectGuid.h:314
uint32 GetEntry() const
Definition Object.h:89
InstanceScript * GetInstanceScript(InstanceMap *map) const override
static constexpr ObjectData creatureData[]
void AddSC_instance_lost_city_of_the_tolvir()
static constexpr DungeonEncounterData encounters[]
#define LCTScriptName
@ NPC_GENERAL_HUSAM
@ NPC_FRENZIED_CROCOLISK
@ NPC_HIGH_PROPHET_BARIM
@ 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:171