Core/InstanceScript: refactored load and save methods

This commit is contained in:
joschiwald
2014-09-07 00:42:14 +02:00
parent 9ab74b3910
commit ef9b4aea5e
143 changed files with 487 additions and 1860 deletions

View File

@@ -43,16 +43,6 @@ void InstanceScript::SaveToDB()
CharacterDatabase.Execute(stmt);
}
void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go)
{
if (!go)
go = instance->GetGameObject(GUID);
if (go)
go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
else
TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
}
bool InstanceScript::IsEncounterInProgress() const
{
for (std::vector<BossInfo>::const_iterator itr = bosses.begin(); itr != bosses.end(); ++itr)
@@ -62,6 +52,13 @@ bool InstanceScript::IsEncounterInProgress() const
return false;
}
void InstanceScript::SetHeaders(std::string const& dataHeaders)
{
for (char header : dataHeaders)
if (isalpha(header))
headers.push_back(header);
}
void InstanceScript::LoadMinionData(const MinionData* data)
{
while (data->entry)
@@ -232,65 +229,140 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state)
return false;
}
std::string InstanceScript::LoadBossState(const char * data)
void InstanceScript::Load(char const* data)
{
if (!data)
return NULL;
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(data);
std::istringstream loadStream(data);
uint32 buff;
if (ReadSaveDataHeaders(loadStream))
{
ReadSaveDataBossStates(loadStream);
ReadSaveDataMore(loadStream);
}
else
OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
bool InstanceScript::ReadSaveDataHeaders(std::istringstream& data)
{
for (char header : headers)
{
char buff;
data >> buff;
if (header != buff)
return false;
}
return true;
}
void InstanceScript::ReadSaveDataBossStates(std::istringstream& data)
{
uint32 bossId = 0;
for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i, ++bossId)
{
loadStream >> buff;
uint32 buff;
data >> buff;
if (buff == IN_PROGRESS || buff == SPECIAL)
buff = NOT_STARTED;
if (buff < TO_BE_DECIDED)
SetBossState(bossId, (EncounterState)buff);
SetBossState(bossId, EncounterState(buff));
}
return loadStream.str();
}
std::string InstanceScript::GetBossSaveData()
std::string InstanceScript::GetSaveData()
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i)
saveStream << (uint32)i->state << ' ';
WriteSaveDataHeaders(saveStream);
WriteSaveDataBossStates(saveStream);
WriteSaveDataMore(saveStream);
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState)
void InstanceScript::WriteSaveDataHeaders(std::ostringstream& data)
{
if (!uiGuid)
for (char header : headers)
data << header << ' ';
}
void InstanceScript::WriteSaveDataBossStates(std::ostringstream& data)
{
for (BossInfo const& bossInfo : bosses)
data << uint32(bossInfo.state) << ' ';
}
void InstanceScript::HandleGameObject(uint64 guid, bool open, GameObject* go /*= nullptr*/)
{
if (!go)
go = instance->GetGameObject(guid);
if (go)
go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
else
TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
}
void InstanceScript::DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime /*= 0*/, bool useAlternativeState /*= false*/)
{
if (!guid)
return;
GameObject* go = instance->GetGameObject(uiGuid);
if (go)
if (GameObject* go = instance->GetGameObject(guid))
{
if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON)
{
if (go->getLootState() == GO_READY)
go->UseDoorOrButton(uiWithRestoreTime, bUseAlternativeState);
go->UseDoorOrButton(withRestoreTime, useAlternativeState);
else if (go->getLootState() == GO_ACTIVATED)
go->ResetDoorOrButton();
}
else
TC_LOG_ERROR("misc", "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType());
TC_LOG_ERROR("scripts", "InstanceScript: DoUseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
}
else
TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed");
}
void InstanceScript::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn)
void InstanceScript::DoRespawnGameObject(uint64 guid, uint32 timeToDespawn /*= MINUTE*/)
{
if (GameObject* go = instance->GetGameObject(uiGuid))
if (GameObject* go = instance->GetGameObject(guid))
{
//not expect any of these should ever be handled
if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE || go->GetGoType() == GAMEOBJECT_TYPE_DOOR ||
go->GetGoType() == GAMEOBJECT_TYPE_BUTTON || go->GetGoType() == GAMEOBJECT_TYPE_TRAP)
return;
switch (go->GetGoType())
{
case GAMEOBJECT_TYPE_DOOR:
case GAMEOBJECT_TYPE_BUTTON:
case GAMEOBJECT_TYPE_TRAP:
case GAMEOBJECT_TYPE_FISHINGNODE:
// not expect any of these should ever be handled
TC_LOG_ERROR("scripts", "InstanceScript: DoRespawnGameObject can't respawn gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType());
return;
default:
break;
}
if (go->isSpawned())
return;
go->SetRespawnTime(uiTimeToDespawn);
go->SetRespawnTime(timeToDespawn);
}
else
TC_LOG_DEBUG("scripts", "InstanceScript: DoRespawnGameObject failed");
}
void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)

View File

