compat: make hooksecurefunc append by default

This commit is contained in:
shagu
2025-07-30 20:18:52 +02:00
parent 37a5f1a840
commit 73561eda4a
22 changed files with 45 additions and 45 deletions
+4 -4
View File
@@ -395,17 +395,17 @@ hooksecurefunc("CastSpell", function(id, bookType)
local cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime, _, _, cachedSpellId, cachedBookType = libspell.GetSpellInfo(id, bookType)
CastCustom(cachedSpellId, cachedBookType, cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime)
end, true)
end)
hooksecurefunc("CastSpellByName", function(spellCasted, target)
local cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime, _, _, cachedSpellId, cachedBookType = libspell.GetSpellInfo(spellCasted)
CastCustom(cachedSpellId, cachedBookType, cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime)
end, true)
end)
hooksecurefunc("UseAction", function(slot, target, button)
if GetActionText(slot) or not IsCurrentAction(slot) then return end
scanner:SetAction(slot)
local rawSpellName, rank = scanner:Line(1)
if not rawSpellName then return end -- ignore if the spell is not found
@@ -413,7 +413,7 @@ hooksecurefunc("UseAction", function(slot, target, button)
local cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime, _, _, cachedSpellId, cachedBookType = libspell.GetSpellInfo(rawSpellName .. (rank and ("(" .. rank .. ")") or ""))
CastCustom(cachedSpellId, cachedBookType, cachedRawSpellName, cachedRank, cachedTexture, cachedCastingTime)
end, true)
end)
-- add libcast to pfUI API
pfUI.api.libcast = libcast
+3 -3
View File
@@ -236,13 +236,13 @@ hooksecurefunc("CastSpell", function(id, bookType)
local rawEffect, rank = libspell.GetSpellInfo(id, bookType)
local duration = libdebuff:GetDuration(rawEffect, rank)
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration, "player")
end, true)
end)
hooksecurefunc("CastSpellByName", function(effect, target)
local rawEffect, rank = libspell.GetSpellInfo(effect)
local duration = libdebuff:GetDuration(rawEffect, rank)
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration, "player")
end, true)
end)
hooksecurefunc("UseAction", function(slot, target, button)
if GetActionText(slot) or not IsCurrentAction(slot) then return end
@@ -250,7 +250,7 @@ hooksecurefunc("UseAction", function(slot, target, button)
local rawEffect, rank = scanner:Line(1)
local duration = libdebuff:GetDuration(rawEffect, rank)
libdebuff:AddPending(UnitName("target"), UnitLevel("target"), rawEffect, duration, "player")
end, true)
end)
function libdebuff:UnitDebuff(unit, id)
local unitname = UnitName(unit)
+3 -3
View File
@@ -397,7 +397,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
@@ -414,7 +414,7 @@ hooksecurefunc("CastSpellByName", function(effect, target)
spell_queue[1] = effect
spell_queue[2] = effect.. ( rank or "" )
spell_queue[3] = target or mouseover or default
end, true)
end)
local scanner = libtipscan:GetScanner("prediction")
hooksecurefunc("UseAction", function(slot, target, selfcast)
@@ -426,7 +426,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", "pfPredictionSender", UIParent)
libpredict.sender.enabled = true
+3 -3
View File
@@ -158,13 +158,13 @@ hooksecurefunc("CastSpell", function(id, bookType)
local name, rank, icon = libspell.GetSpellInfo(id, bookType)
if not name then return end
if libtotem:CheckAddQueue(name, rank, icon) then return end
end, true)
end)
hooksecurefunc("CastSpellByName", function(effect, target)
local name, rank, icon = libspell.GetSpellInfo(effect)
if not name then return end
if libtotem:CheckAddQueue(name, rank, icon) then return end
end, true)
end)
local scanner = libtipscan:GetScanner("prediction")
hooksecurefunc("UseAction", function(slot, target, selfcast)
@@ -174,4 +174,4 @@ hooksecurefunc("UseAction", function(slot, target, selfcast)
local icon = GetActionTexture(slot)
if not name then return end
if libtotem:CheckAddQueue(name, rank, icon) then return end
end, true)
end)