From 6402e29b1b3f0045f1239d1c2ee0579977cf44ac Mon Sep 17 00:00:00 2001 From: shagu Date: Wed, 1 Mar 2017 19:48:48 +0100 Subject: [PATCH] api: rename to hooksecurefunc --- api/api.lua | 2 +- modules/actionbar.lua | 6 +++--- modules/autoshift.lua | 6 +++--- modules/castbar.lua | 6 +++--- modules/cooldown.lua | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/api/api.lua b/api/api.lua index 3f96c45b..e0bd4116 100644 --- a/api/api.lua +++ b/api/api.lua @@ -47,7 +47,7 @@ end -- 'func' [function] function containing the custom code -- 'append' [bool] optional variable, used to append custom -- code instead of prepending it -function pfUI.api.Hook(name, func, append) +function pfUI.api.hooksecurefunc(name, func, append) if not _G[name] then return end pfUI.hooks[tostring(func)] = {} diff --git a/modules/actionbar.lua b/modules/actionbar.lua index 3f2943ff..e195364d 100644 --- a/modules/actionbar.lua +++ b/modules/actionbar.lua @@ -34,18 +34,18 @@ pfUI:RegisterModule("actionbar", function () end end - Hook("ShowBonusActionBar", function() + hooksecurefunc("ShowBonusActionBar", function() if pfActionBar then pfActionBar:Hide() end if pfBonusBar then pfBonusBar:Show() end end) - Hook("HideBonusActionBar", function() + hooksecurefunc("HideBonusActionBar", function() if pfActionBar then pfActionBar:Show() end if pfBonusBar then pfBonusBar:Hide() end end) if C.bars.glowrange == "1" then - Hook("ActionButton_OnUpdate", function(elapsed) + hooksecurefunc("ActionButton_OnUpdate", function(elapsed) -- Handle range indicator if ( this.rangeTimer ) then this.rangeTimer = this.rangeTimer - elapsed diff --git a/modules/autoshift.lua b/modules/autoshift.lua index b1b04f73..8720c2f5 100644 --- a/modules/autoshift.lua +++ b/modules/autoshift.lua @@ -5,7 +5,7 @@ pfUI:RegisterModule("autoshift", function () pfUI.autoshift.lastError = "" pfUI.autoshift.CastSpellByName = _G["CastSpellByName"] - Hook("CastSpell", function(spellId, spellbookTabNum) + hooksecurefunc("CastSpell", function(spellId, spellbookTabNum) if pfUI.autoshift.lastError == L["stances"]['wantBattleStance'] then pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance']) elseif pfUI.autoshift.lastError == L["stances"]['wantBattleDefStance'] then @@ -20,7 +20,7 @@ pfUI:RegisterModule("autoshift", function () pfUI.autoshift.lastError = "" end) - Hook("CastSpellByName", function(spellName, onSelf) + hooksecurefunc("CastSpellByName", function(spellName, onSelf) if pfUI.autoshift.lastError == L["stances"]['wantBattleStance'] then pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance']) elseif pfUI.autoshift.lastError == L["stances"]['wantBattleDefStance'] then @@ -35,7 +35,7 @@ pfUI:RegisterModule("autoshift", function () pfUI.autoshift.lastError = "" end) - Hook("UseAction", function(slot, checkCursor, onSelf) + hooksecurefunc("UseAction", function(slot, checkCursor, onSelf) if pfUI.autoshift.lastError == L["stances"]['wantBattleStance'] then pfUI.autoshift.CastSpellByName(L["stances"]['BattleStance']) elseif pfUI.autoshift.lastError == L["stances"]['wantBattleDefStance'] then diff --git a/modules/castbar.lua b/modules/castbar.lua index 33d3f5ce..3b2b4375 100644 --- a/modules/castbar.lua +++ b/modules/castbar.lua @@ -118,20 +118,20 @@ pfUI:RegisterModule("castbar", function () end end - Hook("CastSpell", function(id, bookType) + hooksecurefunc("CastSpell", function(id, bookType) local spellName = GetSpellName(id, bookType) if pfUI.castbar.player[spellName] then pfUI.castbar.player[spellName](true) end end, true) - Hook("CastSpellByName", function(spellName, target) + hooksecurefunc("CastSpellByName", function(spellName, target) if pfUI.castbar.player[spellName] then pfUI.castbar.player[spellName](true) end end, true) - Hook("UseAction", function(slot, target, button) + hooksecurefunc("UseAction", function(slot, target, button) if GetActionText(slot) or not IsCurrentAction(slot) then return end scanner:ClearLines() scanner:SetAction(slot) diff --git a/modules/cooldown.lua b/modules/cooldown.lua index 2fb3abc5..c1b6df9e 100644 --- a/modules/cooldown.lua +++ b/modules/cooldown.lua @@ -55,7 +55,7 @@ pfUI:RegisterModule("cooldown", function () end -- hook - Hook("CooldownFrame_SetTimer", function(this, start, duration, enable) + hooksecurefunc("CooldownFrame_SetTimer", function(this, start, duration, enable) -- realign guessed cooldown frames if this:GetParent() and this:GetParent():GetWidth() / 36 > 0 then this:SetScale(this:GetParent():GetWidth() / 36)