Core/InstanceScript: refactored load and save methods
This commit is contained in:
1 parent
9ab74b3910
commit
ef9b4aea5e
143 files changed
+487
-1860
No files matched your search
@@ -19,6 +19,7 @@
|
||||
#define DRAK_THARON_KEEP_H_
|
||||
|
||||
#define DrakTharonKeepScriptName "instance_drak_tharon_keep"
|
||||
#define DataHeader "DTK"
|
||||
|
||||
uint32 const EncounterCount = 4;
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ class instance_drak_tharon_keep : public InstanceMapScript
|
||||
{
|
||||
instance_drak_tharon_keep_InstanceScript(Map* map) : InstanceScript(map)
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(EncounterCount);
|
||||
|
||||
TrollgoreGUID = 0;
|
||||
@@ -159,49 +160,6 @@ class instance_drak_tharon_keep : public InstanceMapScript
|
||||
novos->AI()->DoAction(ACTION_CRYSTAL_HANDLER_DIED);
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "D K " << 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 == 'D' && dataHead2 == 'K')
|
||||
{
|
||||
for (uint32 i = 0; i < EncounterCount; ++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;
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64 TrollgoreGUID;
|
||||
uint64 NovosGUID;
|
||||
|
||||
Reference in new issue
Block a user