Jump to content

Removing unnecessary table `npc_gossip`


Guest virusav

Recommended Posts

Table `npc_gossip` is no longer needed, since All menus can be realized through the table `gossip_ ...`.

Patch:

diff --git a/sql/mangos.sql b/sql/mangos.sql
index 9750f81..03b5208 100644
--- a/sql/mangos.sql
+++ b/sql/mangos.sql
@@ -4018,26 +4018,6 @@ LOCK TABLES `milling_loot_template` WRITE;
UNLOCK TABLES;

--
--- Table structure for table `npc_gossip`
---
-
-DROP TABLE IF EXISTS `npc_gossip`;
-CREATE TABLE `npc_gossip` (
-  `npc_guid` int(10) unsigned NOT NULL default '0',
-  `textid` mediumint(8) unsigned NOT NULL default '0',
-  PRIMARY KEY  (`npc_guid`)
-) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-
---
--- Dumping data for table `npc_gossip`
---
-
-LOCK TABLES `npc_gossip` WRITE;
-/*!40000 ALTER TABLE `npc_gossip` DISABLE KEYS */;
-/*!40000 ALTER TABLE `npc_gossip` ENABLE KEYS */;
-UNLOCK TABLES;
-
---
-- Table structure for table `npc_spellclick_spells`
--

diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp
index 0f50875..fc21428 100644
--- a/src/game/Chat.cpp
+++ b/src/game/Chat.cpp
@@ -558,7 +558,6 @@ ChatCommand * ChatHandler::getCommandTable()
        { "mail_loot_template",          SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadLootTemplatesMailCommand,       "", NULL },
        { "mangos_string",               SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadMangosStringCommand,            "", NULL },
        { "milling_loot_template",       SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadLootTemplatesMillingCommand,    "", NULL },
-        { "npc_gossip",                  SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadNpcGossipCommand,               "", NULL },
        { "npc_text",                    SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadNpcTextCommand,                 "", NULL },
        { "npc_spellclick_spells",       SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadSpellClickSpellsCommand,        "", NULL },
        { "npc_trainer",                 SEC_ADMINISTRATOR, true,  &ChatHandler::HandleReloadNpcTrainerCommand,              "", NULL },
diff --git a/src/game/Chat.h b/src/game/Chat.h
index 7e72cdc..1b81c70 100644
--- a/src/game/Chat.h
+++ b/src/game/Chat.h
@@ -443,7 +443,6 @@ class MANGOS_DLL_SPEC ChatHandler
        bool HandleReloadLootTemplatesSpellCommand(char* args);
        bool HandleReloadMailLevelRewardCommand(char* args);
        bool HandleReloadMangosStringCommand(char* args);
-        bool HandleReloadNpcGossipCommand(char* args);
        bool HandleReloadNpcTextCommand(char* args);
        bool HandleReloadNpcTrainerCommand(char* args);
        bool HandleReloadNpcVendorCommand(char* args);
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 211709a..f530ab5 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -271,10 +271,8 @@ bool ChatHandler::HandleReloadAllLootCommand(char* /*args*/)
    return true;
}

-bool ChatHandler::HandleReloadAllNpcCommand(char* args)
+bool ChatHandler::HandleReloadAllNpcCommand(char* /*args*/)
{
-    if (*args!='a')                                         // will be reloaded from all_gossips
-        HandleReloadNpcGossipCommand((char*)"a");
    HandleReloadNpcTrainerCommand((char*)"a");
    HandleReloadNpcVendorCommand((char*)"a");
    HandleReloadPointsOfInterestCommand((char*)"a");
@@ -346,7 +344,6 @@ bool ChatHandler::HandleReloadAllGossipsCommand(char* args)
    if (*args!='a')                                         // already reload from all_scripts
        HandleReloadGossipScriptsCommand((char*)"a");
    HandleReloadGossipMenuCommand((char*)"a");
-    HandleReloadNpcGossipCommand((char*)"a");
    HandleReloadPointsOfInterestCommand((char*)"a");
    return true;
}
@@ -617,14 +614,6 @@ bool ChatHandler::HandleReloadMangosStringCommand(char* /*args*/)
    return true;
}

