Core/Opcodes:

Added Structure for:
* CMSG_GAMEOBJECT_QUERY
* CMSG_GAMEOBJ_REPORT_USE
* CMSG_GAMEOBJ_USE
* SMSG_GAMEOBJECT_QUERY_RESPONSE

Closes #13791
This commit is contained in:
Golrag
2014-12-28 16:01:53 +00:00
committed by Nayd
parent 62b2ccca13
commit 8fec200670
8 changed files with 203 additions and 72 deletions

View File

@@ -132,60 +132,39 @@ void WorldSession::HandleCreatureQuery(WorldPackets::Query::QueryCreature& packe
}
/// Only _static_ data is sent in this packet !!!
void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObject& packet)
{
uint32 entry;
recvData >> entry;
ObjectGuid guid;
recvData >> guid;
WorldPackets::Query::QueryGameObjectResponse response;
GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(packet.Entry);
const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry);
if (info)
response.Entry = packet.Entry;
if (gameObjectInfo)
{
std::string Name;
std::string IconName;
std::string CastBarCaption;
response.Allow = true;
WorldPackets::Query::GameObjectStats& stats = response.Stats;
Name = info->name;
IconName = info->IconName;
CastBarCaption = info->castBarCaption;
stats.CastBarCaption = gameObjectInfo->castBarCaption;
stats.DisplayID = gameObjectInfo->displayId;
stats.IconName = gameObjectInfo->IconName;
stats.Name[0] = gameObjectInfo->name;
int loc_idx = GetSessionDbLocaleIndex();
if (loc_idx >= 0)
{
if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(entry))
{
ObjectMgr::GetLocaleString(gl->Name, loc_idx, Name);
ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption);
}
}
TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150);
data << uint32(entry);
data << uint32(info->type);
data << uint32(info->displayId);
data << Name;
data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4
data << IconName; // 2.0.3, string. Icon name to use instead of default icon for go's (ex: "Attack" makes sword)
data << CastBarCaption; // 2.0.3, string. Text will appear in Cast Bar when using GO (ex: "Collecting")
data << info->unk1; // 2.0.3, string
data.append(info->raw.data, MAX_GAMEOBJECT_DATA);
data << float(info->size); // go size
for (uint32 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
data << uint32(info->questItems[i]); // itemId[6], quest drop
data << int32(info->unkInt32); // 4.x, unknown
SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE");
for (uint8 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; i++)
if (gameObjectInfo->questItems[i])
stats.QuestItems.push_back(gameObjectInfo->questItems[i]);
for (uint32 i = 0; i < MAX_GAMEOBJECT_DATA; i++)
stats.Data[i] = gameObjectInfo->raw.data[i];
stats.Size = gameObjectInfo->size;
stats.Type = gameObjectInfo->type;
stats.UnkString = gameObjectInfo->unk1;
stats.UnkInt32 = gameObjectInfo->unkInt32;
stats.Expansion = 0;
}
else
{
TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (%s, ENTRY: %u)",
guid.ToString().c_str(), entry);
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
data << uint32(entry | 0x80000000);
SendPacket(&data);
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_GAMEOBJECT_QUERY_RESPONSE");
}
response.Allow = false;
SendPacket(response.Write());
}
void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)