Merge branch 'master' into dev
This commit is contained in:
+4
-3
@@ -1,7 +1,7 @@
|
||||
## Interface: 11200
|
||||
## Title: Aux
|
||||
## Notes: A lightweight addon designed to help manage auctions
|
||||
## SavedVariablesPerCharacter: AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
|
||||
## SavedVariablesPerCharacter: aux_view, AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
|
||||
## SavedVariables: aux_database, aux_recently_searched, aux_auctionable_items
|
||||
|
||||
core.xml
|
||||
@@ -12,14 +12,15 @@ util.lua
|
||||
scan.lua
|
||||
stack.lua
|
||||
post.lua
|
||||
list.lua
|
||||
sheet.lua
|
||||
info.xml
|
||||
completion.xml
|
||||
|
||||
item_search_frame.xml
|
||||
filter_search_frame.xml
|
||||
post_frame.xml
|
||||
manage_frame.xml
|
||||
auctions_frame.xml
|
||||
bids_frame.xml
|
||||
scan_frame.xml
|
||||
|
||||
options.xml
|
||||
|
||||
@@ -0,0 +1,326 @@
|
||||
local private, public = {}, {}
|
||||
Aux.auctions_frame = public
|
||||
|
||||
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)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
end,
|
||||
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
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 = 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()
|
||||
public.update_auction_records()
|
||||
public.update_listing()
|
||||
end
|
||||
|
||||
function public.on_close()
|
||||
end
|
||||
|
||||
function private.auction_alpha_setter(cell, auction)
|
||||
cell:SetAlpha(auction.gone and 0.3 or 1)
|
||||
end
|
||||
|
||||
function public.update_auction_records()
|
||||
Aux.log('Scanning auctions ...')
|
||||
auction_records = {}
|
||||
Aux.scan.start{
|
||||
type = 'owner',
|
||||
page = 0,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning auction page '..(page+1)..' out of '..total_pages..' ...')
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
private.create_auction_record(auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
Aux.log('Scan complete: '..getn(auction_records)..' '..Aux_PluralizeIf('auction', getn(auction_records))..' found')
|
||||
public.update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
if page < last_page then
|
||||
return page + 1
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function public.update_listing()
|
||||
AuxAuctionsFrameListingAuctionListing:Show()
|
||||
Aux.sheet.populate(AuxAuctionsFrameListingAuctionListing.sheet, auction_records)
|
||||
AuxAuctionsFrameListing:SetWidth(AuxAuctionsFrameListingAuctionListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxAuctionsFrameListing:GetWidth() + 15)
|
||||
end
|
||||
|
||||
function private.create_record(auction_info)
|
||||
|
||||
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 buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
|
||||
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 {
|
||||
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),
|
||||
|
||||
name = auction_info.name,
|
||||
tooltip = auction_info.tooltip,
|
||||
aux_quantity = aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
buyout_price_per_unit = buyout_price_per_unit,
|
||||
quality = auction_info.quality,
|
||||
hyperlink = auction_info.hyperlink,
|
||||
itemstring = auction_info.itemstring,
|
||||
bid = bid,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
current_bid = auction_info.current_bid > 0 and auction_info.current_bid or nil,
|
||||
min_bid = auction_info.min_bid,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
function private.create_auction_record(auction_info)
|
||||
tinsert(auction_records, private.create_record(auction_info))
|
||||
end
|
||||
|
||||
function public.dialog_cancel()
|
||||
Aux.log('Aborted.')
|
||||
Aux.scan.abort()
|
||||
AuxAuctionsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
|
||||
function private.find_auction(entry, express_mode)
|
||||
|
||||
if entry.gone then
|
||||
Aux.log('Auction not available')
|
||||
return
|
||||
end
|
||||
|
||||
local amount
|
||||
|
||||
Aux.log('Processing cancelation request for '..entry.hyperlink..' x '..entry.aux_quantity..' at '..Aux.util.money_string(amount)..' ...')
|
||||
|
||||
if not express_mode then
|
||||
private.show_dialog(entry)
|
||||
end
|
||||
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
local found
|
||||
|
||||
Aux.scan.start{
|
||||
type = 'owner',
|
||||
page = entry.page,
|
||||
on_read_auction = function(auction_info, ctrl)
|
||||
|
||||
local auction_record = private.create_record(auction_info)
|
||||
|
||||
if entry.signature == auction_record.signature then
|
||||
ctrl.suspend()
|
||||
found = true
|
||||
Aux.log('Matching auction found.'..(express_mode and '' or ' Awaiting confirmation ...'))
|
||||
|
||||
if express_mode then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if private.create_record(Aux.info.auction(auction_info.index, 'owner')).signature == entry.signature then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
|
||||
Aux.scan.abort()
|
||||
AuxAuctionsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
end
|
||||
AuxAuctionsFrameListingDialogContentActionButton:Enable()
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
if not found then
|
||||
Aux.log('No matching auction found. Removing entry from the cache.')
|
||||
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,
|
||||
}
|
||||
end
|
||||
|
||||
function public.on_auction_click(auction_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(auction_record.hyperlink)
|
||||
else
|
||||
private.find_auction(auction_record, express_mode)
|
||||
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
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="auctions_frame.lua"/>
|
||||
|
||||
<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>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
this:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
this:SetBackdropColor(0.15, 0.15, 0.15)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<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>
|
||||
<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 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>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
@@ -1,11 +1,7 @@
|
||||
local private, public = {}, {}
|
||||
Aux.manage_frame = public
|
||||
Aux.bids_frame = public
|
||||
|
||||
local update_bid_records, update_auction_records, wait_for_bids, wait_for_auctions
|
||||
|
||||
local bid_records, auction_records
|
||||
|
||||
local BIDS, AUCTIONS = 1, 2
|
||||
local bid_records
|
||||
|
||||
public.bid_listing_config = {
|
||||
on_row_click = function(sheet, row_index, column_index)
|
||||
@@ -148,135 +144,8 @@ public.bid_listing_config = {
|
||||
sort_order = {{ column = 1, order = 'ascending' }},
|
||||
}
|
||||
|
||||
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)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
end,
|
||||
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
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 = 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()
|
||||
public.listing = public.listing or BIDS
|
||||
|
||||
if public.listing == BIDS then
|
||||
public.update_bid_records()
|
||||
elseif public.listing == AUCTIONS then
|
||||
public.update_auction_records()
|
||||
end
|
||||
|
||||
public.update_bid_records()
|
||||
public.update_listing()
|
||||
end
|
||||
|
||||
@@ -300,34 +169,7 @@ function public.update_bid_records()
|
||||
private.create_bid_record(auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
Aux.log('Scan complete: '..getn(bid_records)..' bids found')
|
||||
public.update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
if page < last_page then
|
||||
return page + 1
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function public.update_auction_records()
|
||||
Aux.log('Scanning auctions ...')
|
||||
auction_records = {}
|
||||
Aux.scan.start{
|
||||
type = 'owner',
|
||||
page = 0,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning auction page '..(page+1)..' out of '..total_pages..' ...')
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
private.create_auction_record(auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
Aux.log('Scan complete: '..getn(auction_records)..' auctions found')
|
||||
Aux.log('Scan complete: '..getn(bid_records)..' '..Aux_PluralizeIf('bid', getn(bid_records))..' found')
|
||||
public.update_listing()
|
||||
end,
|
||||
on_abort = function()
|
||||
@@ -342,24 +184,10 @@ function public.update_auction_records()
|
||||
end
|
||||
|
||||
function public.update_listing()
|
||||
AuxManageFrameListingBidListing:Hide()
|
||||
AuxManageFrameListingAuctionListing:Hide()
|
||||
|
||||
for i=1,2 do
|
||||
getglobal('AuxManageFrameListingTab'..i):SetAlpha(i == public.listing and 1 or 0.5)
|
||||
end
|
||||
|
||||
if public.listing == BIDS then
|
||||
AuxManageFrameListingBidListing:Show()
|
||||
Aux.list.populate(AuxManageFrameListingBidListing.sheet, bid_records)
|
||||
AuxManageFrameListing:SetWidth(AuxManageFrameListingBidListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxManageFrameListing:GetWidth() + 15)
|
||||
elseif public.listing == AUCTIONS then
|
||||
AuxManageFrameListingAuctionListing:Show()
|
||||
Aux.list.populate(AuxManageFrameListingAuctionListing.sheet, auction_records)
|
||||
AuxManageFrameListing:SetWidth(AuxManageFrameListingAuctionListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxManageFrameListing:GetWidth() + 15)
|
||||
end
|
||||
AuxBidsFrameListingBidListing:Show()
|
||||
Aux.sheet.populate(AuxBidsFrameListingBidListing.sheet, bid_records)
|
||||
AuxBidsFrameListing:SetWidth(AuxBidsFrameListingBidListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxBidsFrameListing:GetWidth() + 15)
|
||||
end
|
||||
|
||||
function private.create_record(auction_info)
|
||||
@@ -382,7 +210,6 @@ function private.create_record(auction_info)
|
||||
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price),
|
||||
|
||||
name = auction_info.name,
|
||||
level = auction_info.level,
|
||||
tooltip = auction_info.tooltip,
|
||||
aux_quantity = aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
@@ -391,23 +218,17 @@ function private.create_record(auction_info)
|
||||
hyperlink = auction_info.hyperlink,
|
||||
itemstring = auction_info.itemstring,
|
||||
bid = bid,
|
||||
bid_per_unit = Aux_Round(bid / aux_quantity),
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
current_bid = auction_info.current_bid > 0 and auction_info.current_bid or nil,
|
||||
min_bid = auction_info.min_bid,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
function private.create_auction_record(auction_info)
|
||||
tinsert(auction_records, private.create_record(auction_info))
|
||||
end
|
||||
|
||||
function private.create_bid_record(auction_info)
|
||||
tinsert(bid_records, private.create_record(auction_info))
|
||||
end
|
||||
@@ -415,7 +236,7 @@ end
|
||||
function public.dialog_cancel()
|
||||
Aux.log('Aborted.')
|
||||
Aux.scan.abort()
|
||||
AuxManageFrameListingDialog:Hide()
|
||||
AuxBidsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
|
||||
@@ -449,7 +270,7 @@ function private.find_auction(entry, action, express_mode)
|
||||
local found
|
||||
|
||||
Aux.scan.start{
|
||||
type = action == 'cancel' and 'owner' or 'bidder',
|
||||
type = 'bidder',
|
||||
page = entry.page,
|
||||
on_read_auction = function(auction_info, ctrl)
|
||||
|
||||
@@ -461,11 +282,7 @@ function private.find_auction(entry, action, express_mode)
|
||||
Aux.log('Matching auction found.'..(express_mode and '' or ' Awaiting confirmation ...'))
|
||||
|
||||
if express_mode then
|
||||
if action == 'cancel' then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
|
||||
elseif GetMoney() >= amount then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
@@ -475,22 +292,20 @@ function private.find_auction(entry, action, express_mode)
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if action == 'cancel' then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
|
||||
elseif GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount)..'.')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
if private.create_record(Aux.info.auction(auction_info.index, 'bidder')).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxBidsFrameListingDialogContentBid) or amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(action == 'bid' and MoneyInputFrame_GetCopper(AuxBidsFrameListingDialogContentBid) or amount)..'.')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxBidsFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxManageFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
AuxManageFrameListingDialogContentActionButton:Enable()
|
||||
AuxBidsFrameListingDialogContentActionButton:Enable()
|
||||
end
|
||||
end
|
||||
end,
|
||||
@@ -512,17 +327,6 @@ function private.find_auction(entry, action, express_mode)
|
||||
}
|
||||
end
|
||||
|
||||
function public.on_auction_click(auction_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(auction_record.hyperlink)
|
||||
else
|
||||
private.find_auction(auction_record, 'cancel', express_mode)
|
||||
end
|
||||
end
|
||||
|
||||
function public.on_bid_click(bid_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
@@ -536,44 +340,36 @@ function public.on_bid_click(bid_record)
|
||||
end
|
||||
|
||||
function private.show_dialog(action, entry, amount)
|
||||
AuxManageFrameListingDialogContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
||||
AuxManageFrameListingDialogContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
||||
AuxBidsFrameListingDialogContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
||||
AuxBidsFrameListingDialogContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
||||
|
||||
AuxManageFrameListingDialogContentActionButton:Disable()
|
||||
AuxManageFrameListingDialogContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
||||
AuxManageFrameListingDialogContentItemName:SetText(entry.name)
|
||||
AuxBidsFrameListingDialogContentActionButton:Disable()
|
||||
AuxBidsFrameListingDialogContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
||||
AuxBidsFrameListingDialogContentItemName:SetText(entry.name)
|
||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||
AuxManageFrameListingDialogContentItemName:SetTextColor(color.r, color.g, color.b)
|
||||
AuxBidsFrameListingDialogContentItemName:SetTextColor(color.r, color.g, color.b)
|
||||
|
||||
if entry.aux_quantity > 1 then
|
||||
AuxManageFrameListingDialogContentItemCount:SetText(entry.aux_quantity);
|
||||
AuxManageFrameListingDialogContentItemCount:Show()
|
||||
AuxBidsFrameListingDialogContentItemCount:SetText(entry.aux_quantity);
|
||||
AuxBidsFrameListingDialogContentItemCount:Show()
|
||||
else
|
||||
AuxManageFrameListingDialogContentItemCount:Hide()
|
||||
AuxBidsFrameListingDialogContentItemCount:Hide()
|
||||
end
|
||||
|
||||
if action == 'buyout' then
|
||||
AuxManageFrameListingDialogContentActionButton:SetText('Buy')
|
||||
AuxManageFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyFrame_Update('AuxManageFrameListingDialogContentBuyoutPrice', amount)
|
||||
AuxManageFrameListingDialogContentBid:Hide()
|
||||
AuxManageFrameListingDialogContentCancelLabel:Hide()
|
||||
AuxManageFrameListingDialogContentBuyoutPrice:Show()
|
||||
AuxBidsFrameListingDialogContentActionButton:SetText('Buy')
|
||||
AuxBidsFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyFrame_Update('AuxBidsFrameListingDialogContentBuyoutPrice', amount)
|
||||
AuxBidsFrameListingDialogContentBid:Hide()
|
||||
AuxBidsFrameListingDialogContentBuyoutPrice:Show()
|
||||
elseif action == 'bid' then
|
||||
AuxManageFrameListingDialogContentActionButton:SetText('Bid')
|
||||
AuxManageFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyInputFrame_SetCopper(AuxManageFrameListingDialogContentBid, amount)
|
||||
AuxManageFrameListingDialogContentBuyoutPrice:Hide()
|
||||
AuxManageFrameListingDialogContentCancelLabel:Hide()
|
||||
AuxManageFrameListingDialogContentBid:Show()
|
||||
elseif action == 'cancel' then
|
||||
AuxManageFrameListingDialogContentBid:Hide()
|
||||
AuxManageFrameListingDialogContentBuyoutPrice:Hide()
|
||||
AuxManageFrameListingDialogContentCancelLabel:Show()
|
||||
AuxManageFrameListingDialogContentActionButton:SetText('Yes')
|
||||
AuxManageFrameListingDialogContentCancelButton:SetText('No')
|
||||
AuxBidsFrameListingDialogContentActionButton:SetText('Bid')
|
||||
AuxBidsFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyInputFrame_SetCopper(AuxBidsFrameListingDialogContentBid, amount)
|
||||
AuxBidsFrameListingDialogContentBuyoutPrice:Hide()
|
||||
AuxBidsFrameListingDialogContentBid:Show()
|
||||
end
|
||||
AuxManageFrameListingDialog:Show()
|
||||
AuxBidsFrameListingDialog:Show()
|
||||
end
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="manage_frame.lua"/>
|
||||
<Script file="bids_frame.lua"/>
|
||||
|
||||
<Frame name="AuxManageFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
|
||||
<Frame name="AuxBidsFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
|
||||
<Frames>
|
||||
<Frame name="$parentListing" inherits="AuxFrameBoxTemplate">
|
||||
<Size>
|
||||
@@ -16,44 +16,6 @@
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Button name="$parentTab1" inherits="AuxTopTabTemplate" id="1">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativePoint="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="7" y="-2"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Bids')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.manage_frame.listing = this:GetID()
|
||||
Aux.manage_frame.update_bid_records()
|
||||
Aux.manage_frame.update_listing()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentTab2" inherits="AuxTopTabTemplate" id="2">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentTab1" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Auctions')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.manage_frame.listing = this:GetID()
|
||||
Aux.manage_frame.update_auction_records()
|
||||
Aux.manage_frame.update_listing()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentBidListing">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
@@ -61,25 +23,20 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.manage_frame.bid_listing_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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="$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>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.manage_frame.auction_listing_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, 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>
|
||||
@@ -92,13 +49,6 @@
|
||||
<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>
|
||||
@@ -134,7 +84,7 @@
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.manage_frame.dialog_action()
|
||||
Aux.bids_frame.dialog_action()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
@@ -143,7 +93,7 @@
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.manage_frame.dialog_cancel()
|
||||
Aux.bids_frame.dialog_cancel()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
@@ -153,22 +103,6 @@
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Frame name="AuxManageAuctions" inherits="AuxFrameBoxTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="400" y="326"/>
|
||||
</Size>
|
||||
<Anchors><Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="AuxManageBids"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
this:SetBackdropBorderColor(0.4, 0.4, 0.4)
|
||||
this:SetBackdropColor(0.15, 0.15, 0.15)
|
||||
getglobal(this:GetName().."Title"):SetText('Auctions')
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
+14
-3
@@ -1,4 +1,5 @@
|
||||
Aux.completion = {}
|
||||
local private, public = {}, {}
|
||||
Aux.completion = public
|
||||
|
||||
local NUM_MATCHES = 5
|
||||
|
||||
@@ -50,7 +51,7 @@ function generate_suggestions(input)
|
||||
return Aux.util.map(best, function(match) return { text=match.name, display_text='|c'..Aux_QualityColor(({GetItemInfo(match.id)})[3])..'['..match.name..']'..'|r', value=match.id } end)
|
||||
end
|
||||
|
||||
function Aux.completion.completor(edit_box)
|
||||
function public.completor(edit_box)
|
||||
local self = {}
|
||||
|
||||
local suggestions = {}
|
||||
@@ -161,7 +162,7 @@ function Aux.completion.completor(edit_box)
|
||||
return self
|
||||
end
|
||||
|
||||
function Aux.completion.selector(edit_box)
|
||||
function public.selector(edit_box)
|
||||
local self = {}
|
||||
|
||||
local suggestions = {}
|
||||
@@ -194,6 +195,10 @@ function Aux.completion.selector(edit_box)
|
||||
toggle()
|
||||
end
|
||||
toggle()
|
||||
DropDownList1.aux = true
|
||||
DropDownList1:SetScript('OnHide', function()
|
||||
DropDownList1.aux = false
|
||||
end)
|
||||
end
|
||||
|
||||
function update_highlighting()
|
||||
@@ -261,3 +266,9 @@ function Aux.completion.selector(edit_box)
|
||||
|
||||
return self
|
||||
end
|
||||
|
||||
function public.UIDropDownMenu_StartCounting(frame)
|
||||
if not frame.aux then
|
||||
return Aux.orig.UIDropDownMenu_StartCounting(frame)
|
||||
end
|
||||
end
|
||||
@@ -4,9 +4,5 @@
|
||||
|
||||
<Frame name="AuxCompletionDropDown" inherits="UIDropDownMenuTemplate" hidden="true">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="555" y="0"/></Offset></Anchor></Anchors>
|
||||
<OnUpdate>
|
||||
this.isCounting = false
|
||||
UIDropDownMenu_OnUpdate(arg1)
|
||||
</OnUpdate>
|
||||
</Frame>
|
||||
</Ui>
|
||||
@@ -1,5 +1,5 @@
|
||||
AuxVersion = "2.1.0"
|
||||
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
|
||||
AuxVersion = '2.1.8'
|
||||
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
|
||||
|
||||
local lastRightClickAction = GetTime()
|
||||
|
||||
@@ -17,8 +17,15 @@ Aux = {
|
||||
},
|
||||
},
|
||||
last_picked_up = {},
|
||||
view = {
|
||||
BUYOUT = 1,
|
||||
BID = 2,
|
||||
FULL = 3,
|
||||
},
|
||||
}
|
||||
|
||||
aux_view = Aux.view.BUYOUT
|
||||
|
||||
function Aux_OnLoad()
|
||||
Aux.log('Aux v'..AuxVersion..' loaded.')
|
||||
Aux.loaded = true
|
||||
@@ -34,8 +41,12 @@ function Aux_OnEvent()
|
||||
Aux_OnAuctionHouseShow()
|
||||
elseif event == 'AUCTION_HOUSE_CLOSED' then
|
||||
Aux_OnAuctionHouseClosed()
|
||||
Aux.bids_loaded = false
|
||||
Aux.current_owner_page = nil
|
||||
elseif event == 'AUCTION_BIDDER_LIST_UPDATE' then
|
||||
Aux.bids_loaded = true
|
||||
elseif event == 'AUCTION_OWNED_LIST_UPDATE' then
|
||||
Aux.current_owner_page = Aux.last_owner_page_requested
|
||||
Aux.current_owner_page = Aux.last_owner_page_requested or 0
|
||||
end
|
||||
end
|
||||
|
||||
@@ -124,6 +135,9 @@ function Aux_SetupHookFunctions()
|
||||
Aux.orig.AuctionFrameAuctions_OnEvent = AuctionFrameAuctions_OnEvent
|
||||
AuctionFrameAuctions_OnEvent = Aux.AuctionFrameAuctions_OnEvent
|
||||
|
||||
Aux.orig.UIDropDownMenu_StartCounting = UIDropDownMenu_StartCounting
|
||||
UIDropDownMenu_StartCounting = Aux.completion.UIDropDownMenu_StartCounting
|
||||
|
||||
end
|
||||
|
||||
function Aux.GetOwnerAuctionItems(page)
|
||||
@@ -168,17 +182,19 @@ function Aux.on_tab_click(index)
|
||||
Aux.item_search_frame.on_close()
|
||||
Aux.filter_search_frame.on_close()
|
||||
Aux.sell.on_close()
|
||||
Aux.manage_frame.on_close()
|
||||
Aux.auctions_frame.on_close()
|
||||
Aux.bids_frame.on_close()
|
||||
Aux.history.on_close()
|
||||
|
||||
for i=1,4 do
|
||||
for i=1,5 do
|
||||
getglobal('AuxTab'..i):SetAlpha(i == index and 1 or 0.5)
|
||||
end
|
||||
|
||||
AuxItemSearchFrame:Hide()
|
||||
AuxFilterSearchFrame:Hide()
|
||||
AuxSellFrame:Hide()
|
||||
AuxManageFrame:Hide()
|
||||
AuxAuctionsFrame:Hide()
|
||||
AuxBidsFrame:Hide()
|
||||
AuxHistoryFrame:Hide()
|
||||
|
||||
if index == 1 then
|
||||
@@ -191,9 +207,14 @@ function Aux.on_tab_click(index)
|
||||
AuxSellFrame:Show()
|
||||
Aux.sell.on_open()
|
||||
elseif index == 4 then
|
||||
AuxManageFrame:Show()
|
||||
Aux.manage_frame.on_open()
|
||||
AuxAuctionsFrame:Show()
|
||||
Aux.auctions_frame.on_open()
|
||||
elseif index == 5 then
|
||||
AuxBidsFrame:Show()
|
||||
Aux.bids_frame.on_open()
|
||||
end
|
||||
|
||||
Aux.active_panel = index
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -231,12 +252,16 @@ function Aux_ContainerFrameItemButton_OnClick(button)
|
||||
|
||||
if AuxFrame:IsVisible() and button == "LeftButton" and container_item_info then
|
||||
if IsAltKeyDown() then
|
||||
if not AuxItemSearchFrame:IsVisible() then
|
||||
if Aux.active_panel ~= 1 then
|
||||
Aux.on_tab_click(1)
|
||||
end
|
||||
AuxItemSearchFrameItemItemInputBox:Hide()
|
||||
Aux.item_search_frame.set_item(container_item_info.item_id)
|
||||
return
|
||||
|
||||
Aux.control.as_soon_as(function() return Aux.active_panel == 1 end, function()
|
||||
AuxItemSearchFrameItemItemInputBox:Hide()
|
||||
Aux.item_search_frame.set_item(container_item_info.item_id)
|
||||
end)
|
||||
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -256,7 +281,9 @@ function Aux_QualityColor(code)
|
||||
return "ffa335ee" -- epic, purple
|
||||
elseif code == 5 then
|
||||
return "ffff8000" -- legendary, orange
|
||||
end
|
||||
elseif code == 6 then
|
||||
return "ffe6cc80" -- artifact, pale gold
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.auction_signature(hyperlink, stack_size, bid, amount)
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
this:RegisterEvent('ADDON_LOADED')
|
||||
this:RegisterEvent('AUCTION_HOUSE_SHOW')
|
||||
this:RegisterEvent('AUCTION_HOUSE_CLOSED')
|
||||
this:RegisterEvent('AUCTION_BIDDER_LIST_UPDATE')
|
||||
this:RegisterEvent('AUCTION_OWNED_LIST_UPDATE')
|
||||
</OnLoad>
|
||||
<OnEvent>
|
||||
@@ -340,7 +341,11 @@
|
||||
<AbsDimension x="850" y="445"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER"/>
|
||||
<Anchor point="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="100" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
@@ -462,7 +467,24 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Manage')
|
||||
getglobal(this:GetName().."Text"):SetText('Auctions')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.on_tab_click(this:GetID())
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="AuxTab5" inherits="AuxBottomTabTemplate" id="5">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="AuxTab4" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Bids')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.on_tab_click(this:GetID())
|
||||
|
||||
+103
-95
@@ -18,10 +18,8 @@ function group_alpha_setter(cell, group)
|
||||
cell:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
|
||||
end
|
||||
|
||||
local BUYOUT, BID, FULL = 1, 2, 3
|
||||
|
||||
public.views = {
|
||||
[BUYOUT] = {
|
||||
[Aux.view.BUYOUT] = {
|
||||
name = 'Buyout',
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
@@ -135,7 +133,7 @@ public.views = {
|
||||
},
|
||||
sort_order = {{column = 1, order = 'ascending' }, {column = 4, order = 'ascending'}},
|
||||
},
|
||||
[BID] = {
|
||||
[Aux.view.BID] = {
|
||||
name = 'Bid',
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
@@ -279,7 +277,7 @@ public.views = {
|
||||
},
|
||||
sort_order = {{column = 1, order = 'ascending' }, {column = 4, order = 'ascending' }, {column = 6, order = 'ascending'}},
|
||||
},
|
||||
[FULL] = {
|
||||
[Aux.view.FULL] = {
|
||||
name = 'Full',
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
@@ -464,13 +462,13 @@ public.views = {
|
||||
|
||||
function public.on_close()
|
||||
if AuxFilterSearchFrameResultsConfirmation:IsVisible() then
|
||||
Aux.buy.dialog_cancel()
|
||||
public.dialog_cancel()
|
||||
end
|
||||
current_page = nil
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
public.set_view(1)
|
||||
public.set_view(aux_view)
|
||||
update_sheet()
|
||||
end
|
||||
|
||||
@@ -487,25 +485,30 @@ function public.stop_search()
|
||||
end
|
||||
|
||||
function update_sheet()
|
||||
|
||||
if not AuxFilterSearchFrame:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
AuxFilterSearchFrameResultsBuyListing:Hide()
|
||||
AuxFilterSearchFrameResultsBidListing:Hide()
|
||||
AuxFilterSearchFrameResultsFullListing:Hide()
|
||||
|
||||
if private.view == BUYOUT then
|
||||
if aux_view == Aux.view.BUYOUT then
|
||||
AuxFilterSearchFrameResultsBuyListing:Show()
|
||||
local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
|
||||
Aux.list.populate(AuxFilterSearchFrameResultsBuyListing.sheet, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
|
||||
Aux.sheet.populate(AuxFilterSearchFrameResultsBuyListing.sheet, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
|
||||
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBuyListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
|
||||
elseif private.view == BID then
|
||||
elseif aux_view == Aux.view.BID then
|
||||
AuxFilterSearchFrameResultsBidListing:Show()
|
||||
local bid_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {}
|
||||
Aux.list.populate(AuxFilterSearchFrameResultsBidListing.sheet, bid_auctions)
|
||||
Aux.sheet.populate(AuxFilterSearchFrameResultsBidListing.sheet, bid_auctions)
|
||||
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBidListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
|
||||
elseif private.view == FULL then
|
||||
elseif aux_view == Aux.view.FULL then
|
||||
AuxFilterSearchFrameResultsFullListing:Show()
|
||||
Aux.list.populate(AuxFilterSearchFrameResultsFullListing.sheet, auctions or {})
|
||||
Aux.sheet.populate(AuxFilterSearchFrameResultsFullListing.sheet, auctions or {})
|
||||
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsFullListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
|
||||
end
|
||||
@@ -521,7 +524,7 @@ function public.set_view(view)
|
||||
for i=1,3 do
|
||||
getglobal('AuxFilterSearchFrameResultsTab'..i):SetAlpha(i == view and 1 or 0.5)
|
||||
end
|
||||
private.view = view
|
||||
aux_view = view
|
||||
update_sheet()
|
||||
end
|
||||
|
||||
@@ -531,78 +534,77 @@ end
|
||||
|
||||
function public.start_search()
|
||||
|
||||
if not AuxFilterSearchFrameFiltersSearchButton:IsVisible() then
|
||||
return
|
||||
end
|
||||
Aux.scan.abort(function()
|
||||
|
||||
AuxFilterSearchFrameFiltersSearchButton:Hide()
|
||||
AuxFilterSearchFrameFiltersStopButton:Show()
|
||||
|
||||
auctions = nil
|
||||
|
||||
refresh = true
|
||||
|
||||
local category = UIDropDownMenu_GetSelectedValue(AuxFilterSearchFrameFiltersCategoryDropDown)
|
||||
local tooltip_patterns = {}
|
||||
for i=1,4 do
|
||||
local tooltip_pattern = getglobal('AuxFilterSearchFrameFiltersTooltipInputBox'..i):GetText()
|
||||
if tooltip_pattern ~= '' then
|
||||
tinsert(tooltip_patterns, tooltip_pattern)
|
||||
end
|
||||
end
|
||||
|
||||
search_query = {
|
||||
name = AuxFilterSearchFrameFiltersNameInputBox:GetText(),
|
||||
min_level = AuxFilterSearchFrameFiltersMinLevel:GetText(),
|
||||
max_level = AuxFilterSearchFrameFiltersMaxLevel:GetText(),
|
||||
slot = category and category.slot,
|
||||
class = category and category.class,
|
||||
subclass = category and category.subclass,
|
||||
quality = UIDropDownMenu_GetSelectedValue(AuxFilterSearchFrameFiltersQualityDropDown),
|
||||
usable = AuxFilterSearchFrameFiltersUsableCheckButton:GetChecked()
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
page = AuxFilterSearchFrameFiltersAllPagesCheckButton:GetChecked() and 0 or AuxFilterSearchFrameFiltersPageEditBox:GetNumber(),
|
||||
on_submit_query = function()
|
||||
current_page = nil
|
||||
end,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...')
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
if Aux.info.tooltip_match(tooltip_patterns, auction_info.tooltip) then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_info, current_page))
|
||||
AuxFilterSearchFrameFiltersSearchButton:Hide()
|
||||
AuxFilterSearchFrameFiltersStopButton:Show()
|
||||
|
||||
auctions = nil
|
||||
|
||||
refresh = true
|
||||
|
||||
local category = UIDropDownMenu_GetSelectedValue(AuxFilterSearchFrameFiltersCategoryDropDown)
|
||||
local tooltip_patterns = {}
|
||||
for i=1,4 do
|
||||
local tooltip_pattern = getglobal('AuxFilterSearchFrameFiltersTooltipInputBox'..i):GetText()
|
||||
if tooltip_pattern ~= '' then
|
||||
tinsert(tooltip_patterns, tooltip_pattern)
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
end
|
||||
|
||||
AuxFilterSearchFrameFiltersStopButton:Hide()
|
||||
AuxFilterSearchFrameFiltersSearchButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
on_abort = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
AuxFilterSearchFrameFiltersStopButton:Hide()
|
||||
AuxFilterSearchFrameFiltersSearchButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
if AuxFilterSearchFrameFiltersAllPagesCheckButton:GetChecked() then
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
if page < last_page then
|
||||
return page + 1
|
||||
search_query = {
|
||||
name = AuxFilterSearchFrameFiltersNameInputBox:GetText(),
|
||||
min_level = AuxFilterSearchFrameFiltersMinLevel:GetText(),
|
||||
max_level = AuxFilterSearchFrameFiltersMaxLevel:GetText(),
|
||||
slot = category and category.slot,
|
||||
class = category and category.class,
|
||||
subclass = category and category.subclass,
|
||||
quality = UIDropDownMenu_GetSelectedValue(AuxFilterSearchFrameFiltersQualityDropDown),
|
||||
usable = AuxFilterSearchFrameFiltersUsableCheckButton:GetChecked()
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
page = AuxFilterSearchFrameFiltersAllPagesCheckButton:GetChecked() and 0 or AuxFilterSearchFrameFiltersPageEditBox:GetNumber(),
|
||||
on_submit_query = function()
|
||||
current_page = nil
|
||||
end,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...')
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
if Aux.info.tooltip_match(tooltip_patterns, auction_info.tooltip) then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_info, current_page))
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
end,
|
||||
on_complete = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
|
||||
AuxFilterSearchFrameFiltersStopButton:Hide()
|
||||
AuxFilterSearchFrameFiltersSearchButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
on_abort = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
AuxFilterSearchFrameFiltersStopButton:Hide()
|
||||
AuxFilterSearchFrameFiltersSearchButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
if AuxFilterSearchFrameFiltersAllPagesCheckButton:GetChecked() then
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
if page < last_page then
|
||||
return page + 1
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
||||
function show_dialog(buyout_mode, entry, amount)
|
||||
@@ -696,18 +698,20 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxFilterSearchFrameFiltersSearchButton:Enable()
|
||||
AuxFilterSearchFrameResultsConfirmation:Hide()
|
||||
update_sheet()
|
||||
if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxFilterSearchFrameFiltersSearchButton:Enable()
|
||||
AuxFilterSearchFrameResultsConfirmation:Hide()
|
||||
update_sheet()
|
||||
end
|
||||
end
|
||||
AuxFilterSearchFrameResultsConfirmationContentActionButton:Enable()
|
||||
end
|
||||
@@ -718,7 +722,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
Aux.log('No matching auction found. Removing entry from the cache.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
Aux.buy.dialog_cancel()
|
||||
public.dialog_cancel()
|
||||
end
|
||||
if express_mode then
|
||||
AuxFilterSearchFrameFiltersSearchButton:Enable()
|
||||
@@ -744,6 +748,10 @@ function private.on_row_click(entry)
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(entry.hyperlink)
|
||||
elseif IsShiftKeyDown() then
|
||||
if ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(entry.hyperlink)
|
||||
end
|
||||
else
|
||||
find_auction(entry, buyout_mode, express_mode)
|
||||
end
|
||||
|
||||
+100
-9
@@ -37,6 +37,13 @@
|
||||
<OnEscapePressed>
|
||||
this:ClearFocus()
|
||||
</OnEscapePressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
@@ -110,7 +117,15 @@
|
||||
</OnLoad>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
Aux.filter_search_frame.start_search()
|
||||
</OnEnterPressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
<EditBox name="$parentMaxLevel" letters="2" numeric="true" autoFocus="false" inherits="AuxInputBoxTemplate">
|
||||
@@ -123,7 +138,15 @@
|
||||
</OnLoad>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
Aux.filter_search_frame.start_search()
|
||||
</OnEnterPressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'MinLevel'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
<CheckButton name="$parentUsableCheckButton" inherits="UICheckButtonTemplate">
|
||||
@@ -145,6 +168,17 @@
|
||||
getglobal(this:GetName()..'Label'):SetText('Tooltip')
|
||||
this:SetWidth(150)
|
||||
</OnLoad>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
Aux.filter_search_frame.start_search()
|
||||
</OnEnterPressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
@@ -154,6 +188,17 @@
|
||||
<OnLoad>
|
||||
this:SetWidth(150)
|
||||
</OnLoad>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
Aux.filter_search_frame.start_search()
|
||||
</OnEnterPressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
@@ -163,6 +208,17 @@
|
||||
<OnLoad>
|
||||
this:SetWidth(150)
|
||||
</OnLoad>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
Aux.filter_search_frame.start_search()
|
||||
</OnEnterPressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
@@ -172,6 +228,17 @@
|
||||
<OnLoad>
|
||||
this:SetWidth(150)
|
||||
</OnLoad>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
Aux.filter_search_frame.start_search()
|
||||
</OnEnterPressed>
|
||||
<OnTabPressed>
|
||||
if IsShiftKeyDown() then
|
||||
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
|
||||
else
|
||||
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
|
||||
end
|
||||
</OnTabPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
@@ -250,7 +317,7 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Buy')
|
||||
getglobal(this:GetName()..'Text'):SetText('Buy')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.filter_search_frame.set_view(this:GetID())
|
||||
@@ -267,7 +334,7 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Bid')
|
||||
getglobal(this:GetName()..'Text'):SetText('Bid')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.filter_search_frame.set_view(this:GetID())
|
||||
@@ -284,7 +351,7 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Text"):SetText('Full')
|
||||
getglobal(this:GetName()..'Text'):SetText('Full')
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.filter_search_frame.set_view(this:GetID())
|
||||
@@ -299,8 +366,16 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.filter_search_frame.views[1]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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>
|
||||
@@ -312,8 +387,16 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.filter_search_frame.views[2]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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>
|
||||
@@ -325,8 +408,16 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.filter_search_frame.views[3]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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>
|
||||
|
||||
@@ -13,7 +13,7 @@ function public.container_item(bag, slot)
|
||||
local item_id, suffix_id, unique_id, enchant_id = private.parse_hyperlink(hyperlink)
|
||||
local item_info = public.item(item_id, suffix_id, unique_id, enchant_id)
|
||||
|
||||
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot)
|
||||
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
|
||||
local tooltip = public.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||
|
||||
return {
|
||||
@@ -31,7 +31,7 @@ function public.container_item(bag, slot)
|
||||
level = item_info.level,
|
||||
type = item_info.type,
|
||||
subtype = item_info.subtype,
|
||||
quality = quality,
|
||||
quality = item_info.quality,
|
||||
max_stack = item_info.max_stack,
|
||||
|
||||
count = count,
|
||||
|
||||
+108
-93
@@ -17,10 +17,9 @@ function group_alpha_setter(cell, group)
|
||||
cell:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
|
||||
end
|
||||
|
||||
local BUYOUT, BID, FULL = 1, 2, 3
|
||||
|
||||
public.recently_searched_config = {
|
||||
on_row_click = function (sheet, row_index)
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxItemSearchFrameItemItemInputBox:Hide()
|
||||
public.set_item(sheet.data[data_index].item_id)
|
||||
@@ -81,7 +80,7 @@ public.recently_searched_config = {
|
||||
sort_order = {},
|
||||
}
|
||||
public.views = {
|
||||
[BUYOUT] = {
|
||||
[Aux.view.BUYOUT] = {
|
||||
name = 'Buyout',
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
@@ -153,7 +152,7 @@ public.views = {
|
||||
},
|
||||
sort_order = {{column = 3, order = 'ascending' }},
|
||||
},
|
||||
[BID] = {
|
||||
[Aux.view.BID] = {
|
||||
name = 'Bid',
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
@@ -255,7 +254,7 @@ public.views = {
|
||||
},
|
||||
sort_order = {{column = 3, order = 'ascending'}, {column = 5, order = 'ascending'}},
|
||||
},
|
||||
[FULL] = {
|
||||
[Aux.view.FULL] = {
|
||||
name = 'Full',
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
@@ -414,7 +413,7 @@ function public.on_close()
|
||||
end
|
||||
|
||||
function public.on_open()
|
||||
public.set_view(1)
|
||||
public.set_view(aux_view)
|
||||
public.update_item()
|
||||
private.update_recently_searched()
|
||||
update_listing()
|
||||
@@ -436,25 +435,30 @@ function public.stop_search()
|
||||
end
|
||||
|
||||
function update_listing()
|
||||
|
||||
if not AuxItemSearchFrame:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
AuxItemSearchFrameAuctionsBuyListing:Hide()
|
||||
AuxItemSearchFrameAuctionsBidListing:Hide()
|
||||
AuxItemSearchFrameAuctionsFullListing:Hide()
|
||||
|
||||
if private.view == BUYOUT then
|
||||
if aux_view == Aux.view.BUYOUT then
|
||||
AuxItemSearchFrameAuctionsBuyListing:Show()
|
||||
local buy_records = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
|
||||
Aux.list.populate(AuxItemSearchFrameAuctionsBuyListing.sheet, auctions and Aux.util.group_by(buy_records, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
|
||||
Aux.sheet.populate(AuxItemSearchFrameAuctionsBuyListing.sheet, auctions and Aux.util.group_by(buy_records, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
|
||||
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsBuyListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
|
||||
elseif private.view == BID then
|
||||
elseif aux_view == Aux.view.BID then
|
||||
AuxItemSearchFrameAuctionsBidListing:Show()
|
||||
local bid_records = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {}
|
||||
Aux.list.populate(AuxItemSearchFrameAuctionsBidListing.sheet, bid_records)
|
||||
Aux.sheet.populate(AuxItemSearchFrameAuctionsBidListing.sheet, bid_records)
|
||||
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsBidListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
|
||||
elseif private.view == FULL then
|
||||
elseif aux_view == Aux.view.FULL then
|
||||
AuxItemSearchFrameAuctionsFullListing:Show()
|
||||
Aux.list.populate(AuxItemSearchFrameAuctionsFullListing.sheet, auctions or {})
|
||||
Aux.sheet.populate(AuxItemSearchFrameAuctionsFullListing.sheet, auctions or {})
|
||||
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsFullListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
|
||||
end
|
||||
@@ -470,12 +474,12 @@ function public.set_view(view)
|
||||
for i=1,3 do
|
||||
getglobal('AuxItemSearchFrameAuctionsTab'..i):SetAlpha(i == view and 1 or 0.5)
|
||||
end
|
||||
private.view = view
|
||||
aux_view = view
|
||||
update_listing()
|
||||
end
|
||||
|
||||
function private.update_recently_searched()
|
||||
Aux.list.populate(AuxItemSearchFrameRecentlySearchedListing.sheet, aux_recently_searched)
|
||||
Aux.sheet.populate(AuxItemSearchFrameRecentlySearchedListing.sheet, aux_recently_searched)
|
||||
end
|
||||
|
||||
function public.set_item(item_id)
|
||||
@@ -483,10 +487,16 @@ function public.set_item(item_id)
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
private.item_id = item_id
|
||||
public.update_item()
|
||||
tinsert(aux_recently_searched, 1, { item_id=item_id, time=time() })
|
||||
while getn(aux_recently_searched) > 50 do
|
||||
tremove(aux_recently_searched, getn(aux_recently_searched))
|
||||
|
||||
local updated_recently_searched = Aux.util.filter(aux_recently_searched, function(item_entry)
|
||||
return item_entry.item_id ~= item_id
|
||||
end)
|
||||
tinsert(updated_recently_searched, 1, { item_id=item_id, time=time() })
|
||||
while getn(updated_recently_searched) > 50 do
|
||||
tremove(updated_recently_searched, getn(updated_recently_searched))
|
||||
end
|
||||
aux_recently_searched = updated_recently_searched
|
||||
|
||||
private.update_recently_searched()
|
||||
public.start_search()
|
||||
elseif not private.item_id then
|
||||
@@ -513,75 +523,74 @@ end
|
||||
|
||||
function public.start_search()
|
||||
|
||||
if not AuxItemSearchFrameItemRefreshButton:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
AuxItemSearchFrameItemRefreshButton:Hide()
|
||||
AuxItemSearchFrameItemStopButton:Show()
|
||||
|
||||
auctions = nil
|
||||
|
||||
refresh = true
|
||||
Aux.scan.abort(function()
|
||||
|
||||
local item_id = private.item_id
|
||||
local item_info = Aux.info.item(item_id)
|
||||
AuxItemSearchFrameItemRefreshButton:Hide()
|
||||
AuxItemSearchFrameItemStopButton:Show()
|
||||
|
||||
local class_index = Aux.item_class_index(item_info.class)
|
||||
local subclass_index = class_index and Aux.item_subclass_index(class_index, item_info.subclass)
|
||||
auctions = nil
|
||||
|
||||
search_query = {
|
||||
name = item_info.name,
|
||||
min_level = item_info.level,
|
||||
min_level = item_info.level,
|
||||
slot = item_info.slot,
|
||||
class = Aux.item_class_index(item_info.class),
|
||||
subclass = item_info.subclass,
|
||||
quality = item_info.quality,
|
||||
usable = item_info.usable,
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
page = AuxItemSearchFrameItemAllPagesCheckButton:GetChecked() and 0 or AuxItemSearchFrameItemPageEditBox:GetNumber(),
|
||||
on_submit_query = function()
|
||||
current_page = nil
|
||||
end,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...')
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
if auction_info.item_id == item_id then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_info, current_page))
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
refresh = true
|
||||
|
||||
AuxItemSearchFrameItemStopButton:Hide()
|
||||
AuxItemSearchFrameItemRefreshButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
on_abort = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
AuxItemSearchFrameItemStopButton:Hide()
|
||||
AuxItemSearchFrameItemRefreshButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
if AuxItemSearchFrameItemAllPagesCheckButton:GetChecked() then
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
if page < last_page then
|
||||
return page + 1
|
||||
local item_id = private.item_id
|
||||
local item_info = Aux.info.item(item_id)
|
||||
|
||||
local class_index = Aux.item_class_index(item_info.class)
|
||||
local subclass_index = class_index and Aux.item_subclass_index(class_index, item_info.subclass)
|
||||
|
||||
search_query = {
|
||||
name = item_info.name,
|
||||
min_level = item_info.level,
|
||||
min_level = item_info.level,
|
||||
slot = item_info.slot,
|
||||
class = Aux.item_class_index(item_info.class),
|
||||
subclass = item_info.subclass,
|
||||
quality = item_info.quality,
|
||||
usable = item_info.usable,
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
page = AuxItemSearchFrameItemAllPagesCheckButton:GetChecked() and 0 or AuxItemSearchFrameItemPageEditBox:GetNumber(),
|
||||
on_submit_query = function()
|
||||
current_page = nil
|
||||
end,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...')
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(auction_info)
|
||||
if auction_info.item_id == item_id then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_info, current_page))
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
end,
|
||||
on_complete = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' of '..item_info.name..' found.')
|
||||
|
||||
AuxItemSearchFrameItemStopButton:Hide()
|
||||
AuxItemSearchFrameItemRefreshButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
on_abort = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' of '..item_info.name..' found.')
|
||||
AuxItemSearchFrameItemStopButton:Hide()
|
||||
AuxItemSearchFrameItemRefreshButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
if AuxItemSearchFrameItemAllPagesCheckButton:GetChecked() then
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
if page < last_page then
|
||||
return page + 1
|
||||
end
|
||||
end
|
||||
end,
|
||||
}
|
||||
end)
|
||||
end
|
||||
|
||||
function show_dialog(buyout_mode, entry, amount)
|
||||
@@ -672,18 +681,20 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
AuxItemSearchFrameAuctionsConfirmation:Hide()
|
||||
update_listing()
|
||||
if create_auction_record(Aux.info.auction(auction_info.index)).signature == entry.signature then
|
||||
if GetMoney() >= amount then
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
AuxItemSearchFrameAuctionsConfirmation:Hide()
|
||||
update_listing()
|
||||
end
|
||||
end
|
||||
AuxItemSearchFrameAuctionsConfirmationContentActionButton:Enable()
|
||||
end
|
||||
@@ -720,6 +731,10 @@ function public.on_row_click(entry)
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(entry.hyperlink)
|
||||
elseif IsShiftKeyDown() then
|
||||
if ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(entry.hyperlink)
|
||||
end
|
||||
else
|
||||
find_auction(entry, buyout_mode, express_mode)
|
||||
end
|
||||
|
||||
+39
-8
@@ -152,8 +152,15 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.recently_searched_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create{
|
||||
frame = this,
|
||||
columns = config.columns,
|
||||
sort_order = config.sort_order,
|
||||
row_setter = config.row_setter,
|
||||
on_row_click = config.on_row_click,
|
||||
on_row_enter = config.on_row_enter,
|
||||
on_row_leave = config.on_row_leave,
|
||||
}
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -231,8 +238,16 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.views[1]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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>
|
||||
@@ -244,8 +259,16 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.views[2]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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>
|
||||
@@ -257,8 +280,16 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.views[3]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
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>
|
||||
|
||||
+36
-24
@@ -9,7 +9,7 @@ local bestPriceOurStackSize
|
||||
|
||||
local current_auction
|
||||
|
||||
local set_auction, update_auction_listing, update_inventory_listing, record_auction, undercut, item_class_index, item_subclass_index, report, select_entry, update_recommendation, refresh_entries, auction_candidates, charge_classes, get_stack_size_slider_value
|
||||
local set_auction, update_auction_listing, record_auction, undercut, item_class_index, item_subclass_index, report, select_entry, update_recommendation, refresh_entries, auction_candidates, charge_classes, get_stack_size_slider_value
|
||||
|
||||
local LIVE, HISTORICAL, FIXED = 1, 2, 3
|
||||
|
||||
@@ -21,6 +21,7 @@ Aux.sell.inventory_listing_config = {
|
||||
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, nil, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
|
||||
on_row_leave = function (sheet, row_index)
|
||||
@@ -28,6 +29,7 @@ Aux.sell.inventory_listing_config = {
|
||||
if not (current_auction and sheet.data[data_index] == current_auction) then
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end
|
||||
AuxTooltip:Hide()
|
||||
end,
|
||||
|
||||
row_setter = function(row, datum)
|
||||
@@ -36,6 +38,7 @@ Aux.sell.inventory_listing_config = {
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
end
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id)
|
||||
end,
|
||||
|
||||
columns = {
|
||||
@@ -68,7 +71,7 @@ Aux.sell.inventory_listing_config = {
|
||||
icon:SetWidth(12)
|
||||
icon:SetHeight(12)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
||||
text:SetPoint('LEFT', icon, 'RIGHT', 1, 0)
|
||||
text:SetPoint('TOPRIGHT', cell)
|
||||
text:SetPoint('BOTTOMRIGHT', cell)
|
||||
text:SetJustifyV('TOP')
|
||||
@@ -89,16 +92,16 @@ Aux.sell.inventory_listing_config = {
|
||||
}
|
||||
|
||||
Aux.sell.auction_listing_config = {
|
||||
on_cell_click = function (sheet, row_index, column_index)
|
||||
on_row_click = function (sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxSellEntry_OnClick(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_cell_enter = function (sheet, row_index, column_index)
|
||||
on_row_enter = function (sheet, row_index, column_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
end,
|
||||
|
||||
on_cell_leave = function (sheet, row_index, column_index)
|
||||
on_row_leave = function (sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
local datum = sheet.data[data_index]
|
||||
if not (datum and current_auction and Aux.util.safe_index{existing_auctions, current_auction.key, 'selected', 'key'} == datum.key) then
|
||||
@@ -171,15 +174,15 @@ Aux.sell.auction_listing_config = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 4, order = 'ascending' }, {column = 4, order = 'ascending'}},
|
||||
sort_order = {{column = 5, order = 'ascending' }},
|
||||
}
|
||||
|
||||
function update_inventory_listing()
|
||||
Aux.list.populate(AuxSellInventoryListing.sheet, inventory_data)
|
||||
function private.parse_inventory()
|
||||
Aux.sheet.populate(AuxSellInventoryListing.sheet, Aux.util.filter(inventory_data, function(item) return item.aux_quantity > 0 end))
|
||||
end
|
||||
|
||||
function update_auction_listing()
|
||||
Aux.list.populate(AuxSellAuctionsListing.sheet, current_auction and existing_auctions[current_auction.key] or {})
|
||||
Aux.sheet.populate(AuxSellAuctionsListing.sheet, current_auction and existing_auctions[current_auction.key] or {})
|
||||
end
|
||||
|
||||
function Aux.sell.on_open()
|
||||
@@ -209,8 +212,10 @@ function Aux.sell.on_open()
|
||||
|
||||
update_inventory_data()
|
||||
|
||||
update_inventory_listing()
|
||||
private.parse_inventory()
|
||||
update_auction_listing()
|
||||
|
||||
update_recommendation()
|
||||
end
|
||||
|
||||
function Aux.sell.on_close()
|
||||
@@ -248,8 +253,9 @@ function Aux_Sell_SetAuctionDuration(duration)
|
||||
end
|
||||
|
||||
function Aux.sell.post_auctions()
|
||||
if current_auction then
|
||||
local key, hyperlink, stack_size, buyout_price, stack_count = current_auction.key, current_auction.hyperlink, get_stack_size_slider_value(), MoneyInputFrame_GetCopper(AuxSellParametersBuyoutPrice), AuxSellStackCountSlider:GetValue()
|
||||
local auction = current_auction
|
||||
if auction then
|
||||
local key, hyperlink, stack_size, buyout_price, stack_count = auction.key, auction.hyperlink, get_stack_size_slider_value(), MoneyInputFrame_GetCopper(AuxSellParametersBuyoutPrice), AuxSellStackCountSlider:GetValue()
|
||||
local duration
|
||||
if AuctionFrameAuctions.duration == 120 then
|
||||
duration = 2
|
||||
@@ -268,7 +274,7 @@ function Aux.sell.post_auctions()
|
||||
stack_count,
|
||||
function(posted)
|
||||
for i = 1, posted do
|
||||
record_auction(key, stack_size, buyout_price, duration, UnitName("player"))
|
||||
record_auction(key, stack_size, buyout_price, duration, UnitName('player'))
|
||||
end
|
||||
if existing_auctions[key] then
|
||||
for _, entry in ipairs(existing_auctions[key]) do
|
||||
@@ -278,8 +284,11 @@ function Aux.sell.post_auctions()
|
||||
end
|
||||
end
|
||||
Aux.sell.clear_auction()
|
||||
update_inventory_data()
|
||||
update_inventory_listing()
|
||||
auction.aux_quantity = auction.aux_quantity - (posted * stack_size)
|
||||
local charge_class = auction.charges or 0
|
||||
auction.availability[charge_class] = auction.availability[charge_class] - (posted * (auction.charges and 1 or stack_size))
|
||||
|
||||
private.parse_inventory()
|
||||
report(hyperlink, stack_size, buyout_price, posted)
|
||||
end
|
||||
)
|
||||
@@ -379,9 +388,9 @@ function update_recommendation()
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', floor(current_auction.unit_vendor_price * 0.05 * (current_auction.charges and 1 or get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * AuctionFrameAuctions.duration / 120)
|
||||
|
||||
if existing_auctions[current_auction.key] and existing_auctions[current_auction.key].selected then
|
||||
if not existing_auctions[current_auction.key].created or GetTime() - existing_auctions[current_auction.key].created > 1800 then
|
||||
AuxSellParametersStrategyDropDownStaleWarning:SetText('Stale data!') -- data older than half an hour marked as stale
|
||||
end
|
||||
-- if not existing_auctions[current_auction.key].created or GetTime() - existing_auctions[current_auction.key].created > 1800 then
|
||||
-- AuxSellParametersStrategyDropDownStaleWarning:SetText('Stale data!') -- data older than half an hour marked as stale
|
||||
-- end
|
||||
|
||||
local new_buyout_price = existing_auctions[current_auction.key].selected.unit_buyout_price * get_stack_size_slider_value()
|
||||
|
||||
@@ -397,9 +406,12 @@ function update_recommendation()
|
||||
-- local market_price = Aux.history.get_price_suggestion(current_auction.key, current_auction.aux_quantity)
|
||||
-- MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, Aux_Round(market_price * 0.95))
|
||||
-- MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, market_price)
|
||||
elseif existing_auctions[current_auction.key] then
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux_Round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 1.053)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux_Round(current_auction.unit_vendor_price * (current_auction.charges and 1 or get_stack_size_slider_value()) * 4)))
|
||||
else
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 0)
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, 0)
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, 0)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -421,12 +433,12 @@ end
|
||||
|
||||
function set_auction(auction_candidate)
|
||||
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
Aux.scan.abort(function()
|
||||
|
||||
current_auction = auction_candidate
|
||||
update_inventory_listing()
|
||||
private.parse_inventory()
|
||||
|
||||
local charge_classes = charge_classes(current_auction.availability)
|
||||
AuxSellStackSizeSlider.charge_classes = current_auction.charges and charge_classes
|
||||
@@ -460,7 +472,7 @@ end
|
||||
|
||||
function update_inventory_data()
|
||||
inventory_data = {}
|
||||
update_inventory_listing()
|
||||
private.parse_inventory()
|
||||
|
||||
local auction_candidate_map = {}
|
||||
|
||||
@@ -536,7 +548,7 @@ function update_inventory_data()
|
||||
tinsert(auction_candidates, auction_candidate)
|
||||
end
|
||||
inventory_data = auction_candidates
|
||||
update_inventory_listing()
|
||||
private.parse_inventory()
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -604,7 +616,7 @@ function AuxSellEntry_OnClick(entry)
|
||||
update_auction_listing()
|
||||
update_recommendation()
|
||||
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
end
|
||||
|
||||
function AuxSellParametersRefreshButton_OnClick()
|
||||
|
||||
+24
-6
@@ -27,8 +27,15 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.sell.inventory_listing_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create{
|
||||
frame = this,
|
||||
columns = config.columns,
|
||||
sort_order = config.sort_order,
|
||||
row_setter = config.row_setter,
|
||||
on_row_click = config.on_row_click,
|
||||
on_row_enter = config.on_row_enter,
|
||||
on_row_leave = config.on_row_leave,
|
||||
}
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -197,7 +204,7 @@
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="16" y="-181"/></Offset></Anchor></Anchors>
|
||||
<layers>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="$parentText" inherits="GameFontNormalSmall" text="STARTING_PRICE">
|
||||
<FontString name="$parentText" inherits="GameFontNormalSmall" text="Starting Stack Price">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-3" y="12"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
@@ -212,7 +219,7 @@
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="16" y="-216"/></Offset></Anchor></Anchors>
|
||||
<layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString name="$parentText" inherits="GameFontNormalSmall" text="Buyout Price |cff808080(optional)|r">
|
||||
<FontString name="$parentText" inherits="GameFontNormalSmall" text="Buyout Stack Price |cff808080(optional)|r">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="-3" y="12"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentErrorText" inherits="GameFontRedSmall" text="AUCTION_BUYOUT_ERROR">
|
||||
@@ -222,6 +229,10 @@
|
||||
</layers>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
MoneyInputFrame_SetPreviousFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Copper'))
|
||||
MoneyInputFrame_SetNextFocus(getglobal(this:GetParent():GetName()..'StartPrice'), getglobal(this:GetName()..'Gold'))
|
||||
MoneyInputFrame_SetPreviousFocus(this, getglobal(this:GetParent():GetName()..'StartPriceCopper'))
|
||||
MoneyInputFrame_SetNextFocus(this, getglobal(this:GetParent():GetName()..'StartPriceGold'))
|
||||
MoneyInputFrame_SetOnvalueChangedFunc(this, Aux.sell.validate_parameters)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
@@ -274,8 +285,15 @@
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
local config = Aux.sell.auction_listing_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_cell_click, config.on_cell_enter, config.on_cell_leave)
|
||||
this.sheet = Aux.sheet.create{
|
||||
frame = this,
|
||||
columns = config.columns,
|
||||
sort_order = config.sort_order,
|
||||
row_setter = config.row_setter,
|
||||
on_row_click = config.on_row_click,
|
||||
on_row_enter = config.on_row_enter,
|
||||
on_row_leave = config.on_row_leave,
|
||||
}
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
@@ -49,7 +49,9 @@ end
|
||||
function wait_for_results(k)
|
||||
local ok
|
||||
if state.job.type == 'bidder' then
|
||||
ok = true
|
||||
Aux.control.as_soon_as(function() return Aux.bids_loaded end, function()
|
||||
ok = true
|
||||
end)
|
||||
elseif state.job.type == 'owner' then
|
||||
if state.page == Aux.current_owner_page then
|
||||
ok = true
|
||||
|
||||
+47
-63
@@ -1,8 +1,9 @@
|
||||
Aux.sheet = {}
|
||||
local private, public = {}, {}
|
||||
Aux.sheet = public
|
||||
|
||||
Aux.list = {}
|
||||
|
||||
MoneyTypeInfo["AUX_LIST"] = {
|
||||
MoneyTypeInfo['AUX_LIST'] = {
|
||||
UpdateFunc = function()
|
||||
return this.staticMoney
|
||||
end,
|
||||
@@ -11,13 +12,13 @@ MoneyTypeInfo["AUX_LIST"] = {
|
||||
showSmallerCoins = 1,
|
||||
}
|
||||
|
||||
function Aux.sheet.render(sheet)
|
||||
function public.render(sheet)
|
||||
|
||||
for i, column in ipairs(sheet.columns) do
|
||||
local sort_info = sheet.sort_order[1]
|
||||
|
||||
if sort_info and sort_info.column == column then
|
||||
if sort_info.sort_ascending then
|
||||
if sort_info and sort_info.column == i then
|
||||
if sort_info.order == 'ascending' then
|
||||
sheet.labels[i].sort_texture:SetTexCoord(0,0.55,0.2,0.9)
|
||||
sheet.labels[i].sort_texture:SetVertexColor(0.2,1,0)
|
||||
sheet.labels[i].sort_texture:Show()
|
||||
@@ -42,7 +43,7 @@ function Aux.sheet.render(sheet)
|
||||
local data = sheet.data
|
||||
|
||||
for i, row in ipairs(rows) do
|
||||
local direction, rowR, rowG, rowB, rowA1, rowA2 = "Horizontal", 1, 1, 1, 0, 0 --row level coloring used for gradients
|
||||
local direction, rowR, rowG, rowB, rowA1, rowA2 = 'Horizontal', 1, 1, 1, 0, 0 --row level coloring used for gradients
|
||||
local datum = data[i + offset]
|
||||
|
||||
if datum then
|
||||
@@ -66,9 +67,9 @@ function Aux.sheet.render(sheet)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click, on_row_enter, on_row_leave, on_row_update)
|
||||
function public.create(params)
|
||||
local sheet
|
||||
local name = (frame:GetName() or '')..'ScrollSheet'
|
||||
local name = (params.frame:GetName() or '')..'ScrollSheet'
|
||||
|
||||
local id = 1
|
||||
while getglobal(name..id) do
|
||||
@@ -76,22 +77,22 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
end
|
||||
name = name..id
|
||||
|
||||
local scroll_frame = CreateFrame("ScrollFrame", name..'ScrollFrame', frame, "FauxScrollFrameTemplate")
|
||||
scroll_frame:SetScript("OnVerticalScroll", function()
|
||||
FauxScrollFrame_OnVerticalScroll(16, function() Aux.sheet.render(this.sheet) end)
|
||||
local scroll_frame = CreateFrame('ScrollFrame', name..'ScrollFrame', params.frame, 'FauxScrollFrameTemplate')
|
||||
scroll_frame:SetScript('OnVerticalScroll', function()
|
||||
FauxScrollFrame_OnVerticalScroll(16, function() public.render(this.sheet) end)
|
||||
end)
|
||||
scroll_frame:SetPoint("TOPLEFT", frame, "TOPLEFT", 5, -10)
|
||||
scroll_frame:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 5, 19)
|
||||
scroll_frame:SetPoint('TOPLEFT', params.frame, 'TOPLEFT', 5, -10)
|
||||
scroll_frame:SetPoint('BOTTOMRIGHT', params.frame, 'BOTTOMRIGHT', 5, 19)
|
||||
|
||||
local parent_height = frame:GetHeight()
|
||||
local content = CreateFrame('Frame', name..'Content', frame)
|
||||
local parent_height = params.frame:GetHeight()
|
||||
local content = CreateFrame('Frame', name..'Content', params.frame)
|
||||
content:SetHeight(parent_height - 30)
|
||||
content:SetPoint("TOPLEFT", scroll_frame, "TOPLEFT", 5, 0)
|
||||
content:SetPoint('TOPLEFT', scroll_frame, 'TOPLEFT', 5, 0)
|
||||
|
||||
local total_width = 0
|
||||
|
||||
local labels = {}
|
||||
for i = 1,getn(columns) do
|
||||
for i = 1,getn(params.columns) do
|
||||
local button = CreateFrame('Button', nil, content)
|
||||
if i == 1 then
|
||||
button:SetPoint('TOPLEFT', content, 'TOPLEFT', 5, 0)
|
||||
@@ -101,15 +102,15 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
total_width = total_width + 3
|
||||
end
|
||||
local label = content:CreateFontString(nil, 'OVERLAY', 'GameFontHighlight')
|
||||
label:SetText(columns[i].title)
|
||||
local column_width = columns[i].width or 30
|
||||
label:SetText(params.columns[i].title)
|
||||
local column_width = params.columns[i].width or 30
|
||||
|
||||
total_width = total_width + column_width
|
||||
button:SetWidth(column_width)
|
||||
button:SetHeight(16)
|
||||
button:SetID(i)
|
||||
button:SetHighlightTexture('Interface\\QuestFrame\\UI-QuestTitleHighlight')
|
||||
button:SetScript("OnMouseDown", function() Aux.list.sort(sheet, this:GetID()) end)
|
||||
button:SetScript("OnMouseDown", function() Aux.sheet.sort(sheet, this:GetID()) end)
|
||||
button:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
|
||||
local texture = content:CreateTexture(nil, 'ARTWORK')
|
||||
@@ -147,17 +148,17 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
labels[i] = label
|
||||
end
|
||||
total_width = total_width + 5
|
||||
frame:SetWidth(total_width)
|
||||
params.frame:SetWidth(total_width)
|
||||
|
||||
local rows = {}
|
||||
local row_index = 1
|
||||
local max_height = content:GetHeight()
|
||||
local total_height = 16
|
||||
while total_height + 14 < max_height do
|
||||
if getn(columns) > 0 then
|
||||
if getn(params.columns) > 0 then
|
||||
local row = CreateFrame('Button', nil, content)
|
||||
row:SetPoint('TOPLEFT', labels[1], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
|
||||
row:SetPoint('TOPRIGHT', labels[getn(columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
|
||||
row:SetPoint('TOPRIGHT', labels[getn(params.columns)], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
|
||||
row:RegisterForClicks("LeftButtonDown", "RightButtonDown")
|
||||
row:SetHeight(14)
|
||||
|
||||
@@ -168,14 +169,14 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
row:SetScript('OnUpdate', function() if sheet.on_row_update then sheet.on_row_update(sheet, row_idx) end end)
|
||||
|
||||
row.cells = {}
|
||||
for i = 1,getn(columns) do
|
||||
for i = 1,getn(params.columns) do
|
||||
local cell = CreateFrame('Button', nil, content)
|
||||
cell:SetPoint('TOPLEFT', labels[i], 'BOTTOMLEFT', 0, -((row_index-1) * 14))
|
||||
cell:SetPoint('TOPRIGHT', labels[i], 'BOTTOMRIGHT', 0, -((row_index-1) * 14))
|
||||
|
||||
cell:SetHeight(14)
|
||||
|
||||
columns[i].cell_initializer(cell)
|
||||
params.columns[i].cell_initializer(cell)
|
||||
|
||||
row.cells[i] = cell
|
||||
end
|
||||
@@ -207,28 +208,28 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
scroll_frame = scroll_frame,
|
||||
labels = labels,
|
||||
rows = rows,
|
||||
columns = columns,
|
||||
columns = params.columns,
|
||||
data = {},
|
||||
sort_order = sort_order,
|
||||
row_setter = row_setter,
|
||||
on_row_click = on_row_click,
|
||||
on_row_enter = on_row_enter,
|
||||
on_row_leave = on_row_leave,
|
||||
on_row_update = on_row_update,
|
||||
sort_order = params.sort_order,
|
||||
row_setter = params.row_setter,
|
||||
on_row_click = params.on_row_click,
|
||||
on_row_enter = params.on_row_enter,
|
||||
on_row_leave = params.on_row_leave,
|
||||
on_row_update = params.on_row_update,
|
||||
}
|
||||
scroll_frame.sheet = sheet
|
||||
|
||||
return sheet
|
||||
end
|
||||
|
||||
function Aux.list.row_comparator(sheet)
|
||||
function private.row_comparator(sheet)
|
||||
return function(row1, row2)
|
||||
for _, sort_info in ipairs(sheet.sort_order) do
|
||||
local column = sort_info.column
|
||||
local column = sheet.columns[sort_info.column]
|
||||
if column.comparator then
|
||||
local ordering = column.comparator(row1, row2)
|
||||
if ordering ~= Aux.util.EQ then
|
||||
return sort_info.sort_ascending and ordering or Aux.util.invert_order(ordering)
|
||||
return sort_info.order == 'ascending' and ordering or Aux.util.invert_order(ordering)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -236,7 +237,7 @@ function Aux.list.row_comparator(sheet)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.sheet.default_cell_initializer(alignment)
|
||||
function public.default_cell_initializer(alignment)
|
||||
return function(cell)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetAllPoints(cell)
|
||||
@@ -247,41 +248,24 @@ function Aux.sheet.default_cell_initializer(alignment)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.sheet.initialize(frame)
|
||||
|
||||
local sort_order = {}
|
||||
for i, column in columns do
|
||||
if i ~= BUYOUT_UNIT and i ~= NAME then
|
||||
tinsert(sort_order, { column = column, sort_ascending = true })
|
||||
end
|
||||
end
|
||||
tinsert(sort_order, 1, { column = columns[BUYOUT_UNIT], sort_ascending = true })
|
||||
tinsert(sort_order, 1, { column = columns[NAME], sort_ascending = true })
|
||||
|
||||
end
|
||||
|
||||
function Aux.list.populate(sheet, data)
|
||||
function public.populate(sheet, data)
|
||||
sheet.data = data
|
||||
|
||||
-- Perform the sort.
|
||||
Aux.util.merge_sort(sheet.data, Aux.list.row_comparator(sheet))
|
||||
Aux.util.merge_sort(sheet.data, private.row_comparator(sheet))
|
||||
|
||||
-- Update the scroll pane.
|
||||
Aux.sheet.render(sheet)
|
||||
public.render(sheet)
|
||||
end
|
||||
|
||||
function Aux.list.sort(sheet, column_index)
|
||||
|
||||
local column = sheet.columns[column_index]
|
||||
function Aux.sheet.sort(sheet, column_index)
|
||||
|
||||
if sheet.sort_order[1] and sheet.sort_order[1].column == column then
|
||||
sheet.sort_order[1].sort_ascending = not sheet.sort_order[1].sort_ascending
|
||||
if sheet.sort_order[1] and sheet.sort_order[1].column == column_index then
|
||||
sheet.sort_order[1].order = sheet.sort_order[1].order == 'ascending' and 'descending' or 'ascending'
|
||||
else
|
||||
sheet.sort_order = Aux.util.filter(sheet.sort_order, function(sort_info) return not sort_info.column == column end)
|
||||
tinsert(sheet.sort_order, 1, {column=column, sort_ascending=true})
|
||||
sheet.sort_order = Aux.util.filter(sheet.sort_order, function(sort_info) return not sort_info.column == column_index end)
|
||||
tinsert(sheet.sort_order, 1, {column=column_index, order = 'ascending'})
|
||||
end
|
||||
|
||||
Aux.util.merge_sort(sheet.data, Aux.list.row_comparator(sheet))
|
||||
Aux.util.merge_sort(sheet.data, private.row_comparator(sheet))
|
||||
|
||||
Aux.sheet.render(sheet)
|
||||
public.render(sheet)
|
||||
end
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
private, public = {}, {}
|
||||
local private, public = {}, {}
|
||||
Aux.static = public
|
||||
|
||||
aux_auctionable_items = {}
|
||||
|
||||
Reference in New Issue
Block a user