TrinityCore
Loading...
Searching...
No Matches
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#include "Player.h"
25
27{
28 public:
30
32 {
39
40 void OnPlayerEnter(Player* player) override
41 {
42 if (!_teamInInstance)
43 _teamInInstance = player->GetTeam();
44 }
45
46 void OnCreatureCreate(Creature* creature) override
47 {
48 switch (creature->GetEntry())
49 {
50 case NPC_ANOMALUS:
51 AnomalusGUID = creature->GetGUID();
52 break;
53 case NPC_KERISTRASZA:
54 KeristraszaGUID = creature->GetGUID();
55 break;
63 break;
64 default:
65 break;
66 }
67 }
68
69 uint32 GetCreatureEntry(ObjectGuid::LowType /*guidLow*/, CreatureData const* data) override
70 {
71 if (!_teamInInstance)
72 {
73 Map::PlayerList const& players = instance->GetPlayers();
74 if (!players.isEmpty())
75 if (Player* player = players.begin()->GetSource())
76 _teamInInstance = player->GetTeam();
77 }
78
79 uint32 entry = data->id;
80 switch (entry)
81 {
92 default:
93 return entry;
94 }
95 }
96
97 void OnGameObjectCreate(GameObject* go) override
98 {
99 switch (go->GetEntry())
100 {
105 break;
110 break;
115 break;
116 default:
117 break;
118 }
119 }
120
121 bool SetBossState(uint32 type, EncounterState state) override
122 {
123 if (!InstanceScript::SetBossState(type, state))
124 return false;
125
126 switch (type)
127 {
129 if (state == DONE)
130 {
132 sphere->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
133 }
134 break;
135 case DATA_ANOMALUS:
136 if (state == DONE)
137 {
139 sphere->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
140 }
141 break;
142 case DATA_ORMOROK:
143 if (state == DONE)
144 {
146 sphere->RemoveFlag(GO_FLAG_NOT_SELECTABLE);
147 }
148 break;
149 default:
150 break;
151 }
152
153 return true;
154 }
155
156 ObjectGuid GetGuidData(uint32 type) const override
157 {
158 switch (type)
159 {
160 case DATA_ANOMALUS:
161 return AnomalusGUID;
162 case DATA_KERISTRASZA:
163 return KeristraszaGUID;
170 default:
171 break;
172 }
173
174 return ObjectGuid::Empty;
175 }
176
177 private:
184 };
185
187 {
188 return new instance_nexus_InstanceMapScript(map);
189 }
190};
191
193{
194 new instance_nexus();
195}
uint32_t uint32
Definition Define.h:133
EncounterState
@ DONE
@ ALLIANCE
@ GO_FLAG_NOT_SELECTABLE
@ FACTION_MONSTER_2
#define DataHeader
uint32 const EncounterCount
void RemoveFlag(GameObjectFlags flags)
Definition GameObject.h:172
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
static bool ServerAllowsTwoSideGroups()
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
void SetHeaders(std::string const &dataHeaders)
bool isEmpty() const
Definition LinkedList.h:108
iterator begin()
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:4430
PlayerList const & GetPlayers() const
Definition Map.h:448
static ObjectGuid const Empty
Definition ObjectGuid.h:140
uint32 LowType
Definition ObjectGuid.h:142
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
uint32 GetTeam() const
Definition Player.h:1832
FROM * GetSource() const
Definition Reference.h:96
void SetFaction(uint32 faction) override
Definition Unit.h:974
InstanceScript * GetInstanceScript(InstanceMap *map) const override
@ NPC_ALLIANCE_COMMANDER
void AddSC_instance_nexus()
@ 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
@ 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:96
void OnCreatureCreate(Creature *creature) override
uint32 GetCreatureEntry(ObjectGuid::LowType, CreatureData const *data) override
bool SetBossState(uint32 type, EncounterState state) override
ObjectGuid GetGuidData(uint32 type) const override