diff --git a/core.lua b/core.lua
index 24dc008..65eb021 100644
--- a/core.lua
+++ b/core.lua
@@ -406,4 +406,16 @@ function Aux.item_quality_index(item_quality)
return i
end
end
+end
+
+function Aux.hide_elements(elements)
+ for _, element in pairs(elements) do
+ element:Hide()
+ end
+end
+
+function Aux.show_elements(elements)
+ for _, element in pairs(elements) do
+ element:Show()
+ end
end
\ No newline at end of file
diff --git a/filter_search_frame.lua b/filter_search_frame.lua
index 38ab9f4..bb1561f 100644
--- a/filter_search_frame.lua
+++ b/filter_search_frame.lua
@@ -11,6 +11,12 @@ local selected_auction
local RESULTS, SAVED, FILTER = {}, {}, {}
+private.elements = {
+ [RESULTS] = {},
+ [SAVED] = {},
+ [FILTER] = {},
+}
+
function private.update_search_listings()
Aux.sheet.populate(private.listings.favorite_searches, aux_favorite_searches)
Aux.sheet.populate(private.listings.recent_searches, aux_recent_searches)
@@ -23,7 +29,7 @@ function private.update_tab(tab)
private.new_filter_button:UnlockHighlight()
AuxFilterSearchFrameResults:Hide()
AuxFilterSearchFrameSaved:Hide()
- AuxFilterSearchFrameFilters:Hide()
+ Aux.hide_elements(private.elements[FILTER])
if tab == RESULTS then
AuxFilterSearchFrameResults:Show()
@@ -32,7 +38,7 @@ function private.update_tab(tab)
AuxFilterSearchFrameSaved:Show()
private.saved_searches_button:LockHighlight()
elseif tab == FILTER then
- AuxFilterSearchFrameFilters:Show()
+ Aux.show_elements(private.elements[FILTER])
private.new_filter_button:LockHighlight()
end
end
@@ -63,7 +69,8 @@ function private.get_form_filter()
class = category and category.class,
subclass = category and category.subclass,
quality = UIDropDownMenu_GetSelectedValue(AuxFilterSearchFrameFiltersQualityDropDown),
- usable_only = AuxFilterSearchFrameFiltersUsableCheckButton:GetChecked()
+ usable_only = AuxFilterSearchFrameFiltersUsableCheckButton:GetChecked(),
+ exact_only = AuxFilterSearchFrameFiltersExactCheckButton:GetChecked(),
}
end
@@ -88,8 +95,6 @@ end
function public.on_open()
private.update_search_listings()
private.update_tab(SAVED)
--- private.tab_group:set_tab(aux_view)
- Aux.filter_search_frame.set_view(aux_view)
end
function public.on_load()
@@ -149,139 +154,151 @@ function public.on_load()
},
sort_order = {{ column = 1, order = 'ascending' }},
}
- private.views = {
- [Aux.view.BUYOUT] = {
- frame = AuxFilterSearchFrameResultsBuyListing,
- on_row_click = function(sheet, row_index)
- local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
- private.on_row_click(sheet.data[data_index], true)
- end,
- on_row_enter = function(sheet, row_index)
- Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0)
- end,
- on_row_leave = function(sheet, row_index)
- AuxTooltip:Hide()
+ private.results_config = {
+ frame = AuxFilterSearchFrameResultsBuyListing,
+ on_row_click = function(sheet, row_index)
+ local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
+ private.on_row_click(sheet.data[data_index], true)
+ end,
+ on_row_enter = function(sheet, row_index)
+ Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0)
+ end,
+ on_row_leave = function(sheet, row_index)
+ AuxTooltip:Hide()
+ ResetCursor()
+ end,
+ on_row_update = function(sheet, row_index)
+ if IsControlKeyDown() then
+ ShowInspectCursor()
+ elseif IsAltKeyDown() then
+ SetCursor('BUY_CURSOR')
+ else
ResetCursor()
- end,
- on_row_update = function(sheet, row_index)
- if IsControlKeyDown() then
- ShowInspectCursor()
- elseif IsAltKeyDown() then
- SetCursor('BUY_CURSOR')
- else
- ResetCursor()
- end
- end,
- selected = function(datum)
- return Aux.util.any(datum, function(entry) return entry == selected_auction end)
- end,
- row_setter = function(row, group)
- row:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
- row.itemstring = Aux.info.itemstring(group[1].item_id, group[1].suffix_id, nil, group[1].enchant_id)
- row.EnhTooltip_info = group[1].EnhTooltip_info
- end,
- columns = {
- {
- title = 'Auction Item',
- width = 280,
- 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
- local normal_texture = icon:CreateTexture(nil)
- normal_texture:SetPoint('CENTER', 0, 0)
- normal_texture:SetWidth(22)
- normal_texture:SetHeight(22)
- normal_texture:SetTexture('Interface\\Buttons\\UI-Quickslot2')
- icon:SetNormalTexture(normal_texture)
- icon:SetPoint('LEFT', cell)
- icon:SetWidth(12)
- icon:SetHeight(12)
- local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
- text:SetPoint('LEFT', icon, 'RIGHT', 1, 0)
- text:SetPoint('TOPRIGHT', cell)
- text:SetPoint('BOTTOMRIGHT', cell)
- text:SetJustifyV('TOP')
- text:SetJustifyH('LEFT')
- text:SetTextColor(0.8, 0.8, 0.8)
- cell.text = text
- cell.icon = icon
- end,
- cell_setter = function(cell, group)
- cell.icon.icon_texture:SetTexture(Aux.info.item(group[1].item_id).texture)
- if not group[1].usable then
- cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
- else
- cell.icon.icon_texture:SetVertexColor(1.0, 1.0, 1.0)
- end
- cell.text:SetText('['..group[1].tooltip[1][1].text..']')
- local color = ITEM_QUALITY_COLORS[group[1].quality]
- cell.text:SetTextColor(color.r, color.g, color.b)
- end,
- },
- {
- title = 'Qty',
- width = 25,
- comparator = function(group1, group2) return Aux.util.compare(group1[1].aux_quantity, group2[1].aux_quantity, Aux.util.LT) end,
- cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
- cell_setter = function(cell, group)
- cell.text:SetText(group[1].aux_quantity)
- end,
- },
- Aux.listing_util.money_column('Bid', function(group) return group[1].bid_price end),
- Aux.listing_util.money_column('Buy', function(group) return group[1].buyout_price end),
- Aux.listing_util.money_column('Bid/ea', function(group) return group[1].unit_bid_price end),
- Aux.listing_util.money_column('Buy/ea', function(group) return group[1].unit_buyout_price end),
- {
- 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)))
- end,
- },
- {
- title = 'Lvl',
- width = 25,
- comparator = function(group1, group2) return Aux.util.compare(group1[1].level, group2[1].level, Aux.util.GT) end,
- cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
- cell_setter = function(cell, group)
- local level = max(1, group[1].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)
- end,
- },
- {
- title = 'Status',
- width = 70,
- comparator = function(group1, group2) return Aux.util.compare(group1[1].status, group2[1].status, Aux.util.GT) end,
- cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
- cell_setter = function(cell, auction)
- cell.text:SetText(auction.status)
- end,
- },
- Aux.listing_util.duration_column(function(group) return group[1].duration end),
- Aux.listing_util.owner_column(function(group) return group[1].owner end),
- Aux.listing_util.percentage_market_column(function(group) return group[1].item_key end, function(group) return group[1].unit_buyout_price end),
+ end
+ end,
+ selected = function(datum)
+ return Aux.util.any(datum, function(entry) return entry == selected_auction end)
+ end,
+ row_setter = function(row, group)
+ row:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
+ row.itemstring = Aux.info.itemstring(group[1].item_id, group[1].suffix_id, nil, group[1].enchant_id)
+ row.EnhTooltip_info = group[1].EnhTooltip_info
+ end,
+ columns = {
+ {
+ title = 'Auction Item',
+ width = 280,
+ 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
+ local normal_texture = icon:CreateTexture(nil)
+ normal_texture:SetPoint('CENTER', 0, 0)
+ normal_texture:SetWidth(22)
+ normal_texture:SetHeight(22)
+ normal_texture:SetTexture('Interface\\Buttons\\UI-Quickslot2')
+ icon:SetNormalTexture(normal_texture)
+ icon:SetPoint('LEFT', cell)
+ icon:SetWidth(12)
+ icon:SetHeight(12)
+ local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
+ text:SetPoint('LEFT', icon, 'RIGHT', 1, 0)
+ text:SetPoint('TOPRIGHT', cell)
+ text:SetPoint('BOTTOMRIGHT', cell)
+ text:SetJustifyV('TOP')
+ text:SetJustifyH('LEFT')
+ text:SetTextColor(0.8, 0.8, 0.8)
+ cell.text = text
+ cell.icon = icon
+ end,
+ cell_setter = function(cell, group)
+ cell.icon.icon_texture:SetTexture(Aux.info.item(group[1].item_id).texture)
+ if not group[1].usable then
+ cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
+ else
+ cell.icon.icon_texture:SetVertexColor(1.0, 1.0, 1.0)
+ end
+ cell.text:SetText('['..group[1].tooltip[1][1].text..']')
+ local color = ITEM_QUALITY_COLORS[group[1].quality]
+ cell.text:SetTextColor(color.r, color.g, color.b)
+ end,
},
- sort_order = {{ column = 1, order = 'ascending' }, { column = 4, order = 'ascending' }},
+ {
+ title = 'Qty',
+ width = 25,
+ comparator = function(group1, group2) return Aux.util.compare(group1[1].aux_quantity, group2[1].aux_quantity, Aux.util.LT) end,
+ cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
+ cell_setter = function(cell, group)
+ cell.text:SetText(group[1].aux_quantity)
+ end,
+ },
+ Aux.listing_util.money_column('Bid', function(group) return group[1].bid_price end),
+ Aux.listing_util.money_column('Buy', function(group) return group[1].buyout_price end),
+ Aux.listing_util.money_column('Bid/ea', function(group) return group[1].unit_bid_price end),
+ Aux.listing_util.money_column('Buy/ea', function(group) return group[1].unit_buyout_price end),
+ {
+ 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)))
+ end,
+ },
+ {
+ title = 'Lvl',
+ width = 25,
+ comparator = function(group1, group2) return Aux.util.compare(group1[1].level, group2[1].level, Aux.util.GT) end,
+ cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
+ cell_setter = function(cell, group)
+ local level = max(1, group[1].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)
+ end,
+ },
+ {
+ title = 'Status',
+ width = 70,
+ comparator = function(group1, group2) return Aux.util.compare(group1[1].status, group2[1].status, Aux.util.GT) end,
+ cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
+ cell_setter = function(cell, group)
+ cell.text:SetText(group[1].status)
+ end,
+ },
+ Aux.listing_util.duration_column(function(group) return group[1].duration end),
+ Aux.listing_util.owner_column(function(group) return group[1].owner end),
+ Aux.listing_util.percentage_market_column(function(group) return group[1].item_key end, function(group) return group[1].unit_buyout_price end),
},
+ sort_order = {{ column = 1, order = 'ascending' }, { column = 4, order = 'ascending' }},
}
private.listings = {
favorite_searches = Aux.sheet.create(private.favorite_searches_config),
recent_searches = Aux.sheet.create(private.recent_searches_config),
- [Aux.view.BUYOUT] = Aux.sheet.create(private.views[Aux.view.BUYOUT]),
+ results = Aux.sheet.create(private.results_config),
}
+ do
+ local panel = Aux.gui.panel(AuxFilterSearchFrame, '$parentFilters')
+ panel:SetWidth(600)
+ panel:SetHeight(290)
+ panel:SetPoint('TOPLEFT', 5, -70)
+ private.elements[FILTER].filters = panel
+ end
+ do
+ local panel = Aux.gui.panel(AuxFilterSearchFrame)
+ panel:SetWidth(300)
+ panel:SetHeight(290)
+ panel:SetPoint('TOPLEFT', private.elements[FILTER].filters, 'TOPRIGHT', 5, 0)
+ private.elements[FILTER].item_filter = panel
+ end
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 22)
btn:SetPoint('TOPRIGHT', -5, -3)
@@ -329,7 +346,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', 10, -40)
- btn:SetWidth(220)
+ btn:SetWidth(330)
btn:SetHeight(24)
btn:SetText('Search Results')
btn:SetScript('OnClick', function() private.update_tab(RESULTS) end)
@@ -338,7 +355,7 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.search_results_button, 'TOPRIGHT', 5, 0)
- btn:SetWidth(220)
+ btn:SetWidth(330)
btn:SetHeight(24)
btn:SetText('Saved Searches')
btn:SetScript('OnClick', function() private.update_tab(SAVED) end)
@@ -347,14 +364,14 @@ function public.on_load()
do
local btn = Aux.gui.button(AuxFilterSearchFrame, 18)
btn:SetPoint('TOPLEFT', private.saved_searches_button, 'TOPRIGHT', 5, 0)
- btn:SetWidth(220)
+ btn:SetWidth(330)
btn:SetHeight(24)
btn:SetText('New Filter')
btn:SetScript('OnClick', function() private.update_tab(FILTER) end)
private.new_filter_button = btn
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameItemFilter)
+ local editbox = Aux.gui.editbox(private.elements[FILTER].item_filter)
local function add_item_filter(item_id)
local old_filter_string = private.search_box:GetText()
old_filter_string = Aux.util.trim(old_filter_string)
@@ -395,14 +412,14 @@ function public.on_load()
end)
end
do
- local btn1 = Aux.gui.button(AuxFilterSearchFrameFilters, 16)
+ local btn1 = Aux.gui.button(private.elements[FILTER].filters, 16)
btn1:SetPoint('BOTTOMLEFT', 8, 15)
btn1:SetWidth(80)
btn1:SetHeight(24)
btn1:SetText('Add Filter')
btn1:SetScript('OnClick', private.add_filter)
- local btn2 = Aux.gui.button(AuxFilterSearchFrameFilters, 16)
+ local btn2 = Aux.gui.button(private.elements[FILTER].filters, 16)
btn2:SetPoint('LEFT', btn1, 'RIGHT', 5, 0)
btn2:SetWidth(80)
btn2:SetHeight(24)
@@ -413,7 +430,7 @@ function public.on_load()
public.start_search()
end)
- local btn3 = Aux.gui.button(AuxFilterSearchFrameFilters, 16)
+ local btn3 = Aux.gui.button(private.elements[FILTER].filters, 16)
btn3:SetPoint('LEFT', btn2, 'RIGHT', 5, 0)
btn3:SetWidth(80)
btn3:SetHeight(24)
@@ -450,7 +467,7 @@ function public.on_load()
private.bid_button = btn
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentNameInputBox')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentNameInputBox')
editbox:SetPoint('TOPLEFT', 14, -20)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
@@ -482,7 +499,7 @@ function public.on_load()
label:SetText('Rarity')
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentMinLevel')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentMinLevel')
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetPoint('TOPLEFT', 14, -140)
@@ -506,7 +523,7 @@ function public.on_load()
label:SetText('Level Range')
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentMaxLevel')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentMaxLevel')
editbox:SetNumeric(true)
editbox:SetMaxLetters(2)
editbox:SetPoint('TOPLEFT', 54, -140)
@@ -535,7 +552,7 @@ function public.on_load()
label:SetText('Usable')
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox1')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox1')
editbox:SetPoint('TOPLEFT', 300, -20)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
@@ -557,7 +574,7 @@ function public.on_load()
label:SetText('Tooltip')
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox2')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFiltersTooltipInputBox1 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
@@ -576,7 +593,7 @@ function public.on_load()
end)
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox3')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFiltersTooltipInputBox2 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
@@ -595,7 +612,7 @@ function public.on_load()
end)
end
do
- local editbox = Aux.gui.editbox(AuxFilterSearchFrameFilters, '$parentTooltipInputBox4')
+ local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFiltersTooltipInputBox3 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
@@ -618,7 +635,7 @@ function public.on_load()
-- CreateFrame('Frame', '$parentCategoryDropDown', AuxFilterSearchFrameFilters, 'UIDropDownMenuTemplate')
-- local dropdown = CreateFrame('Frame', '$parentQualityDropDown', AuxFilterSearchFrameFilters, 'UIDropDownMenuTemplate')
for _, dropdown in ipairs({AuxFilterSearchFrameFiltersCategoryDropDown, AuxFilterSearchFrameFiltersQualityDropDown}) do
- dropdown:SetWidth(150)
+ dropdown:SetWidth(250)
dropdown:SetHeight(10)
dropdown:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=Aux.gui.config.edge_size, insets={top=5,bottom=5}})
dropdown:SetBackdropColor(unpack(Aux.gui.config.content_color))
@@ -655,27 +672,19 @@ function private.update_listing()
AuxFilterSearchFrameResultsBidListing:Hide()
AuxFilterSearchFrameResultsFullListing:Hide()
- if aux_view == Aux.view.BUYOUT then
- AuxFilterSearchFrameResultsBuyListing:Show()
- local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
- Aux.sheet.populate(private.listings[Aux.view.BUYOUT], auctions and Aux.util.group_by(buyout_auctions, function(a1, a2)
- return a1.item_id == a2.item_id
- and a1.suffix_id == a2.suffix_id
- and a1.enchant_id == a2.enchant_id
- and a1.aux_quantity == a2.aux_quantity
- and a1.buyout_price == a2.buyout_price
- and a1.bid_price == a2.bid_price
- and a1.owner == a2.owner
- end) or {})
- AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBuyListing:GetWidth() + 40)
- AuxFrame:SetWidth(AuxFilterSearchFrameResults:GetWidth() + 15)
- end
-end
-
-function public.set_view(view)
- private.clear_selection()
- aux_view = view
- refresh = true
+ AuxFilterSearchFrameResultsBuyListing:Show()
+ local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
+ Aux.sheet.populate(private.listings.results, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2)
+ return a1.item_id == a2.item_id
+ and a1.suffix_id == a2.suffix_id
+ and a1.enchant_id == a2.enchant_id
+ and a1.aux_quantity == a2.aux_quantity
+ and a1.buyout_price == a2.buyout_price
+ and a1.bid_price == a2.bid_price
+ and a1.owner == a2.owner
+ end) or {})
+ AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBuyListing:GetWidth() + 40)
+ AuxFrame:SetWidth(AuxFilterSearchFrameResults:GetWidth() + 15)
end
function public.start_search()
@@ -736,8 +745,11 @@ function public.start_search()
private.status_bar:update_status(100 * (page + 1) / total_pages) -- TODO
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
end,
+ on_page_complete = function()
+ refresh = true
+ end,
on_start_query = function(query_index)
- private.status_bar:update_status(0, 100 * query_index / 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)))
end,
on_read_auction = function(auction_info)
@@ -897,7 +909,7 @@ end
function AuxFilterSearchFrameFiltersCategoryDropDown_Initialize(arg1)
local level = arg1 or 1
-
+
if level == 1 then
local value = {}
UIDropDownMenu_AddButton({
@@ -905,7 +917,7 @@ function AuxFilterSearchFrameFiltersCategoryDropDown_Initialize(arg1)
value = value,
func = AuxFilterSearchFrameFiltersCategoryDropDown_OnClick,
}, 1)
-
+
for i, class in pairs({ GetAuctionItemClasses() }) do
local value = { class = i }
UIDropDownMenu_AddButton({
@@ -916,7 +928,7 @@ function AuxFilterSearchFrameFiltersCategoryDropDown_Initialize(arg1)
}, 1)
end
end
-
+
if level == 2 then
local menu_value = UIDROPDOWNMENU_MENU_VALUE
for i, subclass in pairs({ GetAuctionItemSubClasses(menu_value.class) }) do
@@ -929,7 +941,7 @@ function AuxFilterSearchFrameFiltersCategoryDropDown_Initialize(arg1)
}, 2)
end
end
-
+
if level == 3 then
local menu_value = UIDROPDOWNMENU_MENU_VALUE
for i, slot in pairs({ GetAuctionInvTypes(menu_value.class, menu_value.subclass) }) do
diff --git a/filter_search_frame.xml b/filter_search_frame.xml
index bc9830d..232b41b 100644
--- a/filter_search_frame.xml
+++ b/filter_search_frame.xml
@@ -44,12 +44,12 @@
+
+
+
+
-
-
-
-
diff --git a/groups.lua b/groups.lua
index bc7c6b0..79f21ff 100644
--- a/groups.lua
+++ b/groups.lua
@@ -11,4 +11,10 @@ function m.parse_item_key(item_key)
return tonumber(item_id), suffix_id == '' and 0 or tonumber(suffix_id)
end
-m.test_group = '13127;9510;4438;16254;12006;13131;13012;4413;1482'
\ No newline at end of file
+m.test_group = '13127;9510;4438;16254;12006;13131;13012;4413;1482'
+
+
+function m.test()
+ local array = Aux.persistence.deserialize(';', ';')
+ snipe.log(getn(array))
+end
\ No newline at end of file
diff --git a/gui.lua b/gui.lua
index 1a187ff..faad725 100644
--- a/gui.lua
+++ b/gui.lua
@@ -16,8 +16,8 @@ m.config = {
}
-function m.panel(parent)
- local panel = CreateFrame('Frame', parent)
+function m.panel(parent, name)
+ local panel = CreateFrame('Frame', name, parent)
panel:SetBackdrop({bgFile='Interface\\Buttons\\WHITE8X8', edgeFile='Interface\\Buttons\\WHITE8X8', edgeSize=m.config.edge_size})
panel:SetBackdropColor(unpack(m.config.frame_color))
panel:SetBackdropBorderColor(unpack(m.config.frame_border_color))
diff --git a/info.lua b/info.lua
index 55da64d..4b518c3 100644
--- a/info.lua
+++ b/info.lua
@@ -93,7 +93,7 @@ function public.auction(index, type)
hyperlink = hyperlink,
itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id,
- signature = Aux.persistence.serialize({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!
name = name,
texture = texture,
diff --git a/item_search_frame.lua b/item_search_frame.lua
index 4388eca..2f7f4bd 100644
--- a/item_search_frame.lua
+++ b/item_search_frame.lua
@@ -87,96 +87,94 @@ function public.on_load()
},
sort_order = {},
}
- private.views = {
- [Aux.view.BUYOUT] = {
- frame = AuxItemSearchFrameAuctionsBuyListing,
- on_row_click = function(sheet, row_index)
- local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
- private.on_row_click(sheet.data[data_index], true)
- end,
- on_row_enter = function(sheet, row_index)
- Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0)
- end,
- on_row_leave = function(sheet, row_index)
- AuxTooltip:Hide()
+ private.results_config = {
+ frame = AuxItemSearchFrameAuctionsBuyListing,
+ on_row_click = function(sheet, row_index)
+ local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
+ private.on_row_click(sheet.data[data_index], true)
+ end,
+ on_row_enter = function(sheet, row_index)
+ Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_RIGHT', 0, 0)
+ end,
+ on_row_leave = function(sheet, row_index)
+ AuxTooltip:Hide()
+ ResetCursor()
+ end,
+ on_row_update = function(sheet, row_index)
+ if IsControlKeyDown() then
+ ShowInspectCursor()
+ elseif IsAltKeyDown() then
+ SetCursor('BUY_CURSOR')
+ else
ResetCursor()
- end,
- on_row_update = function(sheet, row_index)
- if IsControlKeyDown() then
- ShowInspectCursor()
- elseif IsAltKeyDown() then
- SetCursor('BUY_CURSOR')
- else
- ResetCursor()
- end
- end,
- selected = function(datum)
- return Aux.util.any(datum, function(entry) return entry == selected_auction end)
- end,
- row_setter = function(row, group)
- row:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
- row.itemstring = Aux.info.itemstring(group[1].item_id, group[1].suffix_id, nil, group[1].enchant_id)
- row.EnhTooltip_info = group[1].EnhTooltip_info
- end,
- columns = {
- {
- title = 'Qty',
- width = 25,
- comparator = function(group1, group2) return Aux.util.compare(group1[1].aux_quantity, group2[1].aux_quantity, Aux.util.LT) end,
- cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
- cell_setter = function(cell, group)
- cell.text:SetText(group[1].aux_quantity)
- end,
- },
- Aux.listing_util.money_column('Bid', function(group) return group[1].bid_price end),
- Aux.listing_util.money_column('Buy', function(group) return group[1].buyout_price end),
- Aux.listing_util.money_column('Bid/ea', function(group) return group[1].unit_bid_price end),
- Aux.listing_util.money_column('Buy/ea', function(group) return group[1].unit_buyout_price end),
- {
- title = 'Lvl',
- width = 25,
- comparator = function(group1, group2) return Aux.util.compare(group1[1].level, group2[1].level, Aux.util.GT) end,
- cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
- cell_setter = function(cell, group)
- local level = max(1, group[1].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)
- end,
- },
- {
- title = 'Status',
- width = 70,
- comparator = function(group1, group2) return Aux.util.compare(group1[1].status, group2[1].status, Aux.util.GT) end,
- cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
- cell_setter = function(cell, auction)
- cell.text:SetText(auction.status)
- end,
- },
- Aux.listing_util.duration_column(function(group) return group[1].duration end),
- Aux.listing_util.owner_column(function(group) return group[1].owner end),
- {
- 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)))
- end,
- },
- Aux.listing_util.percentage_market_column(function(group) return group[1].item_key end, function(group) return group[1].unit_buyout_price end),
+ end
+ end,
+ selected = function(datum)
+ return Aux.util.any(datum, function(entry) return entry == selected_auction end)
+ end,
+ row_setter = function(row, group)
+ row:SetAlpha(Aux.util.all(group, function(auction) return auction.gone end) and 0.3 or 1)
+ row.itemstring = Aux.info.itemstring(group[1].item_id, group[1].suffix_id, nil, group[1].enchant_id)
+ row.EnhTooltip_info = group[1].EnhTooltip_info
+ end,
+ columns = {
+ {
+ title = 'Qty',
+ width = 25,
+ comparator = function(group1, group2) return Aux.util.compare(group1[1].aux_quantity, group2[1].aux_quantity, Aux.util.LT) end,
+ cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
+ cell_setter = function(cell, group)
+ cell.text:SetText(group[1].aux_quantity)
+ end,
},
- sort_order = {{column = 3, order = 'ascending' }},
+ Aux.listing_util.money_column('Bid', function(group) return group[1].bid_price end),
+ Aux.listing_util.money_column('Buy', function(group) return group[1].buyout_price end),
+ Aux.listing_util.money_column('Bid/ea', function(group) return group[1].unit_bid_price end),
+ Aux.listing_util.money_column('Buy/ea', function(group) return group[1].unit_buyout_price end),
+ {
+ title = 'Lvl',
+ width = 25,
+ comparator = function(group1, group2) return Aux.util.compare(group1[1].level, group2[1].level, Aux.util.GT) end,
+ cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
+ cell_setter = function(cell, group)
+ local level = max(1, group[1].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)
+ end,
+ },
+ {
+ title = 'Status',
+ width = 70,
+ comparator = function(group1, group2) return Aux.util.compare(group1[1].status, group2[1].status, Aux.util.GT) end,
+ cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
+ cell_setter = function(cell, group)
+ cell.text:SetText(group[1].status)
+ end,
+ },
+ Aux.listing_util.duration_column(function(group) return group[1].duration end),
+ Aux.listing_util.owner_column(function(group) return group[1].owner end),
+ {
+ 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)))
+ end,
+ },
+ Aux.listing_util.percentage_market_column(function(group) return group[1].item_key end, function(group) return group[1].unit_buyout_price end),
},
+ sort_order = {{column = 3, order = 'ascending' }},
}
private.listings = {
recently_searched = Aux.sheet.create(private.recently_searched_config),
- [Aux.view.BUYOUT] = Aux.sheet.create(private.views[Aux.view.BUYOUT]),
+ results = Aux.sheet.create(private.results_config),
}
do
local btn = Aux.gui.button(AuxItemSearchFrameItem, 16, '$parentRefreshButton')
@@ -276,7 +274,7 @@ function private.update_listing()
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.sheet.populate(private.listings[Aux.view.BUYOUT], auctions and Aux.util.group_by(buy_records, function(a1, a2)
+ Aux.sheet.populate(private.listings.results, auctions and Aux.util.group_by(buy_records, function(a1, a2)
return a1.item_id == a2.item_id
and a1.suffix_id == a2.suffix_id
and a1.enchant_id == a2.enchant_id
@@ -357,6 +355,9 @@ function public.start_search()
private.status_bar:update_status(100 * (page + 1) / total_pages, 100 * (page + 1) / total_pages) -- TODO
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
end,
+ on_page_complete = function()
+ refresh = true
+ end,
on_read_auction = function(auction_info)
auctions = auctions or {}
tinsert(auctions, private.create_auction_record(auction_info))
diff --git a/money.lua b/money.lua
index 1c15a7a..5e646cf 100644
--- a/money.lua
+++ b/money.lua
@@ -37,7 +37,7 @@ function m.to_string(money, pad, trim, color, no_color)
if copper > 0 then
tinsert(parts, private:format_number(copper, pad, color)..copper_text)
end
- text = Aux.persistence.serialize(parts, ' ')
+ text = Aux.util.join(parts, ' ')
else
if gold > 0 then
text = m.format_number(gold, false, color)..gold_text..' '..m.format_number(silver, pad, color)..silver_text..' '..m.format_number(copper, pad, color)..copper_text
diff --git a/scan.lua b/scan.lua
index 930d0d9..2d09d6b 100644
--- a/scan.lua
+++ b/scan.lua
@@ -147,17 +147,19 @@ function private.process_query()
scan_auctions(count, function()
- if current_query().next_page then
- state.page = current_query().next_page(state.page, state.total_pages)
- else
- state.page = private.default_next_page(state.page, state.total_pages)
- end
+ wait_for_callback{state.params.on_page_complete or Aux.util.pass, function()
+ if current_query().next_page then
+ state.page = current_query().next_page(state.page, state.total_pages)
+ else
+ state.page = private.default_next_page(state.page, state.total_pages)
+ end
- if state.page then
- return private.process_query()
- else
- return private.scan()
- end
+ if state.page then
+ return private.process_query()
+ else
+ return private.scan()
+ end
+ end}
end)
end)
end
diff --git a/scan_util.lua b/scan_util.lua
index f02b14c..c5934c2 100644
--- a/scan_util.lua
+++ b/scan_util.lua
@@ -82,34 +82,34 @@ function m.create_item_query(item_id)
end
function m.parse_filter_string(filter_string)
- local parts = Aux.persistence.deserialize(filter_string, ';')
+ local parts = Aux.util.split(filter_string, ';')
local filters = {}
for _, str in ipairs(parts) do
str = Aux.util.trim(str)
- if tonumber(str) then
- local filter = m.create_item_filter(tonumber(str))
- if filter then
- tinsert(filters, filter)
- end
+-- if tonumber(str) then
+-- local filter = m.create_item_filter(tonumber(str))
+-- if filter then
+-- tinsert(filters, filter)
+-- end
+-- else
+ local filter, error = m.filter_from_string(str)
+
+ if not filter then
+ Aux.log('Invalid filter: '..error)
+ elseif filter.name and strlen(filter.name) > 63 then
+
else
- local filter, error = m.filter_from_string(str)
-
- if not filter then
- Aux.log('Invalid filter: '..error)
- elseif filter.name and strlen(filter.name) > 63 then
-
- else
- tinsert(filters, filter)
- end
+ tinsert(filters, filter)
end
+-- end
end
return filters
end
function m.filter_from_string(filter_term)
- local parts = Aux.persistence.deserialize(filter_term, '/')
+ local parts = Aux.util.split(filter_term, '/')
local filter = {}
for i, str in ipairs(parts) do
@@ -127,13 +127,13 @@ function m.filter_from_string(filter_term)
if not filter.class then
filter.class = Aux.item_class_index(str)
else
- return false, 'Invalid Item Type'
+ return false, 'Invalid Item Class'
end
elseif filter.class and Aux.item_subclass_index(filter.class, str) then
if not filter.subclass then
filter.subclass = Aux.item_subclass_index(filter.class, str)
else
- return false, 'Invalid Item SubType'
+ return false, 'Invalid Item Subclass'
end
elseif Aux.item_quality_index(str) then
if not filter.quality then
@@ -168,6 +168,18 @@ function m.filter_from_string(filter_term)
end
end
+ if filter.exact_only then
+ if filter.min_level or filter.max_level or filter.class or filter.subclass or filter.quality or filter.usable_only then
+ return false, 'Invalid Exact Only Filter'
+ end
+ for id, info in pairs(Aux.static.auctionable_items) do
+ if info.name == filter.name then
+ return m.create_item_filter(id)
+ end
+ end
+ return false, 'Invalid Exact Only Filter'
+ end
+
if filter.max_level then
filter.min_level, filter.max_level = min(filter.min_level, filter.max_level), max(filter.min_level, filter.max_level)
end
@@ -195,7 +207,7 @@ function m.filter_to_string(filter)
end
if filter.quality then
- filter_term = format('%s/%s', filter_term, _G["ITEM_QUALITY"..filter.quality.."_DESC"])
+ filter_term = format('%s/%s', filter_term, getglobal['ITEM_QUALITY'..filter.quality..'_DESC'])
end
if filter.usable_only then
diff --git a/util.lua b/util.lua
index 27ca358..1edba22 100644
--- a/util.lua
+++ b/util.lua
@@ -344,3 +344,32 @@ function Aux.util.set()
return self
end
+
+function public.join(array, separator)
+ local str = ''
+ for i, element in ipairs(array) do
+ if i > 1 then
+ str = str..separator
+ end
+ str = str..element
+ end
+ return str
+end
+
+function public.split(str, separator)
+
+ local array = {}
+ while true do
+ local start_index, _ = strfind(str, separator, 1, true)
+
+ if start_index then
+ local part = string.sub(str, 1, start_index - 1)
+ tinsert(array, part)
+ str = string.sub(str, start_index + 1, strlen(str))
+ else
+ local part = string.sub(str, 1, strlen(str))
+ tinsert(array, part)
+ return array
+ end
+ end
+end
\ No newline at end of file