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