Add quest opcodes, fix gossip select packet, and NPC combat animations

Fix CMSG_GOSSIP_SELECT_OPTION missing menuId field (was causing
ByteBufferException). Add 12 quest opcodes and clickable quest items in
gossip dialog. NPC attack/death animation callbacks now work for both
single-player and server-spawned creatures, and SMSG_ATTACKERSTATEUPDATE
triggers NPC swing animations.
This commit is contained in:
Kelsi 2026-02-06 11:45:35 -08:00
parent a20dc947e2
commit 8b98888dd2
7 changed files with 84 additions and 8 deletions

View file

@ -1808,9 +1808,10 @@ network::Packet GossipHelloPacket::build(uint64_t npcGuid) {
return packet;
}
network::Packet GossipSelectOptionPacket::build(uint64_t npcGuid, uint32_t optionId, const std::string& code) {
network::Packet GossipSelectOptionPacket::build(uint64_t npcGuid, uint32_t menuId, uint32_t optionId, const std::string& code) {
network::Packet packet(static_cast<uint16_t>(Opcode::CMSG_GOSSIP_SELECT_OPTION));
packet.writeUInt64(npcGuid);
packet.writeUInt32(menuId);
packet.writeUInt32(optionId);
if (!code.empty()) {
packet.writeString(code);
@ -1818,6 +1819,22 @@ network::Packet GossipSelectOptionPacket::build(uint64_t npcGuid, uint32_t optio
return packet;
}
network::Packet QuestgiverQueryQuestPacket::build(uint64_t npcGuid, uint32_t questId) {
network::Packet packet(static_cast<uint16_t>(Opcode::CMSG_QUESTGIVER_QUERY_QUEST));
packet.writeUInt64(npcGuid);
packet.writeUInt32(questId);
packet.writeUInt8(1); // isDialogContinued = 1 (from gossip)
return packet;
}
network::Packet QuestgiverAcceptQuestPacket::build(uint64_t npcGuid, uint32_t questId) {
network::Packet packet(static_cast<uint16_t>(Opcode::CMSG_QUESTGIVER_ACCEPT_QUEST));
packet.writeUInt64(npcGuid);
packet.writeUInt32(questId);
packet.writeUInt32(0); // unused
return packet;
}
bool GossipMessageParser::parse(network::Packet& packet, GossipMessageData& data) {
data.npcGuid = packet.readUInt64();
data.menuId = packet.readUInt32();