mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +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:
@@ -60,6 +60,7 @@ public:
|
||||
{
|
||||
instance_stratholme_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
void Initialize() override
|
||||
@@ -344,37 +345,36 @@ public:
|
||||
SaveToDB();
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
void ReadSaveDataMore(std::istringstream& data) override
|
||||
{
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "S T " << _baronRunProgress << ' ' << _baronRunTime << ' ' << _zigguratState1 << ' ' << _zigguratState2 << ' ' << _zigguratState3 << ' ' << _slaughterProgress << ' ' << _postboxesOpened;
|
||||
return saveStream.str();
|
||||
}
|
||||
data >> _baronRunProgress;
|
||||
data >> _baronRunTime;
|
||||
data >> _zigguratState1;
|
||||
data >> _zigguratState2;
|
||||
data >> _zigguratState3;
|
||||
data >> _slaughterProgress;
|
||||
data >> _postboxesOpened;
|
||||
|
||||
void Load(const char* in) override
|
||||
{
|
||||
if (!in)
|
||||
return;
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
if (dataHead1 == 'S' && dataHead2 == 'T')
|
||||
if (_baronRunTime)
|
||||
{
|
||||
loadStream >> _baronRunProgress;
|
||||
loadStream >> _baronRunTime;
|
||||
loadStream >> _zigguratState1;
|
||||
loadStream >> _zigguratState2;
|
||||
loadStream >> _zigguratState3;
|
||||
loadStream >> _slaughterProgress;
|
||||
loadStream >> _postboxesOpened;
|
||||
events.ScheduleEvent(EVENT_BARON_TIME, 60000);
|
||||
}
|
||||
|
||||
if (_baronRunTime > 0)
|
||||
events.ScheduleEvent(EVENT_BARON_TIME, 60000);
|
||||
|
||||
if (_slaughterProgress > 0 && _slaughterProgress < 4)
|
||||
{
|
||||
events.ScheduleEvent(EVENT_FORCE_SLAUGHTER_EVENT, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
void WriteSaveDataMore(std::ostringstream& data) override
|
||||
{
|
||||
data << _baronRunProgress << ' '
|
||||
<< _baronRunTime << ' '
|
||||
<< _zigguratState1 << ' '
|
||||
<< _zigguratState2 << ' '
|
||||
<< _zigguratState3 << ' '
|
||||
<< _slaughterProgress << ' '
|
||||
<< _postboxesOpened;
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 type) const override
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "SpellAuras.h"
|
||||
|
||||
#define DataHeader "STR"
|
||||
#define StratholmeScriptName "instance_stratholme"
|
||||
|
||||
enum DataTypes
|
||||
|
||||
Reference in New Issue
Block a user