mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-18 11:25:42 +00:00
feat(Core/Instance): Implement helpers to easily save/retrieve persist… (#15113)
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
||||
{
|
||||
SetHeaders(DataHeader);
|
||||
SetBossNumber(MAX_ENCOUNTER);
|
||||
SetPersistentDataCount(MAX_DATA_INDEXES);
|
||||
LoadDoorData(doorData);
|
||||
|
||||
_passageEncounter = 0;
|
||||
@@ -149,7 +150,8 @@ public:
|
||||
DoSummonAction(creature, player);
|
||||
}
|
||||
}
|
||||
_passageEncounter++;
|
||||
|
||||
StorePersistentData(DATA_INDEX_PASSAGE_ENCOUNTER, _passageEncounter++);
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
@@ -186,16 +188,17 @@ public:
|
||||
if (Creature* creature = instance->GetCreature(_pathaleonGUID))
|
||||
creature->AI()->DoAction(1);
|
||||
}
|
||||
_passageEncounter++;
|
||||
|
||||
StorePersistentData(DATA_INDEX_PASSAGE_ENCOUNTER, _passageEncounter++);
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ReadSaveDataMore(std::istringstream& data) override
|
||||
void ReadSaveDataMore(std::istringstream& /*data*/) override
|
||||
{
|
||||
data >> _passageEncounter;
|
||||
_passageEncounter = GetPersistentData(DATA_INDEX_PASSAGE_ENCOUNTER);
|
||||
|
||||
if (_passageEncounter == ENCOUNTER_PASSAGE_DONE)
|
||||
{
|
||||
@@ -203,11 +206,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void WriteSaveDataMore(std::ostringstream& data) override
|
||||
{
|
||||
data << _passageEncounter;
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectGuid _pathaleonGUID;
|
||||
uint32 _passageTimer;
|
||||
|
||||
@@ -70,6 +70,12 @@ enum SpellIds
|
||||
SPELL_TELEPORT_VISUAL = 35517
|
||||
};
|
||||
|
||||
enum DataIndex
|
||||
{
|
||||
DATA_INDEX_PASSAGE_ENCOUNTER = 0,
|
||||
MAX_DATA_INDEXES
|
||||
};
|
||||
|
||||
template <class AI, class T>
|
||||
inline AI* GetMechanarAI(T* obj)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user