feat: replace page-text chat-dump with proper book/scroll window

handlePageTextQueryResponse() now collects pages into bookPages_ vector
instead of dumping lines to system chat. Multi-page items (nextPageId != 0)
are automatically chained by requesting subsequent pages. The book window
opens automatically when pages arrive, shows formatted text in a parchment-
styled ImGui window with Prev/Next page navigation and a Close button.

SMSG_READ_ITEM_OK clears bookPages_ so each item read starts fresh;
handleGameObjectPageText() does the same before querying the first page.
Closes the long-standing issue where reading scrolls and tattered notes
spammed many separate chat messages instead of showing a readable UI.
This commit is contained in:
Kelsi 2026-03-12 18:21:50 -07:00
parent 218d68e275
commit 5883654e1e
4 changed files with 114 additions and 11 deletions

View file

@ -1462,6 +1462,13 @@ public:
uint32_t getTempEnchantRemainingMs(uint32_t slot) const;
static constexpr const char* kTempEnchantSlotNames[] = { "Main Hand", "Off Hand", "Ranged" };
// ---- Readable text (books / scrolls / notes) ----
// Populated by handlePageTextQueryResponse(); multi-page items chain via nextPageId.
struct BookPage { uint32_t pageId = 0; std::string text; };
const std::vector<BookPage>& getBookPages() const { return bookPages_; }
bool hasBookOpen() const { return !bookPages_.empty(); }
void clearBook() { bookPages_.clear(); }
// Other player level-up callback — fires when another player gains a level
using OtherPlayerLevelUpCallback = std::function<void(uint64_t guid, uint32_t newLevel)>;
void setOtherPlayerLevelUpCallback(OtherPlayerLevelUpCallback cb) { otherPlayerLevelUpCallback_ = std::move(cb); }
@ -2820,6 +2827,7 @@ private:
LevelUpCallback levelUpCallback_;
LevelUpDeltas lastLevelUpDeltas_;
std::vector<TempEnchantTimer> tempEnchantTimers_;
std::vector<BookPage> bookPages_; // pages collected for the current readable item
OtherPlayerLevelUpCallback otherPlayerLevelUpCallback_;
AchievementEarnedCallback achievementEarnedCallback_;
AreaDiscoveryCallback areaDiscoveryCallback_;

View file

@ -437,6 +437,11 @@ private:
bool showInspectWindow_ = false;
void renderInspectWindow(game::GameHandler& gameHandler);
// Readable text window (books / scrolls / notes)
bool showBookWindow_ = false;
int bookCurrentPage_ = 0;
void renderBookWindow(game::GameHandler& gameHandler);
// Threat window
bool showThreatWindow_ = false;
void renderThreatWindow(game::GameHandler& gameHandler);