Core/InstanceScript: refactored load and save methods
This commit is contained in:
1 parent
9ab74b3910
commit
ef9b4aea5e
143 files changed
+487
-1860
No files matched your search
+2
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_BRD_H
|
||||
#define DEF_BRD_H
|
||||
|
||||
#define DataHeader "BRD"
|
||||
|
||||
enum FactionIds
|
||||
{
|
||||
FACTION_NEUTRAL = 734,
|
||||
|
||||
+1
@@ -117,6 +117,7 @@ public:
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
memset(&encounter, 0, sizeof(encounter));
|
||||
|
||||
EmperorGUID = 0;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
uint32 const EncounterCount = 23;
|
||||
|
||||
#define BRSScriptName "instance_blackrock_spire"
|
||||
#define DataHeader "BRS"
|
||||
|
||||
enum DataTypes
|
||||
{
|
||||
|
||||
+3
-47
@@ -15,15 +15,14 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "ObjectDefines.h"
|
||||
#include "Cell.h"
|
||||
#include "CellImpl.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "blackrock_spire.h"
|
||||
|
||||
//uint32 const DragonspireRunes[7] = { GO_HALL_RUNE_1, GO_HALL_RUNE_2, GO_HALL_RUNE_3, GO_HALL_RUNE_4, GO_HALL_RUNE_5, GO_HALL_RUNE_6, GO_HALL_RUNE_7 };
|
||||
@@ -51,6 +50,7 @@ public:
|
||||
{
|
||||
instance_blackrock_spireMapScript(InstanceMap* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
HighlordOmokk = 0;
|
||||
ShadowHunterVoshgajin = 0;
|
||||
@@ -502,50 +502,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "B S " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* strIn) override
|
||||
{
|
||||
if (!strIn)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(strIn);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(strIn);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'B' && dataHead2 == 'S')
|
||||
{
|
||||
for (uint8 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
protected:
|
||||
EventMap Events;
|
||||
uint64 HighlordOmokk;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
uint32 const EncounterCount = 8;
|
||||
|
||||
#define BRLScriptName "instance_blackwing_lair"
|
||||
#define DataHeader "BWL"
|
||||
|
||||
enum BWLEncounter
|
||||
{
|
||||
|
||||
+1
@@ -56,6 +56,7 @@ public:
|
||||
{
|
||||
instance_blackwing_lair_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
// Razorgore
|
||||
EggCount = 0;
|
||||
EggEvent = 0;
|
||||
|
||||
+25
-94
@@ -1,6 +1,5 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
@@ -16,19 +15,10 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
SDName: Instance_Molten_Core
|
||||
SD%Complete: 0
|
||||
SDComment: Place Holder
|
||||
SDCategory: Molten Core
|
||||
EndScriptData */
|
||||
|
||||
#include "ObjectMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "CreatureAI.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "molten_core.h"
|
||||
#include "TemporarySummon.h"
|
||||
|
||||
Position const SummonPositions[10] =
|
||||
{
|
||||
@@ -53,30 +43,19 @@ class instance_molten_core : public InstanceMapScript
|
||||
{
|
||||
instance_molten_core_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(MAX_ENCOUNTER);
|
||||
_golemaggTheIncineratorGUID = 0;
|
||||
_majordomoExecutusGUID = 0;
|
||||
_cacheOfTheFirelordGUID = 0;
|
||||
_executusSchedule = NULL;
|
||||
_deadBossCount = 0;
|
||||
_executusSchedule = false;
|
||||
_ragnarosAddDeaths = 0;
|
||||
_isLoading = false;
|
||||
_summonedExecutus = false;
|
||||
}
|
||||
|
||||
~instance_molten_core_InstanceMapScript()
|
||||
{
|
||||
delete _executusSchedule;
|
||||
}
|
||||
|
||||
void OnPlayerEnter(Player* /*player*/)
|
||||
void OnPlayerEnter(Player* /*player*/) override
|
||||
{
|
||||
if (_executusSchedule)
|
||||
{
|
||||
SummonMajordomoExecutus(*_executusSchedule);
|
||||
delete _executusSchedule;
|
||||
_executusSchedule = NULL;
|
||||
}
|
||||
SummonMajordomoExecutus();
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
@@ -141,19 +120,14 @@ class instance_molten_core : public InstanceMapScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SetBossState(uint32 bossId, EncounterState state)
|
||||
bool SetBossState(uint32 bossId, EncounterState state) override
|
||||
{
|
||||
if (!InstanceScript::SetBossState(bossId, state))
|
||||
return false;
|
||||
|
||||
if (state == DONE && bossId < BOSS_MAJORDOMO_EXECUTUS)
|
||||
++_deadBossCount;
|
||||
|
||||
if (_isLoading)
|
||||
return true;
|
||||
|
||||
if (_deadBossCount == 8)
|
||||
SummonMajordomoExecutus(false);
|
||||
if (CheckMajordomoExecutus())
|
||||
SummonMajordomoExecutus();
|
||||
|
||||
if (bossId == BOSS_MAJORDOMO_EXECUTUS && state == DONE)
|
||||
DoRespawnGameObject(_cacheOfTheFirelordGUID, 7 * DAY);
|
||||
@@ -161,13 +135,13 @@ class instance_molten_core : public InstanceMapScript
|
||||
return true;
|
||||
}
|
||||
|
||||
void SummonMajordomoExecutus(bool done)
|
||||
void SummonMajordomoExecutus()
|
||||
{
|
||||
if (_summonedExecutus)
|
||||
_executusSchedule = false;
|
||||
if (_majordomoExecutusGUID)
|
||||
return;
|
||||
|
||||
_summonedExecutus = true;
|
||||
if (!done)
|
||||
if (GetBossState(BOSS_MAJORDOMO_EXECUTUS) != DONE)
|
||||
{
|
||||
instance->SummonCreature(NPC_MAJORDOMO_EXECUTUS, SummonPositions[0]);
|
||||
instance->SummonCreature(NPC_FLAMEWAKER_HEALER, SummonPositions[1]);
|
||||
@@ -180,76 +154,33 @@ class instance_molten_core : public InstanceMapScript
|
||||
instance->SummonCreature(NPC_FLAMEWAKER_ELITE, SummonPositions[8]);
|
||||
}
|
||||
else if (TempSummon* summon = instance->SummonCreature(NPC_MAJORDOMO_EXECUTUS, RagnarosTelePos))
|
||||
summon->AI()->DoAction(ACTION_START_RAGNAROS_ALT);
|
||||
summon->AI()->DoAction(ACTION_START_RAGNAROS_ALT);
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
bool CheckMajordomoExecutus() const
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
if (GetBossState(BOSS_RAGNAROS) == DONE)
|
||||
return false;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "M C " << GetBossSaveData();
|
||||
for (uint8 i = 0; i < BOSS_MAJORDOMO_EXECUTUS; ++i)
|
||||
if (GetBossState(i) != DONE)
|
||||
return false;
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
return true;
|
||||
}
|
||||
|
||||
void Load(char const* data)
|
||||
void ReadSaveDataMore(std::istringstream& /*data*/) override
|
||||
{
|
||||
if (!data)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
_isLoading = true;
|
||||
OUT_LOAD_INST_DATA(data);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(data);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'M' && dataHead2 == 'C')
|
||||
{
|
||||
EncounterState states[MAX_ENCOUNTER];
|
||||
uint8 executusCounter = 0;
|
||||
|
||||
// need 2 loops to check spawning executus/ragnaros
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > TO_BE_DECIDED)
|
||||
tmpState = NOT_STARTED;
|
||||
states[i] = EncounterState(tmpState);
|
||||
|
||||
if (tmpState == DONE && i < BOSS_MAJORDOMO_EXECUTUS)
|
||||
++executusCounter;
|
||||
}
|
||||
|
||||
if (executusCounter >= 8 && states[BOSS_RAGNAROS] != DONE)
|
||||
_executusSchedule = new bool(states[BOSS_MAJORDOMO_EXECUTUS] == DONE);
|
||||
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
SetBossState(i, states[i]);
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
_isLoading = false;
|
||||
if (CheckMajordomoExecutus())
|
||||
_executusSchedule = true;
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 _golemaggTheIncineratorGUID;
|
||||
uint64 _majordomoExecutusGUID;
|
||||
uint64 _cacheOfTheFirelordGUID;
|
||||
bool* _executusSchedule;
|
||||
uint8 _deadBossCount;
|
||||
bool _executusSchedule;
|
||||
uint8 _ragnarosAddDeaths;
|
||||
bool _isLoading;
|
||||
bool _summonedExecutus;
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_MOLTEN_CORE_H
|
||||
#define DEF_MOLTEN_CORE_H
|
||||
|
||||
#define DataHeader "MC"
|
||||
|
||||
enum Encounters
|
||||
{
|
||||
BOSS_LUCIFRON = 0,
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef DEF_DEADMINES_H
|
||||
#define DEF_DEADMINES_H
|
||||
|
||||
#define DataHeader "DM"
|
||||
|
||||
enum CannonState
|
||||
{
|
||||
CANNON_NOT_USED,
|
||||
|
||||
@@ -74,6 +74,7 @@ class instance_deadmines : public InstanceMapScript
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
FactoryDoorGUID = 0;
|
||||
IronCladDoorGUID = 0;
|
||||
DefiasCannonGUID = 0;
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef DEF_GNOMEREGAN_H
|
||||
#define DEF_GNOMEREGAN_H
|
||||
|
||||
#define DataHeader "GNO"
|
||||
|
||||
enum GameObjectIds
|
||||
{
|
||||
GO_CAVE_IN_LEFT = 146085,
|
||||
|
||||
@@ -36,6 +36,7 @@ public:
|
||||
{
|
||||
instance_gnomeregan_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
// 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered.
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_KARAZHAN_H
|
||||
#define DEF_KARAZHAN_H
|
||||
|
||||
#define DataHeader "KZ"
|
||||
|
||||
enum DataTypes
|
||||
{
|
||||
TYPE_ATTUMEN = 1,
|
||||
@@ -62,5 +64,4 @@ enum OperaEvents
|
||||
EVENT_RAJ = 3
|
||||
};
|
||||
|
||||
#define ERROR_INST_DATA(a) TC_LOG_ERROR("scripts", "Instance Data for Karazhan not set properly. Encounter for Creature Entry %u may not work properly.", a->GetEntry());
|
||||
#endif
|
||||
@@ -45,6 +45,7 @@ class instance_magisters_terrace : public InstanceMapScript
|
||||
{
|
||||
instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadDoorData(doorData);
|
||||
|
||||
@@ -161,48 +162,6 @@ class instance_magisters_terrace : public InstanceMapScript
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "M T " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
if (dataHead1 == 'M' && dataHead2 == 'T')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
uint64 GetData64(uint32 type) const override
|
||||
{
|
||||
switch (type)
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_MAGISTERS_TERRACE_H
|
||||
#define DEF_MAGISTERS_TERRACE_H
|
||||
|
||||
#define DataHeader "MT"
|
||||
|
||||
uint32 const EncounterCount = 4;
|
||||
|
||||
enum DataTypes
|
||||
|
||||
@@ -34,6 +34,7 @@ class instance_scarlet_monastery : public InstanceMapScript
|
||||
{
|
||||
instance_scarlet_monastery_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadDoorData(doorData);
|
||||
|
||||
@@ -155,50 +156,6 @@ class instance_scarlet_monastery : public InstanceMapScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "S M " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'S' && dataHead2 == 'M')
|
||||
{
|
||||
for (uint8 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64 PumpkinShrineGUID;
|
||||
uint64 HorsemanGUID;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#define SCARLET_M_
|
||||
|
||||
#define SMScriptName "instance_scarlet_monastery"
|
||||
#define DataHeader "SM"
|
||||
|
||||
uint32 const EncounterCount = 10;
|
||||
|
||||
enum DataTypes
|
||||
|
||||
@@ -36,6 +36,7 @@ class instance_scholomance : public InstanceMapScript
|
||||
{
|
||||
instance_scholomance_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
GateKirtonosGUID = 0;
|
||||
GateGandlingGUID = 0;
|
||||
@@ -168,49 +169,9 @@ class instance_scholomance : public InstanceMapScript
|
||||
instance->SummonCreature(NPC_DARKMASTER_GANDLING, GandlingLoc);
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
void ReadSaveDataMore(std::istringstream& /*data*/) override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "S O " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'S' && dataHead2 == 'O')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
|
||||
CheckToSpawnGandling();
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
CheckToSpawnGandling();
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef DEF_SCHOLOMANCE_H
|
||||
#define DEF_SCHOLOMANCE_H
|
||||
|
||||
#define DataHeader "SC"
|
||||
|
||||
uint32 const EncounterCount = 8;
|
||||
|
||||
enum DataTypes
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
uiAshGUID = 0;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_SHADOWFANG_H
|
||||
#define DEF_SHADOWFANG_H
|
||||
|
||||
#define DataHeader "SK"
|
||||
|
||||
enum DataTypes
|
||||
{
|
||||
TYPE_FREE_NPC = 1,
|
||||
|
||||
@@ -49,6 +49,7 @@ class instance_stratholme : public InstanceMapScript
|
||||
{
|
||||
instance_stratholme_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
uint32 EncounterState[MAX_ENCOUNTER];
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_STRATHOLME_H
|
||||
#define DEF_STRATHOLME_H
|
||||
|
||||
#define DataHeader "STR"
|
||||
|
||||
enum DataTypes
|
||||
{
|
||||
TYPE_BARON_RUN = 1,
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
{
|
||||
instance_sunken_temple_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
uint64 GOAtalaiStatue1;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_SUNKEN_TEMPLE_H
|
||||
#define DEF_SUNKEN_TEMPLE_H
|
||||
|
||||
#define DataHeader "ST"
|
||||
|
||||
#define TROLLBOSS1_DEATH 1
|
||||
#define TROLLBOSS2_DEATH 2
|
||||
#define TROLLBOSS3_DEATH 3
|
||||
|
||||
@@ -49,6 +49,7 @@ class instance_sunwell_plateau : public InstanceMapScript
|
||||
{
|
||||
instance_sunwell_plateau_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadDoorData(doorData);
|
||||
|
||||
@@ -212,67 +213,24 @@ class instance_sunwell_plateau : public InstanceMapScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
protected:
|
||||
uint64 KalecgosDragonGUID;
|
||||
uint64 KalecgosHumanGUID;
|
||||
uint64 SathrovarrGUID;
|
||||
uint64 BrutallusGUID;
|
||||
uint64 MadrigosaGUID;
|
||||
uint64 FelmystGUID;
|
||||
uint64 AlythessGUID;
|
||||
uint64 SacrolashGUID;
|
||||
uint64 MuruGUID;
|
||||
uint64 KilJaedenGUID;
|
||||
uint64 KilJaedenControllerGUID;
|
||||
uint64 AnveenaGUID;
|
||||
uint64 KalecgosKjGUID;
|
||||
uint32 SpectralPlayers;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "S P " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(char const* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'S' && dataHead2 == 'P')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64 KalecgosDragonGUID;
|
||||
uint64 KalecgosHumanGUID;
|
||||
uint64 SathrovarrGUID;
|
||||
uint64 BrutallusGUID;
|
||||
uint64 MadrigosaGUID;
|
||||
uint64 FelmystGUID;
|
||||
uint64 AlythessGUID;
|
||||
uint64 SacrolashGUID;
|
||||
uint64 MuruGUID;
|
||||
uint64 KilJaedenGUID;
|
||||
uint64 KilJaedenControllerGUID;
|
||||
uint64 AnveenaGUID;
|
||||
uint64 KalecgosKjGUID;
|
||||
uint32 SpectralPlayers;
|
||||
|
||||
uint32 SpectralRealmTimer;
|
||||
std::vector<uint64> SpectralRealmList;
|
||||
uint32 SpectralRealmTimer;
|
||||
std::vector<uint64> SpectralRealmList;
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#define SUNWELL_PLATEAU_H
|
||||
|
||||
#define SunwellPlateauScriptName "instance_sunwell_plateau"
|
||||
#define DataHeader "SWP"
|
||||
|
||||
uint32 const EncounterCount = 6;
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ class instance_uldaman : public InstanceMapScript
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
archaedasGUID = 0;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_ULDAMAN_H
|
||||
#define DEF_ULDAMAN_H
|
||||
|
||||
#define DataHeader "UD"
|
||||
|
||||
#define MAX_ENCOUNTER 3
|
||||
|
||||
enum DataTypes
|
||||
|
||||
@@ -92,6 +92,7 @@ class instance_zulaman : public InstanceMapScript
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
|
||||
HarkorsSatchelGUID = 0;
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#ifndef DEF_ZULAMAN_H
|
||||
#define DEF_ZULAMAN_H
|
||||
|
||||
#define DataHeader "ZA"
|
||||
|
||||
enum DataTypes
|
||||
{
|
||||
DATA_GONGEVENT = 0,
|
||||
|
||||
@@ -41,6 +41,7 @@ class instance_zulgurub : public InstanceMapScript
|
||||
{
|
||||
instance_zulgurub_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
LoadDoorData(doorData);
|
||||
}
|
||||
@@ -144,48 +145,6 @@ class instance_zulgurub : public InstanceMapScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "Z G " << GetBossSaveData();
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
|
||||
if (dataHead1 == 'Z' && dataHead2 == 'G')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
}
|
||||
private:
|
||||
//If all High Priest bosses were killed. Lorkhan, Zath and Ohgan are added too.
|
||||
//Storing Lorkhan, Zath and Thekal because we need to cast on them later. Jindo is needed for healfunction too.
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef DEF_ZULGURUB_H
|
||||
#define DEF_ZULGURUB_H
|
||||
|
||||
#define DataHeader "ZG"
|
||||
|
||||
uint32 const EncounterCount = 13;
|
||||
|
||||
#define ZGScriptName "instance_zulgurub"
|
||||
|
||||
Reference in new issue
Block a user