Skip to content

Commit

Permalink
libcast: make post-hook update last cast texture
Browse files Browse the repository at this point in the history
we now set lastcasttex from the texture returned by libspell.GetSpellInfo in "CastSpellByName" post-hook
  • Loading branch information
dsidirop authored Jun 4, 2024
1 parent 0bd90d4 commit b7289a7
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libs/libcast.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7289a7

Please sign in to comment.