mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
refactor: derive turtle opcodes from classic
This commit is contained in:
parent
0b6265bc55
commit
6ede9a2968
12 changed files with 428 additions and 394 deletions
|
|
@ -4261,8 +4261,11 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
}
|
||||
|
||||
case Opcode::SMSG_ACTION_BUTTONS: {
|
||||
// packed: bits 0-23 = actionId, bits 24-31 = type
|
||||
// 0x00 = spell (when id != 0), 0x80 = item, 0x40 = macro (skip)
|
||||
// Slot encoding differs by expansion:
|
||||
// Classic/Turtle: uint16 actionId + uint8 type + uint8 misc
|
||||
// type: 0=spell, 1=item, 64=macro
|
||||
// TBC/WotLK: uint32 packed = actionId | (type << 24)
|
||||
// type: 0x00=spell, 0x80=item, 0x40=macro
|
||||
// Format differences:
|
||||
// Classic 1.12: no mode byte, 120 slots (480 bytes)
|
||||
// TBC 2.4.3: no mode byte, 132 slots (528 bytes)
|
||||
|
|
@ -4292,12 +4295,20 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
|||
// so we don't wipe hardcoded fallbacks when the server sends zeros.
|
||||
continue;
|
||||
}
|
||||
uint8_t type = static_cast<uint8_t>((packed >> 24) & 0xFF);
|
||||
uint32_t id = packed & 0x00FFFFFFu;
|
||||
uint8_t type = 0;
|
||||
uint32_t id = 0;
|
||||
if (isClassicLikeExpansion()) {
|
||||
id = packed & 0x0000FFFFu;
|
||||
type = static_cast<uint8_t>((packed >> 16) & 0xFF);
|
||||
} else {
|
||||
type = static_cast<uint8_t>((packed >> 24) & 0xFF);
|
||||
id = packed & 0x00FFFFFFu;
|
||||
}
|
||||
if (id == 0) continue;
|
||||
ActionBarSlot slot;
|
||||
switch (type) {
|
||||
case 0x00: slot.type = ActionBarSlot::SPELL; slot.id = id; break;
|
||||
case 0x01: slot.type = ActionBarSlot::ITEM; slot.id = id; break;
|
||||
case 0x80: slot.type = ActionBarSlot::ITEM; slot.id = id; break;
|
||||
default: continue; // macro or unknown — leave as-is
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue