refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-27 11:50:42 +02:00
parent bf8f8250d3
commit 77caf8c063
3 changed files with 50 additions and 71 deletions
+21 -36
View File
@@ -2,36 +2,29 @@ aux 'tooltip' local info, disenchant, cache, money, history = aux.info, aux.dise
_G.aux_tooltip_value = true
game_tooltip_hooks = t
do
local c
hooked_setter
{
get = function() return c end,
set = function(v) c = v end,
}
end
do
local amount
game_tooltip_money
{
get = function() return amount end,
set = function(v) amount = v end,
}
end
local game_tooltip_hooks, game_tooltip_money, inside_hook = t, 0, false
function LOAD()
for name, f in game_tooltip_hooks do
local name, f = name, f
M.hook(name, GameTooltip, function(...) temp=arg
hooked_setter = true
game_tooltip_money = 0
local ret = {orig[GameTooltip][name](unpack(arg))}
hooked_setter = false
f(unpack(arg))
return unpack(ret)
end)
do
for name, f in game_tooltip_hooks do
local name, f = name, f
hook(name, GameTooltip, function(...) temp=arg
inside_hook = true
game_tooltip_money = 0
local ret = {orig[GameTooltip][name](unpack(arg))}
inside_hook = false
f(unpack(arg))
return unpack(ret)
end)
end
local orig = GameTooltip:GetScript 'OnTooltipAddMoney'
GameTooltip:SetScript('OnTooltipAddMoney', function(...) temp=arg
if inside_hook then
game_tooltip_money = arg1
else
return orig(unpack(arg))
end
end)
end
local orig = SetItemRef
setglobal('SetItemRef', function(...) temp=arg
@@ -44,14 +37,6 @@ function LOAD()
end
return result
end)
local orig = GameTooltip:GetScript 'OnTooltipAddMoney'
GameTooltip:SetScript('OnTooltipAddMoney', function(...) temp=arg
if hooked_setter then
game_tooltip_money = arg1
else
return orig(unpack(arg))
end
end)
end
function extend_tooltip(tooltip, link, quantity)