Files
coa-details/functions/hooks.lua
T
terciob19 c29e9875de - fixed issue with panic mode where sometimes his effects isn't triggered.
- added new small tutorial bubles for common tasks.
- tutorials now are account wide and not trigger on new characters.
- small improvements on details framework.
- added new hook type: HOOK_BUFF, triggered with buff or debuff parser.
- new skin: simple gray.
- added a minimap button and a button on addons interface panel.
new Api: instance:LockInstance (boolean)
2014-01-02 11:21:22 -02:00

54 lines
1.4 KiB
Lua

--File Revision: 1
--Last Modification: 06/12/2013
-- Change Log:
-- 06/12/2013: file added.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--[[global]] DETAILS_HOOK_COOLDOWN = "HOOK_COOLDOWN"
--[[global]] DETAILS_HOOK_DEATH = "HOOK_DEATH"
--[[global]] DETAILS_HOOK_BUFF = "HOOK_BUFF"
local _detalhes = _G._detalhes
local _
_detalhes.hooks ["HOOK_COOLDOWN"] = {}
_detalhes.hooks ["HOOK_DEATH"] = {}
_detalhes.hooks ["HOOK_BUFF"] = {}
function _detalhes:InstallHook (hook_type, func)
if (not _detalhes.hooks [hook_type]) then
return false, "Invalid hook type."
end
_detalhes.hooks [hook_type] [#_detalhes.hooks [hook_type] + 1] = func
_detalhes.hooks [hook_type].enabled = true
_detalhes:UpdateParserGears()
return true
end
function _detalhes:UnInstallHook (hook_type, func)
if (not _detalhes.hooks [hook_type]) then
return false, "Invalid hook type."
end
for index, this_func in ipairs (_detalhes.hooks [hook_type]) do
if (this_func == func) then
table.remove (_detalhes.hooks [hook_type], index)
if (#_detalhes.hooks [hook_type] == 0) then
_detalhes.hooks [hook_type].enabled = false
end
_detalhes:UpdateParserGears()
return true
end
end
end