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
+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