mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 13:16:23 +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:
@@ -21,6 +21,8 @@
|
||||
#include "CreatureAIImpl.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
#define DataHeader "GD"
|
||||
|
||||
#define GundrakScriptName "instance_gundrak"
|
||||
|
||||
enum Data
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
{
|
||||
instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
}
|
||||
|
||||
ObjectGuid _sladRanAltarGUID;
|
||||
@@ -197,34 +198,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "G D " << GetBossSaveData();
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void Load(const char* in) override
|
||||
{
|
||||
if (!in)
|
||||
return;
|
||||
|
||||
char dataHead1, dataHead2;
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> dataHead1 >> dataHead2;
|
||||
if (dataHead1 == 'G' && dataHead2 == 'D')
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState > SPECIAL)
|
||||
tmpState = NOT_STARTED;
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Update(uint32 diff) override
|
||||
{
|
||||
if (!_activateTimer)
|
||||
|
||||
Reference in New Issue
Block a user