added safety check to buying by confirmation in case some other addon or something changes the page

This commit is contained in:
Manuel Simon Hirsig
2015-11-10 22:14:59 +01:00
parent d4a2822533
commit 7d271b4a1b
3 changed files with 43 additions and 37 deletions
+14 -12
View File
@@ -696,18 +696,20 @@ function find_auction(entry, buyout_mode, express_mode)
Aux.scan.abort() Aux.scan.abort()
else else
public.dialog_action = function() public.dialog_action = function()
if GetMoney() >= amount then if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid)) if GetMoney() >= amount then
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))..'.') PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))
entry.gone = true Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))..'.')
refresh = true entry.gone = true
else refresh = true
Aux.log('Not enough money.') else
end Aux.log('Not enough money.')
Aux.scan.abort() end
AuxFilterSearchFrameFiltersSearchButton:Enable() Aux.scan.abort()
AuxFilterSearchFrameResultsConfirmation:Hide() AuxFilterSearchFrameFiltersSearchButton:Enable()
update_sheet() AuxFilterSearchFrameResultsConfirmation:Hide()
update_sheet()
end
end end
AuxFilterSearchFrameResultsConfirmationContentActionButton:Enable() AuxFilterSearchFrameResultsConfirmationContentActionButton:Enable()
end end
+14 -12
View File
@@ -672,18 +672,20 @@ function find_auction(entry, buyout_mode, express_mode)
Aux.scan.abort() Aux.scan.abort()
else else
public.dialog_action = function() public.dialog_action = function()
if GetMoney() >= amount then if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid)) if GetMoney() >= amount then
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))..'.') PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))
entry.gone = true Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))..'.')
refresh = true entry.gone = true
else refresh = true
Aux.log('Not enough money.') else
end Aux.log('Not enough money.')
Aux.scan.abort() end
AuxItemSearchFrameItemRefreshButton:Enable() Aux.scan.abort()
AuxItemSearchFrameAuctionsConfirmation:Hide() AuxItemSearchFrameItemRefreshButton:Enable()
update_listing() AuxItemSearchFrameAuctionsConfirmation:Hide()
update_listing()
end
end end
AuxItemSearchFrameAuctionsConfirmationContentActionButton:Enable() AuxItemSearchFrameAuctionsConfirmationContentActionButton:Enable()
end end
+15 -13
View File
@@ -475,20 +475,22 @@ function private.find_auction(entry, action, express_mode)
Aux.scan.abort() Aux.scan.abort()
else else
public.dialog_action = function() public.dialog_action = function()
if action == 'cancel' then if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
CancelAuction(auction_info.index) if action == 'cancel' then
entry.gone = true CancelAuction(auction_info.index)
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity) entry.gone = true
elseif GetMoney() >= amount then Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount) elseif GetMoney() >= amount then
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount)..'.') PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount)
entry.gone = true Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount)..'.')
else entry.gone = true
Aux.log('Not enough money.') else
Aux.log('Not enough money.')
end
Aux.scan.abort()
AuxManageFrameListingDialog:Hide()
public.update_listing()
end end
Aux.scan.abort()
AuxManageFrameListingDialog:Hide()
public.update_listing()
end end
AuxManageFrameListingDialogContentActionButton:Enable() AuxManageFrameListingDialogContentActionButton:Enable()
end end