@@ -137,38 +137,38 @@ class InstanceScript : public ZoneScript
Map* instance;
//On creation, NOT load.
// On creation, NOT load.
virtual void Initialize() { }
//On load
virtual void Load(char const* data) { LoadBossState(data); }
// On load
virtual void Load(char const* data);
//When save is needed, this function generates the data
virtual std::string GetSaveData() { return GetBossSaveData(); }
// When save is needed, this function generates the data
virtual std::string GetSaveData();
void SaveToDB();
virtual void Update(uint32 /*diff*/) { }
//Used by the map's CanEnter function.
//This is to prevent players from entering during boss encounters.
// Used by the map's CanEnter function.
// This is to prevent players from entering during boss encounters.
virtual bool IsEncounterInProgress() const;
//Called when a player successfully enters the instance.
// Called when a player successfully enters the instance.
virtual void OnPlayerEnter(Player* /*player*/) { }
//Handle open / close objects
//use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts
//use HandleGameObject(GUID, boolen, NULL); in any other script
void HandleGameObject(uint64 guid, bool open, GameObject* go = NULL);
// Handle open / close objects
// * use HandleGameObject(0, boolen, GO); in OnObjectCreate in instance scripts
// * use HandleGameObject(GUID, boolen, NULL); in any other script
void HandleGameObject(uint64 guid, bool open, GameObject* go = nullptr);
//change active state of doors or buttons
// Change active state of doors or buttons
void DoUseDoorOrButton(uint64 guid, uint32 withRestoreTime = 0, bool useAlternativeState = false);
//Respawns a GO having negative spawntimesecs in gameobject-table
// Respawns a GO having negative spawntimesecs in gameobject-table
void DoRespawnGameObject(uint64 guid, uint32 timeToDespawn = MINUTE);
//sends world state update to all players in instance
// Sends world state update to all players in instance
void DoUpdateWorldState(uint32 worldstateId, uint32 worldstateValue);
// Send Notify to all players in instance
@@ -215,6 +215,7 @@ class InstanceScript : public ZoneScript
virtual void FillInitialWorldStates(WorldPacket& /*data*/) { }
protected:
void SetHeaders(std::string const& dataHeaders);
void SetBossNumber(uint32 number) { bosses.resize(number); }
void LoadDoorData(DoorData const* data);
void LoadMinionData(MinionData const* data);
@@ -225,9 +226,16 @@ class InstanceScript : public ZoneScript
void UpdateDoorState(GameObject* door);
void UpdateMinionState(Creature* minion, EncounterState state);
std::string LoadBossState(char const* data);
std::string GetBossSaveData();
// Instance Load and Save
bool ReadSaveDataHeaders(std::istringstream& data);
void ReadSaveDataBossStates(std::istringstream& data);
virtual void ReadSaveDataMore(std::istringstream& /*data*/) { }
void WriteSaveDataHeaders(std::ostringstream& data);
void WriteSaveDataBossStates(std::ostringstream& data);
virtual void WriteSaveDataMore(std::ostringstream& /*data*/) { }
private:
std::vector<char> headers;
std::vector<BossInfo> bosses;
DoorInfoMap doors;
MinionInfoMap minions;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_BRD_H
#define DEF_BRD_H
#define DataHeader "BRD"
enum FactionIds
{
FACTION_NEUTRAL = 734,

View File

@@ -117,6 +117,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&encounter, 0, sizeof(encounter));
EmperorGUID = 0;

View File

