diff --git a/Aux-AddOn.toc b/Aux-AddOn.toc
index 1df94b8..8239341 100644
--- a/Aux-AddOn.toc
+++ b/Aux-AddOn.toc
@@ -10,6 +10,7 @@ gui.lua
control.xml
persistence.lua
util.lua
+money.lua
scan.lua
scan_util.lua
@@ -28,8 +29,5 @@ auctions_frame.xml
bids_frame.xml
scan_frame.xml
-options.xml
-about.xml
-
static.xml
diff --git a/about.xml b/about.xml
deleted file mode 100644
index 2da6c62..0000000
--- a/about.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/core.lua b/core.lua
index 1024951..2c8d7f7 100644
--- a/core.lua
+++ b/core.lua
@@ -67,7 +67,7 @@ function Aux_OnLoad()
tab_group:create_tab('Auctions')
tab_group:create_tab('Bids')
tab_group.on_select = Aux.on_tab_click
- tab_group:set_tab(1)
+ Aux.tab_group = tab_group
end
do
local btn = Aux.gui.button(AuxFrame, 12)
@@ -236,12 +236,7 @@ function Aux_OnAuctionHouseShow()
AuxFrame:Show()
- Aux.on_tab_click(1)
- if AUX_OPEN_SELL then
- Aux.on_tab_click(2)
- elseif AUX_OPEN_BUY then
-
- end
+ Aux.tab_group:set_tab(1)
end
@@ -251,7 +246,7 @@ function Aux_OnAuctionHouseClosed()
Aux.scan.abort()
Aux.filter_search_frame.on_close()
- Aux.sell.on_close()
+ Aux.post_frame.on_close()
AuxFrame:Hide()
end
@@ -262,7 +257,7 @@ function Aux.on_tab_click(index)
Aux.scan.abort(function()
Aux.item_search_frame.on_close()
Aux.filter_search_frame.on_close()
- Aux.sell.on_close()
+ Aux.post_frame.on_close()
Aux.auctions_frame.on_close()
Aux.bids_frame.on_close()
Aux.history_frame.on_close()
@@ -282,7 +277,7 @@ function Aux.on_tab_click(index)
Aux.filter_search_frame.on_open()
elseif index == 3 then
AuxSellFrame:Show()
- Aux.sell.on_open()
+ Aux.post_frame.on_open()
elseif index == 4 then
AuxAuctionsFrame:Show()
Aux.auctions_frame.on_open()
diff --git a/filter_search_frame.lua b/filter_search_frame.lua
index ea667bc..bb42001 100644
--- a/filter_search_frame.lua
+++ b/filter_search_frame.lua
@@ -3,7 +3,6 @@ Aux.buy = {}
local private, public = {}, {}
Aux.filter_search_frame = public
-local create_auction_record, find_auction, update_listing
local auctions
local search_query
local tooltip_patterns = {}
@@ -625,7 +624,7 @@ function public.stop_search()
Aux.scan.abort()
end
-function update_listing()
+function private.update_listing()
if not AuxFilterSearchFrame:IsVisible() then
return
@@ -660,7 +659,7 @@ function public.set_view(view)
private.bid_button:Disable()
private.clear_selection()
aux_view = view
- update_listing()
+ private.update_listing()
end
function public.set_item(item_id)
@@ -717,7 +716,7 @@ function public.start_search()
on_read_auction = function(auction_info)
if Aux.info.tooltip_match(tooltip_patterns, auction_info.tooltip) then
auctions = auctions or {}
- tinsert(auctions, create_auction_record(auction_info, current_page))
+ tinsert(auctions, private.create_auction_record(auction_info, current_page))
end
end,
on_complete = function()
@@ -753,7 +752,7 @@ function private.clear_selection()
private.listings[aux_view]:clear_selection()
end
-function find_auction(entry, express_mode, buyout_mode)
+function private.find_auction(entry, express_mode, buyout_mode)
if buyout_mode and not entry.buyout_price then
return
@@ -769,7 +768,7 @@ function find_auction(entry, express_mode, buyout_mode)
PlaySound('igMainMenuOptionCheckBoxOn')
local function test(index)
- return create_auction_record(Aux.info.auction(index)).signature == entry.signature
+ return private.create_auction_record(Aux.info.auction(index)).signature == entry.signature
end
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index)
@@ -781,7 +780,7 @@ function find_auction(entry, express_mode, buyout_mode)
end
if not test(index) then
- return find_auction(entry, express_mode, buyout_mode) -- try again
+ return private.find_auction(entry, express_mode, buyout_mode) -- try again
end
if express_mode then
@@ -805,7 +804,7 @@ function find_auction(entry, express_mode, buyout_mode)
if not test(index) then
private.buyout_button:Disable()
private.bid_button:Disable()
- return find_auction(entry, express_mode, buyout_mode) -- try again
+ return private.find_auction(entry, express_mode, buyout_mode) -- try again
end
if GetMoney() >= amount then
@@ -849,11 +848,11 @@ function private.on_row_click(sheet, datum, grouped)
sheet:clear_selection()
sheet:select(datum)
end
- find_auction(entry, express_mode, buyout_mode)
+ private.find_auction(entry, express_mode, buyout_mode)
end
end
-function create_auction_record(auction_info, current_page)
+function private.create_auction_record(auction_info, current_page)
local aux_quantity = auction_info.charges or auction_info.count
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
@@ -903,7 +902,7 @@ end
function Aux.buy.onupdate()
if refresh then
refresh = false
- update_listing()
+ private.update_listing()
end
end
diff --git a/item_search_frame.lua b/item_search_frame.lua
index d0f5d0a..d4d39f2 100644
--- a/item_search_frame.lua
+++ b/item_search_frame.lua
@@ -3,19 +3,11 @@ Aux.item_search_frame = public
aux_recently_searched = {}
-local create_auction_record, find_auction, hide_sheet, update_listing, auction_alpha_setter, group_alpha_setter, create_auction_record
+local hide_sheet
local auctions
local search_query
local refresh
-function auction_alpha_setter(cell, auction)
- cell:SetAlpha(auction.gone and 0.3 or 1)
-end
-
-function group_alpha_setter(cell, group)
- cell:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
-end
-
function public.on_close()
private.clear_selection()
private.buyout_button:Disable()
@@ -448,7 +440,7 @@ function public.stop_search()
Aux.scan.abort()
end
-function update_listing()
+function private.update_listing()
if not AuxItemSearchFrame:IsVisible() then
return
@@ -489,7 +481,7 @@ function public.set_view(view)
private.bid_button:Disable()
private.clear_selection()
aux_view = view
- update_listing()
+ private.update_listing()
end
function private.update_recently_searched()
@@ -578,7 +570,7 @@ function public.start_search()
on_read_auction = function(auction_info)
if auction_info.item_id == item_id then
auctions = auctions or {}
- tinsert(auctions, create_auction_record(auction_info, current_page))
+ tinsert(auctions, private.create_auction_record(auction_info, current_page))
end
end,
on_complete = function()
@@ -615,8 +607,8 @@ function private.clear_selection()
private.listings[aux_view]:clear_selection()
end
-function find_auction(entry, express_mode, buyout_mode)
-
+function private.find_auction(entry, express_mode, buyout_mode)
+
if buyout_mode and not entry.buyout_price then
return
end
@@ -631,7 +623,7 @@ function find_auction(entry, express_mode, buyout_mode)
PlaySound('igMainMenuOptionCheckBoxOn')
local function test(index)
- return create_auction_record(Aux.info.auction(index)).signature == entry.signature
+ return private.create_auction_record(Aux.info.auction(index)).signature == entry.signature
end
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index)
@@ -644,7 +636,7 @@ function find_auction(entry, express_mode, buyout_mode)
end
if not test(index) then
- return find_auction(entry, express_mode, buyout_mode) -- try again
+ return private.find_auction(entry, express_mode, buyout_mode) -- try again
end
if express_mode then
@@ -668,7 +660,7 @@ function find_auction(entry, express_mode, buyout_mode)
if not test(index) then
private.buyout_button:Disable()
private.bid_button:Disable()
- return find_auction(entry, express_mode, buyout_mode) -- try again
+ return private.find_auction(entry, express_mode, buyout_mode) -- try again
end
if GetMoney() >= amount then
@@ -698,8 +690,8 @@ function private.on_row_click(sheet, datum, grouped)
local express_mode = IsAltKeyDown()
local buyout_mode = express_mode and arg1 == 'LeftButton'
-
- if IsControlKeyDown() then
+
+ if IsControlKeyDown() then
DressUpItemLink(entry.hyperlink)
elseif IsShiftKeyDown() then
if ChatFrameEditBox:IsVisible() then
@@ -712,12 +704,12 @@ function private.on_row_click(sheet, datum, grouped)
sheet:clear_selection()
sheet:select(datum)
end
- find_auction(entry, express_mode, buyout_mode)
+ private.find_auction(entry, express_mode, buyout_mode)
end
end
-function create_auction_record(auction_info, current_page)
-
+function private.create_auction_record(auction_info, current_page)
+
local aux_quantity = auction_info.charges or auction_info.count
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
@@ -764,6 +756,6 @@ end
function public.on_update()
if refresh then
refresh = false
- update_listing()
+ private.update_listing()
end
end
\ No newline at end of file
diff --git a/money.lua b/money.lua
new file mode 100644
index 0000000..b90cce0
--- /dev/null
+++ b/money.lua
@@ -0,0 +1,122 @@
+local m = {}
+Aux.money = m
+
+local private = {textMoneyParts={} }
+
+local GOLD_TEXT = '|cffffd70ag|r'
+local SILVER_TEXT = '|cffc7c7cfs|r'
+local COPPER_TEXT = '|cffeda55fc|r'
+local COPPER_PER_SILVER = 100
+local COPPER_PER_GOLD = 10000
+
+
+-- ============================================================================
+-- TSMAPI Functions
+-- ============================================================================
+
+function m:MoneyToString(money) -- ,...)
+ money = tonumber(money)
+ if not money then return end
+ local color, pad, trim, disabled
+-- for i=1, select('#', ...) do
+-- local opt = select(i, ...)
+-- if type(opt) == 'string' then
+-- if opt == 'OPT_PAD' then -- left-pad all but the highest denomination with zeros (i.e. "1g 00s 02c" instead of "1g 0s 2c")
+-- pad = true
+-- elseif opt == 'OPT_TRIM' then -- removes any 0 valued denominations (i.e. "1g" instead of "1g 0s 0c") - 0 will still be represented as "0c"
+-- trim = true
+-- elseif opt == 'OPT_DISABLE' then -- removes color from denomination text
+-- disabled = true
+-- elseif strmatch(strlower(opt), '^|c[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]$') then -- color the numbers
+-- color = opt
+-- end
+-- end
+-- end
+
+ local isNegative = money < 0
+ money = abs(money)
+ local gold = floor(money / COPPER_PER_GOLD)
+ local silver = floor(mod(money, COPPER_PER_GOLD) / COPPER_PER_SILVER)
+ local copper = floor(mod(money, COPPER_PER_SILVER))
+ local goldText, silverText, copperText = nil, nil, nil
+ if disabled then
+ goldText, silverText, copperText = "g", "s", "c"
+ else
+ goldText, silverText, copperText = TSM.GOLD_TEXT, TSM.SILVER_TEXT, TSM.COPPER_TEXT
+ end
+
+ if money == 0 then
+ return private:FormatNumber(0, false, color)..copperText
+ end
+
+ local text = nil
+ local shouldPad = false
+ if trim then
+ wipe(private.textMoneyParts) -- avoid creating a new table every time
+ -- add gold
+ if gold > 0 then
+ tinsert(private.textMoneyParts, private:FormatNumber(gold, false, color)..goldText)
+ shouldPad = pad
+ end
+ -- add silver
+ if silver > 0 then
+ tinsert(private.textMoneyParts, private:FormatNumber(silver, shouldPad, color)..silverText)
+ shouldPad = pad
+ end
+ -- add copper
+ if copper > 0 then
+ tinsert(private.textMoneyParts, private:FormatNumber(copper, shouldPad, color)..copperText)
+ shouldPad = pad
+ end
+ text = table.concat(private.textMoneyParts, " ")
+ else
+ if gold > 0 then
+ text = private:FormatNumber(gold, false, color)..goldText.." "..private:FormatNumber(silver, pad, color)..silverText.." "..private:FormatNumber(copper, pad, color)..copperText
+ elseif silver > 0 then
+ text = private:FormatNumber(silver, false, color)..silverText.." "..private:FormatNumber(copper, pad, color)..copperText
+ else
+ text = private:FormatNumber(copper, false, color)..copperText
+ end
+ end
+
+ if isNegative then
+ if color then
+ return color..'-|r'..text
+ else
+ return '-'..text
+ end
+ else
+ return text
+ end
+end
+
+function m:MoneyFromString(value)
+ -- remove any colors
+ value = gsub(gsub(value:trim(), '\124c([0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F])', ''), '\124r', '')
+
+ -- extract gold/silver/copper values
+ local gold = tonumber(strmatch(value, '([0-9]+)g'))
+ local silver = tonumber(strmatch(value, '([0-9]+)s'))
+ local copper = tonumber(strmatch(value, '([0-9]+)c'))
+ if not gold and not silver and not copper then return end
+
+ -- test that there are no extra characters (other than spaces)
+ value = gsub(value, '[0-9]+g', '', 1)
+ value = gsub(value, '[0-9]+s', '', 1)
+ value = gsub(value, '[0-9]+c', '', 1)
+ if value:trim() ~= '' then return end
+
+ return ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) + (copper or 0)
+end
+
+function m:format_number(num, pad, color)
+ if num < 10 and pad then
+ num = '0'..num
+ end
+
+ if color then
+ return color..num..'|r'
+ else
+ return num
+ end
+end
\ No newline at end of file
diff --git a/options.lua b/options.lua
deleted file mode 100644
index d2c2b69..0000000
--- a/options.lua
+++ /dev/null
@@ -1,114 +0,0 @@
-Aux.options = {}
-
-AUX_SELL_SHORTCUT = true
-AUX_BUY_SHORTCUT = true
-AUX_OPEN_SELL = false
-AUX_OPEN_BUY = false
-AUX_INSTANT_BUYOUT = false
-
-AUX_AUCTION_DURATION = 'long'
-
-function Aux.options.show_description()
-
- AuxAboutFrame:Show()
-
- AuxAboutDescriptionHTML:SetText("
"
- .."
What is Aux?
"
- .."
"
- .."Aux adds two tabs to the traditional auction house layout, Aux Sell and Aux Buy, which make selling and buying respectively a much more streamlined experience by automating a lot of the annoying little tasks involved in managing your auctions and providing you with much better information to base decisions on."
- .."
Aux Sell
"
- .."The Aux Sell panel gives you pricing suggestions based on existing auctions (undercutting by 1 copper) when you put an item in the auction slot. Aux will cache search results so that you don't have to wait several seconds to minutes between auctions. If you need to update the information there's a refresh button. You can further select a specific entry from the list to base the pricing suggestion on if you don't like its default choice."
- .."
Aux Buy
"
- .."The Aux Buy panel makes a multi-page search for you and lists all items with the most relevant information sorted by unit price. From that list you can select all the auctions you want to buy and after your confirmation Aux then makes another multi-page search, picking up all the selected auctions in the process. At the end you're presented with a report about what has been purchased."
- .."
"
- .."")
- AuxAboutDescriptionHTML:SetSpacing(3)
- AuxAboutAuthorText:SetText("Authors: "..AuxAuthors)
-
-end
-
------------------------------------------
-
-function Aux.options.show()
-
- AuxOptionsFrame:Show()
- AuxOptionsFrame:SetBackdropColor(0,0,0,100)
-
- AuxOptionsConfigTitleText:SetText("Aux Options for "..UnitName("player"))
- AuxOptionsSummary:SetText("Aux is an addon designed to make it easier and faster to setup your auctions and find the best deals at the auction house.")
- AuxOptionsVersionText:SetText("Version: "..AuxVersion)
-
- AuxOptionsSellShortcut:SetChecked(AUX_SELL_SHORTCUT)
- AuxOptionsBuyShortcut:SetChecked(AUX_BUY_SHORTCUT)
- AuxOptionsOpenSell:SetChecked(AUX_OPEN_SELL)
- AuxOptionsOpenBuy:SetChecked(AUX_OPEN_BUY)
- AuxOptionsInstantBuyout:SetChecked(AUX_INSTANT_BUYOUT)
-
-end
-
------------------------------------------
-
-function Aux.options.save()
-
- AUX_SELL_SHORTCUT = AuxOptionsSellShortcut:GetChecked()
- AUX_BUY_SHORTCUT = AuxOptionsBuyShortcut:GetChecked()
- AUX_OPEN_SELL = AuxOptionsOpenSell:GetChecked()
- AUX_OPEN_BUY = AuxOptionsOpenBuy:GetChecked()
- AUX_INSTANT_BUYOUT = AuxOptionsInstantBuyout:GetChecked()
-
-end
-
------------------------------------------
-
-function Aux.options.show_sell_shortcut_tooltip()
-
- GameTooltip:SetOwner(this, "ANCHOR_BOTTOM")
- GameTooltip:SetText("Aux Sell shortcut", 0.9, 1.0, 1.0)
- GameTooltip:AddLine("If this option is checked, holding the Alt key down while clicking an item in your bags will switch to the Aux Sell panel, place the item in the Auction Item area and suggest a price.", 0.5, 0.5, 1.0, 1)
- GameTooltip:Show()
-
-end
-
------------------------------------------
-
-function Aux.options.show_buy_shortcut_tooltip()
-
- GameTooltip:SetOwner(this, "ANCHOR_BOTTOM")
- GameTooltip:SetText("Aux Buy Shortcut", 0.9, 1.0, 1.0)
- GameTooltip:AddLine("If this option is checked, holding the Control key down while clicking an item in your bags will switch to the Aux Buy panel and start a search.", 0.5, 0.5, 1.0, 1)
- GameTooltip:Show()
-
-end
-
------------------------------------------
-
-function Aux.options.show_open_sell_tooltip()
-
- GameTooltip:SetOwner(this, "ANCHOR_BOTTOM")
- GameTooltip:SetText("Start on Aux Sell panel", 0.9, 1.0, 1.0)
- GameTooltip:AddLine("If this option is checked, the Aux Sell panel will display first whenever you open the Auction House window.", 0.5, 0.5, 1.0, 1)
- GameTooltip:Show()
-
-end
-
------------------------------------------
-
-function Aux.options.show_open_buy_tooltip()
-
- GameTooltip:SetOwner(this, "ANCHOR_BOTTOM")
- GameTooltip:SetText("Start on Aux Buy panel", 0.9, 1.0, 1.0)
- GameTooltip:AddLine("If this option is checked, the Aux Buy panel will display first whenever you open the Auction House window.", 0.5, 0.5, 1.0, 1)
- GameTooltip:Show()
-
-end
-
------------------------------------------
-
-function Aux.options.show_instant_buyout_tooltip()
-
- GameTooltip:SetOwner(this, "ANCHOR_BOTTOM")
- GameTooltip:SetText("Instant buyout", 0.9, 1.0, 1.0)
- GameTooltip:AddLine("If this option is checked, right-clicking on an auction in the Browse tab will instantly buy it out.", 0.5, 0.5, 1.0, 1)
- GameTooltip:Show()
-
-end
diff --git a/options.xml b/options.xml
deleted file mode 100644
index b703553..0000000
--- a/options.xml
+++ /dev/null
@@ -1,386 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_sell_shortcut_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_sell_shortcut_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_buy_shortcut_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_buy_shortcut_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_open_sell_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if this:GetChecked() then
- AuxOptionsOpenBuy:SetChecked(false)
- end
-
-
- Aux.options.show_open_sell_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_open_buy_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- if this:GetChecked() then
- AuxOptionsOpenSell:SetChecked(false)
- end
-
-
- Aux.options.show_open_buy_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_instant_buyout_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Aux.options.show_instant_buyout_tooltip()
-
-
- GameTooltip:Hide()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/post_frame.lua b/post_frame.lua
index a864ded..f5d3c91 100644
--- a/post_frame.lua
+++ b/post_frame.lua
@@ -1,20 +1,16 @@
local private, public = {}, {}
-Aux.sell = public
Aux.post_frame = public
local existing_auctions = {}
-
local inventory_data
-local update_auction_listing, undercut, refresh_entries, auction_candidates, charge_classes, get_stack_size_slider_value
-
--local LIVE, HISTORICAL, FIXED = {}, {}, {}
function private.update_inventory_listing()
Aux.sheet.populate(private.listings.inventory, Aux.util.filter(inventory_data, function(item) return item.aux_quantity > 0 end))
end
-function update_auction_listing()
+function private.update_auction_listing()
Aux.sheet.populate(private.listings.auctions, private.current_item() and existing_auctions[private.current_item().key] or {})
end
@@ -147,7 +143,7 @@ function public.on_load()
comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, row)
- cell.text:SetText(row.stack_size == get_stack_size_slider_value() and GREEN_FONT_COLOR_CODE..row.stack_size..FONT_COLOR_CODE_CLOSE or row.stack_size)
+ cell.text:SetText(row.stack_size == private.get_stack_size_slider_value() and GREEN_FONT_COLOR_CODE..row.stack_size..FONT_COLOR_CODE_CLOSE or row.stack_size)
end,
},
{
@@ -204,7 +200,7 @@ function public.on_open()
AuxFrame:SetWidth(AuxSellInventory:GetWidth() + AuxSellParameters:GetWidth() + AuxSellAuctions:GetWidth() + 15)
-- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, LIVE)
- Aux_Sell_SetAuctionDuration(AUX_AUCTION_DURATION)
+ private.set_auction_duration(AUX_AUCTION_DURATION)
AuxSellStackSizeSlider:SetValueStep(1)
AuxSellStackSizeSliderText:SetText('Stack Size')
@@ -220,12 +216,12 @@ function public.on_open()
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 1)
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 1)
- Aux.sell.validate_parameters()
+ public.validate_parameters()
private.update_inventory_data()
private.update_inventory_listing()
- update_auction_listing()
+ private.update_auction_listing()
private.update_recommendation()
end
@@ -234,7 +230,7 @@ function public.on_close()
end
-function Aux.sell.duration_radio_button_on_click(index)
+function public.duration_radio_button_on_click(index)
AuxSellParametersShortDurationRadio:SetChecked(false)
AuxSellParametersMediumDurationRadio:SetChecked(false)
AuxSellParametersLongDurationRadio:SetChecked(false)
@@ -254,20 +250,20 @@ function Aux.sell.duration_radio_button_on_click(index)
private.update_recommendation()
end
-function Aux_Sell_SetAuctionDuration(duration)
+function private.set_auction_duration(duration)
if duration == 'short' then
- Aux.sell.duration_radio_button_on_click(1)
+ public.duration_radio_button_on_click(1)
elseif duration == 'medium' then
- Aux.sell.duration_radio_button_on_click(2)
+ public.duration_radio_button_on_click(2)
elseif duration == 'long' then
- Aux.sell.duration_radio_button_on_click(3)
+ public.duration_radio_button_on_click(3)
end
end
function private.post_auctions()
local auction = private.current_item()
if auction then
- local key, hyperlink, stack_size, buyout_price, stack_count = auction.key, auction.hyperlink, get_stack_size_slider_value(), MoneyInputFrame_GetCopper(AuxSellParametersBuyoutPrice), AuxSellStackCountSlider:GetValue()
+ local key, hyperlink, stack_size, buyout_price, stack_count = auction.key, auction.hyperlink, private.get_stack_size_slider_value(), MoneyInputFrame_GetCopper(AuxSellParametersBuyoutPrice), AuxSellStackCountSlider:GetValue()
local duration
if AuctionFrameAuctions.duration == 120 then
duration = 2
@@ -296,7 +292,7 @@ function private.post_auctions()
end
end
end
- Aux.sell.clear_auction()
+ public.clear_auction()
auction.aux_quantity = auction.aux_quantity - (posted * stack_size)
local charge_class = auction.charges or 0
auction.availability[charge_class] = auction.availability[charge_class] - (posted * (auction.charges and 1 or stack_size))
@@ -322,7 +318,7 @@ function private.select_auction()
end
end
- local auction = cheapest_for_size[get_stack_size_slider_value()] or cheapest
+ local auction = cheapest_for_size[private.get_stack_size_slider_value()] or cheapest
existing_auctions[private.current_item().key].selected = auction
private.listings.auctions:clear_selection()
@@ -330,7 +326,7 @@ function private.select_auction()
end
end
-function get_stack_size_slider_value()
+function private.get_stack_size_slider_value()
if private.current_item().charges then
return AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]
else
@@ -338,7 +334,7 @@ function get_stack_size_slider_value()
end
end
-function Aux.sell.validate_parameters()
+function public.validate_parameters()
private.post_button:Disable()
AuxSellParametersBuyoutPriceErrorText:Hide()
@@ -393,17 +389,17 @@ function private.update_recommendation()
private.refresh_button:Enable()
-- TODO neutral AH deposit formula
- MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', floor(private.current_item().unit_vendor_price * 0.05 * (private.current_item().charges and 1 or get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * AuctionFrameAuctions.duration / 120)
+ MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', floor(private.current_item().unit_vendor_price * 0.05 * (private.current_item().charges and 1 or private.get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * AuctionFrameAuctions.duration / 120)
if existing_auctions[private.current_item().key] then
private.select_auction()
if private.current_auction() then
- local new_buyout_price = private.current_auction().unit_buyout_price * get_stack_size_slider_value()
+ local new_buyout_price = private.current_auction().unit_buyout_price * private.get_stack_size_slider_value()
if private.current_auction().yours == 0 then
- new_buyout_price = undercut(new_buyout_price)
+ new_buyout_price = private.undercut(new_buyout_price)
end
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(new_buyout_price * 0.95)))
@@ -416,8 +412,8 @@ function private.update_recommendation()
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(market_value * 0.95)))
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(market_value)))
else
- MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(private.current_item().unit_vendor_price * (private.current_item().charges and 1 or get_stack_size_slider_value()) * 1.053)))
- MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(private.current_item().unit_vendor_price * (private.current_item().charges and 1 or get_stack_size_slider_value()) * 4)))
+ MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(private.current_item().unit_vendor_price * (private.current_item().charges and 1 or private.get_stack_size_slider_value()) * 1.053)))
+ MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(private.current_item().unit_vendor_price * (private.current_item().charges and 1 or private.get_stack_size_slider_value()) * 4)))
end
end
else -- no search yet
@@ -427,15 +423,15 @@ function private.update_recommendation()
end
end
-function Aux.sell.quantity_update()
+function public.quantity_update()
if private.current_item() then
- AuxSellStackCountSlider:SetMinMaxValues(1, private.current_item().charges and private.current_item().availability[AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]] or floor(private.current_item().availability[0] / get_stack_size_slider_value()))
+ AuxSellStackCountSlider:SetMinMaxValues(1, private.current_item().charges and private.current_item().availability[AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]] or floor(private.current_item().availability[0] / private.get_stack_size_slider_value()))
end
private.update_recommendation()
- update_auction_listing()
+ private.update_auction_listing()
end
-function Aux.sell.clear_auction()
+function public.clear_auction()
private.listings.inventory:clear_selection()
private.update_recommendation()
end
@@ -456,26 +452,26 @@ function private.set_item(item)
private.update_inventory_listing()
- local charge_classes = charge_classes(private.current_item().availability)
+ local charge_classes = private.charge_classes(private.current_item().availability)
AuxSellStackSizeSlider.charge_classes = private.current_item().charges and charge_classes
local stack_size_slider_max = private.current_item().charges and getn(charge_classes) or min(private.current_item().max_stack, private.current_item().availability[0])
AuxSellStackSizeSlider:SetMinMaxValues(1, stack_size_slider_max)
AuxSellStackSizeSlider:SetValue(stack_size_slider_max)
- Aux.sell.quantity_update()
+ public.quantity_update()
AuxSellStackCountSlider:SetValue(private.current_item().aux_quantity) -- reduced to max possible
if not existing_auctions[private.current_item().key] then
- refresh_entries()
+ private.refresh_entries()
end
private.update_recommendation()
- update_auction_listing()
+ private.update_auction_listing()
end)
end
-function charge_classes(availability)
+function private.charge_classes(availability)
local charge_classes = {}
for charge_class, _ in availability do
tinsert(charge_classes, charge_class)
@@ -566,7 +562,7 @@ function private.update_inventory_data()
end)
end
-function refresh_entries()
+function private.refresh_entries()
if private.current_item() then
local item_id, suffix_id = private.current_item().item_id, private.current_item().suffix_id
local item_key = item_id..':'..suffix_id
@@ -612,7 +608,7 @@ function refresh_entries()
on_complete = function()
existing_auctions[item_key] = existing_auctions[item_key] or { created = time() }
private.update_recommendation()
- update_auction_listing()
+ private.update_auction_listing()
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
end,
@@ -639,9 +635,9 @@ end
function private.refresh()
Aux.scan.abort(function()
- refresh_entries()
+ private.refresh_entries()
private.update_recommendation()
- update_auction_listing()
+ private.update_auction_listing()
end)
end
@@ -672,11 +668,11 @@ function private.record_auction(key, aux_quantity, buyout_price, duration, owner
end
end
-function undercut(price)
+function private.undercut(price)
return math.max(0, price - 1)
end
---function Aux.sell.initialize_strategy_dropdown()
+--function public.initialize_strategy_dropdown()
--
-- local function on_click()
-- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, this.value)
@@ -694,9 +690,9 @@ end
-- func = on_click,
-- }
--
----- UIDropDownMenu_AddButton{
----- text = 'Fixed',
----- value = FIXED,
----- func = on_click,
----- }
+-- UIDropDownMenu_AddButton{
+-- text = 'Fixed',
+-- value = FIXED,
+-- func = on_click,
+-- }
--end
diff --git a/post_frame.xml b/post_frame.xml
index 1f2ab9c..5b2b523 100644
--- a/post_frame.xml
+++ b/post_frame.xml
@@ -48,7 +48,7 @@
- Aux.sell.quantity_update()
+ Aux.post_frame.quantity_update()
@@ -56,7 +56,7 @@
- Aux.sell.quantity_update()
+ Aux.post_frame.quantity_update()
@@ -73,7 +73,7 @@
else
AuxSellStackSizeSlider:SetValue(this:GetNumber())
end
- Aux.sell.quantity_update()
+ Aux.post_frame.quantity_update()
-
+
-
+
@@ -193,7 +193,7 @@
- MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.sell.validate_parameters)
+ MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.post_frame.validate_parameters)
@@ -215,7 +215,7 @@
MoneyInputFrame_SetNextFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Gold'))
MoneyInputFrame_SetPreviousFocus(this, getglobal(this:GetParent():GetName()..'StartPriceCopper'))
MoneyInputFrame_SetNextFocus(this, getglobal(this:GetParent():GetName()..'StartPriceGold'))
- MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.sell.validate_parameters)
+ MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.post_frame.validate_parameters)