Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/Classes/TradeQueryRequests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -398,23 +398,30 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
item.explicitMods = item.explicitMods or { }

t_insert(rawLines, "Implicits: " .. (#item.enchantMods + #item.runeMods + #item.implicitMods))
local function addModLine(prefix, modLine)
local description = type(modLine) == "table" and modLine.description or modLine
if description then
t_insert(rawLines, prefix .. escapeGGGString(description))
end
end
for _, modLine in ipairs(item.enchantMods) do
t_insert(rawLines, "{enchant}" .. escapeGGGString(modLine))
addModLine("{enchant}", modLine)
end
for _, modLine in ipairs(item.runeMods) do
t_insert(rawLines, "{enchant}{rune}" .. escapeGGGString(modLine))
addModLine("{enchant}{rune}", modLine)
end
for _, modLine in ipairs(item.implicitMods) do
t_insert(rawLines, escapeGGGString(modLine))
addModLine("", modLine)
end
for _, modLine in ipairs(item.explicitMods) do
local s = ""
for flagName, flag in pairs(modLine.flags or {}) do
local flags = type(modLine) == "table" and modLine.flags or { }
for flagName, flag in pairs(flags) do
if flag then
s = s .. string.format("{%s}", flagName)
end
end
t_insert(rawLines, s .. escapeGGGString(modLine.description))
addModLine(s, modLine)
end
if item.mirrored then
t_insert(rawLines, "Mirrored")
Expand All @@ -428,14 +435,16 @@ function TradeQueryRequestsClass:FetchResultBlock(url, callback)
t_insert(rawLines, "Sanctified")
end

local pseudoMod = trade_entry.item.pseudoMods and trade_entry.item.pseudoMods[1]
local pseudoModLine = pseudoMod and (pseudoMod.description or pseudoMod)
table.insert(items, {
amount = trade_entry.listing.price.amount,
currency = trade_entry.listing.price.currency,
priceType = trade_entry.listing.price.type,
item_string = table.concat(rawLines, "\n"),
whisper = trade_entry.listing.whisper,
trader = trade_entry.listing.account.name,
weight = trade_entry.item.pseudoMods and trade_entry.item.pseudoMods[1]:match("Sum: (.+)") or "0",
weight = pseudoModLine and pseudoModLine:match("Sum: (.+)") or "0",
id = trade_entry.id
})
end
Expand Down