multiple refactorings

This commit is contained in:
Manuel Simon Hirsig
2016-01-25 18:35:05 +01:00
parent 7cbb349cd6
commit 67d013f494
10 changed files with 204 additions and 651 deletions
+1 -3
View File
@@ -10,6 +10,7 @@ gui.lua
control.xml control.xml
persistence.lua persistence.lua
util.lua util.lua
money.lua
scan.lua scan.lua
scan_util.lua scan_util.lua
@@ -28,8 +29,5 @@ auctions_frame.xml
bids_frame.xml bids_frame.xml
scan_frame.xml scan_frame.xml
options.xml
about.xml
static.xml static.xml
-49
View File
@@ -1,49 +0,0 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Frame name="AuxAboutFrame" frameStrata="HIGH" toplevel="true" parent="UIParent" enableMouse="true" hidden="true">
<Size><AbsDimension x="520" y="440" /></Size>
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="-90"/></Offset></Anchor></Anchors>
<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets><AbsInset left="11" right="12" top="12" bottom="11"/></BackgroundInsets>
<TileSize><AbsValue val="32"/></TileSize>
<EdgeSize><AbsValue val="32"/></EdgeSize>
</Backdrop>
<Layers>
<Layer level="BACKGROUND">
<FontString name="AuxAboutAuthorText" inherits="GameFontDisableSmall" justifyH="LEFT" justifyV="TOP">
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset><AbsDimension x="30" y="20"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<SimpleHTML name="AuxAboutDescriptionHTML">
<Size><AbsDimension x="460" y="420" /></Size>
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor>
</Anchors>
<FontString inherits="GameFontHighlightSmall"/>
<FontStringHeader1 inherits="GameFontNormal"/>
</SimpleHTML>
<Button inherits="UIPanelButtonTemplate" text="Close">
<Size><AbsDimension x="100" y="22"/> </Size>
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-20" y="15"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
AuxAboutFrame:Hide()
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>
+5 -10
View File
@@ -67,7 +67,7 @@ function Aux_OnLoad()
tab_group:create_tab('Auctions') tab_group:create_tab('Auctions')
tab_group:create_tab('Bids') tab_group:create_tab('Bids')
tab_group.on_select = Aux.on_tab_click tab_group.on_select = Aux.on_tab_click
tab_group:set_tab(1) Aux.tab_group = tab_group
end end
do do
local btn = Aux.gui.button(AuxFrame, 12) local btn = Aux.gui.button(AuxFrame, 12)
@@ -236,12 +236,7 @@ function Aux_OnAuctionHouseShow()
AuxFrame:Show() AuxFrame:Show()
Aux.on_tab_click(1) Aux.tab_group:set_tab(1)
if AUX_OPEN_SELL then
Aux.on_tab_click(2)
elseif AUX_OPEN_BUY then
end
end end
@@ -251,7 +246,7 @@ function Aux_OnAuctionHouseClosed()
Aux.scan.abort() Aux.scan.abort()
Aux.filter_search_frame.on_close() Aux.filter_search_frame.on_close()
Aux.sell.on_close() Aux.post_frame.on_close()
AuxFrame:Hide() AuxFrame:Hide()
end end
@@ -262,7 +257,7 @@ function Aux.on_tab_click(index)
Aux.scan.abort(function() Aux.scan.abort(function()
Aux.item_search_frame.on_close() Aux.item_search_frame.on_close()
Aux.filter_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.auctions_frame.on_close()
Aux.bids_frame.on_close() Aux.bids_frame.on_close()
Aux.history_frame.on_close() Aux.history_frame.on_close()
@@ -282,7 +277,7 @@ function Aux.on_tab_click(index)
Aux.filter_search_frame.on_open() Aux.filter_search_frame.on_open()
elseif index == 3 then elseif index == 3 then
AuxSellFrame:Show() AuxSellFrame:Show()
Aux.sell.on_open() Aux.post_frame.on_open()
elseif index == 4 then elseif index == 4 then
AuxAuctionsFrame:Show() AuxAuctionsFrame:Show()
Aux.auctions_frame.on_open() Aux.auctions_frame.on_open()
+10 -11
View File
@@ -3,7 +3,6 @@ Aux.buy = {}
local private, public = {}, {} local private, public = {}, {}
Aux.filter_search_frame = public Aux.filter_search_frame = public
local create_auction_record, find_auction, update_listing
local auctions local auctions
local search_query local search_query
local tooltip_patterns = {} local tooltip_patterns = {}
@@ -625,7 +624,7 @@ function public.stop_search()
Aux.scan.abort() Aux.scan.abort()
end end
function update_listing() function private.update_listing()
if not AuxFilterSearchFrame:IsVisible() then if not AuxFilterSearchFrame:IsVisible() then
return return
@@ -660,7 +659,7 @@ function public.set_view(view)
private.bid_button:Disable() private.bid_button:Disable()
private.clear_selection() private.clear_selection()
aux_view = view aux_view = view
update_listing() private.update_listing()
end end
function public.set_item(item_id) function public.set_item(item_id)
@@ -717,7 +716,7 @@ function public.start_search()
on_read_auction = function(auction_info) on_read_auction = function(auction_info)
if Aux.info.tooltip_match(tooltip_patterns, auction_info.tooltip) then if Aux.info.tooltip_match(tooltip_patterns, auction_info.tooltip) then
auctions = auctions or {} auctions = auctions or {}
tinsert(auctions, create_auction_record(auction_info, current_page)) tinsert(auctions, private.create_auction_record(auction_info, current_page))
end end
end, end,
on_complete = function() on_complete = function()
@@ -753,7 +752,7 @@ function private.clear_selection()
private.listings[aux_view]:clear_selection() private.listings[aux_view]:clear_selection()
end 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 if buyout_mode and not entry.buyout_price then
return return
@@ -769,7 +768,7 @@ function find_auction(entry, express_mode, buyout_mode)
PlaySound('igMainMenuOptionCheckBoxOn') PlaySound('igMainMenuOptionCheckBoxOn')
local function test(index) 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 end
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index) 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 end
if not test(index) then 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 end
if express_mode then if express_mode then
@@ -805,7 +804,7 @@ function find_auction(entry, express_mode, buyout_mode)
if not test(index) then if not test(index) then
private.buyout_button:Disable() private.buyout_button:Disable()
private.bid_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 end
if GetMoney() >= amount then if GetMoney() >= amount then
@@ -849,11 +848,11 @@ function private.on_row_click(sheet, datum, grouped)
sheet:clear_selection() sheet:clear_selection()
sheet:select(datum) sheet:select(datum)
end end
find_auction(entry, express_mode, buyout_mode) private.find_auction(entry, express_mode, buyout_mode)
end end
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 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 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() function Aux.buy.onupdate()
if refresh then if refresh then
refresh = false refresh = false
update_listing() private.update_listing()
end end
end end
+15 -23
View File
@@ -3,19 +3,11 @@ Aux.item_search_frame = public
aux_recently_searched = {} 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 auctions
local search_query local search_query
local refresh 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() function public.on_close()
private.clear_selection() private.clear_selection()
private.buyout_button:Disable() private.buyout_button:Disable()
@@ -448,7 +440,7 @@ function public.stop_search()
Aux.scan.abort() Aux.scan.abort()
end end
function update_listing() function private.update_listing()
if not AuxItemSearchFrame:IsVisible() then if not AuxItemSearchFrame:IsVisible() then
return return
@@ -489,7 +481,7 @@ function public.set_view(view)
private.bid_button:Disable() private.bid_button:Disable()
private.clear_selection() private.clear_selection()
aux_view = view aux_view = view
update_listing() private.update_listing()
end end
function private.update_recently_searched() function private.update_recently_searched()
@@ -578,7 +570,7 @@ function public.start_search()
on_read_auction = function(auction_info) on_read_auction = function(auction_info)
if auction_info.item_id == item_id then if auction_info.item_id == item_id then
auctions = auctions or {} auctions = auctions or {}
tinsert(auctions, create_auction_record(auction_info, current_page)) tinsert(auctions, private.create_auction_record(auction_info, current_page))
end end
end, end,
on_complete = function() on_complete = function()
@@ -615,8 +607,8 @@ function private.clear_selection()
private.listings[aux_view]:clear_selection() private.listings[aux_view]:clear_selection()
end 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 if buyout_mode and not entry.buyout_price then
return return
end end
@@ -631,7 +623,7 @@ function find_auction(entry, express_mode, buyout_mode)
PlaySound('igMainMenuOptionCheckBoxOn') PlaySound('igMainMenuOptionCheckBoxOn')
local function test(index) 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 end
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index) 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 end
if not test(index) then 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 end
if express_mode then if express_mode then
@@ -668,7 +660,7 @@ function find_auction(entry, express_mode, buyout_mode)
if not test(index) then if not test(index) then
private.buyout_button:Disable() private.buyout_button:Disable()
private.bid_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 end
if GetMoney() >= amount then if GetMoney() >= amount then
@@ -698,8 +690,8 @@ function private.on_row_click(sheet, datum, grouped)
local express_mode = IsAltKeyDown() local express_mode = IsAltKeyDown()
local buyout_mode = express_mode and arg1 == 'LeftButton' local buyout_mode = express_mode and arg1 == 'LeftButton'
if IsControlKeyDown() then if IsControlKeyDown() then
DressUpItemLink(entry.hyperlink) DressUpItemLink(entry.hyperlink)
elseif IsShiftKeyDown() then elseif IsShiftKeyDown() then
if ChatFrameEditBox:IsVisible() then if ChatFrameEditBox:IsVisible() then
@@ -712,12 +704,12 @@ function private.on_row_click(sheet, datum, grouped)
sheet:clear_selection() sheet:clear_selection()
sheet:select(datum) sheet:select(datum)
end end
find_auction(entry, express_mode, buyout_mode) private.find_auction(entry, express_mode, buyout_mode)
end end
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 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 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 local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
@@ -764,6 +756,6 @@ end
function public.on_update() function public.on_update()
if refresh then if refresh then
refresh = false refresh = false
update_listing() private.update_listing()
end end
end end
+122
View File
@@ -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
-114
View File
@@ -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("<html><body>"
.."<h1>What is Aux?</h1><br/>"
.."<p>"
.."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."
.."</p><br/><h1>Aux Sell</h1><br/><p>"
.."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."
.."</p><br/><h1>Aux Buy</h1><br/><p>"
.."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."
.."</p>"
.."</body></html>")
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
-386
View File
@@ -1,386 +0,0 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="options.lua"/>
<Frame name="AuxOptionsButtonTemplate" virtual="true" hidden="true">
<Size>
<AbsDimension x="1" y="1"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="210" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Frames>
<Button name="AuxOptionsButton" inherits="UIPanelButtonTemplate" text="Aux">
<Size><AbsDimension x="50" y="22"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="758" y="-12"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
if AuxFrame:IsVisible() then
AuxFrame:Hide()
else
AuxFrame:Show()
end
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
<Frame name="AuxOptionsFrame" frameStrata="HIGH" toplevel="true" parent="UIParent" enableMouse="true" hidden="true">
<Size><AbsDimension x="400" y="440"/></Size>
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="-170"/></Offset></Anchor></Anchors>
<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
<BackgroundInsets><AbsInset left="11" right="12" top="12" bottom="11"/></BackgroundInsets>
<TileSize><AbsValue val="32"/></TileSize>
<EdgeSize><AbsValue val="32"/></EdgeSize>
</Backdrop>
<Layers>
<Layer level="ARTWORK">
<Texture name="AuxOptionsHeader" file="Interface\DialogFrame\UI-DialogBox-Header">
<Size x="120" y="64"/>
<Anchors><Anchor point="TOP"><Offset x="0" y="12"/></Anchor></Anchors>
</Texture>
<FontString inherits="GameFontNormal" text="Aux">
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsHeader">
<Offset x="0" y="-14"/>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<Frame name="AuxOptionsAboutTitle">
<Size><AbsDimension y="30" /></Size>
<Anchors>
<Anchor point="TOP"><Offset><AbsDimension y="-50"/></Offset></Anchor>
<Anchor point="LEFT"><Offset><AbsDimension x="30"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-30"/></Offset></Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString inherits="GameFontNormal" text="About Aux" justifyH="LEFT" justifyV="TOP"></FontString>
</Layer>
</Layers>
</Frame>
<Frame>
<Size><AbsDimension y="35" /></Size>
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsAboutTitle" relativePoint="BOTTOM"><Offset><AbsDimension y="-5"/></Offset></Anchor>
<Anchor point="LEFT"><Offset><AbsDimension x="30"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-30"/></Offset></Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="AuxOptionsSummary" inherits="GameFontHighlight" justifyH="LEFT" justifyV="TOP" >
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
<Button inherits="UIPanelButtonTemplate" text="Read More">
<Size><AbsDimension x="80" y="18"/> </Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="AuxOptionsSummary" relativePoint="BOTTOMLEFT"><Offset><AbsDimension x="-3" y="-5"/></Offset></Anchor>
</Anchors>
<NormalFont inherits="GameFontNormalSmall"/>
<HighlightFont inherits="GameFontHighlightSmall"/>
<Scripts>
<OnClick>
Aux.options.show_description()
</OnClick>
</Scripts>
</Button>
<Frame name="AuxOptionsConfigTitle">
<Size><AbsDimension y="30" /></Size>
<Anchors>
<Anchor point="TOP" ><Offset><AbsDimension y="-180"/></Offset></Anchor>
<Anchor point="LEFT" ><Offset><AbsDimension x="30"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-30"/></Offset></Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="AuxOptionsConfigTitleText" inherits="GameFontNormal" justifyH="LEFT" justifyV="TOP" text="Options">
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="AuxOptionsSellShortcutBox">
<Size><AbsDimension y="40" /></Size>
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsConfigTitle" relativePoint="BOTTOM" ><Offset><AbsDimension y="-5"/></Offset></Anchor>
<Anchor point="LEFT" ><Offset><AbsDimension x="40"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-20"/></Offset></Anchor>
</Anchors>
<Scripts>
<OnEnter>
Aux.options.show_sell_shortcut_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<Frames>
<CheckButton name="AuxOptionsSellShortcut" inherits="UICheckButtonTemplate">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString inherits="GameFontHighlight" text="Aux Sell shortcut">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="AuxOptionsSellShortcut">
<Offset><AbsDimension x="8" y="1"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnEnter>
Aux.options.show_sell_shortcut_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</CheckButton>
</Frames>
</Frame>
<Frame name="AuxOptionsBuyShortcutBox">
<Size><AbsDimension y="40" /></Size>
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsConfigTitle" relativePoint="BOTTOM" ><Offset><AbsDimension y="-35"/></Offset></Anchor>
<Anchor point="LEFT" ><Offset><AbsDimension x="40"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-20"/></Offset></Anchor>
</Anchors>
<Scripts>
<OnEnter>
Aux.options.show_buy_shortcut_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<Frames>
<CheckButton name="AuxOptionsBuyShortcut" inherits="UICheckButtonTemplate">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString inherits="GameFontHighlight" text="Aux Buy Shortcut">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="AuxOptionsBuyShortcut">
<Offset><AbsDimension x="8" y="1"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnEnter>
Aux.options.show_buy_shortcut_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</CheckButton>
</Frames>
</Frame>
<Frame name="AuxOptionsOpenSellBox">
<Size><AbsDimension y="40" /></Size>
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsConfigTitle" relativePoint="BOTTOM" ><Offset><AbsDimension y="-65"/></Offset></Anchor>
<Anchor point="LEFT" ><Offset><AbsDimension x="40"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-20"/></Offset></Anchor>
</Anchors>
<Scripts>
<OnEnter>
Aux.options.show_open_sell_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<Frames>
<CheckButton name="AuxOptionsOpenSell" inherits="UICheckButtonTemplate">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString inherits="GameFontHighlight" text="Start on Aux Sell panel">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="AuxOptionsOpenSell">
<Offset><AbsDimension x="8" y="1"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
if this:GetChecked() then
AuxOptionsOpenBuy:SetChecked(false)
end
</OnClick>
<OnEnter>
Aux.options.show_open_sell_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</CheckButton>
</Frames>
</Frame>
<Frame name="AuxOptionsOpenBuyBox">
<Size><AbsDimension y="40" /></Size>
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsConfigTitle" relativePoint="BOTTOM" ><Offset><AbsDimension y="-95"/></Offset></Anchor>
<Anchor point="LEFT" ><Offset><AbsDimension x="40"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-20"/></Offset></Anchor>
</Anchors>
<Scripts>
<OnEnter>
Aux.options.show_open_buy_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<Frames>
<CheckButton name="AuxOptionsOpenBuy" inherits="UICheckButtonTemplate">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString inherits="GameFontHighlight" text="Start on Aux Buy panel">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="AuxOptionsOpenBuy">
<Offset><AbsDimension x="8" y="1"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
if this:GetChecked() then
AuxOptionsOpenSell:SetChecked(false)
end
</OnClick>
<OnEnter>
Aux.options.show_open_buy_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</CheckButton>
</Frames>
</Frame>
<Frame name="AuxOptionsInstantBuyoutBox">
<Size><AbsDimension y="40" /></Size>
<Anchors>
<Anchor point="TOP" relativeTo="AuxOptionsConfigTitle" relativePoint="BOTTOM" ><Offset><AbsDimension y="-125"/></Offset></Anchor>
<Anchor point="LEFT" ><Offset><AbsDimension x="40"/></Offset></Anchor>
<Anchor point="RIGHT"><Offset><AbsDimension x="-20"/></Offset></Anchor>
</Anchors>
<Scripts>
<OnEnter>
Aux.options.show_instant_buyout_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
<Frames>
<CheckButton name="AuxOptionsInstantBuyout" inherits="UICheckButtonTemplate">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString inherits="GameFontHighlight" text="Instant buyout">
<Anchors>
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="AuxOptionsInstantBuyout">
<Offset><AbsDimension x="8" y="1"/></Offset>
</Anchor>
</Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnEnter>
Aux.options.show_instant_buyout_tooltip()
</OnEnter>
<OnLeave>
GameTooltip:Hide()
</OnLeave>
</Scripts>
</CheckButton>
</Frames>
</Frame>
<Frame>
<Size><AbsDimension x="150" y="40" /></Size>
<Anchors>
<Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="25" y="5"/></Offset></Anchor>
</Anchors>
<Layers>
<Layer level="BACKGROUND">
<FontString name="AuxOptionsVersionText" inherits="GameFontDisableSmall" justifyH="LEFT" justifyV="TOP"></FontString>
</Layer>
</Layers>
</Frame>
<Button name="AuxOptionsCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
<Size><AbsDimension x="80" y="22"/> </Size>
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-20" y="15"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
AuxOptionsFrame:Hide()
</OnClick>
</Scripts>
</Button>
<Button inherits="UIPanelButtonTemplate" text="Okay">
<Size><AbsDimension x="80" y="22"/> </Size>
<Anchors><Anchor point="RIGHT" relativePoint="LEFT" relativeTo="AuxOptionsCancelButton"><Offset><AbsDimension x="-3" y="0"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
Aux.options.save()
AuxOptionsFrame:Hide()
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Ui>
+40 -44
View File
@@ -1,20 +1,16 @@
local private, public = {}, {} local private, public = {}, {}
Aux.sell = public
Aux.post_frame = public Aux.post_frame = public
local existing_auctions = {} local existing_auctions = {}
local inventory_data local inventory_data
local update_auction_listing, undercut, refresh_entries, auction_candidates, charge_classes, get_stack_size_slider_value
--local LIVE, HISTORICAL, FIXED = {}, {}, {} --local LIVE, HISTORICAL, FIXED = {}, {}, {}
function private.update_inventory_listing() function private.update_inventory_listing()
Aux.sheet.populate(private.listings.inventory, Aux.util.filter(inventory_data, function(item) return item.aux_quantity > 0 end)) Aux.sheet.populate(private.listings.inventory, Aux.util.filter(inventory_data, function(item) return item.aux_quantity > 0 end))
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 {}) Aux.sheet.populate(private.listings.auctions, private.current_item() and existing_auctions[private.current_item().key] or {})
end 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, 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_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, row) 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, end,
}, },
{ {
@@ -204,7 +200,7 @@ function public.on_open()
AuxFrame:SetWidth(AuxSellInventory:GetWidth() + AuxSellParameters:GetWidth() + AuxSellAuctions:GetWidth() + 15) AuxFrame:SetWidth(AuxSellInventory:GetWidth() + AuxSellParameters:GetWidth() + AuxSellAuctions:GetWidth() + 15)
-- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, LIVE) -- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, LIVE)
Aux_Sell_SetAuctionDuration(AUX_AUCTION_DURATION) private.set_auction_duration(AUX_AUCTION_DURATION)
AuxSellStackSizeSlider:SetValueStep(1) AuxSellStackSizeSlider:SetValueStep(1)
AuxSellStackSizeSliderText:SetText('Stack Size') AuxSellStackSizeSliderText:SetText('Stack Size')
@@ -220,12 +216,12 @@ function public.on_open()
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 1) MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 1)
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 1) MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 1)
Aux.sell.validate_parameters() public.validate_parameters()
private.update_inventory_data() private.update_inventory_data()
private.update_inventory_listing() private.update_inventory_listing()
update_auction_listing() private.update_auction_listing()
private.update_recommendation() private.update_recommendation()
end end
@@ -234,7 +230,7 @@ function public.on_close()
end end
function Aux.sell.duration_radio_button_on_click(index) function public.duration_radio_button_on_click(index)
AuxSellParametersShortDurationRadio:SetChecked(false) AuxSellParametersShortDurationRadio:SetChecked(false)
AuxSellParametersMediumDurationRadio:SetChecked(false) AuxSellParametersMediumDurationRadio:SetChecked(false)
AuxSellParametersLongDurationRadio:SetChecked(false) AuxSellParametersLongDurationRadio:SetChecked(false)
@@ -254,20 +250,20 @@ function Aux.sell.duration_radio_button_on_click(index)
private.update_recommendation() private.update_recommendation()
end end
function Aux_Sell_SetAuctionDuration(duration) function private.set_auction_duration(duration)
if duration == 'short' then if duration == 'short' then
Aux.sell.duration_radio_button_on_click(1) public.duration_radio_button_on_click(1)
elseif duration == 'medium' then elseif duration == 'medium' then
Aux.sell.duration_radio_button_on_click(2) public.duration_radio_button_on_click(2)
elseif duration == 'long' then elseif duration == 'long' then
Aux.sell.duration_radio_button_on_click(3) public.duration_radio_button_on_click(3)
end end
end end
function private.post_auctions() function private.post_auctions()
local auction = private.current_item() local auction = private.current_item()
if auction then 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 local duration
if AuctionFrameAuctions.duration == 120 then if AuctionFrameAuctions.duration == 120 then
duration = 2 duration = 2
@@ -296,7 +292,7 @@ function private.post_auctions()
end end
end end
end end
Aux.sell.clear_auction() public.clear_auction()
auction.aux_quantity = auction.aux_quantity - (posted * stack_size) auction.aux_quantity = auction.aux_quantity - (posted * stack_size)
local charge_class = auction.charges or 0 local charge_class = auction.charges or 0
auction.availability[charge_class] = auction.availability[charge_class] - (posted * (auction.charges and 1 or stack_size)) 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
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 existing_auctions[private.current_item().key].selected = auction
private.listings.auctions:clear_selection() private.listings.auctions:clear_selection()
@@ -330,7 +326,7 @@ function private.select_auction()
end end
end end
function get_stack_size_slider_value() function private.get_stack_size_slider_value()
if private.current_item().charges then if private.current_item().charges then
return AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()] return AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]
else else
@@ -338,7 +334,7 @@ function get_stack_size_slider_value()
end end
end end
function Aux.sell.validate_parameters() function public.validate_parameters()
private.post_button:Disable() private.post_button:Disable()
AuxSellParametersBuyoutPriceErrorText:Hide() AuxSellParametersBuyoutPriceErrorText:Hide()
@@ -393,17 +389,17 @@ function private.update_recommendation()
private.refresh_button:Enable() private.refresh_button:Enable()
-- TODO neutral AH deposit formula -- 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 if existing_auctions[private.current_item().key] then
private.select_auction() private.select_auction()
if private.current_auction() then 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 if private.current_auction().yours == 0 then
new_buyout_price = undercut(new_buyout_price) new_buyout_price = private.undercut(new_buyout_price)
end end
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(new_buyout_price * 0.95))) 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(AuxSellParametersStartPrice, max(1, Aux.round(market_value * 0.95)))
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(market_value))) MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(market_value)))
else 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(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 get_stack_size_slider_value()) * 4))) 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
end end
else -- no search yet else -- no search yet
@@ -427,15 +423,15 @@ function private.update_recommendation()
end end
end end
function Aux.sell.quantity_update() function public.quantity_update()
if private.current_item() then 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 end
private.update_recommendation() private.update_recommendation()
update_auction_listing() private.update_auction_listing()
end end
function Aux.sell.clear_auction() function public.clear_auction()
private.listings.inventory:clear_selection() private.listings.inventory:clear_selection()
private.update_recommendation() private.update_recommendation()
end end
@@ -456,26 +452,26 @@ function private.set_item(item)
private.update_inventory_listing() 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 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]) 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:SetMinMaxValues(1, stack_size_slider_max)
AuxSellStackSizeSlider:SetValue(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 AuxSellStackCountSlider:SetValue(private.current_item().aux_quantity) -- reduced to max possible
if not existing_auctions[private.current_item().key] then if not existing_auctions[private.current_item().key] then
refresh_entries() private.refresh_entries()
end end
private.update_recommendation() private.update_recommendation()
update_auction_listing() private.update_auction_listing()
end) end)
end end
function charge_classes(availability) function private.charge_classes(availability)
local charge_classes = {} local charge_classes = {}
for charge_class, _ in availability do for charge_class, _ in availability do
tinsert(charge_classes, charge_class) tinsert(charge_classes, charge_class)
@@ -566,7 +562,7 @@ function private.update_inventory_data()
end) end)
end end
function refresh_entries() function private.refresh_entries()
if private.current_item() then if private.current_item() then
local item_id, suffix_id = private.current_item().item_id, private.current_item().suffix_id local item_id, suffix_id = private.current_item().item_id, private.current_item().suffix_id
local item_key = item_id..':'..suffix_id local item_key = item_id..':'..suffix_id
@@ -612,7 +608,7 @@ function refresh_entries()
on_complete = function() on_complete = function()
existing_auctions[item_key] = existing_auctions[item_key] or { created = time() } existing_auctions[item_key] = existing_auctions[item_key] or { created = time() }
private.update_recommendation() private.update_recommendation()
update_auction_listing() private.update_auction_listing()
private.status_bar:update_status(100, 100) private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning') private.status_bar:set_text('Done Scanning')
end, end,
@@ -639,9 +635,9 @@ end
function private.refresh() function private.refresh()
Aux.scan.abort(function() Aux.scan.abort(function()
refresh_entries() private.refresh_entries()
private.update_recommendation() private.update_recommendation()
update_auction_listing() private.update_auction_listing()
end) end)
end end
@@ -672,11 +668,11 @@ function private.record_auction(key, aux_quantity, buyout_price, duration, owner
end end
end end
function undercut(price) function private.undercut(price)
return math.max(0, price - 1) return math.max(0, price - 1)
end end
--function Aux.sell.initialize_strategy_dropdown() --function public.initialize_strategy_dropdown()
-- --
-- local function on_click() -- local function on_click()
-- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, this.value) -- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, this.value)
@@ -694,9 +690,9 @@ end
-- func = on_click, -- func = on_click,
-- } -- }
-- --
---- UIDropDownMenu_AddButton{ -- UIDropDownMenu_AddButton{
---- text = 'Fixed', -- text = 'Fixed',
---- value = FIXED, -- value = FIXED,
---- func = on_click, -- func = on_click,
---- } -- }
--end --end
+11 -11
View File
@@ -48,7 +48,7 @@
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="10" y="-70"/></Offset></Anchor></Anchors> <Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="10" y="-70"/></Offset></Anchor></Anchors>
<Scripts> <Scripts>
<OnValueChanged> <OnValueChanged>
Aux.sell.quantity_update() Aux.post_frame.quantity_update()
</OnValueChanged> </OnValueChanged>
</Scripts> </Scripts>
</Slider> </Slider>
@@ -56,7 +56,7 @@
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="10" y="-100"/></Offset></Anchor></Anchors> <Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="10" y="-100"/></Offset></Anchor></Anchors>
<Scripts> <Scripts>
<OnValueChanged> <OnValueChanged>
Aux.sell.quantity_update() Aux.post_frame.quantity_update()
</OnValueChanged> </OnValueChanged>
</Scripts> </Scripts>
</Slider> </Slider>
@@ -73,7 +73,7 @@
else else
AuxSellStackSizeSlider:SetValue(this:GetNumber()) AuxSellStackSizeSlider:SetValue(this:GetNumber())
end end
Aux.sell.quantity_update() Aux.post_frame.quantity_update()
</OnTextChanged> </OnTextChanged>
<OnTabPressed> <OnTabPressed>
<!-- if (IsShiftKeyDown()) then <!-- if (IsShiftKeyDown()) then
@@ -103,7 +103,7 @@
else else
AuxSellStackCountSlider:SetValue(this:GetNumber()) AuxSellStackCountSlider:SetValue(this:GetNumber())
end end
Aux.sell.quantity_update() Aux.post_frame.quantity_update()
</OnTextChanged> </OnTextChanged>
<OnTabPressed> <OnTabPressed>
<!-- if (IsShiftKeyDown()) then <!-- if (IsShiftKeyDown()) then
@@ -134,7 +134,7 @@
getglobal(this:GetName().."Text"):SetText("2h") getglobal(this:GetName().."Text"):SetText("2h")
</OnLoad> </OnLoad>
<OnClick> <OnClick>
Aux.sell.duration_radio_button_on_click(1) Aux.post_frame.duration_radio_button_on_click(1)
</OnClick> </OnClick>
</Scripts> </Scripts>
</CheckButton> </CheckButton>
@@ -145,7 +145,7 @@
getglobal(this:GetName()..'Text'):SetText("8h") getglobal(this:GetName()..'Text'):SetText("8h")
</OnLoad> </OnLoad>
<OnClick> <OnClick>
Aux.sell.duration_radio_button_on_click(2) Aux.post_frame.duration_radio_button_on_click(2)
</OnClick> </OnClick>
</Scripts> </Scripts>
</CheckButton> </CheckButton>
@@ -156,7 +156,7 @@
getglobal(this:GetName().."Text"):SetText("24h") getglobal(this:GetName().."Text"):SetText("24h")
</OnLoad> </OnLoad>
<OnClick> <OnClick>
Aux.sell.duration_radio_button_on_click(3) Aux.post_frame.duration_radio_button_on_click(3)
</OnClick> </OnClick>
</Scripts> </Scripts>
</CheckButton> </CheckButton>
@@ -175,10 +175,10 @@
<!--<Scripts>--> <!--<Scripts>-->
<!--<OnLoad>--> <!--<OnLoad>-->
<!--UIDropDownMenu_SetWidth(100)--> <!--UIDropDownMenu_SetWidth(100)-->
<!--UIDropDownMenu_Initialize(this, Aux.sell.initialize_strategy_dropdown)--> <!--UIDropDownMenu_Initialize(this, Aux.post_frame.initialize_strategy_dropdown)-->
<!--</OnLoad>--> <!--</OnLoad>-->
<!--<OnShow>--> <!--<OnShow>-->
<!--UIDropDownMenu_Initialize(this, Aux.sell.initialize_strategy_dropdown)--> <!--UIDropDownMenu_Initialize(this, Aux.post_frame.initialize_strategy_dropdown)-->
<!--</OnShow>--> <!--</OnShow>-->
<!--</Scripts>--> <!--</Scripts>-->
<!--</Frame>--> <!--</Frame>-->
@@ -193,7 +193,7 @@
</layers> </layers>
<Scripts> <Scripts>
<OnLoad> <OnLoad>
MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.sell.validate_parameters) MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.post_frame.validate_parameters)
</OnLoad> </OnLoad>
</Scripts> </Scripts>
</Frame> </Frame>
@@ -215,7 +215,7 @@
MoneyInputFrame_SetNextFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Gold')) MoneyInputFrame_SetNextFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Gold'))
MoneyInputFrame_SetPreviousFocus(this, getglobal(this:GetParent():GetName()..'StartPriceCopper')) MoneyInputFrame_SetPreviousFocus(this, getglobal(this:GetParent():GetName()..'StartPriceCopper'))
MoneyInputFrame_SetNextFocus(this, getglobal(this:GetParent():GetName()..'StartPriceGold')) MoneyInputFrame_SetNextFocus(this, getglobal(this:GetParent():GetName()..'StartPriceGold'))
MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.sell.validate_parameters) MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.post_frame.validate_parameters)
</OnLoad> </OnLoad>
</Scripts> </Scripts>
</Frame> </Frame>