TrinityCore
Loading...
Searching...
No Matches
instance_sunwell_plateau.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 "AreaBoundary.h"
20#include "Creature.h"
21#include "InstanceScript.h"
22#include "Log.h"
23#include "Map.h"
24#include "Player.h"
25#include "sunwell_plateau.h"
26
27/* Sunwell Plateau:
280 - Kalecgos and Sathrovarr
291 - Brutallus
302 - Felmyst
313 - Eredar Twins (Alythess and Sacrolash)
324 - M'uru
335 - Kil'Jaeden
34*/
35
45
64
65static constexpr ObjectData gameObjectData[] =
66{
68};
69
71{
72 { DATA_KALECGOS, new BoundaryUnionBoundary(new CircleBoundary(Position(1704.9f, 928.4f), 34.0f), new RectangleBoundary(1689.2f, 1713.3f, 762.2f, 1074.8f)) }
73};
74
75static constexpr DungeonEncounterData encounters[] =
76{
77 { DATA_KALECGOS, {{ 724 }} },
78 { DATA_BRUTALLUS, {{ 725 }} },
79 { DATA_FELMYST, {{ 726 }} },
80 { DATA_EREDAR_TWINS, {{ 727 }} },
81 { DATA_MURU, {{ 728 }} },
82 { DATA_KILJAEDEN, {{ 729 }} }
83};
84
86{
87 public:
89
91 {
101
102 Player const* GetPlayerInMap() const
103 {
104 Map::PlayerList const& players = instance->GetPlayers();
105
106 if (!players.empty())
107 {
108 for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
109 {
110 Player* player = itr->GetSource();
111 if (player && !player->HasAura(45839))
112 return player;
113 }
114 }
115 else
116 TC_LOG_DEBUG("scripts", "Instance Sunwell Plateau: GetPlayerInMap, but PlayerList is empty!");
117
118 return nullptr;
119 }
120
121 void OnCreatureCreate(Creature* creature) override
122 {
124
125 switch (creature->GetEntry())
126 {
128 EredarTwinsSpawnId[0] = creature->GetSpawnId();
129 break;
131 EredarTwinsSpawnId[1] = creature->GetSpawnId();
132 break;
133 default:
134 break;
135 }
136 }
137
138 uint64 GetData64(uint32 type) const override
139 {
140 switch (type)
141 {
142 case DATA_SACROLASH:
143 return EredarTwinsSpawnId[0];
144 case DATA_ALYTHESS:
145 return EredarTwinsSpawnId[1];
146 default:
147 break;
148 }
149
150 return InstanceScript::GetData64(type);
151 }
152
153 ObjectGuid GetGuidData(uint32 id) const override
154 {
155 switch (id)
156 {
157 case DATA_PLAYER_GUID:
158 {
159 Player const* target = GetPlayerInMap();
160 return target ? target->GetGUID() : ObjectGuid::Empty;
161 }
162 default:
163 break;
164 }
166 }
167
169 };
170
172 {
174 }
175};
176
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:173
#define DataHeader
uint32 const EncounterCount
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
ObjectGuid::LowType GetSpawnId() const
Definition Creature.h:110
void SetBossNumber(uint32 number)
virtual void OnCreatureCreate(Creature *creature) override
virtual ObjectGuid GetGuidData(uint32 type) const override
void LoadObjectData(std::span< ObjectData const > creatureData, std::span< ObjectData const > gameObjectData)
InstanceMap * instance
void SetHeaders(std::string_view dataHeaders)
void LoadDungeonEncounterData(std::span< DungeonEncounterData const > encounters)
void LoadDoorData(std::span< DoorData const > data)
void LoadBossBoundaries(BossBoundaryData const &data)
bool empty() const
Definition LinkedList.h:107
PlayerList const & GetPlayers() const
Definition Map.h:408
static ObjectGuid const Empty
Definition ObjectGuid.h:314
uint64 LowType
Definition ObjectGuid.h:321
uint32 GetEntry() const
Definition Object.h:89
iterator end()
Definition RefManager.h:36
iterator begin()
Definition RefManager.h:35
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
virtual uint64 GetData64(uint32) const
Definition ZoneScript.h:95
InstanceScript * GetInstanceScript(InstanceMap *map) const override
static constexpr ObjectData creatureData[]
void AddSC_instance_sunwell_plateau()
static constexpr DoorData doorData[]
BossBoundaryData const boundaries
static constexpr ObjectData gameObjectData[]
static constexpr DungeonEncounterData encounters[]
@ NPC_KALECGOS
@ DATA_KALECGOS
@ GO_BOSS_COLLISION_2
@ GO_FORCE_FIELD
@ GO_FIRE_BARRIER
@ GO_MURUS_GATE_2
@ GO_MURUS_GATE_1
@ GO_ICE_BARRIER
@ GO_BOSS_COLLISION_1
#define SunwellPlateauScriptName
@ DATA_KILJAEDEN_CONTROLLER
@ DATA_BRUTALLUS
@ DATA_EREDAR_TWINS
@ DATA_MURU
@ DATA_SATHROVARR
@ DATA_ICE_BARRIER
@ DATA_KILJAEDEN
@ DATA_FELMYST
@ DATA_ALYTHESS
@ DATA_ANVEENA
@ DATA_WORLD_TRIGGER
@ DATA_KALECGOS_HUMAN
@ DATA_SACROLASH
@ DATA_KALECGOS_DRAGON
@ DATA_PLAYER_GUID
@ DATA_ENTROPIUS
@ DATA_KALECGOS_KJ
@ DATA_MADRIGOSA
@ NPC_LADY_SACROLASH
@ NPC_KALECGOS_HUMAN
@ NPC_KILJAEDEN_CONTROLLER
@ NPC_GRAND_WARLOCK_ALYTHESS
@ NPC_MURU
@ NPC_BRUTALLUS
@ NPC_ANVEENA
@ NPC_KILJAEDEN
@ NPC_ENTROPIUS
@ NPC_SATHROVARR
@ NPC_FELMYST
@ NPC_KALECGOS_KJ
@ NPC_MADRIGOSA