mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +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
|
|
@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
|
|||
`version` varchar(120) default NULL,
|
||||
`creature_ai_version` varchar(120) default NULL,
|
||||
`cache_id` int(10) default '0',
|
||||
`required_11968_01_mangos_creature_linking_template` bit(1) default NULL
|
||||
`required_11985_01_mangos_gameobject_template_scripts` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -2133,6 +2133,40 @@ LOCK TABLES `gameobject_template` WRITE;
|
|||
/*!40000 ALTER TABLE `gameobject_template` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `gameobject_template_scripts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `gameobject_template_scripts`;
|
||||
CREATE TABLE `gameobject_template_scripts` (
|
||||
`id` mediumint(8) unsigned NOT NULL default '0',
|
||||
`delay` int(10) unsigned NOT NULL default '0',
|
||||
`command` mediumint(8) unsigned NOT NULL default '0',
|
||||
`datalong` mediumint(8) unsigned NOT NULL default '0',
|
||||
`datalong2` int(10) unsigned NOT NULL default '0',
|
||||
`buddy_entry` int(10) unsigned NOT NULL default '0',
|
||||
`search_radius` int(10) unsigned NOT NULL default '0',
|
||||
`data_flags` tinyint(3) unsigned NOT NULL default '0',
|
||||
`dataint` int(11) NOT NULL default '0',
|
||||
`dataint2` int(11) NOT NULL default '0',
|
||||
`dataint3` int(11) NOT NULL default '0',
|
||||
`dataint4` int(11) NOT NULL default '0',
|
||||
`x` float NOT NULL default '0',
|
||||
`y` float NOT NULL default '0',
|
||||
`z` float NOT NULL default '0',
|
||||
`o` float NOT NULL default '0',
|
||||
`comments` varchar(255) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `gameobject_template_scripts`
|
||||
--
|
||||
|
||||
LOCK TABLES `gameobject_template_scripts` WRITE;
|
||||
/*!40000 ALTER TABLE `gameobject_template_scripts` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `gameobject_template_scripts` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `gossip_menu`
|
||||
--
|
||||
|
|
|
|||
35
sql/updates/11985_01_mangos_gameobject_template_scripts.sql
Normal file
35
sql/updates/11985_01_mangos_gameobject_template_scripts.sql
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_11968_01_mangos_creature_linking_template required_11985_01_mangos_gameobject_template_scripts bit;
|
||||
|
||||
--
|
||||
-- Table structure for table `gameobject_template_scripts`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `gameobject_template_scripts`;
|
||||
CREATE TABLE `gameobject_template_scripts` (
|
||||
`id` mediumint(8) unsigned NOT NULL default '0',
|
||||
`delay` int(10) unsigned NOT NULL default '0',
|
||||
`command` mediumint(8) unsigned NOT NULL default '0',
|
||||
`datalong` mediumint(8) unsigned NOT NULL default '0',
|
||||
`datalong2` int(10) unsigned NOT NULL default '0',
|
||||
`buddy_entry` int(10) unsigned NOT NULL default '0',
|
||||
`search_radius` int(10) unsigned NOT NULL default '0',
|
||||
`data_flags` tinyint(3) unsigned NOT NULL default '0',
|
||||
`dataint` int(11) NOT NULL default '0',
|
||||
`dataint2` int(11) NOT NULL default '0',
|
||||
`dataint3` int(11) NOT NULL default '0',
|
||||
`dataint4` int(11) NOT NULL default '0',
|
||||
`x` float NOT NULL default '0',
|
||||
`y` float NOT NULL default '0',
|
||||
`z` float NOT NULL default '0',
|
||||
`o` float NOT NULL default '0',
|
||||
`comments` varchar(255) NOT NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Dumping data for table `gameobject_template_scripts`
|
||||
--
|
||||
|
||||
LOCK TABLES `gameobject_template_scripts` WRITE;
|
||||
/*!40000 ALTER TABLE `gameobject_template_scripts` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `gameobject_template_scripts` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
|
@ -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