AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DatabaseScript Class Reference

#include "DatabaseScript.h"

Inheritance diagram for DatabaseScript:
ScriptObject

Public Member Functions

bool IsDatabaseBound () const override
 
virtual void OnAfterDatabasesLoaded (uint32)
 Called after all databases are loaded.
 
virtual void OnAfterDatabaseLoadCreatureTemplates (std::vector< CreatureTemplate * >)
 Called after all creature template data has been loaded from the database. This hook could be called multiple times, not just at server startup.
 
virtual bool OnModuleDatabasesLoading ()
 Called once the core databases are up, so a module can open a database of its own. Runs before the rest of the world loads, unlike OnAfterDatabasesLoaded which reports the finished core load.
 
virtual void OnModuleDatabasesKeepAlive ()
 Called on the world's keep-alive tick, alongside the core pools being pinged.
 
virtual void OnModuleDatabasesClosing ()
 Called after the core databases are closed, so a module can close its own.
 
virtual void OnDatabaseWarnAboutSyncQueries (bool)
 Called when the core turns its synchronous-query warning on or off.
 
virtual void OnDatabaseGetDBRevision (std::map< std::string, std::string > &)
 Called by .server info to collect the revision of a module-owned database.
 
- Public Member Functions inherited from ScriptObject
virtual bool isAfterLoadScript () const
 
virtual void checkValidity ()
 
std::string const & GetName () const
 
uint16 GetTotalAvailableHooks ()
 

Protected Member Functions

 DatabaseScript (char const *name, std::vector< uint16 > enabledHooks=std::vector< uint16 >())
 
- Protected Member Functions inherited from ScriptObject
 ScriptObject (char const *name, uint16 totalAvailableHooks=0)
 
virtual ~ScriptObject ()=default
 

Detailed Description

Constructor & Destructor Documentation

◆ DatabaseScript()

DatabaseScript::DatabaseScript ( char const *  name,
std::vector< uint16 >  enabledHooks = std::vector<uint16>() 
)
protected
59{
60 // If empty - enable all available hooks.
61 if (enabledHooks.empty())
62 for (uint16 i = 0; i < DATABASEHOOK_END; ++i)
63 enabledHooks.emplace_back(i);
64
65 ScriptRegistry<DatabaseScript>::AddScript(this, std::move(enabledHooks));
66}
@ DATABASEHOOK_END
Definition DatabaseScript.h:35
std::uint16_t uint16
Definition Define.h:108
Definition ScriptObject.h:42
static void AddScript(TScript *const script, std::vector< uint16 > enabledHooks={})
Definition ScriptMgr.h:795

References ScriptRegistry< TScript >::AddScript(), and DATABASEHOOK_END.

Member Function Documentation

◆ IsDatabaseBound()

bool DatabaseScript::IsDatabaseBound ( ) const
inlineoverridevirtual

Reimplemented from ScriptObject.

46{ return false; }

◆ OnAfterDatabaseLoadCreatureTemplates()

virtual void DatabaseScript::OnAfterDatabaseLoadCreatureTemplates ( std::vector< CreatureTemplate * >  )
inlinevirtual

Called after all creature template data has been loaded from the database. This hook could be called multiple times, not just at server startup.

Parameters
creatureTemplatesPointer to a modifiable vector of creature templates. Indexed by Entry ID.
60{ }

Referenced by ScriptMgr::OnAfterDatabaseLoadCreatureTemplates().

◆ OnAfterDatabasesLoaded()

virtual void DatabaseScript::OnAfterDatabasesLoaded ( uint32  )
inlinevirtual

Called after all databases are loaded.

Parameters
updateFlagsUpdate flags from the loader
53{ }

Referenced by ScriptMgr::OnAfterDatabasesLoaded().

◆ OnDatabaseGetDBRevision()

virtual void DatabaseScript::OnDatabaseGetDBRevision ( std::map< std::string, std::string > &  )
inlinevirtual

Called by .server info to collect the revision of a module-owned database.

Parameters
revisionsRevision string to report, keyed by module name
93{ }

Referenced by ScriptMgr::OnDatabaseGetDBRevision().

◆ OnDatabaseWarnAboutSyncQueries()

virtual void DatabaseScript::OnDatabaseWarnAboutSyncQueries ( bool  )
inlinevirtual

Called when the core turns its synchronous-query warning on or off.

Parameters
applyTrue when the warning is being enabled
86{ }

Referenced by ScriptMgr::OnDatabaseWarnAboutSyncQueries().

◆ OnModuleDatabasesClosing()

virtual void DatabaseScript::OnModuleDatabasesClosing ( )
inlinevirtual

Called after the core databases are closed, so a module can close its own.

79{ }

Referenced by ScriptMgr::OnModuleDatabasesClosing().

◆ OnModuleDatabasesKeepAlive()

virtual void DatabaseScript::OnModuleDatabasesKeepAlive ( )
inlinevirtual

Called on the world's keep-alive tick, alongside the core pools being pinged.

74{ }

Referenced by ScriptMgr::OnModuleDatabasesKeepAlive().

◆ OnModuleDatabasesLoading()

virtual bool DatabaseScript::OnModuleDatabasesLoading ( )
inlinevirtual

Called once the core databases are up, so a module can open a database of its own. Runs before the rest of the world loads, unlike OnAfterDatabasesLoaded which reports the finished core load.

Returns
false to abort startup, e.g. when the module's own database failed to open
69{ return true; }

Referenced by ScriptMgr::OnModuleDatabasesLoading().


The documentation for this class was generated from the following files: