Core/Gossip: Ditch gossip_scripts as it is no longer used. SAI is a better option

This commit is contained in:
Nay
2011-06-19 15:24:59 +01:00
parent 44ac6fd375
commit 62908812cb
9 changed files with 12 additions and 118 deletions
+1 -33
View File
@@ -597,7 +597,7 @@ INSERT INTO `command` VALUES
('reload all achievement',3,'Syntax: .reload all achievement\r\n\r\nReload achievement_reward, achievement_criteria_data tables.'),
('reload all area',3,'Syntax: .reload all area\r\n\r\nReload areatrigger_teleport, areatrigger_tavern, game_graveyard_zone tables.'),
('reload all eventai',3,'Syntax: .reload all eventai\r\n\r\nReload creature_ai_scripts, creature_ai_summons, creature_ai_texts tables.'),
('reload all gossips',3,'Syntax: .reload all gossips\nReload gossip_menu, gossip_menu_option, gossip_scripts, points_of_interest tables.'),
('reload all gossips',3,'Syntax: .reload all gossips\nReload gossip_menu, gossip_menu_option, points_of_interest tables.'),
('reload all item',3,'Syntax: .reload all item\nReload page_text, item_enchantment_table tables.'),
('reload all locales',3,'Syntax: .reload all locales\r\n\r\nReload all `locales_*` tables with reload support added and that can be _safe_ reloaded.'),
('reload all loot',3,'Syntax: .reload all loot\r\n\r\nReload all `*_loot_template` tables. This can be slow operation with lags for server run.'),
@@ -632,7 +632,6 @@ INSERT INTO `command` VALUES
('reload game_tele',3,'Syntax: .reload game_tele\nReload game_tele table.'),
('reload gossip_menu',3,'Syntax: .reload gossip_menu\nReload gossip_menu table.'),
('reload gossip_menu_option',3,'Syntax: .reload gossip_menu_option\nReload gossip_menu_option table.'),
('reload gossip_scripts',3,'Syntax: .reload gossip_scripts\nReload gossip_scripts table.'),
('reload gm_tickets',3,'Syntax: .reload gm_tickets\nReload gm_tickets table.'),
('reload item_enchantment_template',3,'Syntax: .reload item_enchantment_template\nReload item_enchantment_template table.'),
('reload item_loot_template',3,'Syntax: .reload item_loot_template\nReload item_loot_template table.'),
@@ -2725,36 +2724,6 @@ LOCK TABLES `gameobject_template` WRITE;
/*!40000 ALTER TABLE `gameobject_template` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `gossip_scripts`
--
DROP TABLE IF EXISTS `gossip_scripts`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `gossip_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',
`dataint` 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'
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `gossip_scripts`
--
LOCK TABLES `gossip_scripts` WRITE;
/*!40000 ALTER TABLE `gossip_scripts` DISABLE KEYS */;
/*!40000 ALTER TABLE `gossip_scripts` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `gossip_menu`
--
@@ -2794,7 +2763,6 @@ CREATE TABLE gossip_menu_option (
npc_option_npcflag int(10) unsigned NOT NULL default '0',
action_menu_id mediumint(8) unsigned NOT NULL default '0',
action_poi_id mediumint(8) unsigned NOT NULL default '0',
action_script_id mediumint(8) unsigned NOT NULL default '0',
box_coded tinyint(3) unsigned NOT NULL default '0',
box_money int(11) unsigned NOT NULL default '0',
box_text text,
@@ -0,0 +1,4 @@
UPDATE `command` SET `help` = 'Syntax: .reload all gossips\nReload gossip_menu, gossip_menu_option, gossip_scripts, points_of_interest tables.' WHERE `name`='reload all gossips';
DELETE FROM `command` WHERE `name` = 'reload gossip_scripts';
DROP TABLE IF EXISTS `gossip_scripts`;
ALTER TABLE `gossip_menu_option` DROP `action_script_id`;
@@ -68,13 +68,12 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me
menuItem.BoxMoney = boxMoney;
}
void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi, uint32 gossipActionScript)
void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi)
{
GossipMenuItemData& itemData = _menuItemData[menuItemId];
itemData.GossipActionMenuId = gossipActionMenuId;
itemData.GossipActionPoi = gossipActionPoi;
itemData.GossipActionScript = gossipActionScript;
}
uint32 GossipMenu::GetMenuItemSender(uint32 menuItemId) const
@@ -143,7 +143,6 @@ struct GossipMenuItemData
{
uint32 GossipActionMenuId; // MenuId of the gossip triggered by this action
uint32 GossipActionPoi;
uint32 GossipActionScript;
};
// need an ordered container
@@ -168,7 +167,7 @@ class GossipMenu
void SetMenuId(uint32 menu_id) { _menuId = menu_id; }
uint32 GetMenuId() const { return _menuId; }
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi, uint32 gossipActionScript);
void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi);
uint32 GetMenuItemCount() const
{
+1 -8
View File
@@ -14096,7 +14096,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
}
menu->GetGossipMenu().AddMenuItem(itr->second.OptionIndex, itr->second.OptionIcon, strOptionText, 0, itr->second.OptionType, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded);
menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId, itr->second.ActionScriptId);
menu->GetGossipMenu().AddGossipMenuItemData(itr->second.OptionIndex, itr->second.ActionMenuId, itr->second.ActionPoiId);
}
}
}
@@ -14185,13 +14185,6 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
if (menuItemData->GossipActionPoi)
PlayerTalkClass->SendPointOfInterest(menuItemData->GossipActionPoi);
if (menuItemData->GossipActionScript)
{
if (source->GetTypeId() == TYPEID_UNIT)
GetMap()->ScriptsStart(sGossipScripts, menuItemData->GossipActionScript, this, source);
else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
GetMap()->ScriptsStart(sGossipScripts, menuItemData->GossipActionScript, source, this);
}
break;
}
case GOSSIP_OPTION_OUTDOORPVP:
+4 -44
View File
@@ -51,7 +51,6 @@ ScriptMapMap sQuestStartScripts;
ScriptMapMap sSpellScripts;
ScriptMapMap sGameObjectScripts;
ScriptMapMap sEventScripts;
ScriptMapMap sGossipScripts;
ScriptMapMap sWaypointScripts;
std::string GetScriptsTableNameByType(ScriptsType type)
@@ -65,7 +64,6 @@ std::string GetScriptsTableNameByType(ScriptsType type)
case SCRIPTS_GAMEOBJECT: res = "gameobject_scripts"; break;
case SCRIPTS_EVENT: res = "event_scripts"; break;
case SCRIPTS_WAYPOINT: res = "waypoint_scripts"; break;
case SCRIPTS_GOSSIP: res = "gossip_scripts"; break;
default: break;
}
return res;
@@ -82,7 +80,6 @@ ScriptMapMap* GetScriptsMapByType(ScriptsType type)
case SCRIPTS_GAMEOBJECT: res = &sGameObjectScripts; break;
case SCRIPTS_EVENT: res = &sEventScripts; break;
case SCRIPTS_WAYPOINT: res = &sWaypointScripts; break;
case SCRIPTS_GOSSIP: res = &sGossipScripts; break;
default: break;
}
return res;
@@ -5091,13 +5088,6 @@ void ObjectMgr::ValidateSpellScripts()
sLog->outString();
}
void ObjectMgr::LoadGossipScripts()
{
LoadScripts(SCRIPTS_GOSSIP);
// checks are done in LoadGossipMenuItems
}
void ObjectMgr::LoadPageTexts()
{
uint32 oldMSTime = getMSTime();
@@ -8515,7 +8505,7 @@ void ObjectMgr::LoadGossipMenuItems()
QueryResult result = WorldDatabase.Query(
"SELECT menu_id, id, option_icon, option_text, option_id, npc_option_npcflag, "
"action_menu_id, action_poi_id, action_script_id, box_coded, box_money, box_text "
"action_menu_id, action_poi_id, box_coded, box_money, box_text "
"FROM gossip_menu_option ORDER BY menu_id, id");
if (!result)
@@ -8527,14 +8517,8 @@ void ObjectMgr::LoadGossipMenuItems()
uint32 count = 0;
std::set<uint32> gossipScriptSet;
for (ScriptMapMap::const_iterator itr = sGossipScripts.begin(); itr != sGossipScripts.end(); ++itr)
gossipScriptSet.insert(itr->first);
do
{
Field* fields = result->Fetch();
GossipMenuItems gMenuItem;
@@ -8547,10 +8531,9 @@ void ObjectMgr::LoadGossipMenuItems()
gMenuItem.OptionNpcflag = fields[5].GetUInt32();
gMenuItem.ActionMenuId = fields[6].GetUInt32();
gMenuItem.ActionPoiId = fields[7].GetUInt32();
gMenuItem.ActionScriptId = fields[8].GetUInt32();
gMenuItem.BoxCoded = fields[9].GetBool();
gMenuItem.BoxMoney = fields[10].GetUInt32();
gMenuItem.BoxText = fields[11].GetString();
gMenuItem.BoxCoded = fields[8].GetBool();
gMenuItem.BoxMoney = fields[9].GetUInt32();
gMenuItem.BoxText = fields[10].GetString();
if (gMenuItem.OptionIcon >= GOSSIP_ICON_MAX)
{
@@ -8567,34 +8550,11 @@ void ObjectMgr::LoadGossipMenuItems()
gMenuItem.ActionPoiId = 0;
}
if (gMenuItem.ActionScriptId)
{
if (gMenuItem.OptionType != GOSSIP_OPTION_GOSSIP)
{
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u but option_id is not GOSSIP_OPTION_GOSSIP, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionScriptId);
continue;
}
if (sGossipScripts.find(gMenuItem.ActionScriptId) == sGossipScripts.end())
{
sLog->outErrorDb("Table gossip_menu_option for menu %u, id %u have action_script_id %u that does not exist in `gossip_scripts`, ignoring", gMenuItem.MenuId, gMenuItem.OptionIndex, gMenuItem.ActionScriptId);
continue;
}
gossipScriptSet.erase(gMenuItem.ActionScriptId);
}
m_mGossipMenuItemsMap.insert(GossipMenuItemsMap::value_type(gMenuItem.MenuId, gMenuItem));
++count;
}
while (result->NextRow());
if (!gossipScriptSet.empty())
{
for (std::set<uint32>::const_iterator itr = gossipScriptSet.begin(); itr != gossipScriptSet.end(); ++itr)
sLog->outErrorDb("Table `gossip_scripts` contain unused script, id %u.", *itr);
}
sLog->outString(">> Loaded %u gossip_menu_option entries in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
-4
View File
@@ -94,7 +94,6 @@ enum ScriptsType
SCRIPTS_GAMEOBJECT,
SCRIPTS_EVENT,
SCRIPTS_WAYPOINT,
SCRIPTS_GOSSIP,
SCRIPTS_LAST
};
@@ -329,7 +328,6 @@ extern ScriptMapMap sQuestStartScripts;
extern ScriptMapMap sSpellScripts;
extern ScriptMapMap sGameObjectScripts;
extern ScriptMapMap sEventScripts;
extern ScriptMapMap sGossipScripts;
extern ScriptMapMap sWaypointScripts;
std::string GetScriptsTableNameByType(ScriptsType type);
@@ -483,7 +481,6 @@ struct GossipMenuItems
uint32 OptionNpcflag;
uint32 ActionMenuId;
uint32 ActionPoiId;
uint32 ActionScriptId;
bool BoxCoded;
uint32 BoxMoney;
std::string BoxText;
@@ -862,7 +859,6 @@ class ObjectMgr
void LoadQuestStartScripts();
void LoadEventScripts();
void LoadSpellScripts();
void LoadGossipScripts();
void LoadWaypointScripts();
void LoadSpellScriptNames();
-2
View File
@@ -1538,8 +1538,6 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading GameTeleports...");
sObjectMgr->LoadGameTele();
sObjectMgr->LoadGossipScripts(); // must be before gossip menu options
sLog->outString("Loading Gossip menu...");
sObjectMgr->LoadGossipMenu();
-23
View File
@@ -98,7 +98,6 @@ public:
{ "gm_tickets", SEC_ADMINISTRATOR, true, &HandleReloadGMTicketsCommand, "", NULL },
{ "gossip_menu", SEC_ADMINISTRATOR, true, &HandleReloadGossipMenuCommand, "", NULL },
{ "gossip_menu_option", SEC_ADMINISTRATOR, true, &HandleReloadGossipMenuOptionCommand, "", NULL },
{ "gossip_scripts", SEC_ADMINISTRATOR, true, &HandleReloadGossipScriptsCommand, "", NULL },
{ "item_enchantment_template", SEC_ADMINISTRATOR, true, &HandleReloadItemEnchantementsCommand, "", NULL },
{ "item_loot_template", SEC_ADMINISTRATOR, true, &HandleReloadLootTemplatesItemCommand, "", NULL },
{ "item_set_names", SEC_ADMINISTRATOR, true, &HandleReloadItemSetNamesCommand, "", NULL },
@@ -257,7 +256,6 @@ public:
sLog->outString("Re-Loading Scripts...");
HandleReloadGameObjectScriptsCommand(handler, "a");
HandleReloadGossipScriptsCommand(handler, "a");
HandleReloadEventScriptsCommand(handler, "a");
HandleReloadQuestEndScriptsCommand(handler, "a");
HandleReloadQuestStartScriptsCommand(handler, "a");
@@ -299,7 +297,6 @@ public:
HandleReloadGossipMenuCommand(handler, "a");
HandleReloadGossipMenuOptionCommand(handler, "a");
if(*args != 'a') // already reload from all_scripts
HandleReloadGossipScriptsCommand(handler, "a");
HandleReloadPointsOfInterestCommand(handler, "a");
return true;
}
@@ -919,26 +916,6 @@ public:
return true;
}
static bool HandleReloadGossipScriptsCommand(ChatHandler* handler, const char* args)
{
if (sScriptMgr->IsScriptScheduled())
{
handler->SendSysMessage("DB scripts used currently, please attempt reload later.");
handler->SetSentErrorMessage(true);
return false;
}
if (*args != 'a')
sLog->outString("Re-Loading Scripts from `gossip_scripts`...");
sObjectMgr->LoadGossipScripts();
if (*args != 'a')
handler->SendGlobalGMSysMessage("DB table `gossip_scripts` reloaded.");
return true;
}
static bool HandleReloadGameObjectScriptsCommand(ChatHandler* handler, const char* args)
{
if (sScriptMgr->IsScriptScheduled())