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
27static constexpr ObjectData creatureData[] =
28{
31 { 0, 0 } // END
32};
33
40
42{
43 public:
45
47 {
57
58 void OnPlayerEnter(Player* /*player*/) override
59 {
61 Events.ScheduleEvent(EVENT_RESET_VAZRUDEN, 0s);
62 }
63
64 void OnUnitDeath(Unit* unit) override
65 {
67
68 if (unit->GetEntry() == NPC_HELLFIRE_SENTRY)
69 {
71
73 {
75 vazruden->AI()->DoAction(ACTION_START_ENCOUNTER);
76
78 }
79 }
80 }
81
82 bool SetBossState(uint32 type, EncounterState state) override
83 {
84 if (!InstanceScript::SetBossState(type, state))
85 return false;
86
87 if (type == DATA_VAZRUDEN_THE_HERALD)
88 {
89 if (state == DONE)
90 {
93 }
94 else if (state == FAIL)
95 Events.ScheduleEvent(EVENT_RESET_VAZRUDEN, 30s);
96 }
97
98 return true;
99 }
100
101 void Update(uint32 diff) override
102 {
103 Events.Update(diff);
104
105 if (Events.ExecuteEvent() == EVENT_RESET_VAZRUDEN)
106 {
108
110
111 ShouldResetVazruden = false;
112
113 if (Creature* vazruden = GetCreature(DATA_VAZRUDEN))
114 vazruden->DespawnOrUnsummon();
115 }
116 }
117
118 void ReadSaveDataMore(std::istringstream& /*data*/) override
119 {
121 ShouldResetVazruden = true;
122 }
123
124 protected:
128 };
129
131 {
133 }
134};
135
137{
138 new instance_ramparts();
139}
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
GameObjectActions
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)
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
GameObject * GetGameObject(uint32 type)
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:3382
uint32 GetEntry() const
Definition Object.h:81
Definition Unit.h:769
virtual void OnUnitDeath(Unit *)
Definition ZoneScript.h:45
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ DATA_VAZRUDEN_THE_HERALD
@ 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[]
bool SetBossState(uint32 type, EncounterState state) override