mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-03 08:03:50 +00:00
Show all buyback items in vendor window (not just the most recent)
This commit is contained in:
parent
682cb8d44b
commit
745768511b
1 changed files with 51 additions and 49 deletions
|
|
@ -8324,10 +8324,9 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
|
||||||
ImGui::TableSetupColumn("Price", ImGuiTableColumnFlags_WidthFixed, 110.0f);
|
ImGui::TableSetupColumn("Price", ImGuiTableColumnFlags_WidthFixed, 110.0f);
|
||||||
ImGui::TableSetupColumn("Buy", ImGuiTableColumnFlags_WidthFixed, 62.0f);
|
ImGui::TableSetupColumn("Buy", ImGuiTableColumnFlags_WidthFixed, 62.0f);
|
||||||
ImGui::TableHeadersRow();
|
ImGui::TableHeadersRow();
|
||||||
// Show only the most recently sold item (LIFO).
|
// Show all buyback items (most recently sold first)
|
||||||
const int i = 0;
|
for (int i = 0; i < static_cast<int>(buyback.size()); ++i) {
|
||||||
const auto& entry = buyback[0];
|
const auto& entry = buyback[i];
|
||||||
// Proactively ensure buyback item info is loaded
|
|
||||||
gameHandler.ensureItemInfo(entry.item.itemId);
|
gameHandler.ensureItemInfo(entry.item.itemId);
|
||||||
auto* bbInfo = gameHandler.getItemInfo(entry.item.itemId);
|
auto* bbInfo = gameHandler.getItemInfo(entry.item.itemId);
|
||||||
uint32_t sellPrice = entry.item.sellPrice;
|
uint32_t sellPrice = entry.item.sellPrice;
|
||||||
|
|
@ -8370,11 +8369,14 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
|
||||||
if (!canAfford) ImGui::PopStyleColor();
|
if (!canAfford) ImGui::PopStyleColor();
|
||||||
ImGui::TableSetColumnIndex(3);
|
ImGui::TableSetColumnIndex(3);
|
||||||
if (!canAfford) ImGui::BeginDisabled();
|
if (!canAfford) ImGui::BeginDisabled();
|
||||||
if (ImGui::SmallButton("Buy Back##buyback_0")) {
|
char bbLabel[32];
|
||||||
gameHandler.buyBackItem(0);
|
snprintf(bbLabel, sizeof(bbLabel), "Buy Back##bb%d", i);
|
||||||
|
if (ImGui::SmallButton(bbLabel)) {
|
||||||
|
gameHandler.buyBackItem(static_cast<uint32_t>(i));
|
||||||
}
|
}
|
||||||
if (!canAfford) ImGui::EndDisabled();
|
if (!canAfford) ImGui::EndDisabled();
|
||||||
ImGui::PopID();
|
ImGui::PopID();
|
||||||
|
}
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue