mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Show item icon and quality color in buyback table
This commit is contained in:
parent
647967cccb
commit
3c0e58bff4
1 changed files with 22 additions and 10 deletions
|
|
@ -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<uint64_t>(sellPrice) *
|
||||
static_cast<uint64_t>(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<game::ItemQuality>(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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue