lots of progress, search table almost done

This commit is contained in:
Manuel Simon Hirsig
2016-02-01 02:25:43 +01:00
parent 2f62806761
commit 3b2fba9b3f
6 changed files with 145 additions and 332 deletions
+12 -158
View File
@@ -18,156 +18,8 @@
</Scripts>
</Frame>
<Button name="AuxTopTabTemplate" virtual="true">
<Size>
<AbsDimension x="100" y="32"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\ChatFrame\ChatFrameTab">
<Size>
<AbsDimension x="16" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT"/>
</Anchors>
<TexCoords left="0.0" right="0.25" top="0.0" bottom="1.0"/>
</Texture>
<Texture name="$parentRight" file="Interface\ChatFrame\ChatFrameTab">
<Size>
<AbsDimension x="16" y="32"/>
</Size>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
<TexCoords left="0.75" right="1.0" top="0.0" bottom="1.0"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\ChatFrame\ChatFrameTab">
<Size>
<AbsDimension x="44" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
</Anchors>
<TexCoords left="0.25" right="0.75" top="0.0" bottom="1.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnShow>
this:SetWidth(getglobal(this:GetName()..'Text'):GetStringWidth()+40)
</OnShow>
</Scripts>
<NormalText name="$parentText" inherits="GameFontHighlight">
<Size>
<AbsDimension x="100" y="8"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="-5"/>
</Offset>
</Anchor>
</Anchors>
</NormalText>
<HighlightTexture name="$parentHighlight" file="Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight" alphaMode="ADD" setAllPoints="true">
<Size>
<AbsDimension x="5" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft">
<Offset>
<AbsDimension x="0" y="-7"/>
</Offset>
</Anchor>
<Anchor point="RIGHT" relativeTo="$parentRight">
<Offset>
<AbsDimension x="0" y="-7"/>
</Offset>
</Anchor>
</Anchors>
</HighlightTexture>
</Button>
<Button name="AuxBottomTabTemplate" virtual="true">
<Size>
<AbsDimension x="100" y="32"/>
</Size>
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" file="Interface\ChatFrame\ChatFrameTab">
<Size>
<AbsDimension x="16" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT"/>
</Anchors>
<TexCoords left="0.0" right="0.25" top="1.0" bottom="0.0"/>
</Texture>
<Texture name="$parentRight" file="Interface\ChatFrame\ChatFrameTab">
<Size>
<AbsDimension x="16" y="32"/>
</Size>
<Anchors>
<Anchor point="RIGHT"/>
</Anchors>
<TexCoords left="0.75" right="1.0" top="1.0" bottom="0.0"/>
</Texture>
<Texture name="$parentMiddle" file="Interface\ChatFrame\ChatFrameTab">
<Size>
<AbsDimension x="44" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
</Anchors>
<TexCoords left="0.25" right="0.75" top="1.0" bottom="0.0"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnShow>
this:SetWidth(getglobal(this:GetName()..'Text'):GetStringWidth()+40)
</OnShow>
<OnClick>
Aux.on_tab_click(this:GetID())
</OnClick>
</Scripts>
<NormalText name="$parentText" inherits="GameFontNormal">
<Size>
<AbsDimension x="100" y="8"/>
</Size>
<Anchors>
<Anchor point="CENTER">
<Offset>
<AbsDimension x="0" y="5"/>
</Offset>
</Anchor>
</Anchors>
</NormalText>
<HighlightTexture name="$parentHighlight" file="Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight" alphaMode="ADD" setAllPoints="true">
<Size>
<AbsDimension x="5" y="32"/>
</Size>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft">
<Offset>
<AbsDimension x="0" y="7"/>
</Offset>
</Anchor>
<Anchor point="RIGHT" relativeTo="$parentRight">
<Offset>
<AbsDimension x="0" y="7"/>
</Offset>
</Anchor>
</Anchors>
</HighlightTexture>
</Button>
<CheckButton name="AuxRadioButtonTemplate" virtual="true">
<Size>
<AbsDimension x="16" y="16"/>
</Size>
<Size><AbsDimension x="16" y="16"/></Size>
<Layers>
<Layer level="BACKGROUND">
<FontString name="$parentText" inherits="GameFontHighlightSmall">
@@ -239,9 +91,7 @@
</EditBox>
<Slider name="AuxSliderTemplate" orientation="HORIZONTAL" enableMouse="true" virtual="true">
<Size>
<AbsDimension x="150" y="17"/>
</Size>
<Size><AbsDimension x="150" y="17"/></Size>
<HitRectInsets>
<AbsInset left="0" right="0" top="-10" bottom="-10"/>
</HitRectInsets>
@@ -266,9 +116,7 @@
</Layer>
</Layers>
<ThumbTexture name="$parentThumb" file="Interface\Buttons\UI-SliderBar-Button-Horizontal">
<Size>
<AbsDimension x="32" y="32"/>
</Size>
<Size><AbsDimension x="32" y="32"/></Size>
</ThumbTexture>
</Slider>
@@ -334,9 +182,7 @@
</Frame>
<Frame name="AuxFrame" toplevel="true" movable="true" enableMouse="true" hidden="true" parent="UIParent" clampedToScreen="true">
<Size>
<AbsDimension x="850" y="402"/>
</Size>
<Size><AbsDimension x="768" y="447"/></Size>
<Anchors>
<Anchor point="LEFT">
<Offset>
@@ -362,6 +208,14 @@
this:StopMovingOrSizing()
</OnDragStop>
</Scripts>
<Frames>
<Frame name="$parentContent">
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="4" y="-80"/></Offset></Anchor>
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-4" y="35"/></Offset></Anchor>
</Anchors>
</Frame>
</Frames>
<Backdrop bgFile="Interface\Buttons\WHITE8X8" edgeFile="Interface\Buttons\WHITE8X8" tile="true">
<EdgeSize>
<AbsValue val="1.5"/>
+76 -92
View File
@@ -4,9 +4,7 @@ Aux.filter_search_frame = public
aux_favorite_searches = {}
aux_recent_searches = {}
local auctions
local tooltip_patterns = {}
local refresh
local selected_auction
local RESULTS, SAVED, FILTER = {}, {}, {}
@@ -74,14 +72,12 @@ end
function private.select_auction(entry)
selected_auction = entry
refresh = true
private.buyout_button:Disable()
private.bid_button:Disable()
end
function private.clear_selection(entry)
selected_auction = nil
refresh = true
private.buyout_button:Disable()
private.bid_button:Disable()
end
@@ -92,7 +88,7 @@ end
function public.on_open()
private.update_search_listings()
AuxFrame:SetWidth(991)
-- AuxFrame:SetWidth(991)
end
function public.on_load()
@@ -370,7 +366,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', 10, -49)
btn:SetWidth(320)
btn:SetWidth(250)
btn:SetHeight(22)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() private.update_tab(RESULTS) end)
@@ -379,7 +375,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.search_results_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(320)
btn:SetWidth(250)
btn:SetHeight(22)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() private.update_tab(SAVED) end)
@@ -388,7 +384,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.saved_searches_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(320)
btn:SetWidth(250)
btn:SetHeight(22)
btn:SetText('New Filter')
btn:SetScript('OnClick', function() private.update_tab(FILTER) end)
@@ -949,6 +945,7 @@ function public.on_load()
-- private.testlisting:Clear()
private.testlisting:Show()
private.testlisting:SetSort(9)
private.testlisting:SetHandler('OnSelectionChanged', private.on_selection_changed)
end
function public.stop_search()
@@ -957,20 +954,20 @@ end
function private.update_listing()
if not AuxFilterSearchFrame:IsVisible() then
return
end
local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
Aux.sheet.populate(private.listings.results, 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
and a1.bid_price == a2.bid_price
and a1.owner == a2.owner
end) or {})
-- if not AuxFilterSearchFrame:IsVisible() then
-- return
-- end
--
-- local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
-- Aux.sheet.populate(private.listings.results, 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
-- and a1.bid_price == a2.bid_price
-- and a1.owner == a2.owner
-- end) or {})
end
function public.start_search()
@@ -1010,14 +1007,15 @@ function public.start_search()
private.clear_selection()
private.search_button:Hide()
private.stop_button:Show()
auctions = nil
refresh = true
private.update_tab(RESULTS)
private.status_bar:update_status(0,0)
private.status_bar:set_text('Scanning auctions...')
local scanned_records = {}
private.testlisting:SetDatabase(scanned_records)
Aux.scan.start{
queries = queries,
on_page_loaded = function(page, total_pages)
@@ -1025,33 +1023,28 @@ function public.start_search()
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
end,
on_page_complete = function()
refresh = true
private.testlisting:SetDatabase()
end,
on_start_query = function(query_index)
private.status_bar:update_status(0, 100 * (query_index - 1) / getn(queries)) -- TODO
private.status_bar:set_text(format('Processing query %d / %d', query_index, getn(queries)))
end,
on_read_auction = function(auction_info)
auctions = auctions or {}
tinsert(auctions, private.create_auction_record(auction_info))
private.testlisting:InsertAuctionRecord(auction_info)
-- tinsert(scanned_records, private.create_auction_record(auction_info))
tinsert(scanned_records, auction_info)
end,
on_complete = function()
auctions = auctions or {}
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
private.stop_button:Hide()
private.search_button:Show()
refresh = true
end,
on_abort = function()
auctions = auctions or {}
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
private.stop_button:Hide()
private.search_button:Show()
refresh = true
end,
}
end)
@@ -1066,13 +1059,12 @@ function private.process_request(entry, express_mode, buyout_mode)
PlaySound('igMainMenuOptionCheckBoxOn')
local function test(index)
local auction_record = private.create_auction_record(Aux.info.auction(index))
local auction_record = Aux.info.auction(index)
return auction_record.signature == entry.signature and auction_record.bid_price == entry.bid_price and auction_record.duration == entry.duration and auction_record.owner ~= UnitName('player')
end
local function remove_entry()
entry.gone = true
refresh = true
private.clear_selection()
end
@@ -1110,15 +1102,14 @@ function private.process_request(entry, express_mode, buyout_mode)
end
end
function private.on_row_click(datum, grouped)
function private.on_selection_changed(rt, datum)
local entry
if grouped then
entry = Aux.util.filter(datum, function(auction) return not auction.gone end)[1] or datum[1]
else
entry = datum
if not datum then
return
end
local entry = datum.record
if IsControlKeyDown() then
DressUpItemLink(entry.hyperlink)
elseif IsShiftKeyDown() then
@@ -1132,58 +1123,51 @@ function private.on_row_click(datum, grouped)
end
end
function private.create_auction_record(auction_info)
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
local unit_buyout_price = buyout_price and auction_info.buyout_price / auction_info.aux_quantity
local status
if auction_info.current_bid == 0 then
status = 'No Bid'
elseif auction_info.high_bidder then
status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
else
status = 'Other Bidder'
end
return {
query = auction_info.query,
page = auction_info.page,
item_id = auction_info.item_id,
suffix_id = auction_info.suffix_id,
unique_id = auction_info.unique_id,
enchant_id = auction_info.enchant_id,
item_key = auction_info.item_key,
signature = auction_info.signature,
name = auction_info.name,
level = auction_info.level,
tooltip = auction_info.tooltip,
aux_quantity = auction_info.aux_quantity,
buyout_price = buyout_price,
unit_buyout_price = unit_buyout_price,
quality = auction_info.quality,
hyperlink = auction_info.hyperlink,
itemstring = auction_info.itemstring,
bid_price = auction_info.bid_price,
unit_bid_price = auction_info.bid_price / auction_info.aux_quantity,
owner = auction_info.owner,
duration = auction_info.duration,
usable = auction_info.usable,
high_bidder = auction_info.high_bidder,
status = status,
EnhTooltip_info = auction_info.EnhTooltip_info,
}
end
function public.on_update()
if refresh then
refresh = false
private.update_listing()
end
end
--function private.create_auction_record(auction_info)
--
-- local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
-- local unit_buyout_price = buyout_price and auction_info.buyout_price / auction_info.aux_quantity
-- local status
-- if auction_info.current_bid == 0 then
-- status = 'No Bid'
-- elseif auction_info.high_bidder then
-- status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
-- else
-- status = 'Other Bidder'
-- end
--
-- return {
-- query = auction_info.query,
-- page = auction_info.page,
--
-- item_id = auction_info.item_id,
-- suffix_id = auction_info.suffix_id,
-- unique_id = auction_info.unique_id,
-- enchant_id = auction_info.enchant_id,
--
-- item_key = auction_info.item_key,
-- signature = auction_info.signature,
--
-- name = auction_info.name,
-- level = auction_info.level,
-- tooltip = auction_info.tooltip,
-- aux_quantity = auction_info.aux_quantity,
-- buyout_price = buyout_price,
-- unit_buyout_price = unit_buyout_price,
-- quality = auction_info.quality,
-- hyperlink = auction_info.hyperlink,
-- itemstring = auction_info.itemstring,
-- bid_price = auction_info.bid_price,
-- unit_bid_price = auction_info.bid_price / auction_info.aux_quantity,
-- owner = auction_info.owner,
-- duration = auction_info.duration,
-- usable = auction_info.usable,
-- high_bidder = auction_info.high_bidder,
-- status = status,
--
-- EnhTooltip_info = auction_info.EnhTooltip_info,
-- }
--end
function private.initialize_class_dropdown()
local function on_click()
+5 -13
View File
@@ -2,14 +2,6 @@
<Script file="filter_search_frame.lua"/>
<Frame>
<Scripts>
<OnUpdate>
Aux.filter_search_frame.on_update()
</OnUpdate>
</Scripts>
</Frame>
<Frame name="AuxFilterSearchFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
<Frames>
<Frame name="$parentFilters">
@@ -26,11 +18,11 @@
</CheckButton>
</Frames>
</Frame>
<Frame name="$parentResults" inherits="AuxFrameBoxTemplate">
<Size>
<AbsDimension x="985" y="278"/>
</Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="3" y="-82"/></Offset></Anchor></Anchors>
<Frame name="$parentResults">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="AuxFrameContent"></Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="AuxFrameContent"></Anchor>
</Anchors>
<Frames>
<Frame name="$parentListing" hidden="true">
<Anchors>
-4
View File
@@ -1,10 +1,6 @@
local m = {}
Aux.test = m
function m.niltest(object)
if not object then snipe.log('eheu')
else snipe.log('euge') end
end
function m.prettify_search(search)
local item_pattern = '([^/;]+)([^;]*)/exact'
while true do
+7 -2
View File
@@ -79,10 +79,12 @@ function public.auction(index, type)
local item_info = public.item(item_id, suffix_id, unique_id, enchant_id)
local name, texture, count, quality, usable, level, start_price, min_increment, buyout_price, high_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(type, index)
local duration = GetAuctionItemTimeLeft(type, index)
local tooltip = public.tooltip(function(tt) tt:SetAuctionItem(type, index) end)
local charges = private.item_charges(tooltip)
local aux_quantity = charges or count
local bid_price = (high_bid > 0 and high_bid or start_price) + min_increment
return {
item_id = item_id,
@@ -94,6 +96,7 @@ function public.auction(index, type)
itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id,
signature = Aux.util.join({item_id, suffix_id, unique_id, enchant_id, aux_quantity, start_price, buyout_price}, ':'), -- not unique!
search_signature = Aux.util.join({item_id, suffix_id, enchant_id, buyout_price, bid_price, aux_quantity, duration, owner or ''}, ':'),
name = name,
texture = texture,
@@ -109,8 +112,10 @@ function public.auction(index, type)
high_bid = high_bid,
current_bid = high_bid, -- deprecated
min_increment = min_increment,
bid_price = (high_bid > 0 and high_bid or start_price) + min_increment,
bid_price = bid_price,
buyout_price = buyout_price,
unit_bid_price = bid_price / aux_quantity,
unit_buyout_price = buyout_price / aux_quantity,
high_bidder = high_bidder,
owner = owner,
sale_status = sale_status,
@@ -124,7 +129,7 @@ function public.auction(index, type)
name = name,
hyperlink = hyperlink,
quality = quality,
count = count,
count = aux_quantity,
},
}
end
+45 -63
View File
@@ -4,17 +4,17 @@ local RT_COUNT = 1
local HEAD_HEIGHT = 27
local HEAD_SPACE = 2
local AUCTION_PCT_COLORS = {
{color="|cff2992ff", value=50}, -- blue
{color="|cff16ff16", value=80}, -- green
{color="|cffffff00", value=110}, -- yellow
{color="|cffff9218", value=135}, -- orange
{color="|cffff0000", value=Aux.huge}, -- red
{color='|cff2992ff', value=50}, -- blue
{color='|cff16ff16', value=80}, -- green
{color='|cffffff00', value=110}, -- yellow
{color='|cffff9218', value=135}, -- orange
{color='|cffff0000', value=Aux.huge}, -- red
}
local TIME_LEFT_STRINGS = {
"|cffff000030m|r", -- Short
"|cffff92182h|r", -- Medium
"|cffffff0012h|r", -- Long
"|cff2992ff48h|r", -- Very Long
'|cffff000030m|r', -- Short
'|cffff92182h|r', -- Medium
'|cffffff0012h|r', -- Long
'|cff2992ff48h|r', -- Very Long
}
@@ -111,7 +111,7 @@ local methods = {
OnCellLeave = function()
GameTooltip:Hide()
-- hide highlight if it's not selected
if not this.rt.selected or this.rt.selected.hash2 ~= this.row.data.record.hash2 then
if not this.rt.selected or this.rt.selected.search_signature ~= this.row.data.record.search_signature then
this.row.highlight:Hide()
end
end,
@@ -138,29 +138,38 @@ local methods = {
end,
-- ============================================================================
-- Internal Results Table Methods
-- ============================================================================
-- default functions which will be overridden
GetMarketValue = function(itemString) return end,
-- GetRowPrices = function(record, isPerUnit) return end, -- TODO
GetRowPrices = function(record, isPerUnit)
return record.bid_price, record.buyout_price
-- GetRowPrices = function(record, isPerUnit) return end, -- TODO
GetRowPrices = function(record, per_unit)
if per_unit then
return record.unit_bid_price, record.unit_buyout_price
else
return record.bid_price, record.buyout_price
end
end,
GetRecordPercent = function(rt, record)
if not record then return end
-- cache the market value on the record
-- record.marketValue = record.marketValue or rt.GetMarketValue(record.item_key) or 0
-- cache the market value on the record
-- record.market_value = record.market_value or rt.GetMarketValue(record.item_key) or 0
-- if record.marketValue > 0 then
-- if record.itemBuyout > 0 then
-- return Aux.round(100 * record.itemBuyout / record.marketValue, 1)
-- end
-- return nil, Aux.round(100 * record.itemDisplayedBid / record.marketValue, 1)
-- end
local market_value = Aux.history.market_value(record.item_key)
if market_value and market_value > 0 then
if record.unit_buyout_price > 0 then
return Aux.round(100 * record.unit_buyout_price / market_value, 1)
end
return nil, Aux.round(100 * record.unit_bid_price / market_value, 1)
end
end,
UpdateRowInfo = function(rt)
@@ -169,11 +178,7 @@ local methods = {
rt.sortInfo.isSorted = nil
rt:SetSelectedRecord(nil, true)
local function search_signature(record)
return Aux.util.join({record.item_key, record.buyout_price, record.bid_price, record.aux_quantity, record.duration, record.owner}, ':')
end
sort(rt.records, function(a,b) return search_signature(a) < search_signature(b) end)
sort(rt.records, function(a,b) return a.search_signature < b.search_signature end)
local records = rt.records
if getn(records) == 0 then return end
@@ -183,7 +188,7 @@ local methods = {
for i=1, getn(records) do
local record = records[i]
local prevRecord = records[i-1]
if prevRecord and search_signature(record) == search_signature(prevRecord) then
if prevRecord and record.search_signature == prevRecord.search_signature then
-- it's an identical auction to the previous row so increment the number of auctions
rt.rowInfo[getn(rt.rowInfo)].children[getn(rt.rowInfo[getn(rt.rowInfo)].children)].numAuctions = rt.rowInfo[getn(rt.rowInfo)].children[getn(rt.rowInfo[getn(rt.rowInfo)].children)].numAuctions + 1
elseif prevRecord and record.item_key == prevRecord.item_key then
@@ -271,7 +276,7 @@ local methods = {
aVal = aVal[sortKey]
bVal = bVal[sortKey]
end
if sortKey == "buyout" or sortKey == "itemBuyout" then
if sortKey == 'buyout' or sortKey == 'itemBuyout' then
-- for buyout, put bid-only auctions at the bottom
if not aVal or aVal == 0 then
aVal = (rt.sortInfo.descending and -1 or 1) * Aux.huge
@@ -352,7 +357,7 @@ local methods = {
local row = rt.rows[rowIndex]
-- show this row
row:Show()
if rt.selected and record.hash2 == rt.selected.hash2 then
if rt.selected and record.search_signature == rt.selected.search_signature then
row.highlight:Show()
else
row.highlight:Hide()
@@ -422,7 +427,7 @@ local methods = {
-- show / hide highlight accordingly
for _, row in ipairs(rt.rows) do
if rt.selected and row.data and row.data.record.hash2 == rt.selected.hash2 then
if rt.selected and row.data and row.data.record.search_signature == rt.selected.search_signature then
row.highlight:Show()
else
row.highlight:Hide()
@@ -536,22 +541,6 @@ local methods = {
rt.handlers[event] = handler
end,
SetPriceInfo = function(rt, info)
-- update the header text
rt.headCells[7].info.name = info.headers[1]
rt.headCells[8].info.name = info.headers[2]
rt.headCells[9].info.name = info.pctHeader
for i=7, 9 do
if rt.headCells[i].info.isPrice then
rt.headCells[i]:SetText(rt.headCells[i].info.name[aux_price_per_unit and 1 or 2])
else
rt.headCells[i]:SetText(rt.headCells[i].info.name)
end
end
rt.GetRowPrices = info.GetRowPrices
rt.GetMarketValue = info.GetMarketValue
end,
SetDisabled = function(rt, disabled)
rt.disabled = disabled
if not disabled then
@@ -568,19 +557,13 @@ local methods = {
GetSelection = function(rt)
if not rt.selected then return end
local selectedData = nil
for i, info in ipairs(rt.rowInfo) do
if rt.expanded[info.expandKey] then
for _, childInfo in ipairs(info.children) do
if childInfo.record.hash2 == rt.selected.hash2 then
selectedData = childInfo
break
end
local selectedData
for _, info in ipairs(rt.rowInfo) do
for _, childInfo in ipairs(info.children) do
if childInfo.record.search_signature == rt.selected.search_signature then
selectedData = childInfo
break
end
if selectedData then break end
elseif info.children[1].record.hash2 == rt.selected.hash2 then
selectedData = info.children[1]
break
end
end
return selectedData
@@ -605,16 +588,16 @@ function CreateAuctionResultsTable(parent)
{name="Stack Size", width=0.055, align="CENTER"},
{name='Time Left', width=0.04, align="CENTER"},
{name='Seller', width=0.13, align="CENTER"},
{name={"??", "??"}, width=0.125, align="RIGHT", isPrice=true},
{name={"??", "??"}, width=0.125, align="RIGHT", isPrice=true},
{name="", width=0.08, align="CENTER"},
{name={'Auction Bid\n(per item)', 'Auction Bid\n(per stack)'}, width=0.125, align="RIGHT", isPrice=true},
{name={'Auction Buyout\n(per item)', 'Auction Buyout\n(per stack)'}, width=0.125, align="RIGHT", isPrice=true},
{name='% Market Value', width=0.08, align="CENTER"},
}
local rtName = 'TSMAuctionResultsTable'..RT_COUNT
RT_COUNT = RT_COUNT + 1
local rt = CreateFrame('Frame', rtName, parent)
-- local numRows = TSM.db.profile.auctionResultRows
local numRows = 10
local numRows = 16
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT-HEAD_SPACE) / numRows
rt.scrollDisabled = nil
rt.expanded = {}
@@ -644,9 +627,9 @@ function CreateAuctionResultsTable(parent)
-- frame to hold the header columns and the rows
local scrollFrame = CreateFrame('ScrollFrame', rtName..'ScrollFrame', rt, 'FauxScrollFrameTemplate')
scrollFrame:SetScript('OnVerticalScroll', function(self, offset)
scrollFrame:SetScript('OnVerticalScroll', function()
if not rt.scrollDisabled then
FauxScrollFrame_OnVerticalScroll(self, offset, rt.ROW_HEIGHT, function() rt:UpdateRows() end)
FauxScrollFrame_OnVerticalScroll(rt.ROW_HEIGHT, function() rt:UpdateRows() end)
end
end)
scrollFrame:SetAllPoints(contentFrame)
@@ -661,7 +644,7 @@ function CreateAuctionResultsTable(parent)
scrollBar:SetWidth(10)
local thumbTex = scrollBar:GetThumbTexture()
thumbTex:SetPoint('CENTER', 0, 0)
-- TSMAPI.Design:SetContentColor(thumbTex)
thumbTex:SetTexture(unpack(Aux.gui.config.content_color))
thumbTex:SetHeight(150)
thumbTex:SetWidth(scrollBar:GetWidth())
getglobal(scrollBar:GetName()..'ScrollUpButton'):Hide()
@@ -670,7 +653,6 @@ function CreateAuctionResultsTable(parent)
-- create the header cells
rt.headCells = {}
for i, info in ipairs(colInfo) do
snipe.log(i)
local cell = CreateFrame('Button', rtName..'HeadCol'..i, rt.contentFrame)
cell:SetHeight(HEAD_HEIGHT)
if i == 1 then