game: implement dual-spec switch via CMSG_SET_ACTIVE_TALENT_GROUP (0x4C3)

switchTalentSpec() was only updating local state without notifying the
server, leaving the server out of sync with the client's active talent
group. Now sends CMSG_SET_ACTIVE_TALENT_GROUP_OBSOLETE (WotLK wire
opcode 0x4C3) with the target group index (0=primary, 1=secondary),
prompting the server to apply the spec swap and respond with a fresh
SMSG_TALENTS_INFO for the newly active group.

Also adds ActivateTalentGroupPacket::build() to world_packets for the
packet construction.
This commit is contained in:
Kelsi 2026-03-09 22:49:23 -07:00
parent d339734143
commit 52c1fed6ab
3 changed files with 25 additions and 3 deletions

View file

@ -12832,9 +12832,16 @@ void GameHandler::switchTalentSpec(uint8_t newSpec) {
return;
}
// For now, just switch locally. In a real implementation, we'd send
// MSG_TALENT_WIPE_CONFIRM to the server to trigger a spec switch.
// The server would respond with new SMSG_TALENTS_INFO for the new spec.
// Send CMSG_SET_ACTIVE_TALENT_GROUP_OBSOLETE (0x4C3) to the server.
// The server will validate the swap, apply the new spec's spells/auras,
// and respond with SMSG_TALENTS_INFO for the newly active group.
// We optimistically update the local state so the UI reflects the change
// immediately; the server response will correct us if needed.
if (state == WorldState::IN_WORLD && socket) {
auto pkt = ActivateTalentGroupPacket::build(static_cast<uint32_t>(newSpec));
socket->send(pkt);
LOG_INFO("Sent CMSG_SET_ACTIVE_TALENT_GROUP_OBSOLETE: group=", (int)newSpec);
}
activeTalentSpec_ = newSpec;
LOG_INFO("Switched to talent spec ", (int)newSpec,