Post by tarumi
BOOMHeadshot.xml
<Frame name="BOOMHeadshot_Frame">
<Scripts>
<OnLoad>
BOOMHeadshot_OnLoad();
</OnLoad>
<OnEvent>
BOOMHeadshot_OnEvent(self, event, ...);
</OnEvent>
</Scripts>
</Frame>
BOOMHeadshot.lua
function BOOMHeadshot_OnLoad()
this:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");
end
function BOOMHeadshot_OnEvent(self, event, ...)
local timestamp, type, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = select(1, ...)
if (event=="COMBAT_LOG_EVENT_UNFILTERED") then
if (type=="SPELL_DAMAGE") then
local spellId, spellName, spellSchool = select(9, ...)
local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = select(12, ...)
if (spellName=="Mind Blast" and critical==true) then
PlaySoundFile("Interface\\AddOns\\BoomHeadShot\\crit.wav");
end
end
end
end
Make sure you have the crit.wav file in your folder for BoomHeadShot also. Keep the .toc file the same. The above code should work.
Ref:
http://www.wowwiki.com/API_COMBAT_LOG_EVENT