Skip to content

Commit ee8f0df

Browse files
committed
Fix trade result parsing for 3.29 API changes
1 parent 99bc6e1 commit ee8f0df

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

src/Classes/TradeQueryRequests.lua

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -398,23 +398,30 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
398398
item.explicitMods = item.explicitMods or { }
399399

400400
t_insert(rawLines, "Implicits: " .. (#item.enchantMods + #item.runeMods + #item.implicitMods))
401+
local function addModLine(prefix, modLine)
402+
local description = type(modLine) == "table" and modLine.description or modLine
403+
if description then
404+
t_insert(rawLines, prefix .. escapeGGGString(description))
405+
end
406+
end
401407
for _, modLine in ipairs(item.enchantMods) do
402-
t_insert(rawLines, "{enchant}" .. escapeGGGString(modLine))
408+
addModLine("{enchant}", modLine)
403409
end
404410
for _, modLine in ipairs(item.runeMods) do
405-
t_insert(rawLines, "{enchant}{rune}" .. escapeGGGString(modLine))
411+
addModLine("{enchant}{rune}", modLine)
406412
end
407413
for _, modLine in ipairs(item.implicitMods) do
408-
t_insert(rawLines, escapeGGGString(modLine))
414+
addModLine("", modLine)
409415
end
410416
for _, modLine in ipairs(item.explicitMods) do
411417
local s = ""
412-
for flagName, flag in pairs(modLine.flags or {}) do
418+
local flags = type(modLine) == "table" and modLine.flags or { }
419+
for flagName, flag in pairs(flags) do
413420
if flag then
414421
s = s .. string.format("{%s}", flagName)
415422
end
416423
end
417-
t_insert(rawLines, s .. escapeGGGString(modLine.description))
424+
addModLine(s, modLine)
418425
end
419426
if item.mirrored then
420427
t_insert(rawLines, "Mirrored")
@@ -428,14 +435,16 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
428435
t_insert(rawLines, "Sanctified")
429436
end
430437

438+
local pseudoMod = trade_entry.item.pseudoMods and trade_entry.item.pseudoMods[1]
439+
local pseudoModLine = pseudoMod and (pseudoMod.description or pseudoMod)
431440
table.insert(items, {
432441
amount = trade_entry.listing.price.amount,
433442
currency = trade_entry.listing.price.currency,
434443
priceType = trade_entry.listing.price.type,
435444
item_string = table.concat(rawLines, "\n"),
436445
whisper = trade_entry.listing.whisper,
437446
trader = trade_entry.listing.account.name,
438-
weight = trade_entry.item.pseudoMods and trade_entry.item.pseudoMods[1]:match("Sum: (.+)") or "0",
447+
weight = pseudoModLine and pseudoModLine:match("Sum: (.+)") or "0",
439448
id = trade_entry.id
440449
})
441450
end

0 commit comments

Comments
 (0)