diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 0455aca..c16ea50 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -6,10 +6,7 @@
-
-
-
-
+
@@ -76,21 +73,11 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -109,8 +96,18 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -120,7 +117,7 @@
-
+
@@ -129,28 +126,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -159,8 +136,8 @@
-
-
+
+
@@ -169,8 +146,28 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -191,12 +188,13 @@
-
-
-
+
+
+
+
@@ -432,6 +430,7 @@
+
@@ -447,7 +446,6 @@
-
@@ -480,22 +478,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -512,18 +494,18 @@
-
+
-
-
+
+
-
+
-
-
+
+
@@ -531,39 +513,63 @@
-
+
-
-
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
diff --git a/buy.lua b/buy.lua
index f50c7c4..232d83b 100644
--- a/buy.lua
+++ b/buy.lua
@@ -2,7 +2,6 @@ Aux.buy = {}
local create_auction_record, show_dialog, find_auction, hide_sheet, update_sheet, auction_alpha_setter, group_alpha_setter
local auctions
-local selectedAuctions = {}
local search_query
local tooltip_patterns = {}
local current_page
@@ -426,8 +425,10 @@ Aux.buy.modes = {
},
}
-function Aux.buy.exit()
- Aux.buy.dialog_cancel()
+function Aux.buy.on_close()
+ if AuxBuyConfirmation:IsVisible() then
+ Aux.buy.dialog_cancel()
+ end
current_page = nil
end
@@ -437,14 +438,8 @@ function Aux.buy.on_open()
update_sheet()
end
-function Aux_AuctionFrameBid_Update()
- Aux.orig.AuctionFrameBid_Update()
- if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index and AuctionFrame:IsShown() then
- Aux_HideElems(Aux.tabs.buy.hiddenElements)
- end
-end
-
function Aux.buy.dialog_cancel()
+ Aux.log('Canceled.')
Aux.scan.abort()
AuxBuyConfirmation:Hide()
update_sheet()
@@ -497,7 +492,6 @@ function Aux.buy.SearchButton_onclick()
AuxBuyStopButton:Show()
auctions = nil
- selectedAuctions = {}
refresh = true
@@ -515,18 +509,16 @@ function Aux.buy.SearchButton_onclick()
usable = AuxBuyUsableCheckButton:GetChecked()
}
- Aux.log('Starting scan')
+ Aux.log('Scanning auctions ...')
Aux.scan.start{
query = search_query,
page = AuxBuyAllPagesCheckButton:GetChecked() and 0 or AuxBuyPageEditBox:GetNumber(),
on_submit_query = function()
current_page = nil
end,
- on_page_loaded = function(page)
- current_page = page
- end,
- on_start_page = function(page, total_pages)
- Aux.log('Scanning page ' .. page + 1 .. (total_pages > 0 and ' out of ' .. total_pages or ''))
+ on_page_loaded = function(page, total_pages)
+ Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...')
+ current_page = page
end,
on_read_auction = function(i)
local auction_item = Aux.info.auction_item(i)
@@ -539,14 +531,15 @@ function Aux.buy.SearchButton_onclick()
end,
on_complete = function()
auctions = auctions or {}
- Aux.log('Scan completed: '..getn(auctions)..' auctions found')
- AuxBuyStopButton:Hide()
+ Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
+
+ AuxBuyStopButton:Hide()
AuxBuySearchButton:Show()
refresh = true
end,
on_abort = function()
auctions = auctions or {}
- Aux.log('Scan aborted: '..getn(auctions)..' auctions found')
+ Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
AuxBuyStopButton:Hide()
AuxBuySearchButton:Show()
refresh = true
@@ -604,16 +597,16 @@ function find_auction(entry, buyout_mode, express_mode)
return
end
- Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request')
+ local amount
+ if buyout_mode then
+ amount = entry.buyout_price
+ else
+ amount = entry.bid
+ end
+
+ Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request for '..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..' ...')
AuxBuySearchButton:Disable()
- local amount
- if buyout_mode then
- amount = entry.buyout_price
- else
- amount = entry.bid
- end
-
if not express_mode then
show_dialog(buyout_mode, entry, amount)
end
@@ -646,23 +639,23 @@ function find_auction(entry, buyout_mode, express_mode)
if entry.signature == signature then
ctrl.suspend()
found = true
- Aux.log('Matching auction found')
+ Aux.log('Matching auction found.'..(express_mode and '' or ' Awaiting confirmation ...'))
if express_mode then
if GetMoney() >= amount then
PlaceAuctionBid("list", i, amount)
- Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size)
+ Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..'.')
entry.gone = true
refresh = true
else
- Aux.log('Not enough money.')
+ Aux.log((buyout_mode and 'Purchase' or 'Bid')..' failed: Not enough money.')
end
Aux.scan.abort()
else
Aux.buy.dialog_action = function()
if GetMoney() >= amount then
PlaceAuctionBid("list", i, amount)
- Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size)
+ Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..'.')
entry.gone = true
refresh = true
else
@@ -679,6 +672,7 @@ function find_auction(entry, buyout_mode, express_mode)
end,
on_complete = function()
if not found then
+ Aux.log('No matching auction found. Removing entry from the cache.')
entry.gone = true
refresh = true
Aux.buy.dialog_cancel()
@@ -724,7 +718,7 @@ function create_auction_record(auction_item, current_page)
elseif auction_item.high_bidder then
status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
else
- status = RED_FONT_COLOR_CODE .. 'Other Bidder'..FONT_COLOR_CODE_CLOSE
+ status = RED_FONT_COLOR_CODE..'Other Bidder'..FONT_COLOR_CODE_CLOSE
end
return {
@@ -832,7 +826,7 @@ function AuxBuyQualityDropDown_Initialize()
end
UIDropDownMenu_AddButton{
- text = ALL,
+ text = 'All',
value = -1,
func = on_click,
}
diff --git a/buy.xml b/buy.xml
index f67e820..aef604e 100644
--- a/buy.xml
+++ b/buy.xml
@@ -117,7 +117,7 @@
-
+
@@ -176,10 +176,9 @@
-
-
+
-
+
@@ -187,24 +186,25 @@
-
-
-
-
-
+
+ getglobal(this:GetName()..'Label'):SetText('Level Range')
+ this:SetWidth(30)
+
this:ClearFocus()
-
-
+
+
+ this:SetWidth(30)
+
this:ClearFocus()
@@ -215,7 +215,7 @@
-
+
@@ -278,20 +278,12 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+ getglobal(this:GetName()..'Label'):SetText('Page')
+ this:SetWidth(30)
this:EnableMouse(false)
this:SetAlpha(0.5)
@@ -305,7 +297,7 @@
-
+
@@ -368,12 +360,13 @@
-
+
+
@@ -461,7 +454,7 @@
@@ -285,13 +304,7 @@
-
-
-
-
-
-
-
+
AuxSellRefreshButton_OnClick()
@@ -299,16 +312,8 @@
-
-
-
-
-
-
-
-
-
-
+
+
Aux.sell.post_auctions()
diff --git a/util.lua b/util.lua
index ef3b08f..83badd1 100644
--- a/util.lua
+++ b/util.lua
@@ -9,6 +9,28 @@ local merge, copy_array
function Aux.util.pass()
end
+function Aux.util.safe_index(chain)
+ local target = chain[1]
+
+ for i=2,getn(chain) do
+ if not target then
+ return
+ end
+ target = target[chain[i]]
+ end
+
+ return target
+end
+
+function Aux_PluralizeIf(word, count)
+
+ if count and count == 1 then
+ return word
+ else
+ return word.."s"
+ end
+end
+
function Aux.util.without_sound(f)
local orig = UIErrorsFrame.AddMessage
UIErrorsFrame.AddMessage = Aux.util.pass