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
27static constexpr ObjectData creatureData[] =
28{
31 { 0, 0 } // END
32};
33
45
50
61
63{
64 public:
66
68 {
77
78 void OnPlayerEnter(Player* /*player*/) override
79 {
82 }
83
84 void OnUnitDeath(Unit* unit) override
85 {
86 switch (unit->GetEntry())
87 {
91 majordomo->AI()->DoAction(ACTION_FLAMEWAKER_DIES);
92 break;
93 default:
94 break;
95 }
96 }
97
98 bool SetBossState(uint32 bossId, EncounterState state) override
99 {
100 if (!InstanceScript::SetBossState(bossId, state))
101 return false;
102
103 switch (bossId)
104 {
105 case BOSS_MAGMADAR:
106 case BOSS_GEHENNAS:
107 case BOSS_GARR:
108 case BOSS_SHAZZRAH:
112 if (state == DONE)
113 {
114 auto runeItr = std::ranges::find(MoltenCoreRunes, bossId, &MoltenCoreRuneInfo::BossId);
115 if (runeItr != std::ranges::end(MoltenCoreRunes))
116 {
117 if (GameObject* rune = GetGameObject(runeItr->RuneData))
118 {
119 rune->SetGoState(GO_STATE_READY);
120 rune->SetLootState(GO_JUST_DEACTIVATED);
121 }
122 }
123 }
124 break;
126 if (state == DONE)
128 break;
129 default:
130 break;
131 }
132
133 if (state == DONE && bossId < BOSS_MAJORDOMO_EXECUTUS)
136
137 return true;
138 }
139
152
154 {
156 return false;
157
158 for (uint8 i = 0; i < BOSS_MAJORDOMO_EXECUTUS; ++i)
159 if (GetBossState(i) != DONE)
160 return false;
161
162 return true;
163 }
164
165 void ReadSaveDataMore(std::istringstream& /*data*/) override
166 {
169 }
170
171 protected:
173 };
174
176 {
178 }
179};
180
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ GO_JUST_DEACTIVATED
Definition GameObject.h:79
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)
InstanceMap * instance
EncounterState GetBossState(uint32 id) const
GameObject * GetGameObject(uint32 type)
void SetHeaders(std::string const &dataHeaders)
void LoadObjectData(ObjectData const *creatureData, ObjectData const *gameObjectData)
bool SpawnGroupSpawn(uint32 groupId, bool ignoreRespawn=false, bool force=false, std::vector< WorldObject * > *spawnedObjects=nullptr)
Definition Map.cpp:3382
uint32 GetEntry() const
Definition Object.h:81
Definition Unit.h:769
InstanceScript * GetInstanceScript(InstanceMap *map) const override
static constexpr ObjectData creatureData[]
void AddSC_instance_molten_core()
static constexpr MoltenCoreRuneInfo MoltenCoreRunes[]
static constexpr ObjectData gameObjectData[]
#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_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