bids panel overhauled
This commit is contained in:
+14
-24
@@ -9,7 +9,14 @@ function public.on_load()
|
||||
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])
|
||||
public.on_auction_click(sheet.data[data_index])
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
@@ -63,7 +70,6 @@ function public.on_load()
|
||||
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,
|
||||
},
|
||||
{
|
||||
@@ -73,7 +79,6 @@ function public.on_load()
|
||||
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,
|
||||
},
|
||||
{
|
||||
@@ -93,7 +98,6 @@ function public.on_load()
|
||||
text = '24h'
|
||||
end
|
||||
cell.text:SetText(text)
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -103,7 +107,6 @@ function public.on_load()
|
||||
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),
|
||||
@@ -139,10 +142,8 @@ function public.on_open()
|
||||
end
|
||||
|
||||
function public.on_close()
|
||||
end
|
||||
|
||||
function private.auction_alpha_setter(cell, auction)
|
||||
cell:SetAlpha(auction.gone and 0.3 or 1)
|
||||
private.listing:clear_selection()
|
||||
private.cancel_button:Disable()
|
||||
end
|
||||
|
||||
function public.update_auction_records()
|
||||
@@ -158,7 +159,7 @@ function public.update_auction_records()
|
||||
page = 0,
|
||||
on_page_loaded = function(page, 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))
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
@@ -277,18 +278,7 @@ function private.find_auction(entry, express_mode)
|
||||
end)
|
||||
end
|
||||
|
||||
--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)
|
||||
function public.on_auction_click(auction_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
|
||||
@@ -301,8 +291,8 @@ function public.on_auction_click(listing, auction_record)
|
||||
elseif not auction_record.gone then
|
||||
if not express_mode then
|
||||
private.cancel_button:Disable()
|
||||
listing:clear_selection()
|
||||
listing:select(auction_record)
|
||||
private.listing:clear_selection()
|
||||
private.listing:select(auction_record)
|
||||
end
|
||||
private.find_auction(auction_record, express_mode)
|
||||
end
|
||||
|
||||
@@ -15,51 +15,6 @@
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
<Frame name="$parentDialog" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnMouseWheel></OnMouseWheel>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentContent">
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="5"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="120"/></Size>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString name="$parentCancelLabel" inherits="GameFontNormal" text="Cancel this auction?" justifyH="RIGHT">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="45"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Frame name="$parentItem" inherits="AuxItemTemplate">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Button name="$parentActionButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||
<Size><AbsDimension x="90" y="26"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.auctions_frame.dialog_action()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="90" y="26"/></Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.auctions_frame.dialog_cancel()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
+219
-264
@@ -3,146 +3,140 @@ Aux.bids_frame = public
|
||||
|
||||
local bid_records
|
||||
|
||||
public.bid_listing_config = {
|
||||
on_row_click = function(sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
public.on_bid_click(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)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
function public.on_load()
|
||||
private.bid_listing_config = {
|
||||
frame = AuxBidsFrameListingBidListing,
|
||||
on_row_click = function(sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
public.on_bid_click(sheet.data[data_index])
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
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)
|
||||
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)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Status',
|
||||
width = 70,
|
||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.status, auction2.status, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(auction.status)
|
||||
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)
|
||||
end,
|
||||
},
|
||||
Aux.listing_util.owner_column(function(datum) return datum.owner end),
|
||||
Aux.listing_util.money_column('Your Bid', function(entry) return entry.current_bid end),
|
||||
Aux.listing_util.money_column('Buy', function(entry) return entry.buyout_price end),
|
||||
},
|
||||
sort_order = {{ column = 1, order = 'ascending' }},
|
||||
}
|
||||
|
||||
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 = 'Status',
|
||||
width = 70,
|
||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.status, auction2.status, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(auction.status)
|
||||
private.auction_alpha_setter(cell, auction)
|
||||
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 = '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)
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Your 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(Aux.util.money_string(auction.current_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' }},
|
||||
}
|
||||
private.listing = Aux.sheet.create(private.bid_listing_config)
|
||||
do
|
||||
local status_bar = Aux.gui.status_bar(AuxBidsFrame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(30)
|
||||
status_bar:SetPoint('BOTTOMLEFT', AuxBidsFrame, '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(AuxBidsFrame, 15)
|
||||
btn:SetPoint('TOPLEFT', private.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Buyout')
|
||||
btn:Disable()
|
||||
private.buyout_button = btn
|
||||
end
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
public.update_bid_records()
|
||||
@@ -150,29 +144,38 @@ function public.on_open()
|
||||
end
|
||||
|
||||
function public.on_close()
|
||||
end
|
||||
|
||||
function private.auction_alpha_setter(cell, auction)
|
||||
cell:SetAlpha(auction.gone and 0.3 or 1)
|
||||
private.listing:clear_selection()
|
||||
private.buyout_button:Disable()
|
||||
-- private.bid_button:Disable()
|
||||
end
|
||||
|
||||
function public.update_bid_records()
|
||||
Aux.log('Scanning bids ...')
|
||||
|
||||
private.status_bar:update_status(0,0)
|
||||
private.status_bar:set_text('Scanning auctions...')
|
||||
|
||||
local current_page
|
||||
|
||||
bid_records = {}
|
||||
Aux.scan.start{
|
||||
type = 'bidder',
|
||||
page = 0,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning bid 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(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
private.create_bid_record(auction_info)
|
||||
tinsert(bid_records, private.create_bid_record(auction_info, current_page))
|
||||
end,
|
||||
on_complete = function()
|
||||
Aux.log('Scan complete: '..getn(bid_records)..' '..Aux_PluralizeIf('bid', getn(bid_records))..' found.')
|
||||
private.status_bar:update_status(100, 100)
|
||||
private.status_bar:set_text('Done Scanning')
|
||||
public.update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
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)
|
||||
@@ -185,12 +188,12 @@ end
|
||||
|
||||
function public.update_listing()
|
||||
AuxBidsFrameListingBidListing:Show()
|
||||
Aux.sheet.populate(AuxBidsFrameListingBidListing.sheet, bid_records)
|
||||
Aux.sheet.populate(private.listing, bid_records)
|
||||
AuxBidsFrameListing:SetWidth(AuxBidsFrameListingBidListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxBidsFrameListing:GetWidth() + 15)
|
||||
end
|
||||
|
||||
function private.create_record(auction_info)
|
||||
function private.create_bid_record(auction_info, page)
|
||||
|
||||
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
|
||||
@@ -205,6 +208,8 @@ function private.create_record(auction_info)
|
||||
end
|
||||
|
||||
return {
|
||||
page = page,
|
||||
|
||||
item_id = auction_info.item_id,
|
||||
key = auction_info.item_signature,
|
||||
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price),
|
||||
@@ -229,146 +234,96 @@ function private.create_record(auction_info)
|
||||
}
|
||||
end
|
||||
|
||||
function private.create_bid_record(auction_info)
|
||||
tinsert(bid_records, private.create_record(auction_info))
|
||||
end
|
||||
function private.find_auction(entry, express_mode, buyout_mode)
|
||||
|
||||
function public.dialog_cancel()
|
||||
Aux.scan.abort()
|
||||
AuxBidsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
|
||||
function private.find_auction(entry, action, express_mode)
|
||||
|
||||
if entry.gone then
|
||||
Aux.log('Auction not available.')
|
||||
return
|
||||
end
|
||||
|
||||
if action == 'buyout' and not entry.buyout_price then
|
||||
Aux.log('Auction has no buyout price.')
|
||||
if buyout_mode and not entry.buyout_price then
|
||||
return
|
||||
end
|
||||
|
||||
local amount
|
||||
if action == 'buyout' then
|
||||
if buyout_mode then
|
||||
amount = entry.buyout_price
|
||||
elseif action == 'bid' then
|
||||
else
|
||||
amount = entry.bid
|
||||
end
|
||||
|
||||
Aux.log('Searching auction ...')
|
||||
|
||||
if not express_mode then
|
||||
private.show_dialog(action, entry, amount)
|
||||
end
|
||||
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
local found
|
||||
local function test(index)
|
||||
return private.create_bid_record(Aux.info.auction(index, 'bidder')).signature == entry.signature
|
||||
end
|
||||
|
||||
Aux.scan.start{
|
||||
type = 'bidder',
|
||||
page = entry.page,
|
||||
on_read_auction = function(auction_info, ctrl)
|
||||
Aux.scan_util.find_auction('bidder', test, {}, entry.page, private.status_bar, function(index)
|
||||
|
||||
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
|
||||
ctrl.suspend()
|
||||
found = true
|
||||
Aux.log('Matching auction found.')
|
||||
if not test(index) then
|
||||
return private.find_auction(entry, express_mode, buyout_mode) -- try again
|
||||
end
|
||||
|
||||
if express_mode then
|
||||
if GetMoney() >= amount then
|
||||
Aux.place_bid('bidder', auction_info.index, amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log((action == 'buyout' and 'Purchase' or 'Bid')..' failed: Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if private.create_record(Aux.info.auction(auction_info.index, 'bidder')).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
Aux.place_bid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxBidsFrameListingDialogContentBid) or amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' ('..auction_record.aux_quantity..').')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxBidsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
end
|
||||
AuxBidsFrameListingDialogContentActionButton:Enable()
|
||||
end
|
||||
if express_mode then
|
||||
if Aux.bid_lock then
|
||||
return
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
if not found then
|
||||
Aux.log('No matching auction found. Removing entry from the cache.')
|
||||
|
||||
if GetMoney() >= amount then
|
||||
entry.gone = true
|
||||
public.dialog_cancel()
|
||||
end
|
||||
end,
|
||||
on_abort = function()
|
||||
public.update_listing()
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
if not page or page == entry.page then
|
||||
return entry.page - 1
|
||||
end
|
||||
end,
|
||||
}
|
||||
Aux.place_bid('bidder', index, amount)
|
||||
|
||||
private.listing:clear_selection()
|
||||
refresh = true
|
||||
else
|
||||
private.buyout_button:SetScript('OnClick', function()
|
||||
if Aux.bid_lock then
|
||||
return
|
||||
end
|
||||
|
||||
if not test(index) then
|
||||
private.buyout_button:Disable()
|
||||
-- private.bid_button:Disable()
|
||||
return private.find_auction(entry, express_mode, buyout_mode) -- try again
|
||||
end
|
||||
|
||||
if GetMoney() >= amount then
|
||||
entry.gone = true
|
||||
end
|
||||
Aux.place_bid('bidder', index, entry.buyout_price)
|
||||
|
||||
private.buyout_button:Disable()
|
||||
-- private.bid_button:Disable()
|
||||
private.listing:clear_selection()
|
||||
refresh = true
|
||||
end)
|
||||
private.buyout_button:Enable()
|
||||
-- private.bid_button:Enable()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function public.on_bid_click(bid_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
local action = arg1 == 'LeftButton' and 'buyout' or 'bid'
|
||||
local buyout_mode = express_mode and arg1 == 'LeftButton'
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(bid_record.hyperlink)
|
||||
else
|
||||
private.find_auction(bid_record, action, express_mode)
|
||||
elseif IsShiftKeyDown() then
|
||||
if ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(bid_record.hyperlink)
|
||||
end
|
||||
elseif not bid_record.gone then
|
||||
if not express_mode then
|
||||
private.buyout_button:Disable()
|
||||
-- private.bid_button:Disable()
|
||||
private.listing:clear_selection()
|
||||
private.listing:select(bid_record)
|
||||
end
|
||||
private.find_auction(bid_record, express_mode, buyout_mode)
|
||||
end
|
||||
end
|
||||
|
||||
function private.show_dialog(action, entry, amount)
|
||||
AuxBidsFrameListingDialogContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
||||
AuxBidsFrameListingDialogContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
||||
|
||||
AuxBidsFrameListingDialogContentActionButton:Disable()
|
||||
AuxBidsFrameListingDialogContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
||||
AuxBidsFrameListingDialogContentItemName:SetText(entry.name)
|
||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||
AuxBidsFrameListingDialogContentItemName:SetTextColor(color.r, color.g, color.b)
|
||||
|
||||
if entry.aux_quantity > 1 then
|
||||
AuxBidsFrameListingDialogContentItemCount:SetText(entry.aux_quantity);
|
||||
AuxBidsFrameListingDialogContentItemCount:Show()
|
||||
else
|
||||
AuxBidsFrameListingDialogContentItemCount:Hide()
|
||||
end
|
||||
|
||||
if action == 'buyout' then
|
||||
AuxBidsFrameListingDialogContentActionButton:SetText('Buy')
|
||||
AuxBidsFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyFrame_Update('AuxBidsFrameListingDialogContentBuyoutPrice', amount)
|
||||
AuxBidsFrameListingDialogContentBid:Hide()
|
||||
AuxBidsFrameListingDialogContentBuyoutPrice:Show()
|
||||
elseif action == 'bid' then
|
||||
AuxBidsFrameListingDialogContentActionButton:SetText('Bid')
|
||||
AuxBidsFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyInputFrame_SetCopper(AuxBidsFrameListingDialogContentBid, amount)
|
||||
AuxBidsFrameListingDialogContentBuyoutPrice:Hide()
|
||||
AuxBidsFrameListingDialogContentBid:Show()
|
||||
end
|
||||
AuxBidsFrameListingDialog:Show()
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
@@ -15,86 +15,7 @@
|
||||
<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.bids_frame.bid_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 name="$parentDialog" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnMouseWheel></OnMouseWheel>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentContent">
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="5"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="120"/></Size>
|
||||
<Frames>
|
||||
<Frame name="$parentItem" inherits="AuxItemTemplate">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="43"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"><Offset><AbsDimension x="-10" y="0"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="45"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"><Offset><AbsDimension x="-5" y="0"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Button name="$parentActionButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||
<Size><AbsDimension x="90" y="26"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.bids_frame.dialog_action()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="90" y="26"/></Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.bids_frame.dialog_cancel()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
|
||||
+2
-2
@@ -139,7 +139,7 @@ function public.completor(edit_box)
|
||||
function self.next()
|
||||
update_dropdown()
|
||||
if getn(suggestions) > 0 then
|
||||
index = index > 0 and math.mod(index + 1, getn(suggestions) + 1) or 1
|
||||
index = index > 0 and mod(index + 1, getn(suggestions) + 1) or 1
|
||||
update_highlighting()
|
||||
if index == 0 then
|
||||
self.set_quietly(input)
|
||||
@@ -245,7 +245,7 @@ function public.selector(edit_box)
|
||||
function self.next()
|
||||
update_dropdown()
|
||||
if getn(suggestions) > 0 then
|
||||
index = math.mod(index, getn(suggestions)) + 1
|
||||
index = mod(index, getn(suggestions)) + 1
|
||||
update_highlighting()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -101,6 +101,7 @@ function Aux_OnLoad()
|
||||
Aux.filter_search_frame.on_load()
|
||||
Aux.post_frame.on_load()
|
||||
Aux.auctions_frame.on_load()
|
||||
Aux.bids_frame.on_load()
|
||||
end
|
||||
|
||||
function Aux_OnEvent()
|
||||
|
||||
@@ -702,7 +702,7 @@ function public.start_search()
|
||||
end,
|
||||
on_page_loaded = function(page, 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))
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
|
||||
@@ -215,7 +215,7 @@ function public.auction_signature(index, type)
|
||||
local _, _, count, _, _, _, min_bid, _, buyout_price, _, _, owner = GetAuctionItemInfo('list', index)
|
||||
local hyperlink = GetAuctionItemLink(type, index)
|
||||
local item_id, suffix_id, unique_id, enchant_id = private.parse_hyperlink(hyperlink)
|
||||
return string.format(
|
||||
return format(
|
||||
'%s:%s:%s:%s:%s:%s:%s',
|
||||
item_id or 0,
|
||||
suffix_id or 0,
|
||||
|
||||
@@ -556,7 +556,7 @@ function public.start_search()
|
||||
page = AuxItemSearchFrameItemAllPagesCheckButton:GetChecked() and 0 or AuxItemSearchFrameItemPageEditBox:GetNumber(),
|
||||
on_page_loaded = function(page, 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))
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
|
||||
+1
-1
@@ -593,7 +593,7 @@ function private.refresh_entries()
|
||||
page = 0,
|
||||
on_page_loaded = function(page, 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))
|
||||
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
if auction_info.item_key == item_key then
|
||||
|
||||
Reference in New Issue
Block a user