TrinityCore
instance_nexus.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 "GameObject.h"
21#include "InstanceScript.h"
22#include "Map.h"
23#include "nexus.h"
24
26{
27 { DATA_COMMANDER, {{ 519 }} },
28 { DATA_MAGUS_TELESTRA, {{ 520, 521, 2010 }} },
29 { DATA_ANOMALUS, {{ 522, 523, 2009 }} },
30 { DATA_ORMOROK, {{ 524, 525, 2012 }} },
31 { DATA_KERISTRASZA, {{ 526, 527, 2011 }} }
32};
33
35{
36 public:
38
40 {
42 {
46 }
47
48 void OnCreatureCreate(Creature* creature) override
49 {
50 switch (creature->GetEntry())
51 {
52 case NPC_ANOMALUS:
53 AnomalusGUID = creature->GetGUID();
54 break;
55 case NPC_KERISTRASZA:
56 KeristraszaGUID = creature->GetGUID();
57 break;
65 break;
66 default:
67 break;
68 }
69 }
70
71 uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
72 {
73 switch (data->id)
74 {
85 default:
86 return data->id;
87 }
88 }
89
90 void OnGameObjectCreate(GameObject* go) override
91 {
92 switch (go->GetEntry())
93 {
98 break;
103 break;
108 break;
109 default:
110 break;
111 }
112 }
113
114 bool SetBossState(uint32 type, EncounterState state) override
115 {
116 if (!InstanceScript::SetBossState(type, state))
117 return false;
118
119 switch (type)
120 {
122 if (state == DONE)
123 {
125 sphere->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
126 }
127 break;
128 case DATA_ANOMALUS:
129 if (state == DONE)
130 {
132 sphere->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
133 }
134 break;
135 case DATA_ORMOROK:
136 if (state == DONE)
137 {
139 sphere->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
140 }
141 break;
142 default:
143 break;
144 }
145
146 return true;
147 }
148
149 ObjectGuid GetGuidData(uint32 type) const override
150 {
151 switch (type)
152 {
153 case DATA_ANOMALUS:
154 return AnomalusGUID;
155 case DATA_KERISTRASZA:
156 return KeristraszaGUID;
163 default:
164 break;
165 }
166
167 return ObjectGuid::Empty;
168 }
169
170 private:
176 };
177
179 {
180 return new instance_nexus_InstanceMapScript(map);
181 }
182};
183
185{
186 new instance_nexus();
187}
uint32_t uint32
Definition: Define.h:142
EncounterState
@ DONE
@ ALLIANCE
@ GO_FLAG_NOT_SELECTABLE
@ FACTION_MONSTER_2
#define DataHeader
uint32 const EncounterCount
void RemoveFlag(GameObjectFlags flags)
Definition: GameObject.h:275
Team GetTeamInInstance() const
Definition: Map.h:883
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
void LoadDungeonEncounterData(T const &encounters)
static bool ServerAllowsTwoSideGroups()
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
uint64 LowType
Definition: ObjectGuid.h:278
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void SetFaction(uint32 faction) override
Definition: Unit.h:859
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ NPC_ALLIANCE_COMMANDER
void AddSC_instance_nexus()
DungeonEncounterData const encounters[]
@ NPC_COMMANDER_KOLURG
Definition: nexus.h:58
@ NPC_HORDE_COMMANDER
Definition: nexus.h:57
@ NPC_HORDE_RANGER
Definition: nexus.h:55
@ NPC_COMMANDER_STOUTBEARD
Definition: nexus.h:51
@ NPC_HORDE_CLERIC
Definition: nexus.h:56
@ NPC_ALLIANCE_RANGER
Definition: nexus.h:48
@ NPC_KERISTRASZA
Definition: nexus.h:44
@ NPC_ANOMALUS
Definition: nexus.h:43
@ NPC_HORDE_BERSERKER
Definition: nexus.h:54
@ NPC_ALLIANCE_BERSERKER
Definition: nexus.h:47
@ NPC_ALLIANCE_CLERIC
Definition: nexus.h:49
@ DATA_COMMANDER
Definition: nexus.h:30
@ ANOMALUS_CONTAINMENT_SPHERE
Definition: nexus.h:36
@ ORMOROKS_CONTAINMENT_SPHERE
Definition: nexus.h:37
@ DATA_MAGUS_TELESTRA
Definition: nexus.h:31
@ DATA_ANOMALUS
Definition: nexus.h:32
@ DATA_ORMOROK
Definition: nexus.h:33
@ TELESTRAS_CONTAINMENT_SPHERE
Definition: nexus.h:38
@ DATA_KERISTRASZA
Definition: nexus.h:34
@ GO_ORMOROKS_CONTAINMENT_SPHERE
Definition: nexus.h:64
@ GO_TELESTRAS_CONTAINMENT_SPHERE
Definition: nexus.h:65
@ GO_ANOMALUS_CONTAINMENT_SPHERE
Definition: nexus.h:63
#define NexusScriptName
Definition: nexus.h:23
uint32 id
Definition: SpawnData.h:104
void OnCreatureCreate(Creature *creature) override
uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data) override
bool SetBossState(uint32 type, EncounterState state) override
void OnGameObjectCreate(GameObject *go) override
ObjectGuid GetGuidData(uint32 type) const override