Fix Q7363_Stave_of_the_ANcient_P1_SOlenor_the_slayer (#112)
* Q7636_P1_FIX_Solenor_the_slayer * Fix pPlayer->GetGossipTextId(pCreature) Add Cache support for default npc gossip texts set in DB (grab the 1st gossip menu text by min id in the cache)
This commit is contained in:
parent
01de314569
commit
76321d1b26
@ -9071,6 +9071,58 @@ void ObjectMgr::LoadGossipMenus()
|
||||
{
|
||||
sLog.outErrorDb("Table `db_scripts [type = %d]` contains unused script, id %u.", DBS_ON_GOSSIP, *itr);
|
||||
}
|
||||
|
||||
LoadCoreSideGossipTextIdCache();
|
||||
}
|
||||
|
||||
/*
|
||||
This method will send the correct return when the code calls
|
||||
pPlayer->GetGossipTextId(pCreature)
|
||||
Otherwise teh default
|
||||
*/
|
||||
void ObjectMgr::LoadCoreSideGossipTextIdCache()
|
||||
{
|
||||
m_mCacheNpcTextIdMap.clear();
|
||||
|
||||
QueryResult* result = WorldDatabase.Query("SELECT `ct`.`Entry`, "
|
||||
"`gm`.`text_id` "
|
||||
"FROM `creature_template` `ct` "
|
||||
"LEFT JOIN ("
|
||||
" SELECT "
|
||||
" `entry`, MIN(`text_id`) as `text_id` "
|
||||
" FROM `gossip_menu` "
|
||||
" GROUP BY `entry` "
|
||||
") As gm on `ct`.`GossipMenuId` = `gm`.`entry` "
|
||||
"WHERE `ct`.GossipMenuId <> 0 "
|
||||
"ORDER BY `ct`.`Entry` ASC, `gm`.`entry` ASC, `gm`.`text_id` ASC"
|
||||
);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
BarGoLink bar(1);
|
||||
bar.step();
|
||||
sLog.outErrorDb(">> Loaded core side gossip text id cache, NO DATA FOUND !");
|
||||
sLog.outString();
|
||||
return;
|
||||
}
|
||||
|
||||
BarGoLink bar(result->GetRowCount());
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
Field* fields = result->Fetch();
|
||||
m_mCacheNpcTextIdMap[fields[0].GetUInt32()] = fields[1].GetUInt32();
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
sLog.outString(">> Loaded %u core side gossip text id in cache", count);
|
||||
sLog.outString();
|
||||
|
||||
}
|
||||
|
||||
void ObjectMgr::AddVendorItem(uint32 entry, uint32 item, uint32 maxcount, uint32 incrtime)
|
||||
|
@ -731,6 +731,8 @@ class ObjectMgr
|
||||
void LoadGameTele();
|
||||
|
||||
void LoadGossipMenus();
|
||||
void LoadCoreSideGossipTextIdCache();
|
||||
|
||||
|
||||
void LoadVendorTemplates();
|
||||
void LoadVendors()
|
||||
@ -1086,7 +1088,7 @@ class ObjectMgr
|
||||
bool AddGameTele(GameTele& data);
|
||||
bool DeleteGameTele(const std::string& name);
|
||||
|
||||
uint32 GetNpcGossip(uint32 entry) const
|
||||
uint32 GetNpcGossipTextId(uint32 entry) const
|
||||
{
|
||||
CacheNpcTextIdMap::const_iterator iter = m_mCacheNpcTextIdMap.find(entry);
|
||||
if (iter == m_mCacheNpcTextIdMap.end())
|
||||
|
@ -13803,7 +13803,7 @@ uint32 Player::GetGossipTextId(WorldObject* pSource)
|
||||
return DEFAULT_GOSSIP_MESSAGE;
|
||||
}
|
||||
|
||||
if (uint32 pos = sObjectMgr.GetNpcGossip(((Creature*)pSource)->GetGUIDLow()))
|
||||
if (uint32 pos = sObjectMgr.GetNpcGossipTextId(((Creature*)pSource)->GetEntry()))
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8e937b8dfedc563c2ac4c1ebcda9ca2f7d25ce95
|
||||
Subproject commit cda75d0c980e7e6e864a6efb24bb235cf63701d2
|
Loading…
x
Reference in New Issue
Block a user