mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 19:35:42 +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:
@@ -37,7 +37,10 @@ public:
|
||||
|
||||
struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_shadowfang_keep_InstanceMapScript(Map* map) : InstanceScript(map) { }
|
||||
instance_shadowfang_keep_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
@@ -112,30 +115,16 @@ public:
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
void ReadSaveDataMore(std::istringstream& data) override
|
||||
{
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "S K " << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2];
|
||||
return saveStream.str();
|
||||
data >> _encounters[0];
|
||||
data >> _encounters[1];
|
||||
data >> _encounters[2];
|
||||
}
|
||||
|
||||
void Load(const char* in) override
|
||||
void WriteSaveDataMore(std::ostringstream& data) override
|
||||
{
|
||||
if (!in)
|
||||
return;
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
if (dataHead1 == 'S' && dataHead2 == 'K')
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
|
||||
{
|
||||
loadStream >> _encounters[i];
|
||||
if (_encounters[i] == IN_PROGRESS)
|
||||
_encounters[i] = NOT_STARTED;
|
||||
}
|
||||
}
|
||||
data << _encounters[0] << ' ' << _encounters[1] << ' ' << _encounters[2];
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "SpellScript.h"
|
||||
#include "CreatureAIImpl.h"
|
||||
|
||||
#define DataHeader "SK"
|
||||
#define ShadowfangKeepScriptName "instance_shadowfang_keep"
|
||||
|
||||
enum DataTypes
|
||||
|
||||
Reference in New Issue
Block a user