Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
instance_molten_core.cpp
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6/* ScriptData
7SDName: Instance_Molten_Core
8SD%Complete: 0
9SDComment: Place Holder
10SDCategory: Molten Core
11EndScriptData */
12
13#include "ObjectMgr.h"
14#include "ScriptMgr.h"
15#include "InstanceScript.h"
16#include "CreatureAI.h"
17#include "molten_core.h"
18#include "TemporarySummon.h"
19
21{
22 {737.850f, -1145.35f, -120.288f, 4.71368f},
23 {744.162f, -1151.63f, -119.726f, 4.58204f},
24 {751.247f, -1152.82f, -119.744f, 4.49673f},
25 {759.206f, -1155.09f, -120.051f, 4.30104f},
26 {755.973f, -1152.33f, -120.029f, 4.25588f},
27 {731.712f, -1147.56f, -120.195f, 4.95955f},
28 {726.499f, -1149.80f, -120.156f, 5.24055f},
29 {722.408f, -1152.41f, -120.029f, 5.33087f},
30 {718.994f, -1156.36f, -119.805f, 5.75738f},
31 {838.510f, -829.840f, -232.000f, 2.00000f},
32};
33
35{
36 public:
37 instance_molten_core() : InstanceMapScript("instance_molten_core", 409) { }
38
40 {
53
58
59 void OnPlayerEnter(Player* /*player*/) OVERRIDE
60 {
62 {
64 delete _executusSchedule;
65 _executusSchedule = NULL;
66 }
67 }
68
70 {
71 switch (creature->GetEntry())
72 {
74 _golemaggTheIncineratorGUID = creature->GetGUID();
75 break;
77 _majordomoExecutusGUID = creature->GetGUID();
78 break;
79 default:
80 break;
81 }
82 }
83
85 {
86 switch (go->GetEntry())
87 {
89 _cacheOfTheFirelordGUID = go->GetGUID();
90 break;
91 default:
92 break;
93 }
94 }
95
96 void SetData(uint32 type, uint32 data) OVERRIDE
97 {
98 if (type == DATA_RAGNAROS_ADDS)
99 {
100 if (data == 1)
102 else if (data == 0)
104 }
105 }
106
108 {
109 switch (type)
110 {
112 return _ragnarosAddDeaths;
113 }
114
115 return 0;
116 }
117
119 {
120 switch (type)
121 {
126 }
127
128 return 0;
129 }
130
132 {
133 if (!InstanceScript::SetBossState(bossId, state))
134 return false;
135
136 if (state == DONE && bossId < BOSS_MAJORDOMO_EXECUTUS)
138
139 if (_isLoading)
140 return true;
141
142 if (_deadBossCount == 8)
144
145 if (bossId == BOSS_MAJORDOMO_EXECUTUS && state == DONE)
147
148 return true;
149 }
150
152 {
154 return;
155
156 _summonedExecutus = true;
157 if (!done)
158 {
164 instance->SummonCreature(NPC_FLAMEWAKER_ELITE, SummonPositions[5]);
165 instance->SummonCreature(NPC_FLAMEWAKER_ELITE, SummonPositions[6]);
166 instance->SummonCreature(NPC_FLAMEWAKER_ELITE, SummonPositions[7]);
167 instance->SummonCreature(NPC_FLAMEWAKER_ELITE, SummonPositions[8]);
168 }
169 else if (TempSummon* summon = instance->SummonCreature(NPC_MAJORDOMO_EXECUTUS, RagnarosTelePos))
170 summon->AI()->DoAction(ACTION_START_RAGNAROS_ALT);
171 }
172
173 std::string GetSaveData() OVERRIDE
174 {
176
177 std::ostringstream saveStream;
178 saveStream << "M C " << GetBossSaveData();
179
181 return saveStream.str();
182 }
183
184 void Load(char const* data) OVERRIDE
185 {
186 if (!data)
187 {
189 return;
190 }
191
192 _isLoading = true;
193 OUT_LOAD_INST_DATA(data);
194
195 char dataHead1, dataHead2;
196
197 std::istringstream loadStream(data);
198 loadStream >> dataHead1 >> dataHead2;
199
200 if (dataHead1 == 'M' && dataHead2 == 'C')
201 {
203 uint8 executusCounter = 0;
204
205 // need 2 loops to check spawning executus/ragnaros
206 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
207 {
208 uint32 tmpState;
209 loadStream >> tmpState;
210 if (tmpState == IN_PROGRESS || tmpState > TO_BE_DECIDED)
211 tmpState = NOT_STARTED;
212 states[i] = EncounterState(tmpState);
213
214 if (tmpState == DONE && i < BOSS_MAJORDOMO_EXECUTUS)
215 ++executusCounter;
216 }
217
218 if (executusCounter >= 8 && states[BOSS_RAGNAROS] != DONE)
219 _executusSchedule = new bool(states[BOSS_MAJORDOMO_EXECUTUS] == DONE);
220
221 for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
222 SetBossState(i, states[i]);
223 }
224 else
226
228 _isLoading = false;
229 }
230
231 private:
240 };
241
246};
247
@ DAY
Definition Common.h:121
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
#define OUT_LOAD_INST_DATA_FAIL
EncounterState
@ IN_PROGRESS
@ DONE
@ NOT_STARTED
@ TO_BE_DECIDED
#define OUT_SAVE_INST_DATA_COMPLETE
#define OUT_LOAD_INST_DATA_COMPLETE
#define OUT_SAVE_INST_DATA
#define OUT_LOAD_INST_DATA(a)
InstanceMapScript(const char *name, uint32 mapId)
InstanceScript(Map *map)
void SetBossNumber(uint32 number)
virtual bool SetBossState(uint32 id, EncounterState state)
std::string GetBossSaveData()
void DoRespawnGameObject(uint64 guid, uint32 timeToDespawn=MINUTE)
Definition Map.h:238
InstanceScript * GetInstanceScript(InstanceMap *map) const OVERRIDE
#define MAX_ENCOUNTER
Position const SummonPositions[10]
void AddSC_instance_molten_core()
@ GO_CACHE_OF_THE_FIRELORD
Definition molten_core.h:51
@ ACTION_START_RAGNAROS_ALT
Definition molten_core.h:27
@ NPC_FLAMEWAKER_ELITE
Definition molten_core.h:46
@ NPC_MAJORDOMO_EXECUTUS
Definition molten_core.h:43
@ NPC_FLAMEWAKER_HEALER
Definition molten_core.h:45
@ NPC_GOLEMAGG_THE_INCINERATOR
Definition molten_core.h:42
Position const RagnarosTelePos
Definition molten_core.h:30
@ BOSS_GOLEMAGG_THE_INCINERATOR
Definition molten_core.h:18
@ BOSS_RAGNAROS
Definition molten_core.h:20
@ BOSS_MAJORDOMO_EXECUTUS
Definition molten_core.h:19
@ DATA_RAGNAROS_ADDS
Definition molten_core.h:56
bool SetBossState(uint32 bossId, EncounterState state) OVERRIDE