mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-15 10:00:28 +00:00
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:
@@ -25,3 +25,11 @@ void ScriptMgr::OnAfterDatabasesLoaded(uint32 updateFlags)
|
||||
script->OnAfterDatabasesLoaded(updateFlags);
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnAfterDatabaseLoadCreatureTemplates(std::vector<CreatureTemplate*> creatureTemplates)
|
||||
{
|
||||
ExecuteScript<DatabaseScript>([&](DatabaseScript* script)
|
||||
{
|
||||
script->OnAfterDatabaseLoadCreatureTemplates(creatureTemplates);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user