mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 16:10:49 +01:00
Core/Handlers: prevent sending empty packet in npc text query if no BroadcastTextID is set in db, to prevent wrong client caching. writes error instead
This commit is contained in:
@@ -203,19 +203,23 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPackets::Query::QueryNPCText& p
|
||||
WorldPackets::Query::QueryNPCTextResponse response;
|
||||
response.TextID = packet.TextID;
|
||||
|
||||
bool hasText = false;
|
||||
if (gossip)
|
||||
{
|
||||
for (uint8 i = 0; i < MAX_GOSSIP_TEXT_OPTIONS; ++i)
|
||||
{
|
||||
response.Probabilities[i] = gossip->Options[i].Probability;
|
||||
response.BroadcastTextID[i] = gossip->Options[i].BroadcastTextID;
|
||||
if (!hasText && gossip->Options[i].BroadcastTextID)
|
||||
hasText = true;
|
||||
}
|
||||
|
||||
response.Allow = true;
|
||||
}
|
||||
|
||||
SendPacket(response.Write());
|
||||
|
||||
if (hasText)
|
||||
SendPacket(response.Write());
|
||||
else
|
||||
TC_LOG_ERROR("sql.sql", "HandleNpcTextQueryOpcode: no BroadcastTextID found for text %u in `npc_text table`", packet.TextID);
|
||||
TC_LOG_DEBUG("network", "WORLD: Sent SMSG_NPC_TEXT_UPDATE");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user