Added support for item set names in case where item does not exist in item_template (like gladiator gear)
--HG-- branch : trunk
This commit is contained in:
@@ -1003,40 +1003,25 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data)
|
||||
recv_data.read_skip<uint64>(); // guid
|
||||
|
||||
sLog.outDebug("WORLD: CMSG_ITEM_NAME_QUERY %u", itemid);
|
||||
ItemPrototype const *pProto = objmgr.GetItemPrototype(itemid);
|
||||
if (pProto)
|
||||
ItemSetNameEntry const *pName = objmgr.GetItemSetNameEntry(itemid);
|
||||
if (pName)
|
||||
{
|
||||
std::string Name;
|
||||
Name = pProto->Name1;
|
||||
|
||||
std::string Name = pName->name;
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
{
|
||||
ItemLocale const *il = objmgr.GetItemLocale(pProto->ItemId);
|
||||
if (il)
|
||||
{
|
||||
if (il->Name.size() > size_t(loc_idx) && !il->Name[loc_idx].empty())
|
||||
Name = il->Name[loc_idx];
|
||||
}
|
||||
ItemSetNameLocale const *isnl = objmgr.GetItemSetNameLocale(itemid);
|
||||
if (isnl)
|
||||
if (isnl->Name.size() > size_t(loc_idx) && !isnl->Name[loc_idx].empty())
|
||||
Name = isnl->Name[loc_idx];
|
||||
}
|
||||
// guess size
|
||||
WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+10));
|
||||
data << uint32(pProto->ItemId);
|
||||
|
||||
WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4));
|
||||
data << uint32(itemid);
|
||||
data << Name;
|
||||
data << uint32(pProto->InventoryType);
|
||||
data << uint32(pName->InventoryType);
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
// This is a BS check, there are lots of items listed in Item.dbc that do not even exist on official -- so we can NEVER get the data for them.
|
||||
// If you *really* want to spam your error log -- uncomment this.
|
||||
/* else
|
||||
{
|
||||
// listed in dbc or not expected to exist unknown item
|
||||
if (sItemStore.LookupEntry(itemid))
|
||||
sLog.outErrorDb("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (item listed in Item.dbc but not exist in DB)", itemid);
|
||||
else
|
||||
sLog.outError("WORLD: CMSG_ITEM_NAME_QUERY for item %u failed (unknown item, not listed in Item.dbc)", itemid);
|
||||
} */
|
||||
}
|
||||
|
||||
void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data)
|
||||
|
||||
Reference in New Issue
Block a user