mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
Load npc_options at server startup, use cached data at creature gossip menu init.
Also new .reload table command added. Note: currently it will not affect creatures that have gossim memu created at command use moment.
This commit is contained in:
parent
e96fedc97c
commit
9e6390d88d
8 changed files with 77 additions and 31 deletions
|
|
@ -6882,6 +6882,51 @@ void ObjectMgr::LoadNpcTextId()
|
|||
sLog.outString( ">> Loaded %d NpcTextId ", count );
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadNpcOptions()
|
||||
{
|
||||
m_mCacheNpcOptionList.clear(); // For reload case
|
||||
|
||||
QueryResult *result = WorldDatabase.Query( "SELECT id,gossip_id,npcflag,icon,action,option_text FROM npc_option");
|
||||
if( !result )
|
||||
{
|
||||
barGoLink bar( 1 );
|
||||
|
||||
bar.step();
|
||||
|
||||
sLog.outString();
|
||||
sLog.outErrorDb(">> Loaded `npc_option`, table is empty!");
|
||||
return;
|
||||
}
|
||||
|
||||
barGoLink bar( result->GetRowCount() );
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
do
|
||||
{
|
||||
bar.step();
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
GossipOption go;
|
||||
go.Id = fields[0].GetUInt32();
|
||||
go.GossipId = fields[1].GetUInt32();
|
||||
go.NpcFlag = fields[2].GetUInt32();
|
||||
go.Icon = fields[3].GetUInt32();
|
||||
go.Action = fields[4].GetUInt32();
|
||||
go.OptionText = fields[5].GetCppString();
|
||||
|
||||
m_mCacheNpcOptionList.push_back(go);
|
||||
|
||||
++count;
|
||||
|
||||
} while (result->NextRow());
|
||||
delete result;
|
||||
|
||||
sLog.outString();
|
||||
sLog.outString( ">> Loaded %d npc_option entries", count );
|
||||
}
|
||||
|
||||
void ObjectMgr::AddVendorItem( uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 extendedcost )
|
||||
{
|
||||
VendorItemData& vList = m_mCacheVendorItemMap[entry];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue