From 120c2967ebd188ef90bb33e8d96fe10f99cd8298 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 20 Mar 2026 06:04:29 -0700 Subject: [PATCH] feat: show proficiency warning in item tooltips Item tooltips now display a red "You can't use this type of item." warning when the player lacks proficiency for the weapon or armor subclass (e.g. a mage hovering over a plate item or a two-handed sword). Uses the existing canUseWeaponSubclass/canUseArmorSubclass checks against SMSG_SET_PROFICIENCY bitmasks. --- src/ui/inventory_screen.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index 74b52b3d..e9fcf39a 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -2627,6 +2627,20 @@ void InventoryScreen::renderItemTooltip(const game::ItemDef& item, const game::I ImGui::TextColored(ImVec4(0.7f, 0.7f, 0.7f, 1.0f), "%s", slotName); } } + + // Show red warning if player lacks proficiency for this weapon/armor type + if (gameHandler_) { + const auto* qi = gameHandler_->getItemInfo(item.itemId); + if (qi && qi->valid) { + bool canUse = true; + if (qi->itemClass == 2) // Weapon + canUse = gameHandler_->canUseWeaponSubclass(qi->subClass); + else if (qi->itemClass == 4 && qi->subClass > 0) // Armor (skip subclass 0 = misc) + canUse = gameHandler_->canUseArmorSubclass(qi->subClass); + if (!canUse) + ImGui::TextColored(ImVec4(1.0f, 0.2f, 0.2f, 1.0f), "You can't use this type of item."); + } + } } auto isWeaponInventoryType = [](uint32_t invType) {