diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 664ff541..4c454a9a 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -7777,7 +7777,8 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) { const auto& buyback = gameHandler.getBuybackItems(); if (!buyback.empty()) { ImGui::TextColored(ImVec4(1.0f, 0.82f, 0.0f, 1.0f), "Buy Back"); - if (ImGui::BeginTable("BuybackTable", 3, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) { + if (ImGui::BeginTable("BuybackTable", 4, ImGuiTableFlags_Borders | ImGuiTableFlags_RowBg)) { + ImGui::TableSetupColumn("##icon", ImGuiTableColumnFlags_WidthFixed, 22.0f); ImGui::TableSetupColumn("Item", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("Price", ImGuiTableColumnFlags_WidthFixed, 110.0f); ImGui::TableSetupColumn("Buy", ImGuiTableColumnFlags_WidthFixed, 62.0f); @@ -7787,11 +7788,10 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) { const auto& entry = buyback[0]; // Proactively ensure buyback item info is loaded gameHandler.ensureItemInfo(entry.item.itemId); + auto* bbInfo = gameHandler.getItemInfo(entry.item.itemId); uint32_t sellPrice = entry.item.sellPrice; if (sellPrice == 0) { - if (auto* info = gameHandler.getItemInfo(entry.item.itemId); info && info->valid) { - sellPrice = info->sellPrice; - } + if (bbInfo && bbInfo->valid) sellPrice = bbInfo->sellPrice; } uint64_t price = static_cast(sellPrice) * static_cast(entry.count > 0 ? entry.count : 1); @@ -7803,17 +7803,29 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) { ImGui::TableNextRow(); ImGui::PushID(8000 + i); ImGui::TableSetColumnIndex(0); - const char* name = entry.item.name.empty() ? "Unknown Item" : entry.item.name.c_str(); - if (entry.count > 1) { - ImGui::Text("%s x%u", name, entry.count); - } else { - ImGui::Text("%s", name); + { + uint32_t dispId = entry.item.displayInfoId; + if (bbInfo && bbInfo->valid && bbInfo->displayInfoId != 0) dispId = bbInfo->displayInfoId; + if (dispId != 0) { + VkDescriptorSet iconTex = inventoryScreen.getItemIcon(dispId); + if (iconTex) ImGui::Image((ImTextureID)(uintptr_t)iconTex, ImVec2(18, 18)); + } } ImGui::TableSetColumnIndex(1); + game::ItemQuality bbQuality = entry.item.quality; + if (bbInfo && bbInfo->valid) bbQuality = static_cast(bbInfo->quality); + ImVec4 bbQc = InventoryScreen::getQualityColor(bbQuality); + const char* name = entry.item.name.empty() ? "Unknown Item" : entry.item.name.c_str(); + if (entry.count > 1) { + ImGui::TextColored(bbQc, "%s x%u", name, entry.count); + } else { + ImGui::TextColored(bbQc, "%s", name); + } + ImGui::TableSetColumnIndex(2); if (!canAfford) ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.3f, 0.3f, 1.0f)); ImGui::Text("%ug %us %uc", g, s, c); if (!canAfford) ImGui::PopStyleColor(); - ImGui::TableSetColumnIndex(2); + ImGui::TableSetColumnIndex(3); if (!canAfford) ImGui::BeginDisabled(); if (ImGui::SmallButton("Buy Back##buyback_0")) { gameHandler.buyBackItem(0);