fix: send GAMEOBJ_USE+LOOT together for chests, reset off-screen bag pos

Chest-type GOs now send CMSG_GAMEOBJ_USE immediately followed by
CMSG_LOOT in the same frame. The USE handler opens the chest, then the
LOOT handler reads the contents — both processed sequentially by the
server. Previously only CMSG_LOOT was sent (no USE), which failed on
AzerothCore because the chest wasn't activated first.

Reset the Bags window position to bottom-right if the saved position
is outside the current screen resolution (e.g. after a resolution
change or moving between monitors).
This commit is contained in:
Kelsi 2026-03-23 18:10:16 -07:00
parent 8a617e842b
commit b10c8b7aea
2 changed files with 14 additions and 6 deletions

View file

@ -21335,12 +21335,12 @@ void GameHandler::performGameObjectInteractionNow(uint64_t guid) {
" name='", goName, "' chestLike=", chestLike, " isMailbox=", isMailbox);
if (chestLike) {
// For chest-like GOs (quest objects, treasure chests, etc.), send CMSG_LOOT
// directly with the GO GUID — same as creature corpse looting. The server's
// LOOT handler activates the GO, generates loot, and sends SMSG_LOOT_RESPONSE
// in a single step. Sending CMSG_GAMEOBJ_USE + delayed CMSG_LOOT doesn't work
// because the USE handler opens+despawns the GO before CMSG_LOOT arrives, and
// CMSG_LOOT's DoLootRelease() closes any loot the USE handler already opened.
// For chest-like GOs: send CMSG_GAMEOBJ_USE (opens the chest) followed
// immediately by CMSG_LOOT (requests loot contents). Both sent in the
// same frame so the server processes them sequentially: USE transitions
// the GO to lootable state, then LOOT reads the contents.
auto usePacket = GameObjectUsePacket::build(guid);
socket->send(usePacket);
lootTarget(guid);
lastInteractedGoGuid_ = guid;
} else {

View file

@ -941,6 +941,14 @@ void InventoryScreen::renderAggregateBags(game::Inventory& inventory, uint64_t m
return;
}
// Reset to bottom-right if the window ended up outside the screen (resolution change)
ImVec2 winPos = ImGui::GetWindowPos();
ImVec2 winSize = ImGui::GetWindowSize();
if (winPos.x > screenW || winPos.y > screenH ||
winPos.x + winSize.x < 0 || winPos.y + winSize.y < 0) {
ImGui::SetWindowPos(ImVec2(posX, posY));
}
renderBackpackPanel(inventory, compactBags_);
ImGui::Spacing();