auctions panel overhaul
This commit is contained in:
+203
-217
@@ -3,125 +3,135 @@ Aux.auctions_frame = public
|
|||||||
|
|
||||||
local auction_records
|
local auction_records
|
||||||
|
|
||||||
public.auction_listing_config = {
|
|
||||||
on_row_click = function (sheet, row_index)
|
|
||||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
|
||||||
public.on_auction_click(sheet.data[data_index])
|
|
||||||
end,
|
|
||||||
|
|
||||||
on_row_enter = function (sheet, row_index)
|
function public.on_load()
|
||||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
private.auction_listing_config = {
|
||||||
end,
|
frame = AuxAuctionsFrameListingAuctionListing,
|
||||||
|
on_row_click = function (sheet, row_index)
|
||||||
|
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||||
|
public.on_auction_click(sheet, sheet.data[data_index])
|
||||||
|
end,
|
||||||
|
on_row_update = function(sheet, row_index)
|
||||||
|
if IsControlKeyDown() then
|
||||||
|
ShowInspectCursor()
|
||||||
|
else
|
||||||
|
ResetCursor()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
row_setter = function(row, datum)
|
||||||
|
row:SetAlpha(datum.gone and 0.3 or 1)
|
||||||
|
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.util.compare(row1.tooltip[1][1].text, row2.tooltip[1][1].text, 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(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)
|
||||||
|
private.auction_alpha_setter(cell, datum)
|
||||||
|
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, datum)
|
||||||
|
cell.text:SetText(datum.aux_quantity)
|
||||||
|
private.auction_alpha_setter(cell, datum)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = 'Left',
|
||||||
|
width = 30,
|
||||||
|
comparator = function(row1, row2) return Aux.util.compare(row1.duration, row2.duration, Aux.util.GT) end,
|
||||||
|
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||||
|
cell_setter = function(cell, datum)
|
||||||
|
local text
|
||||||
|
if datum.duration == 1 then
|
||||||
|
text = '30m'
|
||||||
|
elseif datum.duration == 2 then
|
||||||
|
text = '2h'
|
||||||
|
elseif datum.duration == 3 then
|
||||||
|
text = '8h'
|
||||||
|
elseif datum.duration == 4 then
|
||||||
|
text = '24h'
|
||||||
|
end
|
||||||
|
cell.text:SetText(text)
|
||||||
|
private.auction_alpha_setter(cell, datum)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = 'Current Bid',
|
||||||
|
width = 80,
|
||||||
|
comparator = function(auction1, auction2) return Aux.util.compare(auction1.current_bid, auction2.current_bid, Aux.util.GT) end,
|
||||||
|
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||||
|
cell_setter = function(cell, auction)
|
||||||
|
cell.text:SetText(auction.current_bid and Aux.util.money_string(auction.current_bid) or RED_FONT_COLOR_CODE..'No Bids'..FONT_COLOR_CODE_CLOSE)
|
||||||
|
private.auction_alpha_setter(cell, auction)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
Aux.listing_util.money_column('Min Bid', function(entry) return entry.min_bid end),
|
||||||
|
Aux.listing_util.money_column('Buy', function(entry) return entry.buyout_price end),
|
||||||
|
},
|
||||||
|
sort_order = {{ column = 1, order = 'ascending' }},
|
||||||
|
}
|
||||||
|
|
||||||
on_row_leave = function (sheet, row_index)
|
private.listing = Aux.sheet.create(private.auction_listing_config)
|
||||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
do
|
||||||
end,
|
local status_bar = Aux.gui.status_bar(AuxAuctionsFrame)
|
||||||
columns = {
|
status_bar:SetWidth(265)
|
||||||
{
|
status_bar:SetHeight(30)
|
||||||
title = 'Auction Item',
|
status_bar:SetPoint('BOTTOMLEFT', AuxAuctionsFrame, 'BOTTOMLEFT', 6, 6)
|
||||||
width = 280,
|
status_bar:update_status(100, 0)
|
||||||
comparator = function(row1, row2) return Aux.util.compare(row1.tooltip[1][1].text, row2.tooltip[1][1].text, Aux.util.GT) end,
|
status_bar:set_text('')
|
||||||
cell_initializer = function(cell)
|
private.status_bar = status_bar
|
||||||
local icon = CreateFrame('Button', nil, cell)
|
end
|
||||||
icon:EnableMouse(false)
|
do
|
||||||
local icon_texture = icon:CreateTexture(nil, 'BORDER')
|
local btn = Aux.gui.button(AuxAuctionsFrame, 15)
|
||||||
icon_texture:SetAllPoints(icon)
|
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
|
||||||
icon.icon_texture = icon_texture
|
btn:SetWidth(80)
|
||||||
local normal_texture = icon:CreateTexture(nil)
|
btn:SetHeight(24)
|
||||||
normal_texture:SetPoint('CENTER', 0, 0)
|
btn:SetText('Cancel')
|
||||||
normal_texture:SetWidth(22)
|
btn:Disable()
|
||||||
normal_texture:SetHeight(22)
|
private.cancel_button = btn
|
||||||
normal_texture:SetTexture('Interface\\Buttons\\UI-Quickslot2')
|
end
|
||||||
icon:SetNormalTexture(normal_texture)
|
end
|
||||||
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)
|
|
||||||
private.auction_alpha_setter(cell, datum)
|
|
||||||
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, datum)
|
|
||||||
cell.text:SetText(datum.aux_quantity)
|
|
||||||
private.auction_alpha_setter(cell, datum)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title = 'Left',
|
|
||||||
width = 30,
|
|
||||||
comparator = function(row1, row2) return Aux.util.compare(row1.duration, row2.duration, Aux.util.GT) end,
|
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
|
||||||
cell_setter = function(cell, datum)
|
|
||||||
local text
|
|
||||||
if datum.duration == 1 then
|
|
||||||
text = '30m'
|
|
||||||
elseif datum.duration == 2 then
|
|
||||||
text = '2h'
|
|
||||||
elseif datum.duration == 3 then
|
|
||||||
text = '8h'
|
|
||||||
elseif datum.duration == 4 then
|
|
||||||
text = '24h'
|
|
||||||
end
|
|
||||||
cell.text:SetText(text)
|
|
||||||
private.auction_alpha_setter(cell, datum)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title = 'Current Bid',
|
|
||||||
width = 90,
|
|
||||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.current_bid, auction2.current_bid, Aux.util.GT) end,
|
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
|
||||||
cell_setter = function(cell, auction)
|
|
||||||
cell.text:SetText(auction.current_bid and Aux.util.money_string(auction.current_bid) or RED_FONT_COLOR_CODE..'No Bids'..FONT_COLOR_CODE_CLOSE)
|
|
||||||
private.auction_alpha_setter(cell, auction)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title = 'Min Bid',
|
|
||||||
width = 90,
|
|
||||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.min_bid, auction2.min_bid, Aux.util.GT) end,
|
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
|
||||||
cell_setter = function(cell, auction)
|
|
||||||
cell.text:SetText(Aux.util.money_string(auction.min_bid))
|
|
||||||
private.auction_alpha_setter(cell, auction)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title = 'Buy',
|
|
||||||
width = 90,
|
|
||||||
comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price, row2.buyout_price, Aux.util.GT) end,
|
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
|
||||||
cell_setter = function(cell, datum)
|
|
||||||
cell.text:SetText(Aux.util.money_string(datum.buyout_price))
|
|
||||||
private.auction_alpha_setter(cell, datum)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
sort_order = {{ column = 1, order = 'ascending' }},
|
|
||||||
}
|
|
||||||
|
|
||||||
function public.on_open()
|
function public.on_open()
|
||||||
public.update_auction_records()
|
public.update_auction_records()
|
||||||
@@ -136,22 +146,32 @@ function private.auction_alpha_setter(cell, auction)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function public.update_auction_records()
|
function public.update_auction_records()
|
||||||
Aux.log('Scanning auctions ...')
|
|
||||||
|
private.status_bar:update_status(0,0)
|
||||||
|
private.status_bar:set_text('Scanning auctions...')
|
||||||
|
|
||||||
|
local current_page
|
||||||
|
|
||||||
auction_records = {}
|
auction_records = {}
|
||||||
Aux.scan.start{
|
Aux.scan.start{
|
||||||
type = 'owner',
|
type = 'owner',
|
||||||
page = 0,
|
page = 0,
|
||||||
on_page_loaded = function(page, total_pages)
|
on_page_loaded = function(page, total_pages)
|
||||||
Aux.log('Scanning auction page '..(page+1)..' out of '..total_pages..' ...')
|
private.status_bar:update_status(100 * (page + 1) / total_pages, 100 * (page + 1) / total_pages)
|
||||||
|
private.status_bar:set_text(string.format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||||
|
current_page = page
|
||||||
end,
|
end,
|
||||||
on_read_auction = function(auction_info)
|
on_read_auction = function(auction_info)
|
||||||
private.create_auction_record(auction_info)
|
tinsert(auction_records, private.create_auction_record(auction_info, current_page))
|
||||||
end,
|
end,
|
||||||
on_complete = function()
|
on_complete = function()
|
||||||
Aux.log('Scan complete: '..getn(auction_records)..' '..Aux_PluralizeIf('auction', getn(auction_records))..' found.')
|
private.status_bar:update_status(100, 100)
|
||||||
|
private.status_bar:set_text('Done Scanning')
|
||||||
public.update_listing()
|
public.update_listing()
|
||||||
end,
|
end,
|
||||||
on_abort = function()
|
on_abort = function()
|
||||||
|
private.status_bar:update_status(100, 100)
|
||||||
|
private.status_bar:set_text('Done Scanning')
|
||||||
end,
|
end,
|
||||||
next_page = function(page, total_pages)
|
next_page = function(page, total_pages)
|
||||||
local last_page = max(total_pages - 1, 0)
|
local last_page = max(total_pages - 1, 0)
|
||||||
@@ -164,12 +184,12 @@ end
|
|||||||
|
|
||||||
function public.update_listing()
|
function public.update_listing()
|
||||||
AuxAuctionsFrameListingAuctionListing:Show()
|
AuxAuctionsFrameListingAuctionListing:Show()
|
||||||
Aux.sheet.populate(AuxAuctionsFrameListingAuctionListing.sheet, auction_records)
|
Aux.sheet.populate(private.listing, auction_records)
|
||||||
AuxAuctionsFrameListing:SetWidth(AuxAuctionsFrameListingAuctionListing:GetWidth() + 40)
|
AuxAuctionsFrameListing:SetWidth(AuxAuctionsFrameListingAuctionListing:GetWidth() + 40)
|
||||||
AuxFrame:SetWidth(AuxAuctionsFrameListing:GetWidth() + 15)
|
AuxFrame:SetWidth(AuxAuctionsFrameListing:GetWidth() + 15)
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.create_record(auction_info)
|
function private.create_auction_record(auction_info, page)
|
||||||
|
|
||||||
local aux_quantity = auction_info.charges or auction_info.count
|
local aux_quantity = auction_info.charges or auction_info.count
|
||||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||||
@@ -184,9 +204,11 @@ function private.create_record(auction_info)
|
|||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
page = page,
|
||||||
|
|
||||||
item_id = auction_info.item_id,
|
item_id = auction_info.item_id,
|
||||||
key = auction_info.item_signature,
|
key = auction_info.item_signature,
|
||||||
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price),
|
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price, auction_info.duration),
|
||||||
|
|
||||||
name = auction_info.name,
|
name = auction_info.name,
|
||||||
tooltip = auction_info.tooltip,
|
tooltip = auction_info.tooltip,
|
||||||
@@ -208,118 +230,82 @@ function private.create_record(auction_info)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.create_auction_record(auction_info)
|
|
||||||
tinsert(auction_records, private.create_record(auction_info))
|
|
||||||
end
|
|
||||||
|
|
||||||
function public.dialog_cancel()
|
|
||||||
Aux.scan.abort()
|
|
||||||
AuxAuctionsFrameListingDialog:Hide()
|
|
||||||
public.update_listing()
|
|
||||||
end
|
|
||||||
|
|
||||||
function private.find_auction(entry, express_mode)
|
function private.find_auction(entry, express_mode)
|
||||||
|
|
||||||
if entry.gone then
|
|
||||||
Aux.log('Auction not available.')
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local amount
|
|
||||||
|
|
||||||
Aux.log('...')
|
|
||||||
|
|
||||||
if not express_mode then
|
|
||||||
private.show_dialog(entry)
|
|
||||||
end
|
|
||||||
|
|
||||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||||
|
|
||||||
local found
|
local function test(index)
|
||||||
|
return private.create_auction_record(Aux.info.auction(index, 'owner')).signature == entry.signature
|
||||||
|
end
|
||||||
|
|
||||||
Aux.scan.start{
|
Aux.scan_util.find_auction('owner', test, {}, entry.page, private.status_bar, function(index)
|
||||||
type = 'owner',
|
|
||||||
page = entry.page,
|
|
||||||
on_read_auction = function(auction_info, ctrl)
|
|
||||||
|
|
||||||
local auction_record = private.create_record(auction_info)
|
if not index then
|
||||||
|
entry.gone = true
|
||||||
|
private.listing:clear_selection()
|
||||||
|
refresh = true
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if entry.signature == auction_record.signature then
|
if not test(index) then
|
||||||
ctrl.suspend()
|
return private.find_auction(entry, express_mode) -- try again
|
||||||
found = true
|
end
|
||||||
Aux.log('')
|
|
||||||
|
|
||||||
if express_mode then
|
if express_mode then
|
||||||
CancelAuction(auction_info.index)
|
CancelAuction(index)
|
||||||
entry.gone = true
|
entry.gone = true
|
||||||
Aux.log('Canceled '..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
|
||||||
Aux.scan.abort()
|
private.listing:clear_selection()
|
||||||
else
|
refresh = true
|
||||||
public.dialog_action = function()
|
else
|
||||||
if private.create_record(Aux.info.auction(auction_info.index, 'owner')).signature == entry.signature then
|
private.cancel_button:SetScript('OnClick', function()
|
||||||
CancelAuction(auction_info.index)
|
|
||||||
entry.gone = true
|
if not test(index) then
|
||||||
Aux.log('Canceled '..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
private.cancel_button:Disable()
|
||||||
Aux.scan.abort()
|
return private.find_auction(entry, express_mode) -- try again
|
||||||
AuxAuctionsFrameListingDialog:Hide()
|
|
||||||
public.update_listing()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
AuxAuctionsFrameListingDialogContentActionButton:Enable()
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
end,
|
CancelAuction(index)
|
||||||
on_complete = function()
|
|
||||||
if not found then
|
|
||||||
Aux.log('No matching auction found. Removing entry from the cache.')
|
|
||||||
entry.gone = true
|
entry.gone = true
|
||||||
public.dialog_cancel()
|
|
||||||
end
|
private.cancel_button:Disable()
|
||||||
end,
|
private.listing:clear_selection()
|
||||||
on_abort = function()
|
refresh = true -- TODO
|
||||||
public.update_listing()
|
end)
|
||||||
end,
|
private.cancel_button:Enable()
|
||||||
next_page = function(page, total_pages)
|
end
|
||||||
if not page or page == entry.page then
|
end)
|
||||||
return entry.page - 1
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function public.on_auction_click(auction_record)
|
--function private.find_auction(entry, express_mode)
|
||||||
|
--
|
||||||
|
--
|
||||||
|
-- next_page = function(page, total_pages)
|
||||||
|
-- if not page or page == entry.page then -- TODO
|
||||||
|
-- return entry.page - 1
|
||||||
|
-- end
|
||||||
|
-- end
|
||||||
|
--
|
||||||
|
--end
|
||||||
|
|
||||||
|
function public.on_auction_click(listing, auction_record)
|
||||||
|
|
||||||
local express_mode = IsAltKeyDown()
|
local express_mode = IsAltKeyDown()
|
||||||
|
|
||||||
if IsControlKeyDown() then
|
if IsControlKeyDown() then
|
||||||
DressUpItemLink(auction_record.hyperlink)
|
DressUpItemLink(auction_record.hyperlink)
|
||||||
else
|
elseif IsShiftKeyDown() then
|
||||||
|
if ChatFrameEditBox:IsVisible() then
|
||||||
|
ChatFrameEditBox:Insert(auction_record.hyperlink)
|
||||||
|
end
|
||||||
|
elseif not auction_record.gone then
|
||||||
|
if not express_mode then
|
||||||
|
private.cancel_button:Disable()
|
||||||
|
listing:clear_selection()
|
||||||
|
listing:select(auction_record)
|
||||||
|
end
|
||||||
private.find_auction(auction_record, express_mode)
|
private.find_auction(auction_record, express_mode)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.show_dialog(entry)
|
|
||||||
AuxAuctionsFrameListingDialogContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
|
||||||
AuxAuctionsFrameListingDialogContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
|
||||||
|
|
||||||
AuxAuctionsFrameListingDialogContentActionButton:Disable()
|
|
||||||
AuxAuctionsFrameListingDialogContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
|
||||||
AuxAuctionsFrameListingDialogContentItemName:SetText(entry.name)
|
|
||||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
|
||||||
AuxAuctionsFrameListingDialogContentItemName:SetTextColor(color.r, color.g, color.b)
|
|
||||||
|
|
||||||
if entry.aux_quantity > 1 then
|
|
||||||
AuxAuctionsFrameListingDialogContentItemCount:SetText(entry.aux_quantity);
|
|
||||||
AuxAuctionsFrameListingDialogContentItemCount:Show()
|
|
||||||
else
|
|
||||||
AuxAuctionsFrameListingDialogContentItemCount:Hide()
|
|
||||||
end
|
|
||||||
|
|
||||||
AuxAuctionsFrameListingDialogContentCancelLabel:Show()
|
|
||||||
AuxAuctionsFrameListingDialogContentActionButton:SetText('Yes')
|
|
||||||
AuxAuctionsFrameListingDialogContentCancelButton:SetText('No')
|
|
||||||
|
|
||||||
AuxAuctionsFrameListingDialog:Show()
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,21 +15,6 @@
|
|||||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||||
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||||
</Anchors>
|
</Anchors>
|
||||||
<Scripts>
|
|
||||||
<OnLoad>
|
|
||||||
local config = Aux.auctions_frame.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,
|
|
||||||
on_row_update = config.on_row_update,
|
|
||||||
}
|
|
||||||
</OnLoad>
|
|
||||||
</Scripts>
|
|
||||||
</Frame>
|
</Frame>
|
||||||
<Frame name="$parentDialog" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
<Frame name="$parentDialog" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
||||||
<Anchors>
|
<Anchors>
|
||||||
|
|||||||
@@ -100,6 +100,7 @@ function Aux_OnLoad()
|
|||||||
Aux.item_search_frame.on_load()
|
Aux.item_search_frame.on_load()
|
||||||
Aux.filter_search_frame.on_load()
|
Aux.filter_search_frame.on_load()
|
||||||
Aux.post_frame.on_load()
|
Aux.post_frame.on_load()
|
||||||
|
Aux.auctions_frame.on_load()
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux_OnEvent()
|
function Aux_OnEvent()
|
||||||
|
|||||||
+3
-11
@@ -359,15 +359,7 @@ function public.on_load()
|
|||||||
cell.text:SetText(text)
|
cell.text:SetText(text)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
Aux.listing_util.owner_column(function(datum) return datum.owner end),
|
||||||
title = 'Owner',
|
|
||||||
width = 90,
|
|
||||||
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
|
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
|
||||||
cell_setter = function(cell, datum)
|
|
||||||
cell.text:SetText(datum.owner)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
Aux.listing_util.percentage_market_column(function(entry) return entry.item_key end, function(entry) return entry.buyout_price_per_unit 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' }},
|
sort_order = {{column = 1, order = 'ascending' }, {column = 7, order = 'ascending' }},
|
||||||
@@ -771,7 +763,7 @@ function private.find_auction(entry, express_mode, buyout_mode)
|
|||||||
return private.create_auction_record(Aux.info.auction(index)).signature == entry.signature
|
return private.create_auction_record(Aux.info.auction(index)).signature == entry.signature
|
||||||
end
|
end
|
||||||
|
|
||||||
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index)
|
Aux.scan_util.find_auction('list', test, search_query, entry.page, private.status_bar, function(index)
|
||||||
if not index then
|
if not index then
|
||||||
entry.gone = true
|
entry.gone = true
|
||||||
private.clear_selection()
|
private.clear_selection()
|
||||||
@@ -841,7 +833,7 @@ function private.on_row_click(sheet, datum, grouped)
|
|||||||
if ChatFrameEditBox:IsVisible() then
|
if ChatFrameEditBox:IsVisible() then
|
||||||
ChatFrameEditBox:Insert(entry.hyperlink)
|
ChatFrameEditBox:Insert(entry.hyperlink)
|
||||||
end
|
end
|
||||||
elseif not entry.gone then
|
elseif not entry.gone and entry.owner ~= UnitName('player') then
|
||||||
if not express_mode then
|
if not express_mode then
|
||||||
private.buyout_button:Disable()
|
private.buyout_button:Disable()
|
||||||
private.bid_button:Disable()
|
private.bid_button:Disable()
|
||||||
|
|||||||
+3
-11
@@ -293,15 +293,7 @@ function public.on_load()
|
|||||||
cell.text:SetText(text)
|
cell.text:SetText(text)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{
|
Aux.listing_util.owner_column(function(datum) return datum.owner end),
|
||||||
title = 'Owner',
|
|
||||||
width = 90,
|
|
||||||
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
|
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
|
||||||
cell_setter = function(cell, datum)
|
|
||||||
cell.text:SetText(datum.owner)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title = 'Page',
|
title = 'Page',
|
||||||
width = 40,
|
width = 40,
|
||||||
@@ -626,7 +618,7 @@ function private.find_auction(entry, express_mode, buyout_mode)
|
|||||||
return private.create_auction_record(Aux.info.auction(index)).signature == entry.signature
|
return private.create_auction_record(Aux.info.auction(index)).signature == entry.signature
|
||||||
end
|
end
|
||||||
|
|
||||||
Aux.scan_util.find_auction(test, search_query, entry.page, private.status_bar, function(index)
|
Aux.scan_util.find_auction('list', test, search_query, entry.page, private.status_bar, function(index)
|
||||||
|
|
||||||
if not index then
|
if not index then
|
||||||
entry.gone = true
|
entry.gone = true
|
||||||
@@ -697,7 +689,7 @@ function private.on_row_click(sheet, datum, grouped)
|
|||||||
if ChatFrameEditBox:IsVisible() then
|
if ChatFrameEditBox:IsVisible() then
|
||||||
ChatFrameEditBox:Insert(entry.hyperlink)
|
ChatFrameEditBox:Insert(entry.hyperlink)
|
||||||
end
|
end
|
||||||
elseif not entry.gone then
|
elseif not entry.gone and entry.owner ~= UnitName('player') then
|
||||||
if not express_mode then
|
if not express_mode then
|
||||||
private.buyout_button:Disable()
|
private.buyout_button:Disable()
|
||||||
private.bid_button:Disable()
|
private.bid_button:Disable()
|
||||||
|
|||||||
+49
-27
@@ -14,32 +14,54 @@ function m.money_column(name, getter)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.percentage_market_column(item_key_getter, value_getter)
|
function m.owner_column(getter)
|
||||||
return {
|
return {
|
||||||
title = 'Pct',
|
title = 'Owner',
|
||||||
width = 40,
|
width = 90,
|
||||||
comparator = function(datum1, datum2)
|
comparator = function(datum1, datum2)
|
||||||
local market_price1 = Aux.history.market_value(item_key_getter(datum1))
|
if getter(datum1) == UnitName('player') and getter(datum2) == UnitName('player') then
|
||||||
local market_price2 = Aux.history.market_value(item_key_getter(datum2))
|
return Aux.util.EQ
|
||||||
local factor1 = market_price1 > 0 and value_getter(datum1) / market_price1
|
elseif getter(datum1) == UnitName('player') then
|
||||||
local factor2 = market_price2 > 0 and value_getter(datum2) / market_price2
|
return Aux.util.LT
|
||||||
return Aux.util.compare(factor1, factor2, Aux.util.GT)
|
elseif getter(datum2) == UnitName('player') then
|
||||||
end,
|
return Aux.util.GT
|
||||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
else
|
||||||
cell_setter = function(cell, datum)
|
return Aux.util.compare(getter(datum1), getter(datum2), Aux.util.GT)
|
||||||
local market_price = Aux.history.market_value(item_key_getter(datum))
|
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))
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
local pct = market_price > 0 and ceil(100 / market_price * value_getter(datum))
|
function m.percentage_market_column(item_key_getter, value_getter)
|
||||||
if not pct then
|
return {
|
||||||
cell.text:SetText('N/A')
|
title = 'Pct',
|
||||||
elseif pct > 999 then
|
width = 40,
|
||||||
cell.text:SetText('>999%')
|
comparator = function(datum1, datum2)
|
||||||
else
|
local market_price1 = Aux.history.market_value(item_key_getter(datum1))
|
||||||
cell.text:SetText(pct..'%')
|
local market_price2 = Aux.history.market_value(item_key_getter(datum2))
|
||||||
end
|
local factor1 = market_price1 > 0 and value_getter(datum1) / market_price1
|
||||||
if pct then
|
local factor2 = market_price2 > 0 and value_getter(datum2) / market_price2
|
||||||
cell.text:SetTextColor(Aux.price_level_color(pct))
|
return Aux.util.compare(factor1, factor2, Aux.util.GT)
|
||||||
end
|
end,
|
||||||
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 and 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
|
end
|
||||||
+2
-1
@@ -1,7 +1,7 @@
|
|||||||
local m = {}
|
local m = {}
|
||||||
Aux.scan_util = m
|
Aux.scan_util = m
|
||||||
|
|
||||||
function m.find_auction(test, search_query, page, status_bar, callback)
|
function m.find_auction(type, test, search_query, page, status_bar, callback)
|
||||||
|
|
||||||
Aux.scan.abort(function()
|
Aux.scan.abort(function()
|
||||||
|
|
||||||
@@ -11,6 +11,7 @@ function m.find_auction(test, search_query, page, status_bar, callback)
|
|||||||
local pages = page > 0 and { page, page - 1 } or { page }
|
local pages = page > 0 and { page, page - 1 } or { page }
|
||||||
|
|
||||||
Aux.scan.start{
|
Aux.scan.start{
|
||||||
|
type = type,
|
||||||
query = search_query,
|
query = search_query,
|
||||||
on_read_auction = function(auction_info, ctrl)
|
on_read_auction = function(auction_info, ctrl)
|
||||||
if test(auction_info.index) then
|
if test(auction_info.index) then
|
||||||
|
|||||||
Reference in New Issue
Block a user