diff --git a/completion.lua b/completion.lua
index dd9c1a1..7098fb3 100644
--- a/completion.lua
+++ b/completion.lua
@@ -4,12 +4,40 @@ local NUM_MATCHES = 5
local fuzzy, generate_suggestions
-local item_names = {}
+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(item_names, name)
+ tinsert(items, { name=name, id=item_id })
end
end
@@ -42,10 +70,10 @@ function generate_suggestions(input)
end
local best = {}
- for _, name in ipairs(item_names) do
- local rating = matcher(name)
+ for _, item in ipairs(items) do
+ local rating = matcher(item.name)
if rating then
- local candidate = { name=name, rating=rating }
+ local candidate = { name=item.name, id=item.id, rating=rating }
if getn(best) < NUM_MATCHES then
tinsert(best, candidate)
fuzzy_sort(best)
@@ -56,7 +84,7 @@ function generate_suggestions(input)
end
end
- return Aux.util.map(best, function(match) return match.name end)
+ return Aux.util.map(best, function(match) return { text=match.name, display_text='|c'..Aux_QualityColor(({GetItemInfo(match.id)})[3])..'['..match.name..']'..'|r', value=match.id } end)
end
function Aux.completion.completor(edit_box)
@@ -71,12 +99,21 @@ function Aux.completion.completor(edit_box)
function fill_dropdown()
for _, suggestion in ipairs(suggestions) do
+ local text = suggestion.text
UIDropDownMenu_AddButton{
- text = suggestion,
- value = suggestion,
+ text = suggestion.display_text,
+ value = suggestion.value,
notCheckable = true,
func = function()
- self.set_quietly(this.value)
+-- 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()
end,
}
end
@@ -148,7 +185,7 @@ function Aux.completion.completor(edit_box)
if index == 0 then
self.set_quietly(input)
else
- self.set_quietly(suggestions[index])
+ self.set_quietly(suggestions[index].text)
end
end
end
@@ -161,7 +198,7 @@ function Aux.completion.completor(edit_box)
if index == 0 then
self.set_quietly(input)
else
- self.set_quietly(suggestions[index])
+ self.set_quietly(suggestions[index].text)
end
end
end
diff --git a/core.lua b/core.lua
index a885dd3..c8a1c79 100644
--- a/core.lua
+++ b/core.lua
@@ -97,13 +97,13 @@ function Aux_SetupHookFunctions()
Aux.orig.AuctionFrame_OnShow = AuctionFrame_OnShow
-- TODO for some reason this breaks the auction house functionality
- AuctionFrame_OnShow = function()
- if not Aux.blizzard_ui_shown then
- HideUIPanel(AuctionFrame)
- else
- return Aux.orig.AuctionFrame_OnShow()
- end
- end
+-- AuctionFrame_OnShow = function()
+-- if not Aux.blizzard_ui_shown then
+-- HideUIPanel(AuctionFrame)
+-- else
+-- return Aux.orig.AuctionFrame_OnShow()
+-- end
+-- end
Aux.orig.PickupContainerItem = PickupContainerItem
PickupContainerItem = Aux.PickupContainerItem
diff --git a/core.xml b/core.xml
index 1c06abf..3c660c9 100644
--- a/core.xml
+++ b/core.xml
@@ -16,7 +16,7 @@
-
-
+
-
+
-
+
- getglobal(this:GetName().."Text"):SetText('Search')
+ getglobal(this:GetName().."Text"):SetText('Browse')
+
+ Aux.on_tab_click(this:GetID())
+
-
+
@@ -360,9 +434,12 @@
getglobal(this:GetName().."Text"):SetText('Post')
+
+ Aux.on_tab_click(this:GetID())
+
-
+
@@ -374,9 +451,12 @@
getglobal(this:GetName().."Text"):SetText('Manage')
+
+ Aux.on_tab_click(this:GetID())
+
-
+
@@ -388,6 +468,9 @@
getglobal(this:GetName().."Text"):SetText('Scan')
+
+ Aux.on_tab_click(this:GetID())
+
diff --git a/search_frame.lua b/search_frame.lua
index ac5fe50..f76f1e7 100644
--- a/search_frame.lua
+++ b/search_frame.lua
@@ -1,5 +1,8 @@
Aux.buy = {}
+local private, public = {}, {}
+Aux.browse_frame = public
+
local create_auction_record, show_dialog, find_auction, hide_sheet, update_sheet, auction_alpha_setter, group_alpha_setter, create_auction_record
local auctions
local search_query
@@ -16,6 +19,7 @@ function group_alpha_setter(cell, group)
end
local BUYOUT, BID, FULL = 1, 2, 3
+local ITEM, ADVANCED = 1, 2
Aux.buy.modes = {
[BUYOUT] = {
@@ -64,7 +68,7 @@ Aux.buy.modes = {
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_RIGHT', cell.EnhTooltip_info) end)
+ 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)
@@ -170,7 +174,7 @@ Aux.buy.modes = {
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_RIGHT', cell.EnhTooltip_info) end)
+ 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)
@@ -306,7 +310,7 @@ Aux.buy.modes = {
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_RIGHT', cell.EnhTooltip_info) end)
+ 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)
@@ -433,6 +437,8 @@ function Aux.buy.on_close()
end
function Aux.buy.on_open()
+ public.set_filter(1)
+ public.set_view(1)
update_sheet()
end
@@ -452,25 +458,18 @@ function update_sheet()
AuxBuyBuyList:Hide()
AuxBuyBidList:Hide()
AuxBuyFullList:Hide()
-
- local mode = UIDropDownMenu_GetSelectedValue(AuxBuyModeDropDown)
- if mode == BUYOUT then
+
+ if private.view == BUYOUT then
AuxBuyBuyList:Show()
- elseif mode == BID then
+ local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
+ Aux.list.populate(AuxBuyBuyList.sheet, auctions and Aux.util.group_by(buyout_auctions, 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
AuxBuyBidList:Show()
- elseif mode == FULL then
+ local bid_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {}
+ Aux.list.populate(AuxBuyBidList.sheet, bid_auctions)
+ elseif private.view == FULL then
AuxBuyFullList:Show()
- end
-
- local mode = UIDropDownMenu_GetSelectedValue(AuxBuyModeDropDown)
- if mode == BUYOUT then
- local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
- Aux.list.populate(AuxBuyBuyList.sheet, auctions and Aux.util.group_by(buyout_auctions, 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 mode == BID then
- local bid_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {}
- Aux.list.populate(AuxBuyBidList.sheet, bid_auctions)
- elseif mode == FULL then
- Aux.list.populate(AuxBuyFullList.sheet, auctions or {})
+ Aux.list.populate(AuxBuyFullList.sheet, auctions or {})
end
end
@@ -480,6 +479,55 @@ function hide_sheet()
AuxBuyFullList:Hide()
end
+function public.set_view(view)
+ private.view = view
+ update_sheet()
+end
+
+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,
+ AuxBuyTooltipInputBox,
+ AuxBuyTooltipArrow,
+ AuxBuyTooltipButton,
+ }
+ 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
@@ -521,7 +569,7 @@ function Aux.buy.SearchButton_onclick()
on_read_auction = function(i)
local auction_item = Aux.info.auction_item(i)
if auction_item then
- if (auction_item.name == search_query.name or search_query.name == '' or not AuxBuyExactCheckButton:GetChecked()) and Aux.info.tooltip_match(tooltip_patterns, auction_item.tooltip) then
+ if (auction_item.name == search_query.name or search_query.name == '' or not (private.filter == ITEM)) and Aux.info.tooltip_match(tooltip_patterns, auction_item.tooltip) then
auctions = auctions or {}
tinsert(auctions, create_auction_record(auction_item, current_page))
end
@@ -868,17 +916,3 @@ end
function Aux.buy.toggle_tooltip_dropdown()
ToggleDropDownMenu(1, nil, AuxBuyTooltipDropDown, AuxBuyTooltipInputBox, -12, 4)
end
-
-function AuxBuyModeDropDown_Initialize()
-
- for i, mode in ipairs(Aux.buy.modes) do
- UIDropDownMenu_AddButton{
- text = mode.name,
- value = i,
- func = function()
- UIDropDownMenu_SetSelectedValue(AuxBuyModeDropDown, this.value)
- update_sheet()
- end,
- }
- end
-end
diff --git a/search_frame.xml b/search_frame.xml
index 3c1aca3..ebfacb1 100644
--- a/search_frame.xml
+++ b/search_frame.xml
@@ -13,58 +13,82 @@
-
+
this:SetBackdropBorderColor(0.4, 0.4, 0.4)
this:SetBackdropColor(0.15, 0.15, 0.15)
- getglobal(this:GetName().."Title"):SetText('Filters')
+
-
-
+
+
+
+
+
+
+
+
- UIDropDownMenu_SetWidth(140)
- UIDropDownMenu_Initialize(this, AuxBuyModeDropDown_Initialize)
- UIDropDownMenu_SetSelectedValue(this, 1)
+ getglobal(this:GetName().."Text"):SetText('Item')
-
- UIDropDownMenu_Initialize(this, AuxBuyModeDropDown_Initialize)
-
+
+ Aux.browse_frame.set_filter(this:GetID())
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
- getglobal(this:GetName()..'Label'):SetText('Name')
+ getglobal(this:GetName().."Text"):SetText('Filters')
+
+
+ Aux.browse_frame.set_filter(this:GetID())
+
+
+
+
+
+
+
+
+ this:SetHighlightTexture(nil)
+
+
+ Aux.browse_frame.set_item()
+ Aux.browse_frame.update_item()
+ AuxBuyFiltersItemInputBox:SetText('')
+ AuxBuyFiltersItemInputBox:SetFocus()
+
+
+
+
+
+
+
+
+ getglobal(this:GetName()..'Label'):SetText('Item')
this.completor = Aux.completion.completor(this)
+ this:SetWidth(193)
this.completor.suggest()
if IsShiftKeyDown() then
- this.completor.previous()
+ this.completor.previous()
else
- this.completor.next()
+ this.completor.next()
end
@@ -74,25 +98,29 @@
if this.completor.open() then
- this.completor.close()
+ this.completor.close()
else
- this:ClearFocus()
+ this:ClearFocus()
end
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+ getglobal(this:GetName()..'Label'):SetText('Name')
+
+
+ this:ClearFocus()
+ Aux.buy.SearchButton_onclick()
+
+
+ this:ClearFocus()
+
+
+
@@ -248,8 +276,17 @@
+
+
+
+
+
+ Aux.buy.SearchButton_onclick()
+
+
+
-
+
getglobal(this:GetName()..'Label'):SetText('Page')
@@ -264,7 +301,7 @@
-
+
@@ -291,10 +328,61 @@
this:SetBackdropBorderColor(0.4, 0.4, 0.4)
this:SetBackdropColor(0.15, 0.15, 0.15)
- getglobal(this:GetName().."Title"):SetText('Search Results')
+
+
+
+
+
+
+
+
+
+
+
+ getglobal(this:GetName().."Text"):SetText('Buy')
+
+
+ Aux.browse_frame.set_view(this:GetID())
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getglobal(this:GetName().."Text"):SetText('Bid')
+
+
+ Aux.browse_frame.set_view(this:GetID())
+
+
+
+
+
+
+
+
+
+
+
+
+
+ getglobal(this:GetName().."Text"):SetText('Full')
+
+
+ Aux.browse_frame.set_view(this:GetID())
+
+
+
@@ -397,16 +485,6 @@
-
-
-
-
-
- Aux.buy.SearchButton_onclick()
-
-
-
-