mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 09:33:51 +00:00
Fix character appearance, previews, mount seat, and online unequip
This commit is contained in:
parent
4a023e773b
commit
275914b4db
19 changed files with 743 additions and 113 deletions
|
|
@ -1485,6 +1485,10 @@ void GameHandler::requestCharacterList() {
|
|||
|
||||
LOG_INFO("Requesting character list from server...");
|
||||
|
||||
// Prevent the UI from showing/selecting stale characters while we wait for the new SMSG_CHAR_ENUM.
|
||||
// This matters after character create/delete where the old list can linger for a few frames.
|
||||
characters.clear();
|
||||
|
||||
// Build CMSG_CHAR_ENUM packet (no body, just opcode)
|
||||
auto packet = CharEnumPacket::build();
|
||||
|
||||
|
|
@ -1663,6 +1667,10 @@ void GameHandler::selectCharacter(uint64_t characterGuid) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Make the selected character authoritative in GameHandler.
|
||||
// This avoids relying on UI/Application ordering for appearance-dependent logic.
|
||||
activeCharacterGuid_ = characterGuid;
|
||||
|
||||
LOG_INFO("========================================");
|
||||
LOG_INFO(" ENTERING WORLD");
|
||||
LOG_INFO("========================================");
|
||||
|
|
@ -5980,6 +5988,28 @@ void GameHandler::autoEquipItemBySlot(int backpackIndex) {
|
|||
}
|
||||
}
|
||||
|
||||
void GameHandler::unequipToBackpack(EquipSlot equipSlot) {
|
||||
if (state != WorldState::IN_WORLD || !socket) return;
|
||||
|
||||
int freeSlot = inventory.findFreeBackpackSlot();
|
||||
if (freeSlot < 0) {
|
||||
addSystemChatMessage("Cannot unequip: no free backpack slots.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Use SWAP_ITEM for cross-container moves. For inventory slots we address bag as 0xFF.
|
||||
uint8_t srcBag = 0xFF;
|
||||
uint8_t srcSlot = static_cast<uint8_t>(equipSlot);
|
||||
uint8_t dstBag = 0xFF;
|
||||
uint8_t dstSlot = static_cast<uint8_t>(23 + freeSlot);
|
||||
|
||||
LOG_INFO("UnequipToBackpack: equipSlot=", (int)srcSlot,
|
||||
" -> backpackIndex=", freeSlot, " (dstSlot=", (int)dstSlot, ")");
|
||||
|
||||
auto packet = SwapItemPacket::build(dstBag, dstSlot, srcBag, srcSlot);
|
||||
socket->send(packet);
|
||||
}
|
||||
|
||||
void GameHandler::useItemBySlot(int backpackIndex) {
|
||||
if (backpackIndex < 0 || backpackIndex >= inventory.getBackpackSize()) return;
|
||||
const auto& slot = inventory.getBackpackSlot(backpackIndex);
|
||||
|
|
|
|||
|
|
@ -2398,6 +2398,22 @@ network::Packet AutoEquipItemPacket::build(uint8_t srcBag, uint8_t srcSlot) {
|
|||
return packet;
|
||||
}
|
||||
|
||||
network::Packet SwapItemPacket::build(uint8_t dstBag, uint8_t dstSlot, uint8_t srcBag, uint8_t srcSlot) {
|
||||
network::Packet packet(static_cast<uint16_t>(Opcode::CMSG_SWAP_ITEM));
|
||||
packet.writeUInt8(dstBag);
|
||||
packet.writeUInt8(dstSlot);
|
||||
packet.writeUInt8(srcBag);
|
||||
packet.writeUInt8(srcSlot);
|
||||
return packet;
|
||||
}
|
||||
|
||||
network::Packet SwapInvItemPacket::build(uint8_t srcSlot, uint8_t dstSlot) {
|
||||
network::Packet packet(static_cast<uint16_t>(Opcode::CMSG_SWAP_INV_ITEM));
|
||||
packet.writeUInt8(srcSlot);
|
||||
packet.writeUInt8(dstSlot);
|
||||
return packet;
|
||||
}
|
||||
|
||||
network::Packet LootMoneyPacket::build() {
|
||||
network::Packet packet(static_cast<uint16_t>(Opcode::CMSG_LOOT_MONEY));
|
||||
return packet;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue