TrinityCore
Loading...
Searching...
No Matches
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 public:
29
31 {
37
38 void OnCreatureCreate(Creature* creature) override
39 {
40 switch (creature->GetEntry())
41 {
42 case NPC_TROLLGORE:
43 TrollgoreGUID = creature->GetGUID();
44 break;
45 case NPC_NOVOS:
46 NovosGUID = creature->GetGUID();
47 break;
48 case NPC_KING_DRED:
49 KingDredGUID = creature->GetGUID();
50 break;
51 case NPC_THARON_JA:
52 TharonJaGUID = creature->GetGUID();
53 break;
56 break;
59 break;
60 default:
61 break;
62 }
63 }
64
65 void OnGameObjectCreate(GameObject* go) override
66 {
67 switch (go->GetEntry())
68 {
70 NovosCrystalGUIDs[0] = go->GetGUID();
71 break;
73 NovosCrystalGUIDs[1] = go->GetGUID();
74 break;
76 NovosCrystalGUIDs[2] = go->GetGUID();
77 break;
79 NovosCrystalGUIDs[3] = go->GetGUID();
80 break;
81 default:
82 break;
83 }
84 }
85
87 {
88 float y = creature->GetPositionY();
89 float z = creature->GetPositionZ();
90
91 if (z < 50.0f)
92 return;
93
94 if (y < -650.0f && y > -660.0f)
96 else if (y < -660.0f && y > -670.0f)
98 else if (y < -675.0f && y > -685.0f)
100 }
101
103 {
104 float x = creature->GetPositionX();
105 float y = creature->GetPositionY();
106 float z = creature->GetPositionZ();
107
108 if (x < -374.0f && x > -379.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
109 NovosSummonerGUIDs[0] = creature->GetGUID();
110 else if (x < -379.0f && x > -385.0f && y > -820.0f && y < -815.0f && z < 60.0f && z > 58.0f)
111 NovosSummonerGUIDs[1] = creature->GetGUID();
112 else if (x < -374.0f && x > -385.0f && y > -827.0f && y < -820.0f && z < 60.0f && z > 58.0f)
113 NovosSummonerGUIDs[2] = creature->GetGUID();
114 else if (x < -338.0f && x > -344.0f && y > -727.0f && y < 721.0f && z < 30.0f && z > 26.0f)
115 NovosSummonerGUIDs[3] = creature->GetGUID();
116 }
117
118 ObjectGuid GetGuidData(uint32 type) const override
119 {
120 switch (type)
121 {
122 case DATA_TROLLGORE:
123 return TrollgoreGUID;
124 case DATA_NOVOS:
125 return NovosGUID;
126 case DATA_KING_DRED:
127 return KingDredGUID;
128 case DATA_THARON_JA:
129 return TharonJaGUID;
144 }
145
146 return ObjectGuid::Empty;
147 }
148
149 void OnUnitDeath(Unit* unit) override
150 {
151 if (unit->GetEntry() == NPC_CRYSTAL_HANDLER)
152 if (Creature* novos = instance->GetCreature(NovosGUID))
153 novos->AI()->DoAction(ACTION_CRYSTAL_HANDLER_DIED);
154 }
155
156 protected:
161
165 };
166
168 {
170 }
171};
172
@ NPC_WORLD_TRIGGER
uint32_t uint32
Definition Define.h:133
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
InstanceMap * instance
void SetHeaders(std::string const &dataHeaders)
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:4397
static ObjectGuid const Empty
Definition ObjectGuid.h:140
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
Definition Unit.h:769
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()
float GetPositionZ() const
Definition Position.h:81
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80