Bug fixes, Framework update, General changes to accommodate new systems.

This commit is contained in:
Tercio Jose
2024-02-26 14:12:11 -03:00
parent 483d9c6976
commit 32adc61608
34 changed files with 1801 additions and 524 deletions
+38 -49
View File
@@ -1,69 +1,58 @@
--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_BATTLERESS = "HOOK_BATTLERESS"
--[[global]] DETAILS_HOOK_INTERRUPT = "HOOK_INTERRUPT"
--[[global]] DETAILS_HOOK_BUFF = "HOOK_BUFF" --[[REMOVED--]]
local _detalhes = _G.Details
local _
local addonName, Details222 = ...
_detalhes.hooks ["HOOK_COOLDOWN"] = {}
_detalhes.hooks ["HOOK_DEATH"] = {}
_detalhes.hooks ["HOOK_BATTLERESS"] = {}
_detalhes.hooks ["HOOK_INTERRUPT"] = {}
_detalhes.hooks ["HOOK_BUFF"] = {} --[[REMOVED--]]
function _detalhes:InstallHook (hook_type, func)
if (not _detalhes.hooks [hook_type]) then
local Details = _G.Details
local addonName, Details222 = ...
local _
---@alias detailshook
---| '"HOOK_COOLDOWN"' # Hook for cooldowns
---| '"HOOK_DEATH"' # Hook for deaths
---| '"HOOK_BATTLERESS"' # Hook for battle ress
---| '"HOOK_INTERRUPT"' # Hook for interrupts
Details.hooks["HOOK_COOLDOWN"] = {}
Details.hooks["HOOK_DEATH"] = {}
Details.hooks["HOOK_BATTLERESS"] = {}
Details.hooks["HOOK_INTERRUPT"] = {}
function Details:InstallHook(hookType, func)
if (not Details.hooks[hookType]) then
return false, "Invalid hook type."
end
for _, this_func in ipairs(_detalhes.hooks [hook_type]) do
if (this_func == func) then
for _, thisFunc in ipairs(Details.hooks[hookType]) do
if (thisFunc == func) then
--already installed
return
end
end
_detalhes.hooks [hook_type] [#_detalhes.hooks [hook_type] + 1] = func
_detalhes.hooks [hook_type].enabled = true
_detalhes:UpdateParserGears()
Details.hooks[hookType][#Details.hooks[hookType] + 1] = func
Details.hooks[hookType].enabled = true
Details:UpdateParserGears()
return true
end
function _detalhes:UnInstallHook (hook_type, func)
if (not _detalhes.hooks [hook_type]) then
function Details:UnInstallHook(hookType, func)
if (not Details.hooks[hookType]) 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
for index, thisFunc in ipairs(Details.hooks[hookType]) do
if (thisFunc == func) then
table.remove(Details.hooks[hookType], index)
if (#Details.hooks[hookType] == 0) then
Details.hooks[hookType].enabled = false
end
_detalhes:UpdateParserGears()
Details:UpdateParserGears()
return true
end
end
end
end