refactoring, change of pickup/use behavior

This commit is contained in:
Manuel Simon Hirsig
2016-08-07 23:06:31 +02:00
parent c3447aedd2
commit abc163d7f3
10 changed files with 108 additions and 143 deletions
+2 -2
View File
@@ -10,12 +10,12 @@ function m.LOAD()
m.create_frames(m, public, private)
end
function public.OPEN()
function m.OPEN()
m.frame:Show()
m.scan_auctions()
end
function public.CLOSE()
function m.CLOSE()
m.frame:Hide()
end
+2 -2
View File
@@ -10,12 +10,12 @@ function m.LOAD()
m.create_frames(m, public, private)
end
function public.OPEN()
function m.OPEN()
m.frame:Show()
m.scan_bids()
end
function public.CLOSE()
function m.CLOSE()
m.frame:Hide()
end
+11 -3
View File
@@ -17,7 +17,7 @@ function m.LOAD()
m.create_frames(m, public, private)
end
function public.OPEN()
function m.OPEN()
m.frame:Show()
m.deposit:SetText('Deposit: '..aux.money.to_string(0, nil, nil, nil, aux.gui.inline_color.text.enabled))
@@ -30,11 +30,19 @@ function public.OPEN()
m.refresh = true
end
function public.CLOSE()
function m.CLOSE()
m.selected_item = nil
m.frame:Hide()
end
function m.PICKUP_ITEM(item_info)
m.select_item(item_info.item_key)
end
function m.USE_ITEM(item_info)
m.select_item(item_info.item_key)
end
function private.default_settings()
return {
duration = DURATION_8,
@@ -358,7 +366,7 @@ function private.unit_vendor_price(item_key)
if aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
ClearCursor()
PickupContainerItem(unpack(slot))
aux.orig.PickupContainerItem(unpack(slot))
ClickAuctionSellItemButton()
local auction_sell_item = aux.info.auction_sell_item()
ClearCursor()
+3 -24
View File
@@ -118,34 +118,13 @@ aux.post_tab.FRAMES(function(m, public, private)
do
local item = aux.gui.item(m.frame.parameters)
item:SetPoint('TOPLEFT', 6, -6)
item:EnableMouse()
item:SetScript('OnReceiveDrag', function()
local item_info = aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
item:SetScript('OnClick', function()
local item_info = aux.cursor_item()
if item_info then
m.select_item(item_info.item_key)
end
ClearCursor()
end)
local highlight = item:CreateTexture()
highlight:SetPoint('TOPLEFT', -2.5, 2)
highlight:SetPoint('BOTTOMRIGHT', 2.5, -2)
highlight:Hide()
highlight:SetTexture(1, .9, .9, .1)
item:SetScript('OnEnter', function()
highlight:Show()
item.button:EnableMouse(true)
item.button:SetScript('OnEnter', function()
if m.selected_item then
aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
end
end)
item:SetScript('OnLeave', function()
highlight:Hide()
item.button:SetScript('OnLeave', function()
GameTooltip:Hide()
end)
private.item = item
+17 -2
View File
@@ -144,17 +144,32 @@ function m.LOAD()
m.current_search().placeholder = true
end
function public.OPEN()
function m.OPEN()
m.frame:Show()
m.update_search_listings()
end
function public.CLOSE()
function m.CLOSE()
m.close_settings()
m.current_search().table:SetSelectedRecord()
m.frame:Hide()
end
function m.CLICK_LINK(item_info)
m.set_filter(strlower(item_info.name)..'/exact')
m.execute(nil, false)
end
function m.PICKUP_ITEM(item_info)
m.set_filter(strlower(item_info.name)..'/exact')
m.execute(nil, false)
end
function m.USE_ITEM(item_info)
m.set_filter(strlower(item_info.name)..'/exact')
m.execute(nil, false)
end
function private.update_search_listings()
local favorite_search_rows = {}
for i, favorite_search in aux_favorite_searches do
-8
View File
@@ -243,14 +243,6 @@ aux.search_tab.FRAMES(function(m, public, private)
this:HighlightText(0, 0)
end)
editbox:SetScript('OnEnterPressed', m.execute)
editbox:SetScript('OnReceiveDrag', function()
local item_info = aux.cursor_item() and aux.info.item(aux.cursor_item().item_id)
if item_info then
m.set_filter(strlower(item_info.name)..'/exact')
m.execute(nil, false)
end
ClearCursor()
end)
private.search_box = editbox
end
do