diff --git a/bids_frame.lua b/bids_frame.lua index c8de249..de325d9 100644 --- a/bids_frame.lua +++ b/bids_frame.lua @@ -282,7 +282,7 @@ function private.find_auction(entry, action, express_mode) if express_mode then if GetMoney() >= amount then - PlaceAuctionBid('bidder', auction_info.index, amount) + Aux.place_bid('bidder', auction_info.index, amount) Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').') entry.gone = true else @@ -293,7 +293,7 @@ function private.find_auction(entry, action, express_mode) public.dialog_action = function() if private.create_record(Aux.info.auction(auction_info.index, 'bidder')).signature == entry.signature then if GetMoney() >= amount then - PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxBidsFrameListingDialogContentBid) or amount) + Aux.place_bid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxBidsFrameListingDialogContentBid) or amount) Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').') entry.gone = true else diff --git a/core.lua b/core.lua index 578ac30..25ab2b0 100644 --- a/core.lua +++ b/core.lua @@ -129,6 +129,17 @@ function Aux_OnAddonLoaded() end end +function Aux.place_bid(type, index, bid) + local money = GetMoney() + if money >= bid then + Aux.bid_lock = true + Aux.control.as_soon_as(function() return GetMoney() < money end, function() + Aux.bid_lock = false + end) + end + PlaceAuctionBid(type, index, bid) +end + function Aux.log_frame_load() this:SetFading(false) this:EnableMouseWheel() diff --git a/filter_search_frame.lua b/filter_search_frame.lua index 926c817..9be6bda 100644 --- a/filter_search_frame.lua +++ b/filter_search_frame.lua @@ -639,14 +639,22 @@ function find_auction(entry, express_mode, buyout_mode) end if express_mode then + if Aux.bid_lock then + return + end + if GetMoney() >= amount then entry.gone = true end - PlaceAuctionBid('list', index, amount) + Aux.place_bid('list', index, amount) private.selected = nil refresh = true else private.buyout_button:SetScript('OnClick', function() + if Aux.bid_lock then + return + end + if not test(index) then private.buyout_button:Disable() return find_auction(entry, express_mode, buyout_mode) -- try again @@ -655,7 +663,7 @@ function find_auction(entry, express_mode, buyout_mode) if GetMoney() >= amount then entry.gone = true end - PlaceAuctionBid('list', index, entry.buyout_price) + Aux.place_bid('list', index, entry.buyout_price) private.buyout_button:Disable() private.selected = nil diff --git a/item_search_frame.lua b/item_search_frame.lua index 7d851ed..09eeac0 100644 --- a/item_search_frame.lua +++ b/item_search_frame.lua @@ -653,6 +653,7 @@ function find_auction(entry, express_mode, buyout_mode) end Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index) + if not index then entry.gone = true private.clear_selection() @@ -665,14 +666,23 @@ function find_auction(entry, express_mode, buyout_mode) end if express_mode then + if Aux.bid_lock then + return + end + if GetMoney() >= amount then entry.gone = true end - PlaceAuctionBid('list', index, amount) + Aux.place_bid('list', index, amount) + private.clear_selection() refresh = true else private.buyout_button:SetScript('OnClick', function() + if Aux.bid_lock then + return + end + if not test(index) then private.buyout_button:Disable() return find_auction(entry, express_mode, buyout_mode) -- try again @@ -681,7 +691,7 @@ function find_auction(entry, express_mode, buyout_mode) if GetMoney() >= amount then entry.gone = true end - PlaceAuctionBid('list', index, entry.buyout_price) + Aux.place_bid('list', index, entry.buyout_price) private.buyout_button:Disable() private.clear_selection()