mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36: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:
@@ -26,7 +26,11 @@ public:
|
||||
|
||||
struct instance_the_eye_InstanceMapScript : public InstanceScript
|
||||
{
|
||||
instance_the_eye_InstanceMapScript(Map* map) : InstanceScript(map) {}
|
||||
instance_the_eye_InstanceMapScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(MAX_ENCOUNTER);
|
||||
}
|
||||
|
||||
ObjectGuid ThaladredTheDarkenerGUID;
|
||||
ObjectGuid LordSanguinarGUID;
|
||||
@@ -38,11 +42,6 @@ public:
|
||||
ObjectGuid KaelStateRightGUID;
|
||||
ObjectGuid KaelStateLeftGUID;
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
SetBossNumber(MAX_ENCOUNTER);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
@@ -110,49 +109,6 @@ public:
|
||||
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "E Y " << 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 == 'E' && dataHead2 == 'Y')
|
||||
{
|
||||
for (uint32 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;
|
||||
}
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const override
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SpellScript.h"
|
||||
|
||||
#define DataHeader "TE"
|
||||
|
||||
#define TheEyeScriptName "instance_the_eye"
|
||||
|
||||
enum EyeData
|
||||
|
||||
Reference in New Issue
Block a user