feat(Core/Hooks): Add OnAfterDatabaseLoadCreatureTemplates hook (#17621)

* Add OnAfterDatabaseLoadCreatureTemplates hook
- fix issue where the fast template cache was not updated correctly after a CS reload of a single creature template

* Parameter naming tweak to reduce confusion.

* Refactor to streamline fastcache creation, remove threading concerns

* Remove unneeded resize when loading creature templates

* Update fast cache resizing to highest-performing option
This commit is contained in:
KJack
2023-10-31 05:58:45 -04:00
committed by GitHub
parent 52d37a927d
commit 751ffc7c70
5 changed files with 51 additions and 18 deletions

View File

@@ -2024,7 +2024,20 @@ public:
[[nodiscard]] bool IsDatabaseBound() const override { return false; }
/**
* @brief Called after all databases are loaded
*
* @param updateFlags Update flags from the loader
*/
virtual void OnAfterDatabasesLoaded(uint32 /*updateFlags*/) { }
/**
* @brief Called after all creature template data has been loaded from the database. This hook could be called multiple times, not just at server startup.
*
* @param creatureTemplates Pointer to a modifiable vector of creature templates. Indexed by Entry ID.
*/
virtual void OnAfterDatabaseLoadCreatureTemplates(std::vector<CreatureTemplate*> /*creatureTemplates*/) { }
};
class WorldObjectScript : public ScriptObject
@@ -2671,6 +2684,7 @@ public: /* CommandSC */
public: /* DatabaseScript */
void OnAfterDatabasesLoaded(uint32 updateFlags);
void OnAfterDatabaseLoadCreatureTemplates(std::vector<CreatureTemplate*> creatureTemplateStore);
public: /* WorldObjectScript */