Make a combat log to set cvar to 0 on cast success
Code:
if not MacroEvent then
MacroEvent = true
if not SuccessEvent then
SuccessEvent = CreateFrame("FRAME", nil, UIParent)
SuccessEvent:Hide()
end
local function SuccessEvent_OnEvent(self, event, ...)
local type, _, sourceGUID, sourceNAME, _, _, destGUID, destNAME = select(2, ...)
if event == "COMBAT_LOG_EVENT_UNFILTERED" then
if (type == "SPELL_CAST_SUCCESS")
or (type == "SPELL_DAMAGE") then
if sourceGUID == UnitGUID("player") then
local SpellCastSucceededID = select(12,...)
local SpellCastSucceededTarget = destGUID
--print(SpellCastSucceededID)
if GetCVar("Spell_"..string.gsub(GetSpellInfo(SpellCastSucceededID).."","%s","")) ~= nil
and tonumber(GetCVar("Spell_"..string.gsub(GetSpellInfo(SpellCastSucceededID).."","%s",""))) == 1 then
SetCVar("Spell_"..string.gsub(GetSpellInfo(SpellCastSucceededID).."","%s",""), 0)
end
end
end
end
end
SuccessEvent:SetScript("OnEvent", SuccessEvent_OnEvent)
SuccessEvent:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
Something like that