My intention:
I wrote this script to track the internal cooldown of my trinket. So it's basically in it's functioning way a liteweight version of ExtraCD.
What i want the script to do:
Create an icon above my PlayerFrame and when my trinket procs, the ICD should be displayed.
What works right now:
The icon shows up and it also shows the ICD of 45 sec.
Whats wrong:
The CD display starts/resets whenever i use an ability or autoattack regardless which ability is used.
What i think is the problem:
I think the script fails when its checking if the trinket buff was applied to my character or not. It seems just to fire everytime SPELL_AURA_APPLIED is happening which causes the instant reset on the ICD display. But it should only fire for the trinket of course.
Code:
--create the event frame & register events
local eventFrame = CreateFrame("Frame")
eventFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
--create cooldown frame & texture it
local proc = CreateFrame("Cooldown","ProcTrinket",eventFrame,"CooldownFrameTemplate")
proc:ClearAllPoints()
proc:SetPoint("TOPRIGHT",PlayerFrame,-2,15)
proc:SetSize(30,30)
proc.icon = proc:CreateTexture(nil,"BACKGROUND")
proc.icon:SetAllPoints()
proc.icon:SetTexture("Interface\\Icons\\inv_60pvp_trinket3c")
--let the magic happen here
eventFrame:SetScript("OnEvent",function(self,...)
local _,event,_,_,sourceName,_,_,_,_,_,_,spellId,_,_,_,_ = select(2,...)
if event == "SPELL_AURA_APPLIED" or "SPELL_AURA_REFRESH" and sourceName == UnitName("player") and spellId == 126707 then
CooldownFrame_SetTimer(proc,GetTime(),45,1)
end
end)
Here is the way i figured out he COMBAT_LOG_EVENT stuff. I guess i misunderstood something here. I got the information from wowwiki, wowpedia and wowprogramming.
Code:
PARAMETER- timestamp
- event
- hideCaster
- sourceGUID
- sourceName
- sourceFlags
- sourceRaidFlags
- destGUID
- destName
- destFlags
- destRaidFlags
- spellId
- spellName
- spellSchool
- auraType
- amount