-bool ChatHandler::HandleReloadNpcGossipCommand(char* /*args*/)
-{
-    sLog.outString( "Re-Loading `npc_gossip` Table!" );
-    sObjectMgr.LoadNpcGossips();
-    SendGlobalSysMessage("DB table `npc_gossip` reloaded.");
-    return true;
-}
-
bool ChatHandler::HandleReloadNpcTextCommand(char* /*args*/)
{
    sLog.outString( "Re-Loading `npc_text` Table!" );
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index c966206..be6f0ff 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -8432,57 +8432,6 @@ void ObjectMgr::LoadVendorTemplates()
        sLog.outErrorDb("Table `npc_vendor_template` has vendor template %u not used by any vendors ", *vItr);
}

-void ObjectMgr::LoadNpcGossips()
-{
-
-    m_mCacheNpcTextIdMap.clear();
-
-    QueryResult* result = WorldDatabase.Query("SELECT npc_guid, textid FROM npc_gossip");
-    if( !result )
-    {
-        BarGoLink bar(1);
-
-        bar.step();
-
-        sLog.outString();
-        sLog.outErrorDb(">> Loaded `npc_gossip`, table is empty!");
-        return;
-    }
-
-    BarGoLink bar(result->GetRowCount());
-
-    uint32 count = 0;
-    uint32 guid,textid;
-    do
-    {
-        bar.step();
-
-        Field* fields = result->Fetch();
-
-        guid   = fields[0].GetUInt32();
-        textid = fields[1].GetUInt32();
-
-        if (!GetCreatureData(guid))
-        {
-            sLog.outErrorDb("Table `npc_gossip` have nonexistent creature (GUID: %u) entry, ignore. ",guid);
-            continue;
-        }
-        if (!GetGossipText(textid))
-        {
-            sLog.outErrorDb("Table `npc_gossip` for creature (GUID: %u) have wrong Textid (%u), ignore. ", guid, textid);
-            continue;
-        }
-
-        m_mCacheNpcTextIdMap[guid] = textid ;
-        ++count;
-
-    } while (result->NextRow());
-    delete result;
-
-    sLog.outString();
-    sLog.outString( ">> Loaded %d NpcTextId ", count );
-}
-
void ObjectMgr::LoadGossipMenu(std::set<uint32>& gossipScriptSet)
{
    m_mGossipMenusMap.clear();
diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h
index c569b80..912699b 100644
--- a/src/game/ObjectMgr.h
+++ b/src/game/ObjectMgr.h
@@ -704,8 +704,6 @@ class ObjectMgr
        void LoadWeatherZoneChances();
        void LoadGameTele();

-        void LoadNpcGossips();
-
        void LoadGossipMenus();

        void LoadVendorTemplates();
diff --git a/src/game/World.cpp b/src/game/World.cpp
index b59ba84..5e6fccd 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -1199,9 +1199,6 @@ void World::SetInitialWorldSettings()
    sLog.outString( "Loading Instance encounters data..." );  // must be after Creature loading
    sObjectMgr.LoadInstanceEncounters();

-    sLog.outString( "Loading Npc Text Id..." );
-    sObjectMgr.LoadNpcGossips();                            // must be after load Creature and LoadGossipText
-
    sLog.outString( "Loading Gossip scripts..." );
    sScriptMgr.LoadGossipScripts();                         // must be before gossip menu options

Request to delete a table:

DROP TABLE IF EXISTS `npc_gossip`;

Link to comment
Share on other sites

hmm, the patch is not entirely complete - in this form lot of junk will remain within mangos sources

But deleting is usually rather simple :)

refer to the variable m_mCacheNpcTextIdMap which must be removed along with others

Edit: Just talked with crackm from UDB.

He wishes the table to last a little longer until we drop it.

So my suggestion would be summer this year.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use