Fix vendor packet parsing and Tokens display

Auto-detect whether SMSG_LIST_INVENTORY has 7 fields (28 bytes/item, no
extendedCost) or 8 fields (32 bytes/item) per item from packet size. Servers
that omit extendedCost caused every item after the first to have garbage prices
due to misaligned field reads.

Also remove the [+Tokens] hybrid indicator; only show [Tokens] on pure
token-purchased items (buyPrice==0 && extendedCost!=0).
This commit is contained in:
Kelsi 2026-02-17 18:08:00 -08:00
parent 369ad26476
commit 68e39a2192
2 changed files with 10 additions and 7 deletions

View file

@ -4813,7 +4813,8 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
}
ImGui::TableSetColumnIndex(1);
if (item.extendedCost != 0 && item.buyPrice == 0) {
if (item.buyPrice == 0 && item.extendedCost != 0) {
// Token-only item (no gold cost)
ImGui::TextColored(ImVec4(0.4f, 0.8f, 1.0f, 1.0f), "[Tokens]");
} else {
uint32_t g = item.buyPrice / 10000;
@ -4823,10 +4824,6 @@ void GameScreen::renderVendorWindow(game::GameHandler& gameHandler) {
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();
if (item.extendedCost != 0) {
ImGui::SameLine();
ImGui::TextColored(ImVec4(0.4f, 0.8f, 1.0f, 1.0f), "[+Tokens]");
}
}
ImGui::TableSetColumnIndex(2);