diff --git a/helpers.lua b/helpers.lua index d4b3e80..8fa3521 100644 --- a/helpers.lua +++ b/helpers.lua @@ -85,9 +85,9 @@ ShaguTweaks.HookAddonOrVariable = function(addon, func) end local hooks = {} -ShaguTweaks.hooksecurefunc = function(tbl, name, func, append) +ShaguTweaks.hooksecurefunc = function(tbl, name, func, prepend) if type(tbl) == "string" then - append, func, name, tbl = func, name, tbl, _G + prepend, func, name, tbl = func, name, tbl, _G end if not tbl or not tbl[name] then return end @@ -96,15 +96,15 @@ ShaguTweaks.hooksecurefunc = function(tbl, name, func, append) hooks[tostring(func)]["old"] = tbl[name] hooks[tostring(func)]["new"] = func - if append then + if prepend then hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) - hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) end else hooks[tostring(func)]["function"] = function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) - hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) hooks[tostring(func)]["old"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + hooks[tostring(func)]["new"](a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) end end diff --git a/libs/libcast.lua b/libs/libcast.lua index 823f935..4778c02 100644 --- a/libs/libcast.lua +++ b/libs/libcast.lua @@ -381,7 +381,7 @@ hooksecurefunc("CastSpell", function(id, bookType) local spellName = GetSpellName(id, bookType) CastCustom(spellName) end -end, true) +end) hooksecurefunc("CastSpellByName", function(spell, target) _, lastrank = libspell.GetSpellInfo(spell) @@ -393,7 +393,7 @@ hooksecurefunc("CastSpellByName", function(spell, target) return end end -end, true) +end) hooksecurefunc("UseAction", function(slot, target, button) scanner:SetAction(slot) @@ -404,6 +404,6 @@ hooksecurefunc("UseAction", function(slot, target, button) if GetActionText(slot) or not IsCurrentAction(slot) then return end CastCustom(spellName) -end, true) +end) ShaguTweaks.libcast = libcast diff --git a/libs/libdebuff.lua b/libs/libdebuff.lua index 1be5953..30ee3fa 100644 --- a/libs/libdebuff.lua +++ b/libs/libdebuff.lua @@ -224,13 +224,13 @@ hooksecurefunc("CastSpell", function(id, bookType) local _, rank = libspell.GetSpellInfo(id, bookType) local duration = libdebuff:GetDuration(effect, rank) libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration) -end, true) +end) hooksecurefunc("CastSpellByName", function(effect, target) local _, rank = libspell.GetSpellInfo(effect) local duration = libdebuff:GetDuration(effect, rank) libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration) -end, true) +end) hooksecurefunc("UseAction", function(slot, target, button) if GetActionText(slot) or not IsCurrentAction(slot) then return end @@ -238,7 +238,7 @@ hooksecurefunc("UseAction", function(slot, target, button) local effect, rank = scanner:Line(1) local duration = libdebuff:GetDuration(effect, rank) libdebuff:AddPending(UnitName("target"), UnitLevel("target"), effect, duration) -end, true) +end) function libdebuff:UnitDebuff(unit, id) local unitname = UnitName(unit) diff --git a/libs/libpredict.lua b/libs/libpredict.lua index 5655775..cbe585f 100644 --- a/libs/libpredict.lua +++ b/libs/libpredict.lua @@ -304,7 +304,7 @@ hooksecurefunc("CastSpell", function(id, bookType) spell_queue[1] = effect spell_queue[2] = effect.. ( rank or "" ) spell_queue[3] = UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player") -end, true) +end) hooksecurefunc("CastSpellByName", function(effect, target) if not libpredict.sender.enabled then return end @@ -313,7 +313,7 @@ hooksecurefunc("CastSpellByName", function(effect, target) spell_queue[1] = effect spell_queue[2] = effect.. ( rank or "" ) spell_queue[3] = UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player") -end, true) +end) local scanner = libtipscan:GetScanner("prediction") hooksecurefunc("UseAction", function(slot, target, selfcast) @@ -325,7 +325,7 @@ hooksecurefunc("UseAction", function(slot, target, selfcast) spell_queue[1] = effect spell_queue[2] = effect.. ( rank or "" ) spell_queue[3] = selfcast and UnitName("player") or UnitName("target") and UnitCanAssist("player", "target") and UnitName("target") or UnitName("player") -end, true) +end) libpredict.sender = CreateFrame("Frame", "ShaguTweaksPredictionSender", UIParent) libpredict.sender.enabled = true diff --git a/libs/libspell.lua b/libs/libspell.lua index 439d26f..143a0d7 100644 --- a/libs/libspell.lua +++ b/libs/libspell.lua @@ -1,7 +1,6 @@ local _G = ShaguTweaks.GetGlobalEnv() local GetExpansion = ShaguTweaks.GetExpansion local libtipscan = ShaguTweaks.libtipscan -local hooksecurefunc = ShaguTweaks.hooksecurefunc local scanner = libtipscan:GetScanner("libspell") local libspell = {} diff --git a/mods/chat-links.lua b/mods/chat-links.lua index 394902f..681d680 100644 --- a/mods/chat-links.lua +++ b/mods/chat-links.lua @@ -2,7 +2,6 @@ local _G = ShaguTweaks.GetGlobalEnv() local T = ShaguTweaks.T local gfind = string.gmatch or string.gfind local GetUnitData = ShaguTweaks.GetUnitData -local hooksecurefunc = ShaguTweaks.hooksecurefunc local GetExpansion = ShaguTweaks.GetExpansion local cmatch = ShaguTweaks.cmatch local rgbhex = ShaguTweaks.rgbhex diff --git a/mods/social-colors.lua b/mods/social-colors.lua index 813b2ce..cb8ac3f 100644 --- a/mods/social-colors.lua +++ b/mods/social-colors.lua @@ -110,7 +110,7 @@ module.enable = function(self) end end end - end, true) + end) end do -- add colors to friend list @@ -168,7 +168,7 @@ module.enable = function(self) friendInfo:SetVertexColor(1,1,1,.4) end end - end, true) + end) end do -- add colors to who list @@ -226,6 +226,6 @@ module.enable = function(self) local color = GetDifficultyColor(level) _G["WhoFrameButton"..i.."Level"]:SetTextColor(color.r, color.g, color.b) end - end, true) + end) end end