refactor(Core/GameObject): Move the GameObject state save handling to… (#18080)

* refactor(Core/GameObject): Move the GameObject state save handling to instance level

* Update GameObject.h

* remove leftover

* small improvements
This commit is contained in:
Andrew
2024-01-01 01:51:33 -03:00
committed by GitHub
parent a1212a52b0
commit a11434b24f
14 changed files with 100 additions and 192 deletions

View File

@@ -136,6 +136,7 @@ typedef std::pair<DoorInfoMap::const_iterator, DoorInfoMap::const_iterator> Door
typedef std::map<uint32 /*entry*/, MinionInfo> MinionInfoMap;
typedef std::map<uint32 /*type*/, ObjectGuid /*guid*/> ObjectGuidMap;
typedef std::map<uint32 /*entry*/, uint32 /*type*/> ObjectInfoMap;
typedef std::map<ObjectGuid::LowType /*spawnId*/, uint8 /*state*/> ObjectStateMap;
class InstanceScript : public ZoneScript
{
@@ -265,6 +266,12 @@ public:
// Allows executing code using all creatures registered in the instance script as minions
void DoForAllMinions(uint32 id, std::function<void(Creature*)> exec);
//
void StoreGameObjectState(ObjectGuid::LowType spawnId, uint8 state) { _objectStateMap[spawnId] = state; };
[[nodiscard]] uint8 GetStoredGameObjectState(ObjectGuid::LowType spawnId) const;
void LoadInstanceSavedGameobjectStateData();
TaskScheduler scheduler;
protected:
void SetHeaders(std::string const& dataHeaders);
@@ -311,6 +318,7 @@ private:
ObjectInfoMap _creatureInfo;
ObjectInfoMap _gameObjectInfo;
ObjectGuidMap _objectGuids;
ObjectStateMap _objectStateMap;
uint32 completedEncounters; // completed encounter mask, bit indexes are DungeonEncounter.dbc boss numbers, used for packets
std::unordered_set<uint32> _activatedAreaTriggers;
};