mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 00:06:11 +00:00
refactor(Core/InstanceScript): refactored load and save methods (#14977)
Co-authored-by: joschiwald <736792+joschiwald@users.noreply.github.com>
This commit is contained in:
@@ -26,7 +26,10 @@ public:
|
||||
|
||||
struct instance_magisters_terrace_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map) { }
|
||||
instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
uint32 Encounter[MAX_ENCOUNTER];
|
||||
|
||||
@@ -150,39 +153,17 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
// @todo: Use BossStates. This is for code compatibility
|
||||
void ReadSaveDataMore(std::istringstream& data) override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3];
|
||||
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return saveStream.str();
|
||||
data >> Encounter[1];
|
||||
data >> Encounter[2];
|
||||
data >> Encounter[3];
|
||||
}
|
||||
|
||||
void Load(const char* str) override
|
||||
void WriteSaveDataMore(std::ostringstream& data) override
|
||||
{
|
||||
if (!str)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA(str);
|
||||
|
||||
std::istringstream loadStream(str);
|
||||
|
||||
for (uint32 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetData(i, tmpState);
|
||||
}
|
||||
|
||||
OUT_LOAD_INST_DATA_COMPLETE;
|
||||
data << Encounter[0] << ' ' << Encounter[1] << ' ' << Encounter[2] << ' ' << Encounter[3];
|
||||
}
|
||||
|
||||
ObjectGuid GetGuidData(uint32 identifier) const override
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "Player.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
#define DataHeader "MT"
|
||||
#define MTScriptName "instance_magisters_terrace"
|
||||
|
||||
enum MTData
|
||||
|
||||
Reference in New Issue
Block a user