working on auctions/bids tabs
This commit is contained in:
+42
-73
@@ -18,6 +18,19 @@ function private.clear_selection(entry)
|
||||
end
|
||||
|
||||
function public.on_load()
|
||||
private.listing = Aux.listing.CreateScrollingTable(AuxAuctionsFrameListing)
|
||||
private.listing:SetColInfo({
|
||||
{ name='Item', width=.4 },
|
||||
{ name='Qty', width=.5, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='High Bid', width=.15, align='RIGHT' },
|
||||
{ name='Start Price', width=.15, align='RIGHT' },
|
||||
{ name='Buy', width=.15, align='RIGHT' },
|
||||
})
|
||||
private.listing:SetHandler('OnClick', function(table, row_data, column)
|
||||
private.on_row_click(row_data.record)
|
||||
end)
|
||||
|
||||
private.auction_listing_config = {
|
||||
frame = AuxAuctionsFrameListingAuctionListing,
|
||||
on_row_click = function(sheet, row_index)
|
||||
@@ -88,32 +101,8 @@ function public.on_load()
|
||||
cell.text:SetTextColor(color.r, color.g, color.b)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.sort.compare(row1.stack_size, row2.stack_size, Aux.sort.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.duration_column(function(entry) return entry.duration end),
|
||||
{
|
||||
title = 'Current Bid',
|
||||
width = 80,
|
||||
comparator = function(auction1, auction2) return Aux.sort.compare(auction1.high_bid, auction2.high_bid, Aux.sort.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(auction.high_bid and Aux.util.money_string(auction.high_bid) or RED_FONT_COLOR_CODE..'No Bids'..FONT_COLOR_CODE_CLOSE)
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.money_column('Min Bid', function(entry) return entry.start_price end),
|
||||
Aux.listing_util.money_column('Buy', function(entry) return entry.buyout_price end),
|
||||
},
|
||||
sort_order = {{ column = 1, order = 'ascending' }},
|
||||
}
|
||||
|
||||
private.listing = Aux.sheet.create(private.auction_listing_config)
|
||||
do
|
||||
local status_bar = Aux.gui.status_bar(AuxAuctionsFrame)
|
||||
status_bar:SetWidth(265)
|
||||
@@ -144,6 +133,33 @@ function public.on_load()
|
||||
end
|
||||
end
|
||||
|
||||
function private.update_listing()
|
||||
if not AuxAuctionsFrame:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
local auction_rows = {}
|
||||
for i, auction_record in auction_records or {} do
|
||||
local market_value = Aux.history.market_value(auction_record.item_key)
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
{ value='|c'..Aux.quality_color(auction_record.quality)..'['..auction_record.name..']'..'|r' },
|
||||
{ value=auction_record.aux_quantity },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
{ value=auction_record.high_bid > 0 and Aux.money.to_string(auction_record.high_bid, true, false) or RED_FONT_COLOR_CODE..'No Bids'..FONT_COLOR_CODE_CLOSE },
|
||||
{ value=Aux.money.to_string(auction_record.start_price, true, false) },
|
||||
{ value=auction_record.buyout_price > 0 and Aux.money.to_string(auction_record.buyout_price, true, false) or '---' },
|
||||
-- { value=Aux.auction_listing.percentage_market(market_value and Aux.round(auction_record.unit_buyout_price/market_value * 100) or '---') },
|
||||
},
|
||||
record = auction_record,
|
||||
})
|
||||
end
|
||||
sort(auction_rows, function(a, b) return a.record.unit_buyout_price < b.record.unit_buyout_price end)
|
||||
|
||||
private.listing:SetData(auction_rows)
|
||||
private.listing:SetSelection(function(row) return row.record == selected_auction end)
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
public.scan_auctions()
|
||||
refresh = true
|
||||
@@ -171,7 +187,7 @@ function public.scan_auctions()
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
tinsert(auction_records, private.create_auction_record(auction_info))
|
||||
tinsert(auction_records, auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
private.status_bar:update_status(100, 100)
|
||||
@@ -185,53 +201,6 @@ function public.scan_auctions()
|
||||
}
|
||||
end
|
||||
|
||||
function private.update_listing()
|
||||
if not AuxAuctionsFrame:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
AuxAuctionsFrameListingAuctionListing:Show()
|
||||
Aux.sheet.populate(private.listing, auction_records)
|
||||
AuxAuctionsFrameListing:SetWidth(AuxAuctionsFrameListingAuctionListing:GetWidth() + 40)
|
||||
end
|
||||
|
||||
function private.create_auction_record(auction_info)
|
||||
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
|
||||
local status
|
||||
if auction_info.high_bidder then
|
||||
status = GREEN_FONT_COLOR_CODE..'High Bidder'..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
status = RED_FONT_COLOR_CODE..'Outbid'..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
|
||||
return {
|
||||
query = auction_info.query,
|
||||
page = auction_info.page,
|
||||
|
||||
item_id = auction_info.item_id,
|
||||
item_key = auction_info.item_key,
|
||||
signature = auction_info.signature,
|
||||
|
||||
name = auction_info.name,
|
||||
tooltip = auction_info.tooltip,
|
||||
aux_quantity = auction_info.aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
quality = auction_info.quality,
|
||||
hyperlink = auction_info.hyperlink,
|
||||
itemstring = auction_info.itemstring,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
high_bid = auction_info.high_bid > 0 and auction_info.high_bid or nil,
|
||||
start_price = auction_info.start_price,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
function private.process_request(entry, express_mode)
|
||||
|
||||
if entry.gone then
|
||||
@@ -241,7 +210,7 @@ function private.process_request(entry, express_mode)
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
local function test(index)
|
||||
local auction_record = private.create_auction_record(Aux.info.auction(index, 'owner'))
|
||||
local auction_record = Aux.info.auction(index, 'owner')
|
||||
return auction_record.signature == entry.signature and auction_record.bid_price == entry.bid_price and auction_record.duration == entry.duration
|
||||
end
|
||||
|
||||
|
||||
+9
-14
@@ -12,20 +12,15 @@
|
||||
|
||||
<Frame name="AuxAuctionsFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
|
||||
<Frames>
|
||||
<Frame name="$parentListing" inherits="AuxFrameBoxTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="400" y="326"/>
|
||||
</Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="5" y="-35"/></Offset></Anchor></Anchors>
|
||||
<Frames>
|
||||
<Frame name="$parentAuctionListing">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Frames>
|
||||
<Frame name="$parentListing" inherits="AuxFrameBoxTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="AuxFrame"><Offset><AbsDimension x="0" y="-8"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="AuxFrameContent"></Anchor>
|
||||
<Anchor point="BOTTOMRIGHT" relativeTo="AuxFrameContent"></Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
|
||||
+54
-125
@@ -20,8 +20,23 @@ function private.clear_selection(entry)
|
||||
end
|
||||
|
||||
function public.on_load()
|
||||
|
||||
private.listing = Aux.listing.CreateScrollingTable(AuxBidsFrameListing)
|
||||
private.listing:SetColInfo({
|
||||
{ name='Item', width=.3 },
|
||||
{ name='Qty', width=.1, align='CENTER' },
|
||||
{ name='Status', width=.1, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='Seller', width=.1, align='CENTER' },
|
||||
{ name='Your Bid', width=.1, align='RIGHT' },
|
||||
{ name='Bid', width=.1, align='RIGHT' },
|
||||
{ name='Buy', width=.1, align='RIGHT' },
|
||||
})
|
||||
private.listing:SetHandler('OnClick', function(table, row_data, column)
|
||||
private.on_row_click(row_data.record)
|
||||
end)
|
||||
|
||||
private.bid_listing_config = {
|
||||
frame = AuxBidsFrameListingBidListing,
|
||||
on_row_click = function(sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
private.on_row_click(sheet.data[data_index])
|
||||
@@ -50,76 +65,8 @@ function public.on_load()
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id, nil, datum.enchant_id)
|
||||
row.EnhTooltip_info = datum.EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
{
|
||||
title = 'Auction Item',
|
||||
width = 280,
|
||||
comparator = function(row1, row2) return Aux.sort.compare(row1.tooltip[1][1].text, row2.tooltip[1][1].text, Aux.sort.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(Aux.info.item(datum.item_id).texture)
|
||||
if not datum.usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 1.0, 1.0)
|
||||
end
|
||||
cell.text:SetText('['..datum.tooltip[1][1].text..']')
|
||||
local color = ITEM_QUALITY_COLORS[datum.quality]
|
||||
cell.text:SetTextColor(color.r, color.g, color.b)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.sort.compare(row1.stack_size, row2.stack_size, Aux.sort.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Status',
|
||||
width = 70,
|
||||
comparator = function(auction1, auction2) return Aux.sort.compare(auction1.status, auction2.status, Aux.sort.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(auction.status)
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.duration_column(function(entry) return entry.duration end),
|
||||
Aux.listing_util.owner_column(function(datum) return datum.owner end),
|
||||
Aux.listing_util.money_column('Your Bid', function(entry) return entry.your_bid end),
|
||||
Aux.listing_util.money_column('Bid', function(entry) return entry.bid_price end),
|
||||
Aux.listing_util.money_column('Buy', function(entry) return entry.buyout_price end),
|
||||
},
|
||||
sort_order = {{ column = 1, order = 'ascending' }},
|
||||
}
|
||||
|
||||
private.listing = Aux.sheet.create(private.bid_listing_config)
|
||||
do
|
||||
local status_bar = Aux.gui.status_bar(AuxBidsFrame)
|
||||
status_bar:SetWidth(265)
|
||||
@@ -159,6 +106,41 @@ function public.on_load()
|
||||
end
|
||||
end
|
||||
|
||||
function private.update_listing()
|
||||
if not AuxBidsFrame:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
local auction_rows = {}
|
||||
for i, auction_record in bid_records or {} do
|
||||
local status
|
||||
if auction_record.high_bidder then
|
||||
status = GREEN_FONT_COLOR_CODE..'High Bidder'..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
status = RED_FONT_COLOR_CODE..'Outbid'..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
local market_value = Aux.history.market_value(auction_record.item_key)
|
||||
tinsert(auction_rows, {
|
||||
cols = {
|
||||
{ value='|c'..Aux.quality_color(auction_record.quality)..'['..auction_record.name..']'..'|r' },
|
||||
{ value=auction_record.aux_quantity },
|
||||
{ value=status },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
{ value=auction_record.owner },
|
||||
{ value=auction_record.high_bidder and Aux.money.to_string(auction_record.high_bid, true, false) or '---' },
|
||||
{ value=Aux.money.to_string(auction_record.bid_price, true, false) },
|
||||
{ value=auction_record.buyout_price > 0 and Aux.money.to_string(auction_record.buyout_price, true, false) or '---' },
|
||||
-- { value=Aux.auction_listing.percentage_market(market_value and Aux.round(auction_record.unit_buyout_price/market_value * 100) or '---') },
|
||||
},
|
||||
record = auction_record,
|
||||
})
|
||||
end
|
||||
sort(auction_rows, function(a, b) return a.record.unit_buyout_price < b.record.unit_buyout_price end)
|
||||
|
||||
private.listing:SetData(auction_rows)
|
||||
private.listing:SetSelection(function(row) return row.record == selected_auction end)
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
public.scan_bids()
|
||||
refresh = true
|
||||
@@ -185,8 +167,8 @@ function public.scan_bids()
|
||||
private.status_bar:update_status(100 * (page + 1) / total_pages, 100 * (page + 1) / total_pages)
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
tinsert(bid_records, private.create_auction_record(auction_info))
|
||||
on_read_auction = function(auction_record)
|
||||
tinsert(bid_records, auction_record)
|
||||
end,
|
||||
on_complete = function()
|
||||
private.status_bar:update_status(100, 100)
|
||||
@@ -200,59 +182,6 @@ function public.scan_bids()
|
||||
}
|
||||
end
|
||||
|
||||
function private.update_listing()
|
||||
if not AuxBidsFrame:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
AuxBidsFrameListingBidListing:Show()
|
||||
Aux.sheet.populate(private.listing, bid_records)
|
||||
AuxBidsFrameListing:SetWidth(AuxBidsFrameListingBidListing:GetWidth() + 40)
|
||||
end
|
||||
|
||||
function private.create_auction_record(auction_info)
|
||||
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
|
||||
local status
|
||||
if auction_info.high_bidder then
|
||||
status = GREEN_FONT_COLOR_CODE..'High Bidder'..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
status = RED_FONT_COLOR_CODE..'Outbid'..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
|
||||
return {
|
||||
query = auction_info.query,
|
||||
page = auction_info.page,
|
||||
|
||||
item_id = auction_info.item_id,
|
||||
suffix_id = auction_info.suffix_id,
|
||||
unique_id = auction_info.unique_id,
|
||||
enchant_id = auction_info.enchant_id,
|
||||
|
||||
item_id = auction_info.item_id,
|
||||
item_key = auction_info.item_key,
|
||||
signature = auction_info.signature,
|
||||
|
||||
name = auction_info.name,
|
||||
tooltip = auction_info.tooltip,
|
||||
aux_quantity = auction_info.aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
quality = auction_info.quality,
|
||||
hyperlink = auction_info.hyperlink,
|
||||
itemstring = auction_info.itemstring,
|
||||
bid_price = auction_info.bid_price,
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
your_bid = auction_info.high_bidder and auction_info.high_bid,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
function private.process_request(entry, express_mode, buyout_mode)
|
||||
|
||||
if entry.gone or (buyout_mode and not entry.buyout_price) or (express_mode and not buyout_mode and entry.high_bidder) or entry.owner == UnitName('player') then
|
||||
@@ -262,7 +191,7 @@ function private.process_request(entry, express_mode, buyout_mode)
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
local function test(index)
|
||||
local auction_record = private.create_auction_record(Aux.info.auction(index, 'bidder'))
|
||||
local auction_record = Aux.info.auction(index, 'bidder')
|
||||
return auction_record.signature == entry.signature and auction_record.bid_price == entry.bid_price and auction_record.duration == entry.duration and auction_record.owner ~= UnitName('player')
|
||||
end
|
||||
|
||||
|
||||
+6
-13
@@ -13,19 +13,12 @@
|
||||
<Frame name="AuxBidsFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
|
||||
<Frames>
|
||||
<Frame name="$parentListing" inherits="AuxFrameBoxTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="400" y="326"/>
|
||||
</Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="5" y="-35"/></Offset></Anchor></Anchors>
|
||||
<Frames>
|
||||
<Frame name="$parentBidListing">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Anchors>
|
||||
<Anchor point="TOP" relativeTo="AuxFrame"><Offset><AbsDimension x="0" y="-8"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOMLEFT" relativeTo="AuxFrameContent"></Anchor>
|
||||
<Anchor point="BOTTOMRIGHT" relativeTo="AuxFrameContent"></Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
|
||||
@@ -140,10 +140,8 @@ function public.auction(index, type)
|
||||
max_stack = item_info.max_stack,
|
||||
|
||||
count = count,
|
||||
min_bid = start_price, -- deprecated
|
||||
start_price = start_price,
|
||||
high_bid = high_bid,
|
||||
current_bid = high_bid, -- deprecated
|
||||
min_increment = min_increment,
|
||||
bid_price = bid_price,
|
||||
buyout_price = buyout_price,
|
||||
@@ -210,7 +208,7 @@ function public.set_shopping_tooltip(slot)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- ShoppingTooltip1TextLeft1:SetText('Currently Equipped')
|
||||
-- ShoppingTooltip1TextLeft1:SetText('Currently Equipped') -- TODO
|
||||
-- ShoppingTooltip1TextLeft1:SetTextColor(0.5, 0.5, 0.5)
|
||||
|
||||
if index2 then
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
local m = {}
|
||||
Aux.listing_util = m
|
||||
|
||||
function m.money_column(title, getter)
|
||||
return {
|
||||
title = title,
|
||||
width = 80,
|
||||
comparator = function(datum1, datum2) return Aux.sort.compare(getter(datum1), getter(datum2), Aux.sort.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(getter(datum) and Aux.util.money_string(getter(datum)) or 'N/A')
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function m.owner_column(getter)
|
||||
return {
|
||||
title = 'Owner',
|
||||
width = 90,
|
||||
comparator = function(datum1, datum2)
|
||||
if getter(datum1) == UnitName('player') and getter(datum2) == UnitName('player') then
|
||||
return Aux.sort.EQ
|
||||
elseif getter(datum1) == UnitName('player') then
|
||||
return Aux.sort.LT
|
||||
elseif getter(datum2) == UnitName('player') then
|
||||
return Aux.sort.GT
|
||||
else
|
||||
return Aux.sort.compare(getter(datum1), getter(datum2), Aux.sort.GT)
|
||||
end
|
||||
end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(getter(datum) == UnitName('player') and GREEN_FONT_COLOR_CODE..'You'..FONT_COLOR_CODE_CLOSE or getter(datum) or 'N/A')
|
||||
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 = value_getter(datum1) and market_price1 and market_price1 > 0 and value_getter(datum1) / market_price1
|
||||
local factor2 = value_getter(datum2) and market_price2 and market_price2 > 0 and value_getter(datum2) / market_price2
|
||||
return Aux.sort.compare(factor1, factor2, Aux.sort.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 = value_getter(datum) and market_price and market_price > 0 and ceil(100 / market_price * value_getter(datum))
|
||||
if not pct then
|
||||
cell.text:SetText('N/A')
|
||||
cell.text:SetTextColor(0.8, 0.8, 0.8)
|
||||
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
|
||||
|
||||
function m.duration_column(getter)
|
||||
return {
|
||||
title = 'Left',
|
||||
width = 30,
|
||||
comparator = function(datum1, datum2) return Aux.sort.compare(getter(datum1), getter(datum2), Aux.sort.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, datum)
|
||||
local text
|
||||
if getter(datum) == 1 then
|
||||
text = '30m'
|
||||
elseif getter(datum) == 2 then
|
||||
text = '2h'
|
||||
elseif getter(datum) == 3 then
|
||||
text = '8h'
|
||||
elseif getter(datum) == 4 then
|
||||
text = '24h'
|
||||
end
|
||||
cell.text:SetText(text)
|
||||
end,
|
||||
}
|
||||
end
|
||||
+4
-4
@@ -43,9 +43,9 @@ function private.update_auction_listing()
|
||||
cols = {
|
||||
{ value=auction_record.count },
|
||||
{ value=auction_record.yours },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.max_time_left) },
|
||||
{ value=Aux.auction_listing.time_left(auction_record.duration) },
|
||||
{ value=stack_size },
|
||||
{ value=Aux.money.to_string(auction_record.unit_buyout_price) },
|
||||
{ value=Aux.money.to_string(auction_record.unit_buyout_price, true, false) },
|
||||
{ value=Aux.auction_listing.percentage_market(market_value and Aux.round(auction_record.unit_buyout_price/market_value * 100) or '---') },
|
||||
},
|
||||
record = auction_record,
|
||||
@@ -694,7 +694,7 @@ function private.record_auction(key, aux_quantity, buyout_price, duration, owner
|
||||
if entry then
|
||||
entry.count = entry.count + 1
|
||||
entry.yours = entry.yours + (owner == UnitName('player') and 1 or 0)
|
||||
entry.max_time_left = max(entry.max_time_left, duration)
|
||||
entry.duration = max(entry.duration, duration)
|
||||
else
|
||||
tinsert(existing_auctions[key], {
|
||||
item_key = key,
|
||||
@@ -702,7 +702,7 @@ function private.record_auction(key, aux_quantity, buyout_price, duration, owner
|
||||
buyout_price = buyout_price,
|
||||
duration = duration,
|
||||
unit_buyout_price = buyout_price / aux_quantity,
|
||||
max_time_left = duration,
|
||||
duration = duration,
|
||||
count = 1,
|
||||
yours = owner == UnitName('player') and 1 or 0,
|
||||
})
|
||||
|
||||
@@ -33,11 +33,6 @@ function m:complete()
|
||||
if current_filter or not completed_filter_string then
|
||||
current_filter = current_filter or {}
|
||||
|
||||
tinsert(options, 'and')
|
||||
tinsert(options, 'or')
|
||||
tinsert(options, 'not')
|
||||
tinsert(options, 'tt')
|
||||
|
||||
if current_filter.name
|
||||
and Aux.static.auctionable_items[strupper(current_filter.name)]
|
||||
and not current_filter.min_level
|
||||
@@ -52,6 +47,11 @@ function m:complete()
|
||||
tinsert(options, 'exact')
|
||||
end
|
||||
|
||||
tinsert(options, 'and')
|
||||
tinsert(options, 'or')
|
||||
tinsert(options, 'not')
|
||||
tinsert(options, 'tt')
|
||||
|
||||
-- classes
|
||||
if not current_filter.class and not current_filter.exact then
|
||||
for _, class in ipairs({ GetAuctionItemClasses() }) do
|
||||
|
||||
Reference in New Issue
Block a user