View Single Post
04-02-15, 10:30 AM   #1
Sylen
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 50
Misunderstandings with COMBAT_LOG_EVENT

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
  1. timestamp
  2. event
  3. hideCaster
  4. sourceGUID
  5. sourceName
  6. sourceFlags
  7. sourceRaidFlags
  8. destGUID
  9. destName
  10. destFlags
  11. destRaidFlags
  12. spellId
  13. spellName
  14. spellSchool
  15. auraType
  16. amount
  Reply With Quote