TrinityCore
instance_firelands.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 "Creature.h"
20#include "firelands.h"
21#include "GameObject.h"
22#include "InstanceScript.h"
23#include "Map.h"
24
26{
27 { DATA_BETH_TILAC, {{ 1197 }} },
28 { DATA_LORD_RHYOLITH, {{ 1204 }} },
29 { DATA_SHANNOX, {{ 1205 }} },
30 { DATA_ALYSRAZOR, {{ 1206 }} },
31 { DATA_BALEROC, {{ 1200 }} },
32 { DATA_MAJORDOMO_STAGHELM, {{ 1185 }} },
33 { DATA_RAGNAROS, {{ 1203 }} }
34};
35
37{
38 public:
40
42 {
44 {
48 }
49
50 void OnCreatureCreate(Creature* creature) override
51 {
52 switch (creature->GetEntry())
53 {
55 // Cannot directly start attacking here as the creature is not yet on map
56 creature->m_Events.AddEventAtOffset(new DelayedAttackStartEvent(creature), 500ms);
57 break;
58 case NPC_BALEROC:
59 BalerocGUID = creature->GetGUID();
60 break;
61 default:
62 break;
63 }
64 }
65
66 void OnGameObjectCreate(GameObject* go) override
67 {
68 switch (go->GetEntry())
69 {
74 break;
75 default:
76 break;
77 }
78 }
79
80 bool SetBossState(uint32 type, EncounterState state) override
81 {
82 if (!InstanceScript::SetBossState(type, state))
83 return false;
84
85 if ((type == DATA_SHANNOX && state == DONE) || (type == DATA_BALEROC && state != IN_PROGRESS))
86 {
88 door->SetGoState(GO_STATE_ACTIVE);
89 }
90 else if (type == DATA_BALEROC && state == IN_PROGRESS)
92 door->SetGoState(GO_STATE_READY);
93
94 return true;
95 }
96
97 ObjectGuid GetGuidData(uint32 type) const override
98 {
99 switch (type)
100 {
101 case DATA_BALEROC:
102 return BalerocGUID;
103 default:
104 break;
105 }
106 return ObjectGuid::Empty;
107 }
108
109 protected:
112 };
113
115 {
116 return new instance_firelands_InstanceScript(map);
117 }
118};
119
121{
122 new instance_firelands();
123}
uint32_t uint32
Definition: Define.h:142
EncounterState
@ IN_PROGRESS
@ DONE
@ GO_STATE_READY
@ GO_STATE_ACTIVE
#define DataHeader
uint32 const EncounterCount
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
void SetGoState(GOState state)
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void LoadDungeonEncounterData(T const &encounters)
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
void SetHeaders(std::string const &dataHeaders)
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3489
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
EventProcessor m_Events
Definition: Object.h:777
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ NPC_SMOULDERING_HATCHLING
Definition: firelands.h:60
@ NPC_BALEROC
Definition: firelands.h:50
#define FirelandsScriptName
Definition: firelands.h:28
@ GO_BALEROC_FIREWALL
Definition: firelands.h:69
@ DATA_BETH_TILAC
Definition: firelands.h:34
@ DATA_ALYSRAZOR
Definition: firelands.h:37
@ DATA_MAJORDOMO_STAGHELM
Definition: firelands.h:39
@ DATA_RAGNAROS
Definition: firelands.h:40
@ DATA_BALEROC
Definition: firelands.h:38
@ DATA_SHANNOX
Definition: firelands.h:36
@ DATA_LORD_RHYOLITH
Definition: firelands.h:35
void AddSC_instance_firelands()
DungeonEncounterData const encounters[]
bool SetBossState(uint32 type, EncounterState state) override
ObjectGuid GetGuidData(uint32 type) const override