TrinityCore
Loading...
Searching...
No Matches
instance_molten_core.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 "molten_core.h"
20#include "Creature.h"
21#include "CreatureAI.h"
22#include "GameObject.h"
23#include "InstanceScript.h"
24#include "Map.h"
25#include <algorithm>
26
32
43
44static constexpr DungeonEncounterData encounters[] =
45{
46 { BOSS_LUCIFRON, {{ 663 }} },
47 { BOSS_MAGMADAR, {{ 664 }} },
48 { BOSS_GEHENNAS, {{ 665 }} },
49 { BOSS_GARR, {{ 666 }} },
50 { BOSS_SHAZZRAH, {{ 667 }} },
51 { BOSS_BARON_GEDDON, {{ 668 }} },
52 { BOSS_SULFURON_HARBINGER, {{ 669 }} },
53 { BOSS_GOLEMAGG_THE_INCINERATOR, {{ 670 }} },
54 { BOSS_MAJORDOMO_EXECUTUS, {{ 671 }} },
55 { BOSS_RAGNAROS, {{ 672 }} }
56};
57
62
73
75{
76 public:
78
80 {
90
91 void OnPlayerEnter(Player* /*player*/) override
92 {
95 }
96
97 void OnUnitDeath(Unit* unit) override
98 {
99 switch (unit->GetEntry())
100 {
104 majordomo->AI()->DoAction(ACTION_FLAMEWAKER_DIES);
105 break;
106 default:
107 break;
108 }
109 }
110
111 bool SetBossState(uint32 bossId, EncounterState state) override
112 {
113 if (!InstanceScript::SetBossState(bossId, state))
114 return false;
115
116 switch (bossId)
117 {
118 case BOSS_MAGMADAR:
119 case BOSS_GEHENNAS:
120 case BOSS_GARR:
121 case BOSS_SHAZZRAH:
125 if (state == DONE)
126 {
127 auto runeItr = std::ranges::find(MoltenCoreRunes, bossId, &MoltenCoreRuneInfo::BossId);
128 if (runeItr != std::ranges::end(MoltenCoreRunes))
129 {
130 if (GameObject* rune = GetGameObject(runeItr->RuneData))
131 {
132 rune->SetGoState(GO_STATE_READY);
133 rune->SetLootState(GO_JUST_DEACTIVATED);
134 }
135 }
136 }
137 break;
139 if (state == DONE)
141 break;
142 default:
143 break;
144 }
145
146 if (state == DONE && bossId < BOSS_MAJORDOMO_EXECUTUS)
149
150 return true;
151 }
152
165
167 {
169 return false;
170
171 for (uint8 i = 0; i < BOSS_MAJORDOMO_EXECUTUS; ++i)
172 if (GetBossState(i) != DONE)
173 return false;
174
175 return true;
176 }
177
178 void AfterDataLoad() override
179 {
182 }
183
184 protected:
186 };
187
189 {
191 }
192};
193
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ GO_JUST_DEACTIVATED
Definition GameObject.h:165
EncounterState
@ DONE
@ GO_STATE_READY
#define DataHeader
uint32 const EncounterCount
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
Creature * GetCreature(uint32 type)
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)
EncounterState GetBossState(uint32 id) const
GameObject * GetGameObject(uint32 type)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:2360
uint32 GetEntry() const
Definition Object.h:89
Definition Unit.h:647
InstanceScript * GetInstanceScript(InstanceMap *map) const override
static constexpr ObjectData creatureData[]
void AddSC_instance_molten_core()
static constexpr MoltenCoreRuneInfo MoltenCoreRunes[]
static constexpr ObjectData gameObjectData[]
static constexpr DungeonEncounterData encounters[]
#define MCScriptName
Definition molten_core.h:23
@ DATA_RUNE_OF_THERI
Definition molten_core.h:47
@ DATA_RUNE_OF_BLAZ
Definition molten_core.h:48
@ DATA_RUNE_OF_KRESS
Definition molten_core.h:49
@ DATA_RUNE_OF_ZETH
Definition molten_core.h:45
@ DATA_RUNE_OF_KORO
Definition molten_core.h:44
@ DATA_RUNE_OF_MAZJ
Definition molten_core.h:46
@ DATA_RUNE_OF_MOHN
Definition molten_core.h:50
@ SPAWN_GROUP_MAJORDOMO
Definition molten_core.h:84
@ SPAWN_GROUP_FLAMEWAKERS
Definition molten_core.h:85
@ SPAWN_GROUP_CACHE
Definition molten_core.h:83
@ SPAWN_GROUP_MAJORDOMO_ALT
Definition molten_core.h:87
@ GO_RUNE_OF_MOHN
Definition molten_core.h:78
@ GO_RUNE_OF_THERI
Definition molten_core.h:75
@ GO_RUNE_OF_KORO
Definition molten_core.h:72
@ GO_RUNE_OF_KRESS
Definition molten_core.h:77
@ GO_RUNE_OF_ZETH
Definition molten_core.h:73
@ GO_RUNE_OF_BLAZ
Definition molten_core.h:76
@ GO_RUNE_OF_MAZJ
Definition molten_core.h:74
@ ACTION_FLAMEWAKER_DIES
Definition molten_core.h:94
@ NPC_RAGNAROS
Definition molten_core.h:64
@ NPC_FLAMEWAKER_ELITE
Definition molten_core.h:67
@ NPC_MAJORDOMO_EXECUTUS
Definition molten_core.h:63
@ NPC_FLAMEWAKER_HEALER
Definition molten_core.h:66
@ BOSS_GARR
Definition molten_core.h:33
@ BOSS_LUCIFRON
Definition molten_core.h:30
@ BOSS_BARON_GEDDON
Definition molten_core.h:35
@ BOSS_SHAZZRAH
Definition molten_core.h:34
@ BOSS_SULFURON_HARBINGER
Definition molten_core.h:36
@ BOSS_GOLEMAGG_THE_INCINERATOR
Definition molten_core.h:37
@ BOSS_RAGNAROS
Definition molten_core.h:39
@ BOSS_GEHENNAS
Definition molten_core.h:32
@ BOSS_MAGMADAR
Definition molten_core.h:31
@ BOSS_MAJORDOMO_EXECUTUS
Definition molten_core.h:38
bool SetBossState(uint32 bossId, EncounterState state) override