TrinityCore
Loading...
Searching...
No Matches
instance_hellfire_ramparts.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 "EventMap.h"
20#include "Creature.h"
21#include "CreatureAI.h"
22#include "GameObject.h"
23#include "hellfire_ramparts.h"
24#include "InstanceScript.h"
25#include "Map.h"
26
32
38
39static constexpr DungeonEncounterData encounters[] =
40{
41 { DATA_WATCHKEEPER_GARGOLMAR, {{ 1893 }} },
42 { DATA_OMOR_THE_UNSCARRED, {{ 1891 }} },
43 { DATA_VAZRUDEN, {{ 1892 }} }
44};
45
47{
48 public:
50
52 {
63
64 void OnPlayerEnter(Player* /*player*/) override
65 {
67 Events.ScheduleEvent(EVENT_RESET_VAZRUDEN, 0s);
68 }
69
70 void OnUnitDeath(Unit* unit) override
71 {
73
74 if (unit->GetEntry() == NPC_HELLFIRE_SENTRY)
75 {
77
79 {
81 vazruden->AI()->DoAction(ACTION_START_ENCOUNTER);
82
84 }
85 }
86 }
87
88 bool SetBossState(uint32 type, EncounterState state) override
89 {
90 if (!InstanceScript::SetBossState(type, state))
91 return false;
92
93 if (type == DATA_VAZRUDEN_THE_HERALD)
94 {
95 if (state == DONE)
96 {
98 chest->ActivateObject(GameObjectActions::MakeActive, 0);
99 }
100 else if (state == FAIL)
101 Events.ScheduleEvent(EVENT_RESET_VAZRUDEN, 30s);
102 }
103
104 return true;
105 }
106
107 void Update(uint32 diff) override
108 {
109 Events.Update(diff);
110
111 if (Events.ExecuteEvent() == EVENT_RESET_VAZRUDEN)
112 {
114
116
117 ShouldResetVazruden = false;
118
119 if (Creature* vazruden = GetCreature(DATA_VAZRUDEN))
120 vazruden->DespawnOrUnsummon();
121 }
122 }
123
124 void AfterDataLoad() override
125 {
127 ShouldResetVazruden = true;
128 }
129
130 protected:
134 };
135
137 {
139 }
140};
141
143{
144 new instance_ramparts();
145}
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
EncounterState
@ FAIL
@ DONE
#define DataHeader
uint32 const EncounterCount
@ ACTION_START_ENCOUNTER
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
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
GameObject * GetGameObject(uint32 type)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2360
uint32 GetEntry() const
Definition Object.h:89
Definition Unit.h:647
virtual void OnUnitDeath(Unit *unit)
Definition ZoneScript.h:85
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_VAZRUDEN_THE_HERALD
@ DATA_WATCHKEEPER_GARGOLMAR
@ DATA_OMOR_THE_UNSCARRED
@ DATA_FEL_IRON_CHEST
@ DATA_VAZRUDEN
@ GO_FEL_IRON_CHEST_HEROIC
@ GO_FEL_IRON_CHEST_NORMAL
@ NPC_VAZRUDEN
@ NPC_VAZRUDEN_HERALD
@ NPC_HELLFIRE_SENTRY
#define HRScriptName
@ EVENT_RESET_VAZRUDEN
@ SPAWN_GROUP_VAZRUDEN
static constexpr ObjectData creatureData[]
void AddSC_instance_ramparts()
static constexpr ObjectData gameObjectData[]
static constexpr DungeonEncounterData encounters[]
bool SetBossState(uint32 type, EncounterState state) override