From 8b254ac40f87ce38068cc925bea7d59b391fea80 Mon Sep 17 00:00:00 2001 From: Simon Hirsig Date: Wed, 1 Nov 2017 15:43:34 +0100 Subject: [PATCH] bugfix --- aux-addon.lua | 20 -------------------- aux-addon.toc | 4 +++- core/shortcut.lua | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 21 deletions(-) create mode 100644 core/shortcut.lua diff --git a/aux-addon.lua b/aux-addon.lua index e46e7f3..d1dd84d 100644 --- a/aux-addon.lua +++ b/aux-addon.lua @@ -116,26 +116,6 @@ do end end -SetItemRef = T.vararg-function(arg) - if arg[3] ~= 'RightButton' or not index(get_active_tab(), 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then - return orig.SetItemRef(unpack(arg)) - end - local item_info = info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)')))) - if item_info then - return get_active_tab().CLICK_LINK(item_info) - end -end - -UseContainerItem = T.vararg-function(arg) - if modified() or not get_active_tab() then - return orig.UseContainerItem(unpack(arg)) - end - local item_info = info.container_item(arg[1], arg[2]) - if item_info and get_active_tab().USE_ITEM then - get_active_tab().USE_ITEM(item_info) - end -end - M.orig = setmetatable({[_G]=T.acquire()}, {__index=function(self, key) return self[_G][key] end}) M.hook = T.vararg-function(arg) local name, object, handler diff --git a/aux-addon.toc b/aux-addon.toc index ff7e2ef..f52bcf0 100644 --- a/aux-addon.toc +++ b/aux-addon.toc @@ -28,7 +28,7 @@ util\scan.lua core\stack.lua core\post.lua core\tooltip.lua -core\crafting.lua +core\shortcut.lua gui\listing.lua gui\auction_listing.lua @@ -49,4 +49,6 @@ tabs\auctions\frame.lua tabs\bids\core.lua tabs\bids\frame.lua +core\crafting.lua + diff --git a/core/shortcut.lua b/core/shortcut.lua new file mode 100644 index 0000000..34a60bf --- /dev/null +++ b/core/shortcut.lua @@ -0,0 +1,33 @@ +module 'aux.core.shortcut' + +include 'aux' + +local T = require 'T' + +local info = require 'aux.util.info' + +do + local orig = UseContainerItem + _G.SetItemRef = T.vararg-function(arg) + if arg[3] ~= 'RightButton' or not index(get_active_tab(), 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then + return orig.SetItemRef(unpack(arg)) + end + local item_info = info.item(tonumber(select(3, strfind(arg[1], '^item:(%d+)')))) + if item_info then + return get_active_tab().CLICK_LINK(item_info) + end + end +end + +do + local orig = UseContainerItem + _G.UseContainerItem = T.vararg-function(arg) + if modified() or not get_active_tab() then + return orig.UseContainerItem(unpack(arg)) + end + local item_info = info.container_item(arg[1], arg[2]) + if item_info and get_active_tab().USE_ITEM then + get_active_tab().USE_ITEM(item_info) + end + end +end \ No newline at end of file