finished new auto buy mechanism (alt-right-click to add/remove)
This commit is contained in:
+11
-10
@@ -37,7 +37,7 @@ frame.saved.recent:SetPoint('TOPLEFT', frame.saved.favorite, 'TOPRIGHT', 2.5, 0)
|
|||||||
frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
|
frame.saved.recent:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||||
do
|
do
|
||||||
local btn = gui.checkbutton(frame)
|
local btn = gui.checkbutton(frame)
|
||||||
btn:SetPoint('TOPLEFT', 5, -9)
|
btn:SetPoint('TOPLEFT', 5, -8)
|
||||||
btn:SetWidth(90)
|
btn:SetWidth(90)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText'Real Time'
|
btn:SetText'Real Time'
|
||||||
@@ -70,7 +70,7 @@ do
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame, gui.font_size.huge)
|
local btn = gui.button(frame, gui.font_size.huge)
|
||||||
btn:SetPoint('TOPRIGHT', -5, -9)
|
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||||
btn:SetWidth(70)
|
btn:SetWidth(70)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText'Start'
|
btn:SetText'Start'
|
||||||
@@ -85,7 +85,7 @@ do
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local btn = gui.button(frame, gui.font_size.huge)
|
local btn = gui.button(frame, gui.font_size.huge)
|
||||||
btn:SetPoint('TOPRIGHT', -5, -9)
|
btn:SetPoint('TOPRIGHT', -5, -8)
|
||||||
btn:SetWidth(70)
|
btn:SetWidth(70)
|
||||||
btn:SetHeight(25)
|
btn:SetHeight(25)
|
||||||
btn:SetText'Stop'
|
btn:SetText'Stop'
|
||||||
@@ -232,6 +232,7 @@ do
|
|||||||
btn2:SetText'Auto Buy'
|
btn2:SetText'Auto Buy'
|
||||||
btn2:SetScript('OnClick', function()
|
btn2:SetScript('OnClick', function()
|
||||||
add_auto_buy(search_box:GetText())
|
add_auto_buy(search_box:GetText())
|
||||||
|
update_search_listings()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
do
|
do
|
||||||
@@ -524,13 +525,13 @@ for _ = 1, 5 do
|
|||||||
tinsert(tables, table)
|
tinsert(tables, table)
|
||||||
end
|
end
|
||||||
|
|
||||||
private.autobuy_listing = listing.CreateScrollingTable(frame.saved.autobuy)
|
private.auto_buy_listing = listing.CreateScrollingTable(frame.saved.autobuy)
|
||||||
autobuy_listing:SetColInfo{{name='Auto Buy Filters', width=1}}
|
auto_buy_listing:SetColInfo{{name='Auto Buy Filters', width=1}}
|
||||||
autobuy_listing:EnableSorting(false)
|
auto_buy_listing:EnableSorting(false)
|
||||||
autobuy_listing:DisableSelection(true)
|
auto_buy_listing:DisableSelection(true)
|
||||||
autobuy_listing:SetHandler('OnClick', handlers.OnClick)
|
auto_buy_listing:SetHandler('OnClick', handlers.OnClick)
|
||||||
autobuy_listing:SetHandler('OnEnter', handlers.OnEnter)
|
auto_buy_listing:SetHandler('OnEnter', handlers.OnEnter)
|
||||||
autobuy_listing:SetHandler('OnLeave', handlers.OnLeave)
|
auto_buy_listing:SetHandler('OnLeave', handlers.OnLeave)
|
||||||
|
|
||||||
private.recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
private.recent_searches_listing = listing.CreateScrollingTable(frame.saved.recent)
|
||||||
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
|
||||||
|
|||||||
+32
-20
@@ -16,7 +16,7 @@ function private.update_search_listings()
|
|||||||
index = i,
|
index = i,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
autobuy_listing:SetData(autobuy_filter_rows)
|
auto_buy_listing:SetData(autobuy_filter_rows)
|
||||||
|
|
||||||
local favorite_search_rows = t
|
local favorite_search_rows = t
|
||||||
for i, favorite_search in aux_favorite_searches do
|
for i, favorite_search in aux_favorite_searches do
|
||||||
@@ -60,33 +60,34 @@ private.handlers = {
|
|||||||
elseif button == 'RightButton' and IsShiftKeyDown() then
|
elseif button == 'RightButton' and IsShiftKeyDown() then
|
||||||
add_filter(data.search.filter_string)
|
add_filter(data.search.filter_string)
|
||||||
elseif button == 'LeftButton' and IsControlKeyDown() then
|
elseif button == 'LeftButton' and IsControlKeyDown() then
|
||||||
if st == favorite_searches_listing and data.index > 1 then
|
if st == favorite_searches_listing then
|
||||||
local temp = aux_favorite_searches[data.index - 1]
|
move_up(aux_favorite_searches, data.index)
|
||||||
aux_favorite_searches[data.index - 1] = data.search
|
elseif st == auto_buy_listing then
|
||||||
aux_favorite_searches[data.index] = temp
|
move_up(aux_auto_buy_filters, data.index)
|
||||||
update_search_listings()
|
|
||||||
end
|
end
|
||||||
|
update_search_listings()
|
||||||
elseif button == 'RightButton' and IsControlKeyDown() then
|
elseif button == 'RightButton' and IsControlKeyDown() then
|
||||||
if st == favorite_searches_listing and data.index < getn(aux_favorite_searches) then
|
if st == favorite_searches_listing then
|
||||||
local temp = aux_favorite_searches[data.index + 1]
|
move_down(aux_favorite_searches, data.index)
|
||||||
aux_favorite_searches[data.index + 1] = data.search
|
elseif st == auto_buy_listing then
|
||||||
aux_favorite_searches[data.index] = temp
|
move_down(aux_auto_buy_filters, data.index)
|
||||||
update_search_listings()
|
|
||||||
end
|
end
|
||||||
|
update_search_listings()
|
||||||
elseif button == 'RightButton' and IsAltKeyDown() then
|
elseif button == 'RightButton' and IsAltKeyDown() then
|
||||||
if st ~= autobuy_listing then
|
if st == auto_buy_listing then
|
||||||
|
tremove(aux_auto_buy_filters, data.index)
|
||||||
|
else
|
||||||
add_auto_buy(data.search.filter_string)
|
add_auto_buy(data.search.filter_string)
|
||||||
end
|
end
|
||||||
|
update_search_listings()
|
||||||
elseif button == 'LeftButton' then
|
elseif button == 'LeftButton' then
|
||||||
search_box:SetText(data.search.filter_string)
|
search_box:SetText(data.search.filter_string)
|
||||||
execute()
|
execute()
|
||||||
elseif button == 'RightButton' then
|
elseif button == 'RightButton' then
|
||||||
if st == autobuy_listing then
|
if st == favorite_searches_listing then
|
||||||
tremove(aux_auto_buy_filters, data.index)
|
|
||||||
elseif st == recent_searches_listing then
|
|
||||||
tinsert(aux_favorite_searches, 1, data.search)
|
|
||||||
elseif st == favorite_searches_listing then
|
|
||||||
tremove(aux_favorite_searches, data.index)
|
tremove(aux_favorite_searches, data.index)
|
||||||
|
else
|
||||||
|
tinsert(aux_favorite_searches, 1, data.search)
|
||||||
end
|
end
|
||||||
update_search_listings()
|
update_search_listings()
|
||||||
end
|
end
|
||||||
@@ -136,16 +137,27 @@ function private.add_auto_buy(filter_string)
|
|||||||
if queries then
|
if queries then
|
||||||
if getn(queries) > 1 then
|
if getn(queries) > 1 then
|
||||||
print'Error: The automatic buyout filter does not support multi-queries'
|
print'Error: The automatic buyout filter does not support multi-queries'
|
||||||
-- elseif size(queries[1].blizzard_query) > 0 then TODO allow exact
|
elseif size(queries[1].blizzard_query) > 0 and not filter_util.parse_filter_string(filter_string).blizzard.exact then
|
||||||
-- print'Error: The automatic buyout filter does not support Blizzard filters'
|
print'Error: The automatic buyout filter does not support Blizzard filters'
|
||||||
else
|
else
|
||||||
tinsert(aux_auto_buy_filters, 1, T(
|
tinsert(aux_auto_buy_filters, 1, T(
|
||||||
'filter_string', filter_string,
|
'filter_string', filter_string,
|
||||||
'prettified', join(map(queries, function(query) return query.prettified end), ';')
|
'prettified', join(map(queries, function(query) return query.prettified end), ';')
|
||||||
))
|
))
|
||||||
update_search_listings()
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
print('Invalid filter:', error)
|
print('Invalid filter:', error)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function private.move_up(list, index)
|
||||||
|
if list[index - 1] then
|
||||||
|
list[index], list[index - 1] = list[index - 1], list[index]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function private.move_down(list, index)
|
||||||
|
if list[index + 1] then
|
||||||
|
list[index], list[index + 1] = list[index + 1], list[index]
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user