fixed two bugs with charges, that they would be completely ignored on the item in the auction slot and that they wouldn't be parsed for some specific items

This commit is contained in:
Manuel Simon Hirsig
2015-09-11 21:46:09 +02:00
parent 8d850ab889
commit 6df606508b
2 changed files with 39 additions and 4 deletions
+33 -4
View File
@@ -108,6 +108,35 @@ end
-----------------------------------------
function Aux_Scan_ExtractTooltip()
local tooltip = {}
for j=1, 30 do -- conveniently ignores nils
local leftEntry = getglobal('AuxScanTooltipTextLeft'..j):GetText()
if leftEntry then
tinsert(tooltip, leftEntry)
end
local rightEntry = getglobal('AuxScanTooltipTextRight'..j):GetText()
if rightEntry then
tinsert(tooltip, rightEntry)
end
end
return tooltip
end
-----------------------------------------
function Aux_Scan_ItemCharges(tooltip)
for _, entry in ipairs(tooltip) do
local chargesString = gsub(entry, "(%d+) Charges", "%1")
local charges = tonumber(chargesString)
if charges then
return charges
end
end
end
-----------------------------------------
function processQueryResults()
-- SortAuctionItems("list", "buyout")
@@ -126,14 +155,14 @@ function processQueryResults()
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE");
AuxScanTooltip:SetAuctionItem("list", i)
AuxScanTooltip:Show()
local chargesLabel = getglobal("AuxScanTooltipTextLeft"..4):GetText()
local chargesString = gsub(chargesLabel and chargesLabel or "", "(%d+) Charges", "%1")
local charges = tonumber(chargesString)
local tooltip = Aux_Scan_ExtractTooltip()
-- for _, x in ipairs(tooltip) do Aux_Log(x) end
count = Aux_Scan_ItemCharges(tooltip) or count
local scanDatum = {
name = name,
texture = texture,
count = charges and charges or count,
count = count,
quality = quality,
canUse = canUse,
level = level,
+6
View File
@@ -224,6 +224,12 @@ function Aux_OnNewAuctionUpdate()
end
currentAuctionItemName, currentAuctionItemTexture, currentAuctionItemStackSize = GetAuctionSellItemInfo()
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE")
AuxScanTooltip:SetAuctionSellItem()
AuxScanTooltip:Show()
local tooltip = Aux_Scan_ExtractTooltip()
currentAuctionItemStackSize = Aux_Scan_ItemCharges(tooltip) or currentAuctionItemStackSize
if currentAuctionItemName and not auxSellEntries[currentAuctionItemName] then
Aux_RefreshEntries()