item search progress

This commit is contained in:
Manuel Simon Hirsig
2015-10-31 13:36:29 +01:00
parent 68b9b3e486
commit 0b25a526bb
11 changed files with 8081 additions and 218 deletions
+5 -2
View File
@@ -2,7 +2,7 @@
## 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
## SavedVariables: aux_database
## SavedVariables: aux_database, aux_auctionable_items
core.xml
control.xml
persistence.lua
@@ -15,7 +15,8 @@ list.lua
info.xml
completion.xml
search_frame.xml
item_search_frame.xml
filter_search_frame.xml
post_frame.xml
manage_frame.xml
scan_frame.xml
@@ -23,3 +24,5 @@ scan_frame.xml
options.xml
about.xml
auctionable_items.lua
File diff suppressed because it is too large Load Diff
+10 -51
View File
@@ -4,43 +4,6 @@ local NUM_MATCHES = 5
local fuzzy, generate_suggestions
local items = {}
local potentially_auctionable_items = {}
function _process_batch(i)
for j=i, i+1000 do
local name = GetItemInfo('item:'..j)
if name then
local tooltip = Aux.info.tooltip(function(tt) tt:SetHyperlink('item:'..j) end)
if not Aux.info.tooltip_match({'binds when picked up'}, tooltip) and not Aux.info.tooltip_match({'quest item'}, tooltip) then
Aux.log(name)
tinsert(potentially_auctionable_items, { id=j, s=0 })
end
end
end
if i+1000 > 30000 then
snipe.log(getn(potentially_auctionable_items))
else
local t0 = time()
Aux.control.as_soon_as(function() return time() - t0 > 1 end, function()
return _process_batch(i+1000)
end)
end
end
function find_auctionable_items()
_process_batch(1)
end
find_auctionable_items()
for item_id=1,30000 do
local name = GetItemInfo(item_id)
if name then
tinsert(items, { name=name, id=item_id })
end
end
function fuzzy(input)
local uppercase_input = strupper(input)
local pattern = '(.*)'
@@ -70,7 +33,7 @@ function generate_suggestions(input)
end
local best = {}
for _, item in ipairs(items) do
for _, item in ipairs(Aux.localized_auctionable_items) do
local rating = matcher(item.name)
if rating then
local candidate = { name=item.name, id=item.id, rating=rating }
@@ -106,14 +69,8 @@ function Aux.completion.completor(edit_box)
notCheckable = true,
func = function()
-- self.set_quietly(text)
local info = { GetItemInfo(this.value) }
AuxBuyFiltersItemIconTexture:SetTexture(info[9])
AuxBuyFiltersItemName:SetText(text)
local color = ITEM_QUALITY_COLORS[info[3]]
AuxBuyFiltersItemName:SetTextColor(color.r, color.g, color.b)
Aux.browse_frame.set_item(this.value)
Aux.browse_frame.update_item()
Aux.item_search_frame.set_item(this.value)
AuxItemSearchFrameItemItemInputBox:ClearFocus()
end,
}
end
@@ -183,10 +140,11 @@ function Aux.completion.completor(edit_box)
index = index > 0 and math.mod(index + 1, getn(suggestions) + 1) or 1
update_highlighting()
if index == 0 then
self.set_quietly(input)
-- self.set_quietly(input)
else
self.set_quietly(suggestions[index].text)
end
-- self.set_quietly(suggestions[index].text)
Aux.item_search_frame.set_item(suggestions[index].value)
end
end
end
@@ -196,9 +154,10 @@ function Aux.completion.completor(edit_box)
index = index > 0 and index - 1 or getn(suggestions)
update_highlighting()
if index == 0 then
self.set_quietly(input)
-- self.set_quietly(input)
else
self.set_quietly(suggestions[index].text)
-- self.set_quietly(suggestions[index].text)
Aux.item_search_frame.set_item(suggestions[index].value)
end
end
end
+17 -8
View File
@@ -22,6 +22,13 @@ Aux = {
function Aux_OnLoad()
Aux.log('Aux v'..AuxVersion..' loaded.')
Aux.loaded = true
Aux.localized_auctionable_items = {}
for _, item_id in Aux.auctionable_items do
local name = GetItemInfo(item_id)
tinsert(Aux.localized_auctionable_items, { name=name, id=item_id })
end
end
function Aux_OnEvent()
@@ -150,6 +157,7 @@ function Aux.on_tab_click(index)
Aux.post.stop()
Aux.stack.stop()
Aux.scan.abort(function()
Aux.item_search_frame.on_close()
Aux.buy.on_close()
Aux.sell.on_close()
Aux.manage_frame.on_close()
@@ -159,23 +167,24 @@ function Aux.on_tab_click(index)
getglobal('AuxTab'..i):SetAlpha(i == index and 1 or 0.5)
end
AuxSellFrame:Hide()
AuxItemSearchFrame:Hide()
AuxBuyFrame:Hide()
AuxHistoryFrame:Hide()
AuxSellFrame:Hide()
AuxManageFrame:Hide()
AuxHistoryFrame:Hide()
if index == 1 then
AuxBuyFrame:Show()
Aux.buy.on_open()
AuxItemSearchFrame:Show()
Aux.item_search_frame.on_open()
elseif index == 2 then
AuxBuyFrame:Show()
Aux.filter_search_frame.on_open()
elseif index == 3 then
AuxSellFrame:Show()
Aux.sell.on_open()
elseif index == 3 then
elseif index == 4 then
AuxManageFrame:Show()
Aux.manage_frame.on_open()
elseif index == 4 then
AuxHistoryFrame:Show()
Aux.history.on_open()
end
end)
end
+644
View File
@@ -0,0 +1,644 @@
local private, public = {}, {}
Aux.item_search_frame = public
local create_auction_record, show_dialog, find_auction, hide_sheet, update_listing, auction_alpha_setter, group_alpha_setter, create_auction_record
local auctions
local search_query
local tooltip_patterns = {}
local current_page
local refresh
function auction_alpha_setter(cell, auction)
cell:SetAlpha(auction.gone and 0.3 or 1)
end
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] = {
name = 'Buyout',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
public.on_row_click(Aux.util.filter(sheet.data[data_index], function(auction) return not auction.gone end)[1] or sheet.data[data_index][1])
end,
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info)
end,
on_row_leave = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(0)
GameTooltip:Hide()
end,
row_setter = function(row, group)
row.tooltip = group[1].tooltip
row.EnhTooltip_info = group[1].EnhTooltip_info
end,
columns = {
{
title = 'Avail',
width = 40,
comparator = function(group1, group2) return Aux.util.compare(getn(Aux.util.filter(group1, function(auction) return not auction.gone end)), getn(Aux.util.filter(group2, function(auction) return not auction.gone end)), Aux.util.LT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, group)
cell.text:SetText(getn(Aux.util.filter(group, function(auction) return not auction.gone end)))
group_alpha_setter(cell, group)
end,
},
{
title = 'Qty',
width = 23,
comparator = function(group1, group2) return Aux.util.compare(group1[1].stack_size, group2[1].stack_size, Aux.util.LT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, group)
cell.text:SetText(group[1].stack_size)
group_alpha_setter(cell, group)
end,
},
{
title = 'Buy/ea',
width = 93,
comparator = function(group1, group2) return Aux.util.compare(group1[1].buyout_price_per_unit, group2[1].buyout_price_per_unit, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, group)
cell.text:SetText(Aux.util.money_string(group[1].buyout_price_per_unit))
group_alpha_setter(cell, group)
end,
},
{
title = 'Buy',
width = 93,
comparator = function(group1, group2) return Aux.util.compare(group1[1].buyout_price, group2[1].buyout_price, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, group)
cell.text:SetText(Aux.util.money_string(group[1].buyout_price))
group_alpha_setter(cell, group)
end,
},
},
sort_order = {{column = 2, order = 'ascending' }, {column = 4, order = 'ascending'}},
},
[BID] = {
name = 'Bid',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
public.on_row_click(sheet.data[data_index])
end,
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info)
end,
on_row_leave = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(0)
GameTooltip:Hide()
end,
row_setter = function(row, datum)
row.tooltip = datum.tooltip
row.EnhTooltip_info = datum.EnhTooltip_info
end,
columns = {
{
title = 'Page',
width = 40,
comparator = function(row1, row2) return Aux.util.compare(row1.page, row2.page, Aux.util.LT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, datum)
cell.text:SetText(datum.page)
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)
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Status',
width = 70,
comparator = function(auction1, auction2) return Aux.util.compare(auction1.status, auction2.status, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
cell_setter = function(cell, auction)
cell.text:SetText(auction.status)
auction_alpha_setter(cell, auction)
end,
},
{
title = 'Qty',
width = 23,
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.stack_size)
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Bid/ea',
width = 110,
comparator = function(row1, row2) return Aux.util.compare(row1.bid_per_unit, row2.bid_per_unit, 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.bid_per_unit))
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Bid',
width = 110,
comparator = function(row1, row2) return Aux.util.compare(row1.bid, row2.bid, 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.bid))
auction_alpha_setter(cell, datum)
end,
},
},
sort_order = {{column = 2, order = 'ascending' }, {column = 6, order = 'ascending' }, {column = 3, order = 'ascending'}},
},
[FULL] = {
name = 'Full',
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
public.on_row_click(sheet.data[data_index])
end,
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info)
end,
on_row_leave = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(0)
GameTooltip:Hide()
end,
row_setter = function(row, datum)
row.tooltip = datum.tooltip
row.EnhTooltip_info = datum.EnhTooltip_info
end,
columns = {
{
title = 'Qty',
width = 23,
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.stack_size)
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Lvl',
width = 23,
comparator = function(row1, row2) return Aux.util.compare(row1.level, row2.level, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
cell_setter = function(cell, datum)
local level = max(1, datum.level)
local text
if level > UnitLevel('player') then
text = RED_FONT_COLOR_CODE..level..FONT_COLOR_CODE_CLOSE
else
text = level
end
cell.text:SetText(text)
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)
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Owner',
width = 70,
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
cell_setter = function(cell, datum)
cell.text:SetText(datum.owner)
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Bid/ea',
width = 70,
comparator = function(row1, row2) return Aux.util.compare(row1.bid_per_unit, row2.bid_per_unit, 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.bid_per_unit))
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Buy/ea',
width = 70,
comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price_per_unit, row2.buyout_price_per_unit, 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_per_unit))
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Bid',
width = 70,
comparator = function(row1, row2) return Aux.util.compare(row1.bid, row2.bid, 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.bid))
auction_alpha_setter(cell, datum)
end,
},
{
title = 'Buy',
width = 70,
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))
auction_alpha_setter(cell, datum)
end,
},
},
sort_order = {},
},
}
function public.on_close()
if AuxBuyConfirmation:IsVisible() then
public.dialog_cancel()
end
current_page = nil
end
function public.on_open()
public.set_view(1)
public.update_item()
update_listing()
end
function public.dialog_cancel()
Aux.log('Canceled.')
Aux.scan.abort()
AuxBuyConfirmation:Hide()
update_listing()
AuxBuySearchButton:Enable()
end
function public.stop_search()
Aux.scan.abort()
end
function update_listing()
AuxItemSearchFrameAuctionsBuyListing:Hide()
AuxItemSearchFrameAuctionsBidListing:Hide()
AuxItemSearchFrameAuctionsFullListing:Hide()
if private.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.hyperlink == a2.hyperlink and a1.stack_size == a2.stack_size and a1.buyout_price == a2.buyout_price end) or {})
elseif private.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)
elseif private.view == FULL then
AuxItemSearchFrameAuctionsFullListing:Show()
Aux.list.populate(AuxItemSearchFrameAuctionsFullListing.sheet, auctions or {})
end
end
function hide_sheet()
AuxItemSearchFrameAuctionsBuyListing:Hide()
AuxItemSearchFrameAuctionsBidListing:Hide()
AuxItemSearchFrameAuctionsFullListing:Hide()
end
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
update_listing()
end
function public.set_item(item_id)
private.item_id = item_id
end
function public.update_item()
if private.item_id and not AuxItemSearchFrameItemItemInputBox:IsVisible() then
local info = { GetItemInfo(private.item_id) }
AuxItemSearchFrameItemItemIconTexture:SetTexture(info[9])
AuxItemSearchFrameItemItemName:SetText(info[1])
local color = ITEM_QUALITY_COLORS[info[3]]
AuxItemSearchFrameItemItemName:SetTextColor(color.r, color.g, color.b)
AuxItemSearchFrameItemItem:Show()
AuxItemSearchFrameItemItemInputBox:Hide()
public.start_search()
else
AuxItemSearchFrameItemItem:Hide()
end
end
function public.start_search()
if not AuxItemSearchFrameItemSearchButton:IsVisible() then
return
end
AuxItemSearchFrameItemSearchButton:Hide()
AuxItemSearchFrameItemStopButton:Show()
auctions = nil
refresh = true
local name = GetItemInfo(private.item_id)
search_query = {
name = name,
-- min_level = AuxBuyMinLevel:GetText(),
-- max_level = AuxBuyMaxLevel:GetText(),
-- slot = category and category.slot,
-- class = category and category.class,
-- subclass = category and category.subclass,
-- quality = UIDropDownMenu_GetSelectedValue(AuxBuyQualityDropDown),
-- usable = AuxBuyUsableCheckButton:GetChecked()
}
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(i)
local auction_item = Aux.info.auction_item(i)
if auction_item then
if auction_item.name == search_query.name then
auctions = auctions or {}
tinsert(auctions, create_auction_record(auction_item, current_page))
end
end
end,
on_complete = function()
auctions = auctions or {}
Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
AuxItemSearchFrameItemStopButton:Hide()
AuxItemSearchFrameItemSearchButton:Show()
refresh = true
end,
on_abort = function()
auctions = auctions or {}
Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
AuxItemSearchFrameItemStopButton:Hide()
AuxItemSearchFrameItemSearchButton: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
function show_dialog(buyout_mode, entry, amount)
AuxBuyConfirmationContentItem.tooltip = entry.tooltip
AuxBuyConfirmationContentItem.EnhTooltip_info = entry.EnhTooltip_info
AuxBuyConfirmationContentActionButton:Disable()
AuxBuyConfirmationContentItemIconTexture:SetTexture(entry.texture)
AuxBuyConfirmationContentItemName:SetText(entry.tooltip[1][1].text)
local color = ITEM_QUALITY_COLORS[entry.quality]
AuxBuyConfirmationContentItemName:SetTextColor(color.r, color.g, color.b)
if entry.stack_size > 1 then
AuxBuyConfirmationContentItemCount:SetText(entry.stack_size);
AuxBuyConfirmationContentItemCount:Show()
else
AuxBuyConfirmationContentItemCount:Hide()
end
if buyout_mode then
AuxBuyConfirmationContentActionButton:SetText('Buy')
MoneyFrame_Update('AuxBuyConfirmationContentBuyoutPrice', amount)
AuxBuyConfirmationContentBid:Hide()
AuxBuyConfirmationContentBuyoutPrice:Show()
else
AuxBuyConfirmationContentActionButton:SetText('Bid')
MoneyInputFrame_SetCopper(AuxBuyConfirmationContentBid, amount)
AuxBuyConfirmationContentBuyoutPrice:Hide()
AuxBuyConfirmationContentBid:Show()
end
AuxBuyConfirmation:Show()
end
function find_auction(entry, buyout_mode, express_mode)
if entry.gone then
Aux.log('Auction not available')
return
end
if buyout_mode and not entry.buyout_price then
Aux.log('Auction has no buyout price')
return
end
local amount
if buyout_mode then
amount = entry.buyout_price
else
amount = entry.bid
end
Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request for '..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..' ...')
AuxItemSearchFrameItemSearchButton:Disable()
if not express_mode then
show_dialog(buyout_mode, entry, amount)
end
PlaySound('igMainMenuOptionCheckBoxOn')
local found
Aux.scan.start{
query = search_query,
page = entry.page ~= current_page and entry.page,
on_submit_query = function()
current_page = nil
end,
on_page_loaded = function(page)
current_page = page
end,
on_read_auction = function(i, ctrl)
local auction_item = Aux.info.auction_item(i)
if not auction_item then
return
end
local stack_size = auction_item.charges or auction_item.count
local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment
local signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price)
if entry.signature == signature then
ctrl.suspend()
found = true
Aux.log('Matching auction found.'..(express_mode and '' or ' Awaiting confirmation ...'))
if express_mode then
if GetMoney() >= amount then
PlaceAuctionBid("list", i, amount)
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..'.')
entry.gone = true
refresh = true
else
Aux.log((buyout_mode and 'Purchase' or 'Bid')..' failed: Not enough money.')
end
Aux.scan.abort()
else
Aux.buy.dialog_action = function()
if GetMoney() >= amount then
PlaceAuctionBid("list", i, amount)
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..'.')
entry.gone = true
refresh = true
else
Aux.log('Not enough money.')
end
Aux.scan.abort()
AuxItemSearchFrameItemSearchButton:Enable()
AuxItemSearchFrameConfirmation:Hide()
update_listing()
end
AuxItemSearchFrameConfirmationContentActionButton: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
refresh = true
public.dialog_cancel()
end
if express_mode then
AuxItemSearchFrameItemSearchButton:Enable()
end
end,
on_abort = function()
if express_mode then
AuxItemSearchFrameItemSearchButton:Enable()
end
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_row_click(entry)
local express_mode = IsAltKeyDown()
local buyout_mode = arg1 == 'LeftButton'
if IsControlKeyDown() then
DressUpItemLink(entry.hyperlink)
else
find_auction(entry, buyout_mode, express_mode)
end
end
function create_auction_record(auction_item, current_page)
local stack_size = auction_item.charges or auction_item.count
local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment
local buyout_price = auction_item.buyout_price > 0 and auction_item.buyout_price or nil
local buyout_price_per_unit = buyout_price and Aux_Round(auction_item.buyout_price/stack_size)
local status
if auction_item.current_bid == 0 then
status = 'No Bid'
elseif auction_item.high_bidder then
status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
else
status = RED_FONT_COLOR_CODE..'Other Bidder'..FONT_COLOR_CODE_CLOSE
end
return {
key = auction_item.item_signature,
signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price),
name = auction_item.name,
level = auction_item.level,
texture = auction_item.texture,
tooltip = auction_item.tooltip,
stack_size = stack_size,
buyout_price = buyout_price,
buyout_price_per_unit = buyout_price_per_unit,
quality = auction_item.quality,
hyperlink = auction_item.hyperlink,
itemstring = auction_item.itemstring,
page = current_page,
bid = bid,
bid_per_unit = Aux_Round(bid/stack_size),
owner = auction_item.owner,
duration = auction_item.duration,
usable = auction_item.usable,
high_bidder = auction_item.high_bidder,
status = status,
EnhTooltip_info = auction_item.EnhTooltip_info,
}
end
function public.on_update()
if refresh then
refresh = false
update_listing()
end
end
+301
View File
@@ -0,0 +1,301 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="item_search_frame.lua"/>
<Frame>
<Scripts>
<OnUpdate>
Aux.item_search_frame.on_update()
</OnUpdate>
</Scripts>
</Frame>
<Frame name="AuxItemSearchFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
<Frames>
<Frame name="$parentItem" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="213" 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)
getglobal(this:GetName().."Title"):SetText('Item')
</OnLoad>
</Scripts>
<Frames>
<Button name="$parentItem" inherits="AuxItemTemplate">
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="-20"/></Offset></Anchor></Anchors>
<scripts>
<OnLoad>
this:SetHighlightTexture(nil)
</OnLoad>
<OnClick>
AuxItemSearchFrameItemItemInputBox:Show()
Aux.item_search_frame.update_item()
AuxItemSearchFrameItemItemInputBox:SetText('')
AuxItemSearchFrameItemItemInputBox:SetFocus()
</OnClick>
</scripts>
</Button>
<EditBox name="$parentItemInputBox" autoFocus="false" inherits="AuxInputBoxTemplate">
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="-28"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName()..'Label'):SetText('Item')
this.completor = Aux.completion.completor(this)
this:SetWidth(165)
</OnLoad>
<OnTextChanged>
this.completor.suggest()
</OnTextChanged>
<OnTabPressed>
if IsShiftKeyDown() then
this.completor.previous()
else
this.completor.next()
end
</OnTabPressed>
<OnEnterPressed>
this.completor.close()
this:ClearFocus()
</OnEnterPressed>
<OnEditFocusLost>
this:Hide()
Aux.item_search_frame.update_item()
Aux.item_search_frame.start_search()
</OnEditFocusLost>
<OnEscapePressed>
if this.completor.open() then
this.completor.close()
else
this:ClearFocus()
end
</OnEscapePressed>
</Scripts>
</EditBox>
<Button name="$parentSearchButton" inherits="UIPanelButtonTemplate" text="Refresh">
<Size><AbsDimension x="90" y="26"/></Size>
<Anchors><Anchor point="BOTTOMLEFT" ><Offset><AbsDimension x="5" y="5"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
Aux.item_search_frame.start_search()
</OnClick>
</Scripts>
</Button>
<Button name="$parentStopButton" inherits="UIPanelButtonTemplate" text="Stop" hidden="true">
<Size><AbsDimension x="90" y="26"/></Size>
<Anchors><Anchor point="BOTTOMLEFT" ><Offset><AbsDimension x="5" y="5"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
Aux.item_search_frame.stop_search()
</OnClick>
</Scripts>
</Button>
<EditBox name="$parentPageEditBox" numeric="true" autoFocus="false" inherits="AuxInputBoxTemplate">
<Anchors><Anchor point="BOTTOMLEFT" ><Offset><AbsDimension x="110" y="5"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName()..'Label'):SetText('Page')
this:SetWidth(30)
this:EnableMouse(false)
this:SetAlpha(0.5)
</OnLoad>
<OnEnterPressed>
this:ClearFocus()
</OnEnterPressed>
</Scripts>
</EditBox>
<CheckButton name="$parentAllPagesCheckButton" inherits="UICheckButtonTemplate" checked="true">
<Size><AbsDimension x="22" y="22"/></Size>
<Anchors><Anchor point="BOTTOMLEFT" ><Offset><AbsDimension x="143" y="5"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="OVERLAY">
<FontString inherits="GameFontNormalSmall" text="All" justifyH="LEFT">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="9"/></Offset></Anchor></Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
AuxItemSearchFrameItemPageEditBox:EnableMouse(not this:GetChecked())
AuxItemSearchFrameItemPageEditBox:SetAlpha(this:GetChecked() and 0.5 or 1)
AuxItemSearchFrameItemPageEditBox:ClearFocus()
</OnClick>
</Scripts>
</CheckButton>
</Frames>
</Frame>
<Frame name="$parentAuctions" inherits="AuxFrameBoxTemplate">
<Size>
<AbsDimension x="620" y="326"/>
</Size>
<Anchors><Anchor point="TOPLEFT" relativePoint="TOPRIGHT" relativeTo="$parentItem"><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('Search Results')-->
</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('Buy')
</OnLoad>
<OnClick>
Aux.item_search_frame.set_view(this:GetID())
</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('Bid')
</OnLoad>
<OnClick>
Aux.item_search_frame.set_view(this:GetID())
</OnClick>
</Scripts>
</Button>
<Button name="$parentTab3" inherits="AuxTopTabTemplate" id="3">
<Anchors>
<Anchor point="LEFT" relativeTo="$parentTab2" relativePoint="RIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName().."Text"):SetText('Full')
</OnLoad>
<OnClick>
Aux.item_search_frame.set_view(this:GetID())
</OnClick>
</Scripts>
</Button>
<Frame name="$parentBuyListing" hidden="true">
<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.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)
</OnLoad>
</Scripts>
</Frame>
<Frame name="$parentBidListing" hidden="true">
<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.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)
</OnLoad>
</Scripts>
</Frame>
<Frame name="$parentFullListing" hidden="true">
<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.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)
</OnLoad>
</Scripts>
</Frame>
<Frame name="$parentConfirmation" 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="0"/></Offset></Anchor></Anchors>
<Size><AbsDimension x="193" y="140"/></Size>
<Frames>
<Frame name="$parentItem" inherits="AuxItemTemplate">
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
</Frame>
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="48"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="OVERLAY">
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"><Offset><AbsDimension x="-10" y="0"/></Offset></Anchor></Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="50"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
SmallMoneyFrame_OnLoad()
MoneyFrame_SetType("STATIC")
</OnLoad>
</Scripts>
<Layers>
<Layer level="OVERLAY">
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"><Offset><AbsDimension x="-5" y="0"/></Offset></Anchor></Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
<Button name="$parentActionButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
<Size><AbsDimension x="90" y="26"/> </Size>
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>
Aux.item_search_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.item_search_frame.dialog_cancel()
</OnClick>
</Scripts>
</Button>
</Frames>
</Frame>
</Frames>
</Frame>
</Frames>
</Frame>
</Frames>
</Frame>
</Ui>
+19 -18
View File
@@ -44,8 +44,14 @@ function Aux.sheet.render(sheet)
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 datum = data[i + offset]
if sheet.row_setter then
sheet.row_setter(row, datum)
if datum then
if sheet.row_setter then
sheet.row_setter(row, datum)
end
row:Show()
else
row:Hide()
end
for j, column in sheet.columns do
local cell = row.cells[j]
@@ -60,7 +66,7 @@ function Aux.sheet.render(sheet)
end
end
function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click, on_cell_enter, on_cell_leave)
function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click, on_row_enter, on_row_leave)
local sheet
local name = (frame:GetName() or '')..'ScrollSheet'
@@ -141,6 +147,7 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
labels[i] = label
end
total_width = total_width + 5
frame:SetWidth(total_width)
local rows = {}
local row_index = 1
@@ -154,24 +161,18 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
row:RegisterForClicks("LeftButtonDown", "RightButtonDown")
row:SetHeight(14)
local row_index = row_index
row:SetScript("OnClick", function() if sheet.on_row_click then sheet.on_row_click(sheet, row_index) end end)
row:SetScript("OnEnter", function() if sheet.on_row_enter then sheet.on_row_enter(sheet, row_index) end end)
row:SetScript("OnLeave", function() if sheet.on_row_leave then sheet.on_row_leave(sheet, row_index) end end)
local row_idx = row_index
row:SetScript("OnClick", function() if sheet.on_row_click then sheet.on_row_click(sheet, row_idx) end end)
row:SetScript("OnEnter", function() if sheet.on_row_enter then sheet.on_row_enter(sheet, row_idx) end end)
row:SetScript("OnLeave", function() if sheet.on_row_leave then sheet.on_row_leave(sheet, row_idx) end end)
row.cells = {}
for i = 1,getn(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:RegisterForClicks("LeftButtonDown", "RightButtonDown")
cell:SetHeight(14)
local column_index = i
cell:SetScript("OnClick", function() if sheet.on_cell_click then sheet.on_cell_click(sheet, row_index, column_index) end end)
cell:SetScript("OnEnter", function() if sheet.on_cell_enter then sheet.on_cell_enter(sheet, row_index, column_index) end end)
cell:SetScript("OnLeave", function() if sheet.on_cell_leave then sheet.on_cell_leave(sheet, row_index, column_index) end end)
columns[i].cell_initializer(cell)
@@ -185,7 +186,7 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
row.color_texture = color_texture
local highlight = row:CreateTexture()
highlight:SetPoint('TOPLEFT', row 'TOPLEFT', 0, 0)
highlight:SetPoint('TOPLEFT', row, 'TOPLEFT', 0, 0)
highlight:SetPoint('BOTTOMRIGHT', row, 'BOTTOMRIGHT', 0, 1)
highlight:SetAlpha(0)
highlight:SetTexture(0.8, 0.6, 0)
@@ -209,9 +210,9 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_cell_click,
data = {},
sort_order = sort_order,
row_setter = row_setter,
on_cell_click = on_cell_click,
on_cell_enter = on_cell_enter,
on_cell_leave = on_cell_leave,
on_row_click = on_row_click,
on_row_enter = on_row_enter,
on_row_leave = on_row_leave,
}
scroll_frame.sheet = sheet
@@ -223,7 +224,7 @@ function Aux.list.row_comparator(sheet)
for _, sort_info in ipairs(sheet.sort_order) do
local column = sort_info.column
if column.comparator then
local ordering = column.comparator(row1.cells, row2.cells)
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)
end
+1 -3
View File
@@ -53,6 +53,7 @@ Aux.sell.inventory_listing_config = {
comparator = function(row1, row2) return Aux.util.compare(row1.name, row2.name, 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
@@ -65,9 +66,6 @@ Aux.sell.inventory_listing_config = {
icon:SetPoint('LEFT', cell)
icon:SetWidth(12)
icon:SetHeight(12)
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
icon:SetHighlightTexture('Interface\\Buttons\\ButtonHilight-Square')
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
text:SetPoint('TOPRIGHT', cell)
+1 -1
View File
@@ -28,7 +28,7 @@
<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_cell_click, config.on_cell_enter, config.on_cell_leave)
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)
</OnLoad>
</Scripts>
</Frame>
+30 -80
View File
@@ -19,22 +19,25 @@ function group_alpha_setter(cell, group)
end
local BUYOUT, BID, FULL = 1, 2, 3
local ITEM, ADVANCED = 1, 2
Aux.buy.modes = {
[BUYOUT] = {
name = 'Buyout',
on_cell_click = function (sheet, row_index, column_index)
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
AuxBuyEntry_OnClick(Aux.util.filter(sheet.data[data_index], function(auction) return not auction.gone end)[1] or sheet.data[data_index][1])
end,
on_cell_enter = function (sheet, row_index, column_index)
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info)
end,
on_cell_leave = function (sheet, row_index, column_index)
on_row_leave = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(0)
GameTooltip:Hide()
end,
row_setter = function(row, group)
row.tooltip = group[1].tooltip
row.EnhTooltip_info = group[1].EnhTooltip_info
end,
columns = {
{
@@ -53,6 +56,7 @@ Aux.buy.modes = {
comparator = function(group1, group2) return Aux.util.compare(group1[1].name, group2[1].name, 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
@@ -65,11 +69,6 @@ Aux.buy.modes = {
icon:SetPoint('LEFT', cell)
icon:SetWidth(12)
icon:SetHeight(12)
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
icon:SetHighlightTexture('Interface\\Buttons\\ButtonHilight-Square')
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_CURSOR', cell.EnhTooltip_info) end)
icon:SetScript('OnLeave', function() GameTooltip:Hide() end)
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
text:SetPoint('TOPRIGHT', cell)
@@ -130,17 +129,21 @@ Aux.buy.modes = {
},
[BID] = {
name = 'Bid',
on_cell_click = function (sheet, row_index, column_index)
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
AuxBuyEntry_OnClick(sheet.data[data_index])
end,
on_cell_enter = function (sheet, row_index, column_index)
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info)
end,
on_cell_leave = function (sheet, row_index, column_index)
on_row_leave = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(0)
GameTooltip:Hide()
end,
row_setter = function(row, datum)
row.tooltip = datum.tooltip
row.EnhTooltip_info = datum.EnhTooltip_info
end,
columns = {
{
@@ -159,6 +162,7 @@ Aux.buy.modes = {
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
@@ -171,11 +175,6 @@ Aux.buy.modes = {
icon:SetPoint('LEFT', cell)
icon:SetWidth(12)
icon:SetHeight(12)
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
icon:SetHighlightTexture('Interface\\Buttons\\ButtonHilight-Square')
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_CURSOR', cell.EnhTooltip_info) end)
icon:SetScript('OnLeave', function() GameTooltip:Hide() end)
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
text:SetPoint('TOPRIGHT', cell)
@@ -266,27 +265,22 @@ Aux.buy.modes = {
},
[FULL] = {
name = 'Full',
on_cell_click = function (sheet, row_index, column_index)
on_row_click = function (sheet, row_index)
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
AuxBuyEntry_OnClick(sheet.data[data_index])
end,
on_cell_enter = function (sheet, row_index, column_index)
on_row_enter = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(.5)
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info)
end,
on_cell_leave = function (sheet, row_index, column_index)
on_row_leave = function (sheet, row_index)
sheet.rows[row_index].highlight:SetAlpha(0)
GameTooltip:Hide()
end,
row_setter = function(row, datum)
row.tooltip = datum.tooltip
row.EnhTooltip_info = datum.EnhTooltip_info
end,
row_setter = function(row, datum)
if current_auction and datum == current_auction then
row.highlight:SetAlpha(.5)
else
row.highlight:SetAlpha(0)
end
end,
columns = {
{
title = 'Qty',
@@ -304,6 +298,7 @@ Aux.buy.modes = {
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
@@ -316,9 +311,6 @@ Aux.buy.modes = {
icon:SetPoint('LEFT', cell)
icon:SetWidth(12)
icon:SetHeight(12)
icon:SetNormalTexture('Interface\\Buttons\\UI-Quickslot2')
icon:SetPushedTexture('Interface\\Buttons\\UI-Quickslot-Depress')
icon:SetHighlightTexture('Interface\\Buttons\\ButtonHilight-Square')
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_CURSOR', cell.EnhTooltip_info) end)
icon:SetScript('OnLeave', function() GameTooltip:Hide() end)
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
@@ -446,7 +438,6 @@ function Aux.buy.on_close()
end
function Aux.buy.on_open()
public.set_filter(1)
public.set_view(1)
update_sheet()
end
@@ -497,47 +488,6 @@ function public.set_item(item_id)
private.item_id = item_id
end
function public.update_item()
if private.item_id then
AuxBuyFiltersItem:Show()
AuxBuyFiltersItemInputBox:Hide()
else
AuxBuyFiltersItem:Hide()
AuxBuyFiltersItemInputBox:Show()
end
end
function public.set_filter(filter)
local filter_elements = {
AuxBuyNameInputBox,
AuxBuyCategoryDropDown,
AuxBuyQualityDropDown,
AuxBuyMinLevel,
AuxBuyMaxLevel,
AuxBuyUsableCheckButton,
AuxBuyFiltersTooltipInputBox1,
AuxBuyFiltersTooltipInputBox2,
AuxBuyFiltersTooltipInputBox3,
AuxBuyFiltersTooltipInputBox4,
}
private.filter = filter
if filter == ITEM then
public.update_item()
for _, element in filter_elements do
element:Hide()
end
elseif filter == ADVANCED then
AuxBuyFiltersItem:Hide()
AuxBuyFiltersItemInputBox:Hide()
for _, element in filter_elements do
element:Hide()
end
for _, element in filter_elements do
element:Show()
end
end
end
function Aux.buy.SearchButton_onclick()
if not AuxBuySearchButton:IsVisible() then
+4 -55
View File
@@ -19,7 +19,7 @@
<OnLoad>
this:SetBackdropBorderColor(0.4, 0.4, 0.4)
this:SetBackdropColor(0.15, 0.15, 0.15)
<!--getglobal(this:GetName().."Title"):SetText('Filters')-->
getglobal(this:GetName().."Title"):SetText('Filters')
</OnLoad>
</Scripts>
<Frames>
@@ -58,54 +58,6 @@
</Scripts>
</Button>
<Button name="$parentItem" inherits="AuxItemTemplate">
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="-20"/></Offset></Anchor></Anchors>
<scripts>
<OnLoad>
this:SetHighlightTexture(nil)
</OnLoad>
<OnClick>
Aux.browse_frame.set_item()
Aux.browse_frame.update_item()
AuxBuyFiltersItemInputBox:SetText('')
AuxBuyFiltersItemInputBox:SetFocus()
</OnClick>
</scripts>
</Button>
<EditBox name="$parentItemInputBox" autoFocus="false" inherits="AuxInputBoxTemplate">
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="-28"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName()..'Label'):SetText('Item')
this.completor = Aux.completion.completor(this)
this:SetWidth(193)
</OnLoad>
<OnTextChanged>
this.completor.suggest()
</OnTextChanged>
<OnTabPressed>
if IsShiftKeyDown() then
this.completor.previous()
else
this.completor.next()
end
</OnTabPressed>
<OnEnterPressed>
this.completor.close()
this:ClearFocus()
Aux.buy.SearchButton_onclick()
</OnEnterPressed>
<OnEscapePressed>
if this.completor.open() then
this.completor.close()
else
this:ClearFocus()
end
</OnEscapePressed>
</Scripts>
</EditBox>
<EditBox name="AuxBuyNameInputBox" autoFocus="false" inherits="AuxInputBoxTemplate">
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="16" y="-71"/></Offset></Anchor></Anchors>
<Scripts>
@@ -237,7 +189,6 @@
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="15" y="-246"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName()..'Label'):SetText('Tooltip')
this:SetWidth(110)
</OnLoad>
<OnEnterPressed>
@@ -250,7 +201,6 @@
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="15" y="-276"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName()..'Label'):SetText('Tooltip')
this:SetWidth(110)
</OnLoad>
<OnEnterPressed>
@@ -263,7 +213,6 @@
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="15" y="-306"/></Offset></Anchor></Anchors>
<Scripts>
<OnLoad>
getglobal(this:GetName()..'Label'):SetText('Tooltip')
this:SetWidth(110)
</OnLoad>
<OnEnterPressed>
@@ -387,7 +336,7 @@
<Scripts>
<OnLoad>
local sort_order = Aux.util.map(Aux.buy.modes[1].sort_order, function(column_order) return { column = Aux.buy.modes[1].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, Aux.buy.modes[1].columns, sort_order, Aux.buy.modes[1].row_setter, Aux.buy.modes[1].on_cell_click, Aux.buy.modes[1].on_cell_enter, Aux.buy.modes[1].on_cell_leave)
this.sheet = Aux.sheet.create(this, Aux.buy.modes[1].columns, sort_order, Aux.buy.modes[1].row_setter, Aux.buy.modes[1].on_row_click, Aux.buy.modes[1].on_row_enter, Aux.buy.modes[1].on_row_leave)
</OnLoad>
</Scripts>
</Frame>
@@ -399,7 +348,7 @@
<Scripts>
<OnLoad>
local sort_order = Aux.util.map(Aux.buy.modes[2].sort_order, function(column_order) return { column = Aux.buy.modes[2].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, Aux.buy.modes[2].columns, sort_order, Aux.buy.modes[2].row_setter, Aux.buy.modes[2].on_cell_click, Aux.buy.modes[2].on_cell_enter, Aux.buy.modes[2].on_cell_leave)
this.sheet = Aux.sheet.create(this, Aux.buy.modes[2].columns, sort_order, Aux.buy.modes[2].row_setter, Aux.buy.modes[2].on_row_click, Aux.buy.modes[2].on_row_enter, Aux.buy.modes[2].on_row_leave)
</OnLoad>
</Scripts>
</Frame>
@@ -411,7 +360,7 @@
<Scripts>
<OnLoad>
local sort_order = Aux.util.map(Aux.buy.modes[3].sort_order, function(column_order) return { column = Aux.buy.modes[3].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
this.sheet = Aux.sheet.create(this, Aux.buy.modes[3].columns, sort_order, Aux.buy.modes[3].row_setter, Aux.buy.modes[3].on_cell_click, Aux.buy.modes[3].on_cell_enter, Aux.buy.modes[3].on_cell_leave)
this.sheet = Aux.sheet.create(this, Aux.buy.modes[3].columns, sort_order, Aux.buy.modes[3].row_setter, Aux.buy.modes[3].on_row_click, Aux.buy.modes[3].on_row_enter, Aux.buy.modes[3].on_row_leave)
</OnLoad>
</Scripts>
</Frame>