libcast: make post-hook update last cast texture

we now set lastcasttex from the texture returned by libspell.GetSpellInfo in "CastSpellByName" post-hook
This commit is contained in:
Kyriakos (Dominick) Sidiropoulos
2024-06-04 08:55:56 +02:00
committed by GitHub
parent 0bd90d47b4
commit b7289a702c
+7 -3
View File
@@ -400,13 +400,17 @@ hooksecurefunc("CastSpell", function(id, bookType)
end
end, true)
hooksecurefunc("CastSpellByName", function(spell, target)
_, lastrank = libspell.GetSpellInfo(spell)
hooksecurefunc("CastSpellByName", function(spellCasted, target)
local spellName, rank, texture, _, _, _, cachedId = libspell.GetSpellInfo(spellCasted)
if not spellName or not cachedId then return end -- ignore if the spell is not found
lastrank = rank
lastcasttex = texture
for i=1,120 do
-- detect if any cast is ongoing
if IsCurrentAction(i) then
CastCustom(spell)
CastCustom(spellCasted)
return
end
end