@@ -21,6 +21,7 @@
uint32 const EncounterCount = 23;
#define BRSScriptName "instance_blackrock_spire"
#define DataHeader "BRS"
enum DataTypes
{

View File

@@ -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;

View File

@@ -21,6 +21,7 @@
uint32 const EncounterCount = 8;
#define BRLScriptName "instance_blackwing_lair"
#define DataHeader "BWL"
enum BWLEncounter
{

View File

@@ -56,6 +56,7 @@ public:
{
instance_blackwing_lair_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
// Razorgore
EggCount = 0;
EggEvent = 0;

View File

@@ -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

View File

@@ -19,6 +19,8 @@
#ifndef DEF_MOLTEN_CORE_H
#define DEF_MOLTEN_CORE_H
#define DataHeader "MC"
enum Encounters
{
BOSS_LUCIFRON = 0,

View File

@@ -18,6 +18,8 @@
#ifndef DEF_DEADMINES_H
#define DEF_DEADMINES_H
#define DataHeader "DM"
enum CannonState
{
CANNON_NOT_USED,

View File

@@ -74,6 +74,7 @@ class instance_deadmines : public InstanceMapScript
void Initialize() override
{
SetHeaders(DataHeader);
FactoryDoorGUID = 0;
IronCladDoorGUID = 0;
DefiasCannonGUID = 0;

View File

@@ -18,6 +18,8 @@
#ifndef DEF_GNOMEREGAN_H
#define DEF_GNOMEREGAN_H
#define DataHeader "GNO"
enum GameObjectIds
{
GO_CAVE_IN_LEFT = 146085,

View File

@@ -36,6 +36,7 @@ public:
{
instance_gnomeregan_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
}
uint32 m_auiEncounter[MAX_ENCOUNTER];

View File

@@ -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.

View File

@@ -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

View File

@@ -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)

View File

@@ -19,6 +19,8 @@
#ifndef DEF_MAGISTERS_TERRACE_H
#define DEF_MAGISTERS_TERRACE_H
#define DataHeader "MT"
uint32 const EncounterCount = 4;
enum DataTypes

View File

@@ -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;

View File

@@ -19,6 +19,8 @@
#define SCARLET_M_
#define SMScriptName "instance_scarlet_monastery"
#define DataHeader "SM"
uint32 const EncounterCount = 10;
enum DataTypes

View File

@@ -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:

View File

@@ -18,6 +18,8 @@
#ifndef DEF_SCHOLOMANCE_H
#define DEF_SCHOLOMANCE_H
#define DataHeader "SC"
uint32 const EncounterCount = 8;
enum DataTypes

View File

@@ -96,6 +96,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
uiAshGUID = 0;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_SHADOWFANG_H
#define DEF_SHADOWFANG_H
#define DataHeader "SK"
enum DataTypes
{
TYPE_FREE_NPC = 1,

View File

@@ -49,6 +49,7 @@ class instance_stratholme : public InstanceMapScript
{
instance_stratholme_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
}
uint32 EncounterState[MAX_ENCOUNTER];

View File

@@ -19,6 +19,8 @@
#ifndef DEF_STRATHOLME_H
#define DEF_STRATHOLME_H
#define DataHeader "STR"
enum DataTypes
{
TYPE_BARON_RUN = 1,

View File

@@ -60,6 +60,7 @@ public:
{
instance_sunken_temple_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
}
uint64 GOAtalaiStatue1;

View File

@@ -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

View File

@@ -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

View File

@@ -19,6 +19,7 @@
#define SUNWELL_PLATEAU_H
#define SunwellPlateauScriptName "instance_sunwell_plateau"
#define DataHeader "SWP"
uint32 const EncounterCount = 6;

View File

@@ -49,6 +49,7 @@ class instance_uldaman : public InstanceMapScript
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
archaedasGUID = 0;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_ULDAMAN_H
#define DEF_ULDAMAN_H
#define DataHeader "UD"
#define MAX_ENCOUNTER 3
enum DataTypes

View File

@@ -92,6 +92,7 @@ class instance_zulaman : public InstanceMapScript
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
HarkorsSatchelGUID = 0;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_ZULAMAN_H
#define DEF_ZULAMAN_H
#define DataHeader "ZA"
enum DataTypes
{
DATA_GONGEVENT = 0,

View File

@@ -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.

View File

@@ -18,6 +18,8 @@
#ifndef DEF_ZULGURUB_H
#define DEF_ZULGURUB_H
#define DataHeader "ZG"
uint32 const EncounterCount = 13;
#define ZGScriptName "instance_zulgurub"

View File

@@ -19,6 +19,8 @@
#ifndef BFD_H_
#define BFD_H_
#define DataHeader "BFD"
enum Data64
{
DATA_SHRINE1,

View File

@@ -81,6 +81,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&encounter, 0, sizeof(encounter));
twilightLordKelrisGUID = 0;

View File

@@ -19,7 +19,7 @@
#ifndef DEF_HYJAL_H
#define DEF_HYJAL_H
#define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy."
#define DataHeader "HY"
uint32 const EncounterCount = 5;

View File

@@ -59,6 +59,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
m_uiAncientGemGUID.clear();

View File

@@ -18,6 +18,8 @@
#ifndef DEF_CULLING_OF_STRATHOLME_H
#define DEF_CULLING_OF_STRATHOLME_H
#define DataHeader "CS"
enum Data
{
DATA_MEATHOOK_EVENT,

View File

@@ -54,6 +54,7 @@ class instance_culling_of_stratholme : public InstanceMapScript
{
instance_culling_of_stratholme_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
_arthasGUID = 0;
_meathookGUID = 0;
_salrammGUID = 0;

View File

@@ -64,6 +64,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
mBarrelCount = 0;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_OLD_HILLSBRAD_H
#define DEF_OLD_HILLSBRAD_H
#define DataHeader "OH"
enum DataTypes
{
TYPE_BARREL_DIVERSION = 1,

View File

@@ -94,6 +94,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
_medivhGUID = 0;
Clear();
}

View File

@@ -19,6 +19,8 @@
#ifndef DEF_THEBLACKMORASS_H
#define DEF_THEBLACKMORASS_H
#define DataHeader "TBM"
uint32 const EncounterCount = 2;
enum DataTypes

View File

@@ -50,6 +50,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
onyxiaGUID = 0;
@@ -265,61 +266,17 @@ public:
return false;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "O L " << 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 == 'O' && dataHead2 == 'L')
{
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:
std::map<uint64, uint32> FloorEruptionGUID[2];
std::queue<uint64> FloorEruptionGUIDQueue;
uint64 onyxiaGUID;
uint64 triggerGUID;
uint64 tankGUID;
uint32 onyxiaLiftoffTimer;
uint32 manyWhelpsCounter;
uint32 eruptTimer;
bool achievManyWhelpsHandleIt;
bool achievSheDeepBreathMore;
protected:
std::map<uint64, uint32> FloorEruptionGUID[2];
std::queue<uint64> FloorEruptionGUIDQueue;
uint64 onyxiaGUID;
uint64 triggerGUID;
uint64 tankGUID;
uint32 onyxiaLiftoffTimer;
uint32 manyWhelpsCounter;
uint32 eruptTimer;
bool achievManyWhelpsHandleIt;
bool achievSheDeepBreathMore;
};
};

View File

@@ -18,6 +18,8 @@
#ifndef DEF_ONYXIAS_LAIR_H
#define DEF_ONYXIAS_LAIR_H
#define DataHeader "OL"
uint32 const EncounterCount = 1;
enum DataTypes

View File

@@ -53,6 +53,7 @@ public:
{
instance_razorfen_downs_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
}
@@ -167,62 +168,17 @@ public:
}
break;
}
}
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "R D " << 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 == 'R' && dataHead2 == 'D')
{
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 goGongGUID;
uint16 gongWave;
uint8 fiendsKilled;
uint8 reaversKilled;
uint8 summonLowRange;
uint8 summonHighRange;
uint32 summonCreature;
protected:
uint64 goGongGUID;
uint16 gongWave;
uint8 fiendsKilled;
uint8 reaversKilled;
uint8 summonLowRange;
uint8 summonHighRange;
uint32 summonCreature;
};
InstanceScript* GetInstanceScript(InstanceMap* map) const override

View File

@@ -19,6 +19,7 @@
#define DEF_RAZORFEN_DOWNS_H
#define RFDScriptName "instance_razorfen_downs"
#define DataHeader "RFD"
uint32 const EncounterCount = 5;

View File

@@ -49,6 +49,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
WardKeeperDeath = 0;
DoorWardGUID = 0;
}

View File

@@ -19,5 +19,7 @@
#ifndef DEF_RAZORFEN_KRAUL_H
#define DEF_RAZORFEN_KRAUL_H
#define DataHeader "RFK"
#define EVENT_WARD_KEEPER 1
#endif

View File

@@ -28,6 +28,7 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
{
instance_ruins_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(NUM_ENCOUNTER);
_kurinaxxGUID = 0;
@@ -101,49 +102,6 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "R A" << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void Load(char const* data)
{
if (!data)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(data);
char dataHead1, dataHead2;
std::istringstream loadStream(data);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'R' && dataHead2 == 'A')
{
for (uint8 i = 0; i < NUM_ENCOUNTER; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > TO_BE_DECIDED)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
}
else
OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
private:
uint64 _kurinaxxGUID;
uint64 _rajaxxGUID;

View File

@@ -18,6 +18,8 @@
#ifndef DEF_RUINS_OF_AHNQIRAJ_H
#define DEF_RUINS_OF_AHNQIRAJ_H
#define DataHeader "AQR"
enum DataTypes
{
DATA_KURINNAXX = 0,

View File

@@ -58,6 +58,7 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript
void Initialize() override
{
SetHeaders(DataHeader);
IsBossDied[0] = false;
IsBossDied[1] = false;
IsBossDied[2] = false;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_TEMPLE_OF_AHNQIRAJ_H
#define DEF_TEMPLE_OF_AHNQIRAJ_H
#define DataHeader "AQT"
enum DataTypes
{
DATA_SKERAM = 1,

View File

@@ -50,6 +50,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
yelled = false;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_WAILING_CAVERNS_H
#define DEF_WAILING_CAVERNS_H
#define DataHeader "WC"
enum DataTypes
{
TYPE_LORD_COBRAHN = 1,

View File

@@ -126,6 +126,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
GahzRillaEncounter = NOT_STARTED;
ZumrahGUID = 0;
BlyGUID = 0;

View File

@@ -5,6 +5,8 @@
#ifndef DEF_ZF_H
#define DEF_ZF_H
#define DataHeader "ZF"
enum zfEntries
{
ENTRY_ZUM_RAH = 7271,

View File

@@ -19,6 +19,7 @@
#define AHNKAHET_H_
#define AhnKahetScriptName "instance_ahnkahet"
#define DataHeader "AK"
uint32 const EncounterCount = 5;

View File

@@ -35,6 +35,7 @@ class instance_ahnkahet : public InstanceMapScript
{
instance_ahnkahet_InstanceScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
@@ -258,50 +259,15 @@ class instance_ahnkahet : public InstanceMapScript
return true;
}
std::string GetSaveData() override
void WriteSaveDataMore(std::ostringstream& data) override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "A K " << GetBossSaveData() << SpheresState[0] << ' ' << SpheresState[1];
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
data << SpheresState[0] << ' ' << SpheresState[1];
}
void Load(char const* str) override
void ReadSaveDataMore(std::istringstream& data) 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 == 'A' && dataHead2 == 'K')
{
for (uint32 i = 0; i < EncounterCount; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
loadStream >> SpheresState[0];
loadStream >> SpheresState[1];
}
else
OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
data >> SpheresState[0];
data >> SpheresState[1];
}
protected:
@@ -317,7 +283,7 @@ class instance_ahnkahet : public InstanceMapScript
std::set<uint64> InitiandGUIDs;
uint8 SpheresState[2];
uint32 SpheresState[2];
uint8 SwitchTrigger;
};

View File

@@ -19,6 +19,7 @@
#define AZJOL_NERUB_H_
#define AzjolNerubScriptName "instance_azjol_nerub"
#define DataHeader "AN"
uint32 const EncounterCount = 3;

View File

@@ -37,6 +37,7 @@ class instance_azjol_nerub : public InstanceMapScript
{
instance_azjol_nerub_InstanceScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
@@ -128,49 +129,6 @@ class instance_azjol_nerub : public InstanceMapScript
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "A N " << 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 == 'A' && dataHead2 == 'N')
{
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 KrikthirGUID;
uint64 HadronoxGUID;

View File

@@ -34,6 +34,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
sartharionGUID = 0;
tenebronGUID = 0;
shadronGUID = 0;
@@ -98,49 +99,6 @@ public:
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "O S " << 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 == 'O' && dataHead2 == 'S')
{
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 sartharionGUID;
uint64 tenebronGUID;

View File

@@ -19,6 +19,7 @@
#define OBSIDIAN_SANCTUM_H_
#define OSScriptName "instance_obsidian_sanctum"
#define DataHeader "OS"
uint32 const EncounterCount = 5;

View File

@@ -15,9 +15,9 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ObjectMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "ruby_sanctum.h"
@@ -245,7 +245,7 @@ class npc_baltharus_the_warborn_clone : public CreatureScript
void DamageTaken(Unit* /*attacker*/, uint32& damage) override
{
// Setting DATA_BALTHARUS_SHARED_HEALTH to 0 when killed would bug the boss.
if (_instance && me->GetHealth() > damage)
if (me->GetHealth() > damage)
_instance->SetData(DATA_BALTHARUS_SHARED_HEALTH, me->GetHealth() - damage);
}

View File

@@ -17,6 +17,7 @@
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "ruby_sanctum.h"
enum Texts

View File

@@ -15,12 +15,13 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "ruby_sanctum.h"
#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
#include "TemporarySummon.h"
#include "WorldPacket.h"
#include "ruby_sanctum.h"
DoorData const doorData[] =
{
@@ -37,6 +38,7 @@ class instance_ruby_sanctum : public InstanceMapScript
{
instance_ruby_sanctum_InstanceMapScript(InstanceMap* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
BaltharusTheWarbornGUID = 0;
@@ -294,17 +296,6 @@ class instance_ruby_sanctum : public InstanceMapScript
return BaltharusSharedHealth;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "R S " << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void FillInitialWorldStates(WorldPacket& data) override
{
data << uint32(WORLDSTATE_CORPOREALITY_MATERIAL) << uint32(50);
@@ -312,39 +303,6 @@ class instance_ruby_sanctum : public InstanceMapScript
data << uint32(WORLDSTATE_CORPOREALITY_TOGGLE) << uint32(0);
}
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 == 'R' && 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:
uint64 BaltharusTheWarbornGUID;
uint64 GeneralZarithrianGUID;

View File

@@ -18,12 +18,9 @@
#ifndef RUBY_SANCTUM_H_
#define RUBY_SANCTUM_H_
#include "SpellScript.h"
#include "Map.h"
#include "Creature.h"
#include "GameObjectAI.h"
#define RSScriptName "instance_ruby_sanctum"
#define DataHeader "RS"
uint32 const EncounterCount = 4;
Position const HalionControllerSpawnPos = {3156.037f, 533.2656f, 72.97205f, 0.0f};

View File

@@ -68,6 +68,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
uiMovementDone = 0;
uiGrandChampionsDeaths = 0;
uiArgentSoldierDeaths = 0;

View File

@@ -19,6 +19,8 @@
#ifndef DEF_TOC_H
#define DEF_TOC_H
#define DataHeader "TC"
enum Data
{
BOSS_GRAND_CHAMPIONS,

View File

@@ -33,6 +33,7 @@ class instance_trial_of_the_crusader : public InstanceMapScript
void Initialize() override
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTERS);
TrialCounter = 50;
EventStage = 0;

View File

@@ -5,6 +5,8 @@
#ifndef DEF_CRUSADER_H
#define DEF_CRUSADER_H
#define DataHeader "TCR"
enum DataTypes
{
BOSS_BEASTS = 0,

View File

@@ -19,6 +19,7 @@
#define DRAK_THARON_KEEP_H_
#define DrakTharonKeepScriptName "instance_drak_tharon_keep"
#define DataHeader "DTK"
uint32 const EncounterCount = 4;

View File

@@ -29,6 +29,7 @@ class instance_drak_tharon_keep : public InstanceMapScript
{
instance_drak_tharon_keep_InstanceScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
TrollgoreGUID = 0;
@@ -159,49 +160,6 @@ class instance_drak_tharon_keep : public InstanceMapScript
novos->AI()->DoAction(ACTION_CRYSTAL_HANDLER_DIED);
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "D K " << 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 == 'D' && dataHead2 == 'K')
{
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 TrollgoreGUID;
uint64 NovosGUID;

View File

@@ -19,6 +19,7 @@
#define DEF_FORGE_OF_SOULS_H
#define FoSScriptName "instance_forge_of_souls"
#define DataHeader "FOS"
enum Data
{

View File

@@ -36,6 +36,7 @@ class instance_forge_of_souls : public InstanceMapScript
{
instance_forge_of_souls_InstanceScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
bronjahm = 0;
devourerOfSouls = 0;
@@ -110,47 +111,6 @@ class instance_forge_of_souls : public InstanceMapScript
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "F S " << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void Load(const char* in) override
{
if (!in)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'F' && dataHead2 == 'S')
{
for (uint8 i = 0; i < MAX_ENCOUNTER; ++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:
uint64 bronjahm;
uint64 devourerOfSouls;

View File

@@ -19,6 +19,7 @@
#define HALLS_OF_REFLECTION_H_
#define HoRScriptName "instance_halls_of_reflection"
#define DataHeader "HOR"
uint32 const EncounterCount = 3;

View File

@@ -82,6 +82,7 @@ class instance_halls_of_reflection : public InstanceMapScript
{
instance_halls_of_reflection_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
JainaOrSylvanasIntroGUID = 0;
@@ -709,61 +710,25 @@ class instance_halls_of_reflection : public InstanceMapScript
return 0;
}
std::string GetSaveData() override
void WriteSaveDataMore(std::ostringstream& data) override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H R " << GetBossSaveData() << _introState << ' ' << _frostswornGeneralState;
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
data << _introState << ' ' << _frostswornGeneralState;
}
void Load(char const* in) override
void ReadSaveDataMore(std::istringstream& data) override
{
if (!in)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'H' && dataHead2 == 'R')
{
for (uint8 i = 0; i < EncounterCount; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
uint32 temp = 0;
loadStream >> temp;
if (temp == DONE)
SetData(DATA_INTRO_EVENT, DONE);
else
SetData(DATA_INTRO_EVENT, NOT_STARTED);
loadStream >> temp;
if (temp == DONE)
SetData(DATA_FROSTSWORN_GENERAL, DONE);
else
SetData(DATA_FROSTSWORN_GENERAL, NOT_STARTED);
}
uint32 temp = 0;
data >> temp;
if (temp == DONE)
SetData(DATA_INTRO_EVENT, DONE);
else
OUT_LOAD_INST_DATA_FAIL;
SetData(DATA_INTRO_EVENT, NOT_STARTED);
OUT_LOAD_INST_DATA_COMPLETE;
data >> temp;
if (temp == DONE)
SetData(DATA_FROSTSWORN_GENERAL, DONE);
else
SetData(DATA_FROSTSWORN_GENERAL, NOT_STARTED);
}
private:

View File

@@ -41,6 +41,7 @@ class instance_pit_of_saron : public InstanceMapScript
{
instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(Doors);
_garfrostGUID = 0;
@@ -264,50 +265,6 @@ class instance_pit_of_saron : public InstanceMapScript
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "P S " << GetBossSaveData();
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
}
void Load(const char* in) override
{
if (!in)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'P' && 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;
}
private:
uint64 _garfrostGUID;
uint64 _krickGUID;

View File

@@ -19,6 +19,7 @@
#define PIT_OF_SARON_H_
#define PoSScriptName "instance_pit_of_saron"
#define DataHeader "POS"
uint32 const EncounterCount = 3;

View File

@@ -18,6 +18,8 @@
#ifndef DEF_GUNDRAK_H
#define DEF_GUNDRAK_H
#define DataHeader "GD"
enum Data
{
DATA_SLAD_RAN_EVENT,

View File

@@ -45,6 +45,7 @@ public:
{
instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
isHeroic = map->IsHeroic();
}

View File

@@ -19,11 +19,9 @@
#define ICECROWN_CITADEL_H_
#include "SpellScript.h"
#include "Map.h"
#include "Creature.h"
#include "SpellMgr.h"
#define ICCScriptName "instance_icecrown_citadel"
#define DataHeader "IC"
uint32 const EncounterCount = 13;
uint32 const WeeklyNPCs = 9;

View File

@@ -15,12 +15,12 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptedGossip.h"
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "icecrown_citadel.h"
#include "Spell.h"
#include "Player.h"
#include "icecrown_citadel.h"
#define GOSSIP_SENDER_ICC_PORT 631

View File

@@ -115,6 +115,7 @@ class instance_icecrown_citadel : public InstanceMapScript
{
instance_icecrown_citadel_InstanceMapScript(InstanceMap* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
TeamInInstance = 0;
@@ -1324,64 +1325,32 @@ class instance_icecrown_citadel : public InstanceMapScript
}
}
std::string GetSaveData() override
void WriteSaveDataMore(std::ostringstream& data) override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "I C " << GetBossSaveData() << HeroicAttempts << ' '
<< ColdflameJetsState << ' ' << BloodQuickeningState << ' ' << BloodQuickeningMinutes << ' ' << UpperSpireTeleporterActiveState;
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
data << HeroicAttempts << ' '
<< ColdflameJetsState << ' '
<< BloodQuickeningState << ' '
<< BloodQuickeningMinutes << ' '
<< UpperSpireTeleporterActiveState;
}
void Load(const char* str) override
void ReadSaveDataMore(std::istringstream& data) override
{
if (!str)
{
OUT_LOAD_INST_DATA_FAIL;
return;
}
data >> HeroicAttempts;
OUT_LOAD_INST_DATA(str);
char dataHead1, dataHead2;
std::istringstream loadStream(str);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'I' && dataHead2 == 'C')
{
for (uint32 i = 0; i < EncounterCount; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
loadStream >> HeroicAttempts;
uint32 temp = 0;
loadStream >> temp;
if (temp == IN_PROGRESS)
ColdflameJetsState = NOT_STARTED;
else
ColdflameJetsState = temp ? DONE : NOT_STARTED;
loadStream >> temp;
BloodQuickeningState = temp ? DONE : NOT_STARTED; // DONE means finished (not success/fail)
loadStream >> BloodQuickeningMinutes;
loadStream >> temp;
UpperSpireTeleporterActiveState = temp ? DONE : NOT_STARTED;
}
uint32 temp = 0;
data >> temp;
if (temp == IN_PROGRESS)
ColdflameJetsState = NOT_STARTED;
else
OUT_LOAD_INST_DATA_FAIL;
ColdflameJetsState = temp ? DONE : NOT_STARTED;
OUT_LOAD_INST_DATA_COMPLETE;
data >> temp;
BloodQuickeningState = temp ? DONE : NOT_STARTED; // DONE means finished (not success/fail)
data >> BloodQuickeningMinutes;
data >> temp;
UpperSpireTeleporterActiveState = temp ? DONE : NOT_STARTED;
}
void Update(uint32 diff) override

View File

@@ -107,6 +107,7 @@ class instance_naxxramas : public InstanceMapScript
{
instance_naxxramas_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
LoadMinionData(minionData);
@@ -427,50 +428,6 @@ class instance_naxxramas : public InstanceMapScript
return false;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "N X " << GetBossSaveData() << playerDied;
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 == 'N' && dataHead2 == 'X')
{
for (uint8 i = 0; i < EncounterCount; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
loadStream >> playerDied;
}
OUT_LOAD_INST_DATA_COMPLETE;
}
protected:
/* The Arachnid Quarter */
// Grand Widow Faerlina

View File

@@ -18,6 +18,8 @@
#ifndef DEF_NAXXRAMAS_H
#define DEF_NAXXRAMAS_H
#define DataHeader "NAX"
uint32 const EncounterCount = 15;
enum Encounter

View File

@@ -18,6 +18,8 @@
#ifndef DEF_EYE_OF_ETERNITY_H
#define DEF_EYE_OF_ETERNITY_H
#define DataHeader "EOE"
enum InstanceData
{
DATA_MALYGOS_EVENT,

View File

@@ -35,6 +35,7 @@ public:
{
instance_eye_of_eternity_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
vortexTriggers.clear();
@@ -278,65 +279,23 @@ public:
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "E E " << 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 == 'E' && dataHead2 == 'E')
{
for (uint8 i = 0; i < MAX_ENCOUNTER; ++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:
std::list<uint64> vortexTriggers;
std::list<uint64> portalTriggers;
uint64 malygosGUID;
uint64 irisGUID;
uint64 lastPortalGUID;
uint64 platformGUID;
uint64 exitPortalGUID;
uint64 heartOfMagicGUID;
uint64 alexstraszaBunnyGUID;
uint64 giftBoxBunnyGUID;
Position focusingIrisPosition;
Position exitPortalPosition;
private:
std::list<uint64> vortexTriggers;
std::list<uint64> portalTriggers;
uint64 malygosGUID;
uint64 irisGUID;
uint64 lastPortalGUID;
uint64 platformGUID;
uint64 exitPortalGUID;
uint64 heartOfMagicGUID;
uint64 alexstraszaBunnyGUID;
uint64 giftBoxBunnyGUID;
Position focusingIrisPosition;
Position exitPortalPosition;
};
};
void AddSC_instance_eye_of_eternity()
{
new instance_eye_of_eternity();
new instance_eye_of_eternity();
}

View File

@@ -55,6 +55,7 @@ public:
void Initialize() override
{
SetHeaders(DataHeader);
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
Anomalus = 0;

View File

@@ -18,6 +18,8 @@
#ifndef DEF_NEXUS_H
#define DEF_NEXUS_H
#define DataHeader "NEX"
enum DataTypes
{
DATA_MAGUS_TELESTRA_EVENT,

View File

@@ -40,6 +40,7 @@ class instance_oculus : public InstanceMapScript
{
instance_oculus_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
@@ -286,49 +287,6 @@ class instance_oculus : public InstanceMapScript
gwhelp->SetPhaseMask(1, true);
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "T O " << 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 == 'T' && 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));
}
}
else
OUT_LOAD_INST_DATA_FAIL;
OUT_LOAD_INST_DATA_COMPLETE;
}
protected:
uint64 DrakosGUID;
uint64 VarosGUID;

View File

@@ -19,6 +19,7 @@
#define OCULUS_H_
#define OculusScriptName "instance_oculus"
#define DataHeader "OC"
uint32 const EncounterCount = 4;

View File

@@ -19,6 +19,7 @@
#define HALLS_OF_LIGHTNING_H_
#define HoLScriptName "instance_halls_of_lightning"
#define DataHeader "HOL"
uint32 const EncounterCount = 4;

View File

@@ -36,6 +36,7 @@ class instance_halls_of_lightning : public InstanceMapScript
{
instance_halls_of_lightning_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
@@ -136,49 +137,6 @@ class instance_halls_of_lightning : public InstanceMapScript
return 0;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H L " << 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 == 'H' && dataHead2 == 'L')
{
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 GeneralBjarngrimGUID;
uint64 VolkhanGUID;

View File

@@ -19,6 +19,7 @@
#define HALLS_OF_STONE_H_
#define HoSScriptName "instance_halls_of_stone"
#define DataHeader "HOS"
uint32 const EncounterCount = 4;

View File

@@ -15,11 +15,11 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "WorldSession.h"
#include "halls_of_stone.h"
#include <Player.h>
DoorData const doorData[] =
{
@@ -36,6 +36,7 @@ class instance_halls_of_stone : public InstanceMapScript
{
instance_halls_of_stone_InstanceMapScript(Map* map) : InstanceScript(map)
{
SetHeaders(DataHeader);
SetBossNumber(EncounterCount);
LoadDoorData(doorData);
@@ -203,49 +204,6 @@ class instance_halls_of_stone : public InstanceMapScript
return true;
}
std::string GetSaveData() override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "H S " << 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 == 'H' && dataHead2 == 'S')
{
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 KrystallusGUID;
uint64 MaidenOfGriefGUID;

View File

@@ -123,6 +123,7 @@ class instance_ulduar : public InstanceMapScript
void Initialize() override
{
SetHeaders(DataHeader);
SetBossNumber(MAX_ENCOUNTER);
LoadDoorData(doorData);
LoadMinionData(minionData);
@@ -1033,84 +1034,50 @@ class instance_ulduar : public InstanceMapScript
return false;
}
std::string GetSaveData() override
void WriteSaveDataMore(std::ostringstream& data) override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "U U " << GetBossSaveData() << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << (_algalonSummoned ? 1 : 0);
data << GetData(DATA_COLOSSUS) << ' ' << _algalonTimer << ' ' << uint32(_algalonSummoned ? 1 : 0);
for (uint8 i = 0; i < 4; ++i)
saveStream << ' ' << (KeeperGUIDs[i] ? 1 : 0);
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
data << ' ' << uint32(KeeperGUIDs[i] ? 1 : 0);
}
void Load(char const* strIn) override
void ReadSaveDataMore(std::istringstream& data) override
{
if (!strIn)
uint32 tempState;
data >> tempState;
if (tempState == IN_PROGRESS || tempState > SPECIAL)
tempState = NOT_STARTED;
SetData(DATA_COLOSSUS, tempState);
data >> _algalonTimer;
data >> tempState;
_algalonSummoned = tempState != 0;
if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE)
{
OUT_LOAD_INST_DATA_FAIL;
return;
_summonAlgalon = true;
if (_algalonTimer && _algalonTimer <= 60)
{
_events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer);
}
}
OUT_LOAD_INST_DATA(strIn);
char dataHead1, dataHead2;
std::istringstream loadStream(strIn);
loadStream >> dataHead1 >> dataHead2;
if (dataHead1 == 'U' && dataHead2 == 'U')
for (uint8 i = 0; i < 4; ++i)
{
for (uint8 i = 0; i < MAX_ENCOUNTER; ++i)
{
uint32 tmpState;
loadStream >> tmpState;
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
tmpState = NOT_STARTED;
SetBossState(i, EncounterState(tmpState));
}
uint32 tempState;
loadStream >> tempState;
if (tempState == IN_PROGRESS || tempState > SPECIAL)
tempState = NOT_STARTED;
SetData(DATA_COLOSSUS, tempState);
loadStream >> _algalonTimer;
loadStream >> tempState;
_algalonSummoned = tempState != 0;
if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE)
{
_summonAlgalon = true;
if (_algalonTimer && _algalonTimer <= 60)
{
_events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000);
DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1);
DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer);
}
}
for (uint8 i = 0; i < 4; ++i)
{
loadStream >> tempState;
_summonYSKeeper[i] = tempState != 0;
}
if (GetBossState(BOSS_FREYA) == DONE && !_summonYSKeeper[0])
_summonObservationRingKeeper[0] = true;
if (GetBossState(BOSS_HODIR) == DONE && !_summonYSKeeper[1])
_summonObservationRingKeeper[1] = true;
if (GetBossState(BOSS_THORIM) == DONE && !_summonYSKeeper[2])
_summonObservationRingKeeper[2] = true;
if (GetBossState(BOSS_MIMIRON) == DONE && !_summonYSKeeper[3])
_summonObservationRingKeeper[3] = true;
data >> tempState;
_summonYSKeeper[i] = tempState != 0;
}
OUT_LOAD_INST_DATA_COMPLETE;
if (GetBossState(BOSS_FREYA) == DONE && !_summonYSKeeper[0])
_summonObservationRingKeeper[0] = true;
if (GetBossState(BOSS_HODIR) == DONE && !_summonYSKeeper[1])
_summonObservationRingKeeper[1] = true;
if (GetBossState(BOSS_THORIM) == DONE && !_summonYSKeeper[2])
_summonObservationRingKeeper[2] = true;
if (GetBossState(BOSS_MIMIRON) == DONE && !_summonYSKeeper[3])
_summonObservationRingKeeper[3] = true;
}
void Update(uint32 diff) override

Some files were not shown because too many files have changed in this diff Show More