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
@@ -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())