TrinityCore
instance_drak_tharon_keep.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 "drak_tharon_keep.h"
20#include "GameObject.h"
21#include "InstanceScript.h"
22#include "Map.h"
23#include "ScriptedCreature.h"
24
26{
27 { DATA_TROLLGORE, {{ 1974 }} },
28 { DATA_NOVOS, {{ 1976 }} },
29 { DATA_KING_DRED, {{ 1977 }} },
30 { DATA_THARON_JA, {{ 1975 }} }
31};
32
34{
35 public:
37
39 {
41 {
45 }
46
47 void OnCreatureCreate(Creature* creature) override
48 {
49 switch (creature->GetEntry())
50 {
51 case NPC_TROLLGORE:
52 TrollgoreGUID = creature->GetGUID();
53 break;
54 case NPC_NOVOS:
55 NovosGUID = creature->GetGUID();
56 break;
57 case NPC_KING_DRED:
58 KingDredGUID = creature->GetGUID();
59 break;
60 case NPC_THARON_JA:
61 TharonJaGUID = creature->GetGUID();
62 break;
65 break;
68 break;
69 default:
70 break;
71 }
72 }
73
74 void OnGameObjectCreate(GameObject* go) override
75 {
76 switch (go->GetEntry())
77 {
79 NovosCrystalGUIDs[0] = go->GetGUID();
80 break;
82 NovosCrystalGUIDs[1] = go->GetGUID();
83 break;
85 NovosCrystalGUIDs[2] = go->GetGUID();
86 break;
88 NovosCrystalGUIDs[3] = go->GetGUID();
89 break;
90 default:
91 break;
92 }
93 }
94
96 {
97 float y = creature->GetPositionY();
98 float z = creature->GetPositionZ();
99
100 if (z < 50.0f)
101 return;
102
103 if (y < -650.0f && y > -660.0f)
104 TrollgoreInvaderSummonerGuids[0] = creature->GetGUID();
105 else if (y < -660.0f && y > -670.0f)
106 TrollgoreInvaderSummonerGuids[1] = creature->GetGUID();
107 else if (y < -675.0f && y > -685.0f)
108 TrollgoreInvaderSummonerGuids[2] = creature->GetGUID();
109 }
110
112 {
113 float x = creature->GetPositionX();
114 float y = creature->GetPositionY();
115 float z = creature->GetPositionZ();
116
117 if (x < -374.0f && x > -379.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
118 NovosSummonerGUIDs[0] = creature->GetGUID();
119 else if (x < -379.0f && x > -385.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
120 NovosSummonerGUIDs[1] = creature->GetGUID();
121 else if (x < -374.0f && x > -385.0f && y > -827.0f && y < -820.0f && z < 60.0f && z > 58.0f)
122 NovosSummonerGUIDs[2] = creature->GetGUID();
123 else if (x < -338.0f && x > -344.0f && y > -727.0f && y < 721.0f && z < 30.0f && z > 26.0f)
124 NovosSummonerGUIDs[3] = creature->GetGUID();
125 }
126
127 ObjectGuid GetGuidData(uint32 type) const override
128 {
129 switch (type)
130 {
131 case DATA_TROLLGORE:
132 return TrollgoreGUID;
133 case DATA_NOVOS:
134 return NovosGUID;
135 case DATA_KING_DRED:
136 return KingDredGUID;
137 case DATA_THARON_JA:
138 return TharonJaGUID;
153 }
154
155 return ObjectGuid::Empty;
156 }
157
158 void OnUnitDeath(Unit* unit) override
159 {
160 if (unit->GetEntry() == NPC_CRYSTAL_HANDLER)
161 if (Creature* novos = instance->GetCreature(NovosGUID))
162 novos->AI()->DoAction(ACTION_CRYSTAL_HANDLER_DIED);
163 }
164
165 protected:
170
174 };
175
177 {
179 }
180};
181
183{
185}
@ NPC_WORLD_TRIGGER
uint32_t uint32
Definition: Define.h:142
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
void LoadDungeonEncounterData(T const &encounters)
InstanceMap * instance
void SetHeaders(std::string const &dataHeaders)
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3479
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
Definition: Unit.h:627
InstanceScript * GetInstanceScript(InstanceMap *map) const override
#define DrakTharonKeepScriptName
@ NPC_TROLLGORE
@ NPC_CRYSTAL_CHANNEL_TARGET
@ NPC_THARON_JA
@ NPC_NOVOS
@ NPC_KING_DRED
@ NPC_CRYSTAL_HANDLER
@ GO_NOVOS_CRYSTAL_4
@ GO_NOVOS_CRYSTAL_1
@ GO_NOVOS_CRYSTAL_2
@ GO_NOVOS_CRYSTAL_3
@ DATA_NOVOS_CRYSTAL_2
@ DATA_NOVOS_SUMMONER_4
@ DATA_NOVOS_CRYSTAL_3
@ DATA_NOVOS_SUMMONER_3
@ DATA_TROLLGORE_INVADER_SUMMONER_1
@ DATA_TROLLGORE_INVADER_SUMMONER_3
@ DATA_NOVOS_SUMMONER_1
@ DATA_KING_DRED
@ DATA_NOVOS_SUMMONER_2
@ DATA_TROLLGORE_INVADER_SUMMONER_2
@ DATA_NOVOS_CRYSTAL_4
@ DATA_TROLLGORE
@ DATA_NOVOS
@ DATA_THARON_JA
@ ACTION_CRYSTAL_HANDLER_DIED
@ DATA_NOVOS_CRYSTAL_1
void AddSC_instance_drak_tharon_keep()
DungeonEncounterData const encounters[]
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
constexpr float GetPositionZ() const
Definition: Position.h:78