bugfix for auctions without buyout price

This commit is contained in:
Manuel Simon Hirsig
2015-10-04 05:50:38 +02:00
parent 47483edd65
commit 1bdac168e4
2 changed files with 20 additions and 14 deletions
+18 -12
View File
@@ -149,6 +149,10 @@ function AuxBuyEntry_OnClick(entry_index)
local entry = entries[entry_index] local entry = entries[entry_index]
if buyout_mode and not entry.buyout_price then
return
end
if IsControlKeyDown() then if IsControlKeyDown() then
DressUpItemLink(entry.hyperlink) DressUpItemLink(entry.hyperlink)
return return
@@ -170,32 +174,34 @@ function AuxBuyEntry_OnClick(entry_index)
PlaySound("igMainMenuOptionCheckBoxOn") PlaySound("igMainMenuOptionCheckBoxOn")
local found local found
local order_key = Aux.auction_key(entry.tooltip, entry.stack_size, entry.bid, entry.buyout_price) local order_key = Aux.auction_key(entry.tooltip, entry.stack_size, amount)
Aux.scan.start{ Aux.scan.start{
query = search_query, query = search_query,
page = entry.page ~= current_page and entry.page, page = entry.page ~= current_page and entry.page,
on_start_page = function(ok, page) on_start_page = function(ok, page)
current_page = page current_page = page
ok() return ok()
end, end,
on_read_auction = function(ok, i) on_read_auction = function(ok, i)
local auction_item = Aux.info.auction_item(i) local auction_item = Aux.info.auction_item(i)
if not auction_item then if not auction_item then
ok() return ok()
return
end end
local stack_size = auction_item.charges or auction_item.count local stack_size = auction_item.charges or auction_item.count
local bid = auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid + auction_item.min_increment local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment
if not auction_item.tooltip or not stack_size or not auction_item.buyout_price then
ok()
return
end
local key = Aux.auction_key(auction_item.tooltip, stack_size, bid, auction_item.buyout_price) local auction_amount
if buyout_mode then
auction_amount = auction_item.buyout_price
else
auction_amount = bid
end
local key = Aux.auction_key(auction_item.tooltip, stack_size, auction_amount)
if key == order_key then if key == order_key then
found = true found = true
@@ -224,7 +230,7 @@ function AuxBuyEntry_OnClick(entry_index)
AuxBuyDialogActionButton:Enable() AuxBuyDialogActionButton:Enable()
end end
end end
ok() return ok()
end, end,
on_complete = function() on_complete = function()
if not found then if not found then
+2 -2
View File
@@ -478,7 +478,7 @@ end
----------------------------------------- -----------------------------------------
function Aux.auction_key(tooltip, stack_size, bid, buyout_price) function Aux.auction_key(tooltip, stack_size, amount)
local key = '' local key = ''
for i, line in ipairs(tooltip) do for i, line in ipairs(tooltip) do
local left_text = line[1].text local left_text = line[1].text
@@ -490,5 +490,5 @@ function Aux.auction_key(tooltip, stack_size, bid, buyout_price)
key = key .. right_text .. '_' key = key .. right_text .. '_'
end end
end end
return key .. stack_size .. '_' .. bid .. '_' .. buyout_price return key .. (stack_size or '0') .. '_' .. (amount or '0')
end end