diff --git a/buy.lua b/buy.lua index e2d51c1..e5c413f 100644 --- a/buy.lua +++ b/buy.lua @@ -149,6 +149,10 @@ function AuxBuyEntry_OnClick(entry_index) local entry = entries[entry_index] + if buyout_mode and not entry.buyout_price then + return + end + if IsControlKeyDown() then DressUpItemLink(entry.hyperlink) return @@ -170,32 +174,34 @@ function AuxBuyEntry_OnClick(entry_index) PlaySound("igMainMenuOptionCheckBoxOn") 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{ query = search_query, page = entry.page ~= current_page and entry.page, on_start_page = function(ok, page) current_page = page - ok() + return ok() end, on_read_auction = function(ok, i) local auction_item = Aux.info.auction_item(i) if not auction_item then - ok() - return + return ok() end 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 - - if not auction_item.tooltip or not stack_size or not auction_item.buyout_price then - ok() - return - end + local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment - 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 found = true @@ -224,7 +230,7 @@ function AuxBuyEntry_OnClick(entry_index) AuxBuyDialogActionButton:Enable() end end - ok() + return ok() end, on_complete = function() if not found then diff --git a/core.lua b/core.lua index ae0c416..6f1b212 100644 --- a/core.lua +++ b/core.lua @@ -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 = '' for i, line in ipairs(tooltip) do local left_text = line[1].text @@ -490,5 +490,5 @@ function Aux.auction_key(tooltip, stack_size, bid, buyout_price) key = key .. right_text .. '_' end end - return key .. stack_size .. '_' .. bid .. '_' .. buyout_price + return key .. (stack_size or '0') .. '_' .. (amount or '0') end \ No newline at end of file