lots of post tab refactoring
This commit is contained in:
+18
-55
@@ -19,6 +19,7 @@ end
|
||||
function public.on_close()
|
||||
private.clear_selection()
|
||||
private.buyout_button:Disable()
|
||||
private.bid_button:Disable()
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
@@ -132,33 +133,7 @@ function public.on_load()
|
||||
cell.text:SetText(getn(Aux.util.filter(group, function(auction) return not auction.gone end)))
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Pct',
|
||||
width = 40,
|
||||
comparator = function(group1, group2)
|
||||
local market_price1 = Aux.history.market_value(group1[1].item_key)
|
||||
local market_price2 = Aux.history.market_value(group2[1].item_key)
|
||||
local factor1 = market_price1 > 0 and group1[1].buyout_price_per_unit / market_price1
|
||||
local factor2 = market_price2 > 0 and group2[1].buyout_price_per_unit / market_price2
|
||||
return Aux.util.compare(factor1, factor2, Aux.util.GT)
|
||||
end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, group)
|
||||
local market_price = Aux.history.market_value(group[1].item_key)
|
||||
|
||||
local pct = market_price > 0 and ceil(100 / market_price * group[1].buyout_price_per_unit)
|
||||
if not pct then
|
||||
cell.text:SetText('N/A')
|
||||
elseif pct > 999 then
|
||||
cell.text:SetText('>999%')
|
||||
else
|
||||
cell.text:SetText(pct..'%')
|
||||
end
|
||||
if pct then
|
||||
cell.text:SetTextColor(Aux.price_level_color(pct))
|
||||
end
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.percentage_market_column(function(group) return group[1].item_key end, function(group) return group[1].buyout_price_per_unit end),
|
||||
},
|
||||
sort_order = {{column = 3, order = 'ascending' }},
|
||||
},
|
||||
@@ -344,33 +319,7 @@ function public.on_load()
|
||||
cell.text:SetText(datum.page)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Pct',
|
||||
width = 40,
|
||||
comparator = function(row1, row2)
|
||||
local market_price1 = Aux.history.market_value(row1.item_key)
|
||||
local market_price2 = Aux.history.market_value(row2.item_key)
|
||||
local factor1 = market_price1 > 0 and row1.buyout_price_per_unit and row1.buyout_price_per_unit / market_price1
|
||||
local factor2 = market_price2 > 0 and row2.buyout_price_per_unit and row2.buyout_price_per_unit / market_price2
|
||||
return Aux.util.compare(factor1, factor2, Aux.util.GT)
|
||||
end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
local market_price = Aux.history.market_value(datum.item_key)
|
||||
|
||||
local pct = market_price > 0 and datum.buyout_price_per_unit and ceil(100 / market_price * datum.buyout_price_per_unit)
|
||||
if not pct then
|
||||
cell.text:SetText('N/A')
|
||||
elseif pct > 999 then
|
||||
cell.text:SetText('>999%')
|
||||
else
|
||||
cell.text:SetText(pct..'%')
|
||||
end
|
||||
if pct then
|
||||
cell.text:SetTextColor(Aux.price_level_color(pct))
|
||||
end
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.percentage_market_column(function(entry) return entry.item_key end, function(entry) return entry.buyout_price_per_unit end),
|
||||
},
|
||||
sort_order = {{column = 5, order = 'ascending'}},
|
||||
},
|
||||
@@ -448,7 +397,7 @@ function public.on_load()
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(30)
|
||||
status_bar:SetPoint('BOTTOMLEFT', AuxItemSearchFrame, 'BOTTOMLEFT', 6, 6)
|
||||
status_bar:update_status(0,0)
|
||||
status_bar:update_status(100, 0)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
@@ -461,6 +410,15 @@ function public.on_load()
|
||||
btn:Disable()
|
||||
private.buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxItemSearchFrame, 15)
|
||||
btn:SetPoint('TOPLEFT', private.buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Bid')
|
||||
btn:Disable()
|
||||
private.bid_button = btn
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(AuxItemSearchFrameItem, '$parentPageEditBox')
|
||||
editbox:SetNumeric(true)
|
||||
@@ -528,6 +486,7 @@ end
|
||||
|
||||
function public.set_view(view)
|
||||
private.buyout_button:Disable()
|
||||
private.bid_button:Disable()
|
||||
private.clear_selection()
|
||||
aux_view = view
|
||||
update_listing()
|
||||
@@ -708,6 +667,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
|
||||
end
|
||||
|
||||
@@ -717,10 +677,12 @@ function find_auction(entry, express_mode, buyout_mode)
|
||||
Aux.place_bid('list', index, entry.buyout_price)
|
||||
|
||||
private.buyout_button:Disable()
|
||||
private.bid_button:Disable()
|
||||
private.clear_selection()
|
||||
refresh = true
|
||||
end)
|
||||
private.buyout_button:Enable()
|
||||
private.bid_button:Enable()
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -746,6 +708,7 @@ function private.on_row_click(sheet, datum, grouped)
|
||||
elseif not entry.gone then
|
||||
if not express_mode then
|
||||
private.buyout_button:Disable()
|
||||
private.bid_button:Disable()
|
||||
sheet:clear_selection()
|
||||
sheet:select(datum)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user