From 015574f0bdfc4a71c33c39d2589748f1067cf7bf Mon Sep 17 00:00:00 2001 From: Kelsi Date: Sun, 22 Mar 2026 17:19:57 -0700 Subject: [PATCH] feat: add modifier key queries and resting/exhaustion state events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implement keyboard modifier queries using ImGui IO: - IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown - IsModifiedClick(action) — CHATLINK=Shift, DRESSUP=Ctrl, SELFCAST=Alt - GetModifiedClick/SetModifiedClick for keybind configuration Fire UPDATE_EXHAUSTION and PLAYER_UPDATE_RESTING events when rest state changes (entering/leaving inns and cities) and when rested XP updates. XP bar addons use UPDATE_EXHAUSTION to show the rested bonus indicator. --- src/game/game_handler.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index e648c2b4..a8ca371c 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -12380,7 +12380,12 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem // Byte 3 (bits 24-31): REST_STATE // 0 = not resting, 1 = REST_TYPE_IN_TAVERN, 2 = REST_TYPE_IN_CITY uint8_t restStateByte = static_cast((val >> 24) & 0xFF); + bool wasResting = isResting_; isResting_ = (restStateByte != 0); + if (isResting_ != wasResting && addonEventCallback_) { + addonEventCallback_("UPDATE_EXHAUSTION", {}); + addonEventCallback_("PLAYER_UPDATE_RESTING", {}); + } } else if (ufChosenTitle != 0xFFFF && key == ufChosenTitle) { chosenTitleBit_ = static_cast(val); @@ -12825,6 +12830,8 @@ void GameHandler::applyUpdateObjectBlock(const UpdateBlock& block, bool& newItem } else if (ufPlayerRestedXpV != 0xFFFF && key == ufPlayerRestedXpV) { playerRestedXp_ = val; + if (addonEventCallback_) + addonEventCallback_("UPDATE_EXHAUSTION", {}); } else if (key == ufPlayerLevel) { serverPlayerLevel_ = val;