Code:
local LastCastSpell = nil;
if CombatLog == nil then
CombatLog = CreateFrame('Frame')
CombatLog:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
function SuccessfulCast(self, event, ...)
local eventType, _, sourceGUID, _, _, _, _, _, _, _, spellID = select(2, ...);
if (event=="COMBAT_LOG_EVENT_UNFILTERED") then
local playerGUID = UnitGUID("player");
if eventType == "SPELL_CAST_SUCCESS" and sourceGUID == playerGUID then
LastCastSpell = spellID;
end
end
end
CombatLog:SetScript('OnEvent', SuccessfulCast)
CombatLog = true
end
function LastCast ()
return LastCastSpell;
end
Call Example:
Code:
if LastCast() == (133) then
print('we just cast fireball!');
end