mirror of
https://github.com/mangosfour/server.git
synced 2025-12-20 16:37:04 +00:00
[11985] Implement support for go_template_scripts
Add a new table `gameobject_template_scripts` to start scripts for any type gameobject. Scripts in this table are triggered for all gameobjects on GameObject::Use Note: The table `gameobject_scripts` is expected to not be required very much longer, and will most likely be removed someday
This commit is contained in:
parent
4e6fbf5e9e
commit
010d29d1ed
9 changed files with 94 additions and 5 deletions
|
|
@ -961,6 +961,8 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
|
||||
bool scriptReturnValue = user->GetTypeId() == TYPEID_PLAYER && sScriptMgr.OnGameObjectUse((Player*)user, this);
|
||||
if (!scriptReturnValue)
|
||||
GetMap()->ScriptsStart(sGameObjectTemplateScripts, GetEntry(), spellCaster, this);
|
||||
|
||||
switch (GetGoType())
|
||||
{
|
||||
|
|
|
|||
|
|
@ -876,12 +876,13 @@ bool ChatHandler::HandleReloadGameObjectScriptsCommand(char* args)
|
|||
}
|
||||
|
||||
if (*args!='a')
|
||||
sLog.outString( "Re-Loading Scripts from `gameobject_scripts`...");
|
||||
sLog.outString( "Re-Loading Scripts from `gameobject_[template]_scripts`...");
|
||||
|
||||
sScriptMgr.LoadGameObjectScripts();
|
||||
sScriptMgr.LoadGameObjectTemplateScripts();
|
||||
|
||||
if (*args!='a')
|
||||
SendGlobalSysMessage("DB table `gameobject_scripts` reloaded.");
|
||||
SendGlobalSysMessage("DB table `gameobject_[template]_scripts` reloaded.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ ScriptMapMapName sQuestEndScripts;
|
|||
ScriptMapMapName sQuestStartScripts;
|
||||
ScriptMapMapName sSpellScripts;
|
||||
ScriptMapMapName sGameObjectScripts;
|
||||
ScriptMapMapName sGameObjectTemplateScripts;
|
||||
ScriptMapMapName sEventScripts;
|
||||
ScriptMapMapName sGossipScripts;
|
||||
ScriptMapMapName sCreatureMovementScripts;
|
||||
|
|
@ -598,6 +599,18 @@ void ScriptMgr::LoadGameObjectScripts()
|
|||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::LoadGameObjectTemplateScripts()
|
||||
{
|
||||
LoadScripts(sGameObjectTemplateScripts, "gameobject_template_scripts");
|
||||
|
||||
// check ids
|
||||
for (ScriptMapMap::const_iterator itr = sGameObjectTemplateScripts.second.begin(); itr != sGameObjectTemplateScripts.second.end(); ++itr)
|
||||
{
|
||||
if (!sObjectMgr.GetGameObjectInfo(itr->first))
|
||||
sLog.outErrorDb("Table `gameobject_template_scripts` has not existing gameobject (Entry: %u) as script id", itr->first);
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptMgr::LoadQuestEndScripts()
|
||||
{
|
||||
LoadScripts(sQuestEndScripts, "quest_end_scripts");
|
||||
|
|
@ -754,6 +767,7 @@ void ScriptMgr::LoadDbScriptStrings()
|
|||
CheckScriptTexts(sQuestStartScripts, ids);
|
||||
CheckScriptTexts(sSpellScripts, ids);
|
||||
CheckScriptTexts(sGameObjectScripts, ids);
|
||||
CheckScriptTexts(sGameObjectTemplateScripts, ids);
|
||||
CheckScriptTexts(sEventScripts, ids);
|
||||
CheckScriptTexts(sGossipScripts, ids);
|
||||
CheckScriptTexts(sCreatureMovementScripts, ids);
|
||||
|
|
|
|||
|
|
@ -388,6 +388,7 @@ extern ScriptMapMapName sQuestEndScripts;
|
|||
extern ScriptMapMapName sQuestStartScripts;
|
||||
extern ScriptMapMapName sSpellScripts;
|
||||
extern ScriptMapMapName sGameObjectScripts;
|
||||
extern ScriptMapMapName sGameObjectTemplateScripts;
|
||||
extern ScriptMapMapName sEventScripts;
|
||||
extern ScriptMapMapName sGossipScripts;
|
||||
extern ScriptMapMapName sCreatureMovementScripts;
|
||||
|
|
@ -407,6 +408,7 @@ class ScriptMgr
|
|||
~ScriptMgr();
|
||||
|
||||
void LoadGameObjectScripts();
|
||||
void LoadGameObjectTemplateScripts();
|
||||
void LoadQuestEndScripts();
|
||||
void LoadQuestStartScripts();
|
||||
void LoadEventScripts();
|
||||
|
|
|
|||
|
|
@ -1285,6 +1285,7 @@ void World::SetInitialWorldSettings()
|
|||
sScriptMgr.LoadQuestEndScripts(); // must be after load Creature/Gameobject(Template/Data) and QuestTemplate
|
||||
sScriptMgr.LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
sScriptMgr.LoadGameObjectScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
sScriptMgr.LoadGameObjectTemplateScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
sScriptMgr.LoadEventScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||
sLog.outString( ">>> Scripts loaded" );
|
||||
sLog.outString();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11984"
|
||||
#define REVISION_NR "11985"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#ifndef __REVISION_SQL_H__
|
||||
#define __REVISION_SQL_H__
|
||||
#define REVISION_DB_CHARACTERS "required_11785_02_characters_instance"
|
||||
#define REVISION_DB_MANGOS "required_11968_01_mangos_creature_linking_template"
|
||||
#define REVISION_DB_MANGOS "required_11985_01_mangos_gameobject_template_scripts"
|
||||
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
|
||||
#endif // __REVISION_SQL_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue