some progress on buy modes
This commit is contained in:
@@ -12,11 +12,11 @@ local function alpha_setter(cell, datum)
|
||||
cell:SetAlpha(datum.gone and 0.4 or 1)
|
||||
end
|
||||
|
||||
local BUY, BID, FULL = 1, 2, 3
|
||||
local BUYOUT, BID, FULL = 1, 2, 3
|
||||
|
||||
Aux.buy.modes = {
|
||||
[BUY] = {
|
||||
name = 'Buy',
|
||||
[BUYOUT] = {
|
||||
name = 'Buyout',
|
||||
on_cell_click = function (sheet, row_index, column_index)
|
||||
local entry_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxBuyEntry_OnClick(entry_index)
|
||||
@@ -449,7 +449,7 @@ function Aux.buy.exit()
|
||||
end
|
||||
|
||||
function Aux.buy.on_open()
|
||||
|
||||
show_sheet()
|
||||
end
|
||||
|
||||
function Aux_AuctionFrameBid_Update()
|
||||
@@ -480,7 +480,7 @@ function show_sheet()
|
||||
AuxBuyFullList:Hide()
|
||||
|
||||
local mode = UIDropDownMenu_GetSelectedValue(AuxBuyModeDropDown)
|
||||
if mode == BUY then
|
||||
if mode == BUYOUT then
|
||||
AuxBuyBuyList:Show()
|
||||
elseif mode == BID then
|
||||
AuxBuyBidList:Show()
|
||||
@@ -790,8 +790,8 @@ end
|
||||
|
||||
function Aux_Buy_ScrollbarUpdate()
|
||||
local mode = UIDropDownMenu_GetSelectedValue(AuxBuyModeDropDown)
|
||||
if mode == BUY then
|
||||
Aux.list.populate(AuxBuyBuyList.sheet, auctions and Aux.util.group_by(auctions, {'buyout_price', 'stack_size'}) or {})
|
||||
if mode == BUYOUT then
|
||||
Aux.list.populate(AuxBuyBuyList.sheet, auctions and Aux.util.group_by(auctions, function(a1, a2) return a1.hyperlink == a2.hyperlink and a1.stack_size == a2.stack_size and a1.buyout_price = a2.buyout_price end) or {})
|
||||
elseif mode == BID then
|
||||
Aux.list.populate(AuxBuyBidList.sheet, auctions or {})
|
||||
elseif mode == FULL then
|
||||
@@ -923,6 +923,7 @@ function AuxBuyModeDropDown_Initialize()
|
||||
value = i,
|
||||
func = function()
|
||||
UIDropDownMenu_SetSelectedValue(AuxBuyModeDropDown, this.value)
|
||||
show_sheet()
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local TOOLTIP_LENGTH
|
||||
|
||||
Aux.info = {}
|
||||
|
||||
local hyperlink_item, item_id, item_charges
|
||||
@@ -110,7 +112,7 @@ function Aux.info.tooltip_match(patterns, tooltip)
|
||||
end
|
||||
|
||||
function Aux.info.tooltip(setter)
|
||||
for i = 1, 30 do
|
||||
for i = 1, TOOLTIP_LENGTH do
|
||||
getglobal('AuxInfoTooltipTextLeft'..i):SetText()
|
||||
getglobal('AuxInfoTooltipTextRight'..i):SetText()
|
||||
end
|
||||
@@ -120,7 +122,7 @@ function Aux.info.tooltip(setter)
|
||||
AuxInfoTooltip:Show()
|
||||
|
||||
local tooltip = {}
|
||||
for i = 1, 30 do
|
||||
for i = 1, TOOLTIP_LENGTH do
|
||||
local left, right = {}, {}
|
||||
|
||||
left.text = getglobal('AuxInfoTooltipTextLeft'..i):GetText()
|
||||
@@ -132,7 +134,7 @@ function Aux.info.tooltip(setter)
|
||||
tinsert(tooltip, {left, right})
|
||||
end
|
||||
|
||||
for i = 1, 30 do
|
||||
for i = 1, TOOLTIP_LENGTH do
|
||||
getglobal('AuxInfoTooltipTextLeft'..i):SetText()
|
||||
getglobal('AuxInfoTooltipTextRight'..i):SetText()
|
||||
end
|
||||
|
||||
@@ -236,12 +236,12 @@ function Aux.util.money_string(money)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.util.group_by(tables, keys)
|
||||
function Aux.util.group_by(tables, equal)
|
||||
local groups = {}
|
||||
for _, table in ipairs(tables) do
|
||||
local found_group
|
||||
for _, group in ipairs(groups) do
|
||||
if Aux.util.all(keys, function(key) return table[key] == group[1][key] end) then
|
||||
if equal(table, group[1]) then
|
||||
tinsert(group, table)
|
||||
found_group = true
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user