lots of post tab refactoring
This commit is contained in:
+29
-65
@@ -12,6 +12,7 @@ local refresh
|
||||
function public.on_close()
|
||||
private.clear_selection()
|
||||
private.buyout_button:Disable()
|
||||
private.bid_button:Disable()
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
@@ -109,33 +110,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 = 1, order = 'ascending' }, {column = 4, order = 'ascending'}},
|
||||
},
|
||||
@@ -394,33 +369,7 @@ function public.on_load()
|
||||
cell.text:SetText(datum.owner)
|
||||
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 = 1, order = 'ascending' }, {column = 7, order = 'ascending' }},
|
||||
},
|
||||
@@ -461,7 +410,7 @@ function public.on_load()
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(30)
|
||||
status_bar:SetPoint('BOTTOMLEFT', AuxFilterSearchFrame, '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
|
||||
@@ -474,6 +423,15 @@ function public.on_load()
|
||||
btn:Disable()
|
||||
private.buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxFilterSearchFrame, 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(AuxFilterSearchFrameFilters, '$parentNameInputBox')
|
||||
editbox:SetPoint('TOPLEFT', 14, -20)
|
||||
@@ -510,7 +468,7 @@ function public.on_load()
|
||||
local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentMinLevel')
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(2)
|
||||
editbox:SetPoint('TOPLEFT', 14, -135)
|
||||
editbox:SetPoint('TOPLEFT', 14, -140)
|
||||
editbox:SetWidth(30)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
@@ -534,7 +492,7 @@ function public.on_load()
|
||||
local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentMaxLevel')
|
||||
editbox:SetNumeric(true)
|
||||
editbox:SetMaxLetters(2)
|
||||
editbox:SetPoint('TOPLEFT', 54, -135)
|
||||
editbox:SetPoint('TOPLEFT', 54, -140)
|
||||
editbox:SetWidth(30)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
@@ -556,12 +514,12 @@ function public.on_load()
|
||||
end
|
||||
do
|
||||
local label = Aux.gui.label(AuxFilterSearchFrameFiltersUsableCheckButton, 13)
|
||||
label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersUsableCheckButton, 'TOPLEFT', -2, 1)
|
||||
label:SetPoint('BOTTOMLEFT', AuxFilterSearchFrameFiltersUsableCheckButton, 'TOPLEFT', 1, -3)
|
||||
label:SetText('Usable')
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox1')
|
||||
editbox:SetPoint('TOPLEFT', 14, -170)
|
||||
editbox:SetPoint('TOPLEFT', 14, -177)
|
||||
editbox:SetWidth(150)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
@@ -583,7 +541,7 @@ function public.on_load()
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox2')
|
||||
editbox:SetPoint('TOPLEFT', 14, -191)
|
||||
editbox:SetPoint('TOPLEFT', 14, -198)
|
||||
editbox:SetWidth(150)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
@@ -602,7 +560,7 @@ function public.on_load()
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox3')
|
||||
editbox:SetPoint('TOPLEFT', 14, -212)
|
||||
editbox:SetPoint('TOPLEFT', 14, -219)
|
||||
editbox:SetWidth(150)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
@@ -621,7 +579,7 @@ function public.on_load()
|
||||
end
|
||||
do
|
||||
local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox4')
|
||||
editbox:SetPoint('TOPLEFT', 14, -233)
|
||||
editbox:SetPoint('TOPLEFT', 14, -240)
|
||||
editbox:SetWidth(150)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
@@ -699,6 +657,7 @@ end
|
||||
|
||||
function public.set_view(view)
|
||||
private.buyout_button:Disable()
|
||||
private.bid_button:Disable()
|
||||
private.clear_selection()
|
||||
aux_view = view
|
||||
update_listing()
|
||||
@@ -816,7 +775,7 @@ function find_auction(entry, express_mode, buyout_mode)
|
||||
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index)
|
||||
if not index then
|
||||
entry.gone = true
|
||||
private.selected = nil
|
||||
private.clear_selection()
|
||||
refresh = true
|
||||
return
|
||||
end
|
||||
@@ -834,7 +793,8 @@ function find_auction(entry, express_mode, buyout_mode)
|
||||
entry.gone = true
|
||||
end
|
||||
Aux.place_bid('list', index, amount)
|
||||
private.selected = nil
|
||||
|
||||
private.clear_selection()
|
||||
refresh = true
|
||||
else
|
||||
private.buyout_button:SetScript('OnClick', function()
|
||||
@@ -844,6 +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
|
||||
end
|
||||
|
||||
@@ -853,10 +814,12 @@ function find_auction(entry, express_mode, buyout_mode)
|
||||
Aux.place_bid('list', index, entry.buyout_price)
|
||||
|
||||
private.buyout_button:Disable()
|
||||
private.selected = nil
|
||||
private.bid_button:Disable()
|
||||
private.clear_selection()
|
||||
refresh = true
|
||||
end)
|
||||
private.buyout_button:Enable()
|
||||
private.bid_button:Enable()
|
||||
end
|
||||
end)
|
||||
end
|
||||
@@ -882,6 +845,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
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentCategoryDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-8" y="-55" /></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-8" y="-56" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
UIDropDownMenu_SetWidth(140)
|
||||
@@ -35,7 +35,7 @@
|
||||
</Frame>
|
||||
|
||||
<Frame name="$parentQualityDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-8" y="-95" /></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-8" y="-98" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
UIDropDownMenu_SetWidth(140)
|
||||
@@ -48,7 +48,7 @@
|
||||
</Frame>
|
||||
<CheckButton name="$parentUsableCheckButton" inherits="UICheckButtonTemplate">
|
||||
<Size><AbsDimension x="22" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="87" y="-135" /></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="87" y="-136" /></Offset></Anchor></Anchors>
|
||||
</CheckButton>
|
||||
<CheckButton name="$parentAllPagesCheckButton" inherits="UICheckButtonTemplate" checked="true">
|
||||
<Size><AbsDimension x="22" y="22"/></Size>
|
||||
|
||||
+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
|
||||
|
||||
@@ -12,4 +12,34 @@ function m.money_column(name, getter)
|
||||
-- group_alpha_setter(cell, getter(datum))
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function m.percentage_market_column(item_key_getter, value_getter)
|
||||
return {
|
||||
title = 'Pct',
|
||||
width = 40,
|
||||
comparator = function(datum1, datum2)
|
||||
local market_price1 = Aux.history.market_value(item_key_getter(datum1))
|
||||
local market_price2 = Aux.history.market_value(item_key_getter(datum2))
|
||||
local factor1 = market_price1 > 0 and value_getter(datum1) / market_price1
|
||||
local factor2 = market_price2 > 0 and value_getter(datum2) / 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(item_key_getter(datum))
|
||||
|
||||
local pct = market_price > 0 and ceil(100 / market_price * value_getter(datum))
|
||||
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,
|
||||
}
|
||||
end
|
||||
+306
-322
@@ -6,187 +6,198 @@ local existing_auctions = {}
|
||||
|
||||
local inventory_data
|
||||
|
||||
local bestPriceOurStackSize
|
||||
local update_auction_listing, undercut, refresh_entries, auction_candidates, charge_classes, get_stack_size_slider_value
|
||||
|
||||
local current_auction
|
||||
--local LIVE, HISTORICAL, FIXED = {}, {}, {}
|
||||
|
||||
local set_auction, update_auction_listing, record_auction, undercut, item_class_index, item_subclass_index, report, select_entry, update_recommendation, refresh_entries, auction_candidates, charge_classes, get_stack_size_slider_value
|
||||
|
||||
local LIVE, HISTORICAL, FIXED = 1, 2, 3
|
||||
|
||||
Aux.sell.inventory_listing_config = {
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
set_auction(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, nil, this, 'ANCHOR_LEFT', 0, 0)
|
||||
end,
|
||||
|
||||
on_row_leave = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
if not (current_auction and sheet.data[data_index] == current_auction) then
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end
|
||||
AuxTooltip:Hide()
|
||||
end,
|
||||
|
||||
row_setter = function(row, datum)
|
||||
if current_auction and datum == current_auction then
|
||||
row.highlight:SetAlpha(.5)
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
end
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id)
|
||||
end,
|
||||
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
comparator = function(datum1, datum2) return Aux.util.compare(datum1.aux_quantity, datum2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Item',
|
||||
width = 186,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.name, row2.name, Aux.util.GT) end,
|
||||
cell_initializer = function(cell)
|
||||
local icon = CreateFrame('Button', nil, cell)
|
||||
icon:EnableMouse(false)
|
||||
local icon_texture = icon:CreateTexture(nil, 'BORDER')
|
||||
icon_texture:SetAllPoints(icon)
|
||||
icon.icon_texture = icon_texture
|
||||
local normal_texture = icon:CreateTexture(nil)
|
||||
normal_texture:SetPoint('CENTER', 0, 0)
|
||||
normal_texture:SetWidth(22)
|
||||
normal_texture:SetHeight(22)
|
||||
normal_texture:SetTexture('Interface\\Buttons\\UI-Quickslot2')
|
||||
icon:SetNormalTexture(normal_texture)
|
||||
icon:SetPoint('LEFT', cell)
|
||||
icon:SetWidth(12)
|
||||
icon:SetHeight(12)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint('LEFT', icon, 'RIGHT', 1, 0)
|
||||
text:SetPoint('TOPRIGHT', cell)
|
||||
text:SetPoint('BOTTOMRIGHT', cell)
|
||||
text:SetJustifyV('TOP')
|
||||
text:SetJustifyH('LEFT')
|
||||
text:SetTextColor(0.8, 0.8, 0.8)
|
||||
cell.text = text
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
cell.text:SetText('['..datum.name..']')
|
||||
local color = ITEM_QUALITY_COLORS[datum.quality]
|
||||
cell.text:SetTextColor(color.r, color.g, color.b)
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 2, order = 'ascending' }},
|
||||
}
|
||||
|
||||
Aux.sell.auction_listing_config = {
|
||||
on_row_click = function (sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxSellEntry_OnClick(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_row_enter = function (sheet, row_index, column_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
end,
|
||||
|
||||
on_row_leave = function (sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
local datum = sheet.data[data_index]
|
||||
if not (datum and current_auction and Aux.util.safe_index{existing_auctions, current_auction.key, 'selected', 'key'} == datum.key) then
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end
|
||||
end,
|
||||
|
||||
row_setter = function(row, datum)
|
||||
if datum and current_auction and Aux.util.safe_index{existing_auctions, current_auction.key, 'selected', 'key'} == datum.key then
|
||||
row.highlight:SetAlpha(.5)
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
end
|
||||
end,
|
||||
|
||||
columns = {
|
||||
{
|
||||
title = 'Avail',
|
||||
width = 40,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.count, row2.count, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(row.count)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Yours',
|
||||
width = 40,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.yours, row2.yours, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(row.yours)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Max Left',
|
||||
width = 55,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.max_time_left, row2.max_time_left, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, datum)
|
||||
local text
|
||||
if datum.max_time_left == 1 then
|
||||
text = '30m'
|
||||
elseif datum.max_time_left == 2 then
|
||||
text = '2h'
|
||||
elseif datum.max_time_left == 3 then
|
||||
text = '8h'
|
||||
elseif datum.max_time_left == 4 then
|
||||
text = '24h'
|
||||
end
|
||||
cell.text:SetText(text)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
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)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Buy/ea',
|
||||
width = 80,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.unit_buyout_price, row2.unit_buyout_price, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(Aux.util.money_string(row.unit_buyout_price))
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 5, order = 'ascending' }},
|
||||
}
|
||||
|
||||
function private.parse_inventory()
|
||||
Aux.sheet.populate(AuxSellInventoryListing.sheet, Aux.util.filter(inventory_data, function(item) return item.aux_quantity > 0 end))
|
||||
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()
|
||||
Aux.sheet.populate(AuxSellAuctionsListing.sheet, current_auction and existing_auctions[current_auction.key] or {})
|
||||
Aux.sheet.populate(private.listings.auctions, private.current_item() and existing_auctions[private.current_item().key] or {})
|
||||
end
|
||||
|
||||
function Aux.sell.on_open()
|
||||
function private.current_item()
|
||||
return private.listings.inventory:get_selected()
|
||||
end
|
||||
|
||||
function private.current_auction()
|
||||
return private.listings.auctions:get_selected()
|
||||
end
|
||||
|
||||
function public.on_load()
|
||||
private.inventory_listing_config = {
|
||||
frame = AuxSellInventoryListing,
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
private.set_item(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_row_enter = function (sheet, row_index)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, nil, this, 'ANCHOR_LEFT', 0, 0)
|
||||
end,
|
||||
|
||||
on_row_leave = function (sheet, row_index)
|
||||
AuxTooltip:Hide()
|
||||
end,
|
||||
|
||||
row_setter = function(row, datum)
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id)
|
||||
end,
|
||||
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
comparator = function(datum1, datum2) return Aux.util.compare(datum1.aux_quantity, datum2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Item',
|
||||
width = 186,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.name, row2.name, Aux.util.GT) end,
|
||||
cell_initializer = function(cell)
|
||||
local icon = CreateFrame('Button', nil, cell)
|
||||
icon:EnableMouse(false)
|
||||
local icon_texture = icon:CreateTexture(nil, 'BORDER')
|
||||
icon_texture:SetAllPoints(icon)
|
||||
icon.icon_texture = icon_texture
|
||||
local normal_texture = icon:CreateTexture(nil)
|
||||
normal_texture:SetPoint('CENTER', 0, 0)
|
||||
normal_texture:SetWidth(22)
|
||||
normal_texture:SetHeight(22)
|
||||
normal_texture:SetTexture('Interface\\Buttons\\UI-Quickslot2')
|
||||
icon:SetNormalTexture(normal_texture)
|
||||
icon:SetPoint('LEFT', cell)
|
||||
icon:SetWidth(12)
|
||||
icon:SetHeight(12)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint('LEFT', icon, 'RIGHT', 1, 0)
|
||||
text:SetPoint('TOPRIGHT', cell)
|
||||
text:SetPoint('BOTTOMRIGHT', cell)
|
||||
text:SetJustifyV('TOP')
|
||||
text:SetJustifyH('LEFT')
|
||||
text:SetTextColor(0.8, 0.8, 0.8)
|
||||
cell.text = text
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
cell.text:SetText('['..datum.name..']')
|
||||
local color = ITEM_QUALITY_COLORS[datum.quality]
|
||||
cell.text:SetTextColor(color.r, color.g, color.b)
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 2, order = 'ascending' }},
|
||||
}
|
||||
|
||||
private.auction_listing_config = {
|
||||
frame = AuxSellAuctionsListing,
|
||||
on_row_click = function (sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
private.set_auction(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
columns = {
|
||||
{
|
||||
title = 'Avail',
|
||||
width = 40,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.count, row2.count, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(row.count)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Yours',
|
||||
width = 40,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.yours, row2.yours, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(row.yours)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Max Left',
|
||||
width = 55,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.max_time_left, row2.max_time_left, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, datum)
|
||||
local text
|
||||
if datum.max_time_left == 1 then
|
||||
text = '30m'
|
||||
elseif datum.max_time_left == 2 then
|
||||
text = '2h'
|
||||
elseif datum.max_time_left == 3 then
|
||||
text = '8h'
|
||||
elseif datum.max_time_left == 4 then
|
||||
text = '24h'
|
||||
end
|
||||
cell.text:SetText(text)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
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)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Buy/ea',
|
||||
width = 80,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.unit_buyout_price, row2.unit_buyout_price, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(Aux.util.money_string(row.unit_buyout_price))
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.percentage_market_column(function(entry) return entry.item_key end, function(entry) return entry.unit_buyout_price end),
|
||||
},
|
||||
sort_order = {{column = 5, order = 'ascending' }},
|
||||
}
|
||||
|
||||
private.listings = {
|
||||
inventory = Aux.sheet.create(private.inventory_listing_config),
|
||||
auctions = Aux.sheet.create(private.auction_listing_config),
|
||||
}
|
||||
do
|
||||
local status_bar = Aux.gui.status_bar(AuxSellFrame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(30)
|
||||
status_bar:SetPoint('BOTTOMLEFT', AuxSellFrame, 'BOTTOMLEFT', 6, 6)
|
||||
status_bar:update_status(100, 0)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSellParameters, 15, '$parentPostButton')
|
||||
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Post')
|
||||
btn:SetScript('OnClick', private.post_auctions)
|
||||
private.post_button = btn
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSellParameters, 15, '$parentRefreshButton')
|
||||
btn:SetPoint('TOPLEFT', private.post_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', private.refresh)
|
||||
private.refresh_button = btn
|
||||
end
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', 0)
|
||||
AuxSellInventory:SetWidth(AuxSellInventoryListing:GetWidth() + 40)
|
||||
AuxSellAuctions:SetWidth(AuxSellAuctionsListing:GetWidth() + 40)
|
||||
@@ -211,37 +222,18 @@ function Aux.sell.on_open()
|
||||
|
||||
Aux.sell.validate_parameters()
|
||||
|
||||
update_inventory_data()
|
||||
private.update_inventory_data()
|
||||
|
||||
private.parse_inventory()
|
||||
private.update_inventory_listing()
|
||||
update_auction_listing()
|
||||
|
||||
update_recommendation()
|
||||
private.update_recommendation()
|
||||
end
|
||||
|
||||
function Aux.sell.on_close()
|
||||
function public.on_close()
|
||||
|
||||
end
|
||||
|
||||
function public.on_load()
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSellParameters, 15, '$parentPostButton')
|
||||
btn:SetPoint('BOTTOMLEFT', 8, 15)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Post')
|
||||
btn:SetScript('OnClick', private.post_auctions)
|
||||
end
|
||||
do
|
||||
local btn = Aux.gui.button(AuxSellParameters, 15, '$parentRefreshButton')
|
||||
btn:SetPoint('LEFT', AuxSellParametersPostButton,'RIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', private.refresh)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.sell.duration_radio_button_on_click(index)
|
||||
AuxSellParametersShortDurationRadio:SetChecked(false)
|
||||
AuxSellParametersMediumDurationRadio:SetChecked(false)
|
||||
@@ -259,7 +251,7 @@ function Aux.sell.duration_radio_button_on_click(index)
|
||||
AuctionFrameAuctions.duration = 1440
|
||||
AUX_AUCTION_DURATION = 'long'
|
||||
end
|
||||
update_recommendation()
|
||||
private.update_recommendation()
|
||||
end
|
||||
|
||||
function Aux_Sell_SetAuctionDuration(duration)
|
||||
@@ -272,8 +264,8 @@ function Aux_Sell_SetAuctionDuration(duration)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.sell.post_auctions()
|
||||
local auction = current_auction
|
||||
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 duration
|
||||
@@ -284,7 +276,7 @@ function Aux.sell.post_auctions()
|
||||
elseif AuctionFrameAuctions.duration == 1440 then
|
||||
duration = 4
|
||||
end
|
||||
|
||||
|
||||
Aux.post.start(
|
||||
key,
|
||||
stack_size,
|
||||
@@ -294,12 +286,13 @@ function Aux.sell.post_auctions()
|
||||
stack_count,
|
||||
function(posted)
|
||||
for i = 1, posted do
|
||||
record_auction(key, stack_size, buyout_price, duration, UnitName('player'))
|
||||
private.record_auction(key, stack_size, buyout_price, duration, UnitName('player'))
|
||||
end
|
||||
if existing_auctions[key] then
|
||||
for _, entry in ipairs(existing_auctions[key]) do
|
||||
if entry.buyout_price == buyout_price and entry.stack_size == stack_size then
|
||||
existing_auctions[key].selected = entry
|
||||
private.listings.auctions:select(entry)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -308,41 +301,37 @@ function Aux.sell.post_auctions()
|
||||
local charge_class = auction.charges or 0
|
||||
auction.availability[charge_class] = auction.availability[charge_class] - (posted * (auction.charges and 1 or stack_size))
|
||||
|
||||
private.parse_inventory()
|
||||
report(hyperlink, stack_size, buyout_price, posted)
|
||||
private.update_inventory_listing()
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
function select_entry()
|
||||
if current_auction and existing_auctions[current_auction.key] and not existing_auctions[current_auction.key].selected then
|
||||
local bestPrice = {} -- a table with one entry per stack_size that is the cheapest auction for that particular stack_size
|
||||
local absoluteBest -- the overall cheapest auction
|
||||
function private.select_auction()
|
||||
if not private.current_auction() and getn(existing_auctions[private.current_item().key]) > 0 then
|
||||
local cheapest_for_size = {}
|
||||
local cheapest
|
||||
|
||||
----- find the best price per stacksize and overall -----
|
||||
|
||||
for _, auction_datum in ipairs(existing_auctions[current_auction.key]) do
|
||||
if not bestPrice[auction_datum.stack_size] or bestPrice[auction_datum.stack_size].unit_buyout_price >= auction_datum.unit_buyout_price then
|
||||
bestPrice[auction_datum.stack_size] = auction_datum
|
||||
for _, auction_entry in ipairs(existing_auctions[private.current_item().key]) do
|
||||
if not cheapest_for_size[auction_entry.stack_size] or cheapest_for_size[auction_entry.stack_size].unit_buyout_price >= auction_entry.unit_buyout_price then
|
||||
cheapest_for_size[auction_entry.stack_size] = auction_entry
|
||||
end
|
||||
|
||||
if not absoluteBest or absoluteBest.unit_buyout_price > auction_datum.unit_buyout_price then
|
||||
absoluteBest = auction_datum
|
||||
end
|
||||
end
|
||||
|
||||
existing_auctions[current_auction.key].selected = absoluteBest
|
||||
|
||||
if bestPrice[get_stack_size_slider_value()] then
|
||||
existing_auctions[current_auction.key].selected = bestPrice[get_stack_size_slider_value()]
|
||||
bestPriceOurStackSize = bestPrice[get_stack_size_slider_value()]
|
||||
if not cheapest or cheapest.unit_buyout_price > auction_entry.unit_buyout_price then
|
||||
cheapest = auction_entry
|
||||
end
|
||||
end
|
||||
|
||||
local auction = cheapest_for_size[get_stack_size_slider_value()] or cheapest
|
||||
|
||||
existing_auctions[private.current_item().key].selected = auction
|
||||
private.listings.auctions:clear_selection()
|
||||
private.listings.auctions:select(auction)
|
||||
end
|
||||
end
|
||||
|
||||
function get_stack_size_slider_value()
|
||||
if current_auction.charges then
|
||||
if private.current_item().charges then
|
||||
return AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]
|
||||
else
|
||||
return AuxSellStackSizeSlider:GetValue()
|
||||
@@ -350,10 +339,10 @@ function get_stack_size_slider_value()
|
||||
end
|
||||
|
||||
function Aux.sell.validate_parameters()
|
||||
AuxSellParametersPostButton:Disable()
|
||||
private.post_button:Disable()
|
||||
AuxSellParametersBuyoutPriceErrorText:Hide()
|
||||
|
||||
if not current_auction then
|
||||
if not private.current_item() then
|
||||
return
|
||||
end
|
||||
|
||||
@@ -366,15 +355,14 @@ function Aux.sell.validate_parameters()
|
||||
return
|
||||
end
|
||||
|
||||
AuxSellParametersPostButton:Enable()
|
||||
private.post_button:Enable()
|
||||
end
|
||||
|
||||
function update_recommendation()
|
||||
-- AuxSellParametersStrategyDropDownStaleWarning:SetText()
|
||||
function private.update_recommendation()
|
||||
|
||||
if not private.current_item() then
|
||||
private.refresh_button:Disable()
|
||||
|
||||
if not current_auction then
|
||||
AuxSellParametersRefreshButton:Disable()
|
||||
|
||||
AuxSellParametersItemIconTexture:SetTexture(nil)
|
||||
AuxSellParametersItemCount:SetText()
|
||||
AuxSellParametersItemName:SetText()
|
||||
@@ -382,51 +370,55 @@ function update_recommendation()
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 0)
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 0)
|
||||
|
||||
AuxSellStackSizeSlider:SetMinMaxValues(0,0)
|
||||
AuxSellStackSizeSlider:SetMinMaxValues(0, 0)
|
||||
AuxSellStackSize:SetNumber(0)
|
||||
AuxSellStackCountSlider:SetMinMaxValues(0,0)
|
||||
AuxSellStackCountSlider:SetMinMaxValues(0, 0)
|
||||
AuxSellStackCount:SetNumber(0)
|
||||
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', 0)
|
||||
else
|
||||
AuxSellStackSize:SetNumber(current_auction.charges and AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()] or AuxSellStackSizeSlider:GetValue())
|
||||
AuxSellStackSize:SetNumber(private.current_item().charges and AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()] or AuxSellStackSizeSlider:GetValue())
|
||||
AuxSellStackCount:SetNumber(AuxSellStackCountSlider:GetValue())
|
||||
|
||||
AuxSellParametersItemIconTexture:SetTexture(current_auction.texture)
|
||||
AuxSellParametersItemName:SetText(current_auction.name)
|
||||
local color = ITEM_QUALITY_COLORS[current_auction.quality]
|
||||
AuxSellParametersItemIconTexture:SetTexture(private.current_item().texture)
|
||||
AuxSellParametersItemName:SetText(private.current_item().name)
|
||||
local color = ITEM_QUALITY_COLORS[private.current_item().quality]
|
||||
AuxSellParametersItemName:SetTextColor(color.r, color.g, color.b)
|
||||
if current_auction.aux_quantity > 1 then
|
||||
AuxSellParametersItemCount:SetText(current_auction.aux_quantity)
|
||||
if private.current_item().aux_quantity > 1 then
|
||||
AuxSellParametersItemCount:SetText(private.current_item().aux_quantity)
|
||||
else
|
||||
AuxSellParametersItemCount:SetText()
|
||||
end
|
||||
|
||||
AuxSellParametersRefreshButton:Enable()
|
||||
private.refresh_button:Enable()
|
||||
|
||||
-- TODO neutral AH deposit formula
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', floor(current_auction.unit_vendor_price * 0.05 * (current_auction.charges and 1 or get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * AuctionFrameAuctions.duration / 120)
|
||||
|
||||
if existing_auctions[current_auction.key] and existing_auctions[current_auction.key].selected then
|
||||
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)
|
||||
|
||||
local new_buyout_price = existing_auctions[current_auction.key].selected.unit_buyout_price * get_stack_size_slider_value()
|
||||
if existing_auctions[private.current_item().key] then
|
||||
private.select_auction()
|
||||
|
||||
if existing_auctions[current_auction.key].selected.yours == 0 then
|
||||
new_buyout_price = undercut(new_buyout_price)
|
||||
end
|
||||
if private.current_auction() then
|
||||
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(new_buyout_price * 0.95)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(new_buyout_price)))
|
||||
local new_buyout_price = private.current_auction().unit_buyout_price * get_stack_size_slider_value()
|
||||
|
||||
elseif existing_auctions[current_auction.key] then -- unsuccessful search
|
||||
if private.current_auction().yours == 0 then
|
||||
new_buyout_price = undercut(new_buyout_price)
|
||||
end
|
||||
|
||||
local market_value = Aux.history.market_value(current_auction.key)
|
||||
if market_value then
|
||||
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(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 1.053)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 4)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux.round(new_buyout_price * 0.95)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux.round(new_buyout_price)))
|
||||
|
||||
elseif existing_auctions[private.current_item().key] then -- unsuccessful search
|
||||
|
||||
local market_value = Aux.history.market_value(private.current_item().key)
|
||||
if market_value then
|
||||
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)))
|
||||
end
|
||||
end
|
||||
else -- no search yet
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 0)
|
||||
@@ -436,46 +428,49 @@ function update_recommendation()
|
||||
end
|
||||
|
||||
function Aux.sell.quantity_update()
|
||||
if current_auction then
|
||||
AuxSellStackCountSlider:SetMinMaxValues(1, current_auction.charges and current_auction.availability[AuxSellStackSizeSlider.charge_classes[AuxSellStackSizeSlider:GetValue()]] or floor(current_auction.availability[0] / get_stack_size_slider_value()))
|
||||
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()))
|
||||
end
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
private.update_recommendation()
|
||||
update_auction_listing()
|
||||
end
|
||||
|
||||
function Aux.sell.clear_auction()
|
||||
current_auction = nil
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
private.listings.inventory:clear_selection()
|
||||
private.update_recommendation()
|
||||
end
|
||||
|
||||
function set_auction(auction_candidate)
|
||||
function private.set_item(item)
|
||||
|
||||
private.listings.auctions:clear_selection()
|
||||
private.listings.inventory:clear_selection()
|
||||
private.listings.inventory:select(item)
|
||||
local new_auction = Aux.util.safe_index{existing_auctions, item.key, 'selected' }
|
||||
if new_auction then
|
||||
private.listings.auctions:select(new_auction)
|
||||
end
|
||||
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
Aux.scan.abort(function()
|
||||
|
||||
current_auction = auction_candidate
|
||||
private.parse_inventory()
|
||||
private.update_inventory_listing()
|
||||
|
||||
local charge_classes = charge_classes(current_auction.availability)
|
||||
AuxSellStackSizeSlider.charge_classes = current_auction.charges and charge_classes
|
||||
local stack_size_slider_max = current_auction.charges and getn(charge_classes) or min(current_auction.max_stack, current_auction.availability[0])
|
||||
local charge_classes = 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()
|
||||
AuxSellStackCountSlider:SetValue(current_auction.aux_quantity) -- reduced to max possible
|
||||
AuxSellStackCountSlider:SetValue(private.current_item().aux_quantity) -- reduced to max possible
|
||||
|
||||
if not existing_auctions[current_auction.key] then
|
||||
if not existing_auctions[private.current_item().key] then
|
||||
refresh_entries()
|
||||
end
|
||||
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
private.update_recommendation()
|
||||
update_auction_listing()
|
||||
|
||||
end)
|
||||
|
||||
end
|
||||
@@ -489,9 +484,9 @@ function charge_classes(availability)
|
||||
return charge_classes
|
||||
end
|
||||
|
||||
function update_inventory_data()
|
||||
function private.update_inventory_data()
|
||||
inventory_data = {}
|
||||
private.parse_inventory()
|
||||
private.update_inventory_listing()
|
||||
|
||||
local auction_candidate_map = {}
|
||||
|
||||
@@ -535,7 +530,7 @@ function update_inventory_data()
|
||||
|
||||
key = item_info.item_key,
|
||||
hyperlink = item_info.hyperlink,
|
||||
|
||||
|
||||
name = item_info.name,
|
||||
texture = item_info.texture,
|
||||
quality = item_info.quality,
|
||||
@@ -567,13 +562,13 @@ function update_inventory_data()
|
||||
tinsert(auction_candidates, auction_candidate)
|
||||
end
|
||||
inventory_data = auction_candidates
|
||||
private.parse_inventory()
|
||||
private.update_inventory_listing()
|
||||
end)
|
||||
end
|
||||
|
||||
function refresh_entries()
|
||||
if current_auction then
|
||||
local item_id, suffix_id = current_auction.item_id, current_auction.suffix_id
|
||||
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
|
||||
local item_info = Aux.info.item(item_id, suffix_id)
|
||||
|
||||
@@ -594,29 +589,32 @@ function refresh_entries()
|
||||
usable = item_info.usable,
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
private.status_bar:update_status(0,0)
|
||||
private.status_bar:set_text('Scanning auctions...')
|
||||
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
page = 0,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page + 1)..' out of '..total_pages..' ...')
|
||||
private.status_bar:update_status(100 * (page + 1) / total_pages, 100 * (page + 1) / total_pages) -- TODO
|
||||
private.status_bar:set_text(string.format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
if auction_info.name == item_info.name then
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
record_auction(auction_info.item_key, aux_quantity, auction_info.buyout_price, auction_info.duration, auction_info.owner)
|
||||
if auction_info.item_key == item_key then
|
||||
private.record_auction(auction_info.item_key, auction_info.aux_quantity, auction_info.buyout_price, auction_info.duration, auction_info.owner)
|
||||
end
|
||||
end,
|
||||
on_abort = function()
|
||||
existing_auctions[item_key] = nil
|
||||
Aux.log('Scan aborted.')
|
||||
private.status_bar:update_status(100, 100)
|
||||
private.status_bar:set_text('Done Scanning')
|
||||
end,
|
||||
on_complete = function()
|
||||
existing_auctions[item_key] = existing_auctions[item_key] or { created = GetTime() }
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
existing_auctions[item_key] = existing_auctions[item_key] or { created = time() }
|
||||
private.update_recommendation()
|
||||
update_auction_listing()
|
||||
Aux.log('Scan complete: '..getn(existing_auctions[item_key])..' '..Aux_PluralizeIf('auction', getn(existing_auctions[item_key]))..' found.')
|
||||
private.status_bar:update_status(100, 100)
|
||||
private.status_bar:set_text('Done Scanning')
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
@@ -628,12 +626,13 @@ function refresh_entries()
|
||||
end
|
||||
end
|
||||
|
||||
function AuxSellEntry_OnClick(entry)
|
||||
function private.set_auction(entry)
|
||||
|
||||
existing_auctions[current_auction.key].selected = entry
|
||||
existing_auctions[private.current_item().key].selected = entry
|
||||
private.listings.auctions:clear_selection()
|
||||
private.listings.auctions:select(entry)
|
||||
|
||||
update_auction_listing()
|
||||
update_recommendation()
|
||||
private.update_recommendation()
|
||||
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
end
|
||||
@@ -641,38 +640,34 @@ end
|
||||
function private.refresh()
|
||||
Aux.scan.abort(function()
|
||||
refresh_entries()
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
private.update_recommendation()
|
||||
update_auction_listing()
|
||||
end)
|
||||
end
|
||||
|
||||
function record_auction(key, aux_quantity, buyout_price, duration, owner)
|
||||
function private.record_auction(key, aux_quantity, buyout_price, duration, owner)
|
||||
if buyout_price > 0 then
|
||||
existing_auctions[key] = existing_auctions[key] or { created = GetTime() }
|
||||
local entry
|
||||
for _, existingEntry in ipairs(existing_auctions[key]) do
|
||||
if existingEntry.buyout_price == buyout_price and existingEntry.stack_size == aux_quantity then
|
||||
entry = existingEntry
|
||||
for _, existing_entry in ipairs(existing_auctions[key]) do
|
||||
if buyout_price == existing_entry.buyout_price and aux_quantity == existing_entry.stack_size then
|
||||
entry = existing_entry
|
||||
end
|
||||
end
|
||||
if entry then
|
||||
entry.count = entry.count + 1
|
||||
entry.yours = entry.yours + (owner == UnitName("player") and 1 or 0)
|
||||
entry.yours = entry.yours + (owner == UnitName('player') and 1 or 0)
|
||||
entry.max_time_left = max(entry.max_time_left, duration)
|
||||
else
|
||||
entry = {
|
||||
key = aux_quantity..':'..buyout_price,
|
||||
|
||||
else
|
||||
tinsert(existing_auctions[key], {
|
||||
item_key = key,
|
||||
stack_size = aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
unit_buyout_price = buyout_price / aux_quantity,
|
||||
max_time_left = duration,
|
||||
count = 1,
|
||||
yours = owner == UnitName("player") and 1 or 0,
|
||||
}
|
||||
tinsert(existing_auctions[key], entry)
|
||||
table.sort(existing_auctions[key], function(a,b) return a.unit_buyout_price < b.unit_buyout_price end)
|
||||
yours = owner == UnitName('player') and 1 or 0,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -681,17 +676,6 @@ function undercut(price)
|
||||
return math.max(0, price - 1)
|
||||
end
|
||||
|
||||
function report(hyperlink, aux_quantity, buyout_price, posted)
|
||||
Aux.log(string.format(
|
||||
'%i %s of %s (%i) posted at %s.',
|
||||
posted,
|
||||
Aux_PluralizeIf('auction', posted),
|
||||
hyperlink,
|
||||
aux_quantity,
|
||||
Aux.util.money_string(buyout_price)
|
||||
))
|
||||
end
|
||||
|
||||
--function Aux.sell.initialize_strategy_dropdown()
|
||||
--
|
||||
-- local function on_click()
|
||||
|
||||
+15
-43
@@ -11,42 +11,28 @@
|
||||
<Frame name="AuxSellInventory" inherits="AuxFrameBoxTemplate">
|
||||
<Size><AbsDimension x="260" y="326"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="5" y="-35"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Title"):SetText('Inventory')
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<!--<Scripts>-->
|
||||
<!--<OnLoad>-->
|
||||
<!--getglobal(this:GetName().."Title"):SetText('Inventory')-->
|
||||
<!--</OnLoad>-->
|
||||
<!--</Scripts>-->
|
||||
<Frames>
|
||||
<Frame name="$parentListing">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.sell.inventory_listing_config
|
||||
this.sheet = Aux.sheet.create{
|
||||
frame = this,
|
||||
columns = config.columns,
|
||||
sort_order = config.sort_order,
|
||||
row_setter = config.row_setter,
|
||||
on_row_click = config.on_row_click,
|
||||
on_row_enter = config.on_row_enter,
|
||||
on_row_leave = config.on_row_leave,
|
||||
}
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<frame name="AuxSellParameters" inherits="AuxFrameBoxTemplate">
|
||||
<Size><AbsDimension x="213" y="326"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="AuxSellInventory"><Offset><AbsDimension x="3" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Title"):SetText('Parameters')
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<!--<Scripts>-->
|
||||
<!--<OnLoad>-->
|
||||
<!--getglobal(this:GetName().."Title"):SetText('Parameters')-->
|
||||
<!--</OnLoad>-->
|
||||
<!--</Scripts>-->
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<FontString name="$parentDepositLabel" inherits="GameFontNormal" text="Deposit:">
|
||||
@@ -247,31 +233,17 @@
|
||||
<Frame name="AuxSellAuctions" inherits="AuxFrameBoxTemplate">
|
||||
<Size><AbsDimension x="361" y="326"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="AuxSellParameters"><Offset><AbsDimension x="3" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Title"):SetText('Existing Auctions')
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<!--<Scripts>-->
|
||||
<!--<OnLoad>-->
|
||||
<!--getglobal(this:GetName().."Title"):SetText('Existing Auctions')-->
|
||||
<!--</OnLoad>-->
|
||||
<!--</Scripts>-->
|
||||
<Frames>
|
||||
<Frame name="$parentListing">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.sell.auction_listing_config
|
||||
this.sheet = Aux.sheet.create{
|
||||
frame = this,
|
||||
columns = config.columns,
|
||||
sort_order = config.sort_order,
|
||||
row_setter = config.row_setter,
|
||||
on_row_click = config.on_row_click,
|
||||
on_row_enter = config.on_row_enter,
|
||||
on_row_leave = config.on_row_leave,
|
||||
}
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
@@ -28,7 +28,7 @@ function public.render(sheet)
|
||||
sheet.labels[i].sort_texture:Show()
|
||||
end
|
||||
else
|
||||
sheet.labels[i].texture:SetTexture("Interface\\QuestFrame\\UI-QuestTitleHighlight")
|
||||
sheet.labels[i].texture:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]])
|
||||
sheet.labels[i].sort_texture:Hide()
|
||||
end
|
||||
end
|
||||
@@ -47,12 +47,12 @@ function public.render(sheet)
|
||||
local datum = data[i + offset]
|
||||
|
||||
if datum then
|
||||
if sheet.selected[datum] then
|
||||
row.highlight:SetAlpha(0.5)
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
end
|
||||
if sheet.row_setter then
|
||||
if sheet.selected[datum] then
|
||||
row.highlight:SetAlpha(0.5)
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
end
|
||||
sheet.row_setter(row, datum)
|
||||
end
|
||||
row:Show()
|
||||
@@ -130,18 +130,18 @@ function public.create(params)
|
||||
button:SetWidth(column_width)
|
||||
button:SetHeight(16)
|
||||
button:SetID(i)
|
||||
button:SetHighlightTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight')
|
||||
button:SetScript("OnMouseDown", function() Aux.sheet.sort(sheet, this:GetID()) end)
|
||||
button:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
button:SetHighlightTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]])
|
||||
button:SetScript('OnMouseDown', function() Aux.sheet.sort(sheet, this:GetID()) end)
|
||||
button:RegisterForClicks('LeftButtonDown', 'RightButtonDown')
|
||||
|
||||
local texture = content:CreateTexture(nil, 'ARTWORK')
|
||||
texture:SetTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight')
|
||||
texture:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]])
|
||||
texture:SetTexCoord(0.1, 0.8, 0, 1)
|
||||
texture:SetAllPoints(button)
|
||||
button.texture = texture
|
||||
|
||||
local sort_texture = button:CreateTexture(nil, 'ARTWORK')
|
||||
sort_texture:SetTexture('Interface\\Buttons\\UI-SortArrow')
|
||||
sort_texture:SetTexture([[Interface\Buttons\UI-SortArrow]])
|
||||
sort_texture:SetPoint('TOPRIGHT', button, 'TOPRIGHT', 0, 0)
|
||||
sort_texture:SetPoint('BOTTOM', button, 'BOTTOM', 0, 0)
|
||||
sort_texture:SetWidth(12)
|
||||
@@ -149,7 +149,7 @@ function public.create(params)
|
||||
button.sort_texture = sort_texture
|
||||
|
||||
local background = content:CreateTexture(nil, 'ARTWORK')
|
||||
background:SetTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight')
|
||||
background:SetTexture([[Interface\QuestFrame\UI-QuestTitleHighlight]])
|
||||
-- background:SetTextCoord(0.2, 0.9, 0, 0.9)
|
||||
background:SetPoint('TOPLEFT', button, 'BOTTOMLEFT', 0, 0)
|
||||
background:SetPoint('TOPRIGHT', button, 'BOTTOMRIGHT', 0, 0)
|
||||
@@ -186,7 +186,7 @@ function public.create(params)
|
||||
local row = CreateFrame('Button', nil, content)
|
||||
row:SetPoint('TOPLEFT', labels[1], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
|
||||
row:SetPoint('TOPRIGHT', labels[getn(params.columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
|
||||
row:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
row:RegisterForClicks('LeftButtonDown', 'RightButtonDown')
|
||||
row:SetHeight(14)
|
||||
|
||||
local row_idx = row_index
|
||||
@@ -274,6 +274,18 @@ function public.create(params)
|
||||
self.selected[datum] = false
|
||||
public.render(self)
|
||||
end
|
||||
|
||||
function sheet:get_selection()
|
||||
local selection = {}
|
||||
for datum, _ in pairs(self.selected) do
|
||||
tinsert(selection, datum)
|
||||
end
|
||||
return selection
|
||||
end
|
||||
|
||||
function sheet:get_selected()
|
||||
return self:get_selection()[1]
|
||||
end
|
||||
|
||||
return sheet
|
||||
end
|
||||
@@ -306,7 +318,7 @@ end
|
||||
|
||||
function public.populate(sheet, data)
|
||||
sheet.data = data
|
||||
sheet.selected = {}
|
||||
-- sheet.selected = {}
|
||||
|
||||
Aux.util.merge_sort(sheet.data, private.row_comparator(sheet))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user