Thread Tools Display Modes
03-02-20, 12:40 PM   #1
kneeki
A Flamescale Wyrmkin
 
kneeki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 134
Help with COMBAT_LOG_EVENT_UNFILTERED (CLASSIC)

It's been a long time since I've made a WoW addon, and I'm a bit stuck. Using a modified snippet from the wowwiki I came up with the following, which doesn't give any error but also doesn't print '... just critted!'.

Code:
local frame = CreateFrame("FRAME", "FooAddonFrame");
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED");

function eventHandler(self, event, ...)
    local timestamp, type, hideCaster, sourceGUID, sourceName, sourceFlags, sourceFlags2, destGUID, destName, destFlags, destFlags2 = select(1, ...);

    if (event == "COMBAT_LOG_EVENT_UNFILTERED") then
      if (type == "SWING_DAMAGE") then
  
        local amount, overkill, school, resisted, blocked, absorbed, critical, glancing, crushing = select(15, ...);

        if (spellName == "Sinister Strike" and critical == true) then
          print("Sinister Strike just critted!");
        end
      end
    end
end

frame:SetScript("OnEvent", eventHandler);
  Reply With Quote
03-02-20, 01:20 PM   #2
myrroddin
A Pyroguard Emberseer
 
myrroddin's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 1,237
That is the old method, which you have discovered does not work. CLEU's payload is returned from CombatLogGetCurrentEventInfo().

The core problem you will face is that WoWWiki is ancient and should not be used. Use wow.gampedia.com instead, or redirect from wowpedia.org. Be aware that the payload is different depending on subevents; that much hasn't changed in some time with the HUGE caveats that spellID and threat information do not exist in Classic. https://wow.gamepedia.com/COMBAT_LOG_EVENT

I haven't tested for myself, but I suspect that spellID's "value" in Classic will be nil but it still exists in the return chain, ie:
Code:
local something, spellID, somethingElse = blah
print(spellID) --> nil

Last edited by myrroddin : 03-02-20 at 01:31 PM. Reason: Note about subevents
  Reply With Quote
03-02-20, 02:18 PM   #3
kneeki
A Flamescale Wyrmkin
 
kneeki's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2006
Posts: 134
Thanks for the info!
  Reply With Quote
03-02-20, 02:25 PM   #4
Kanegasi
A Molten Giant
 
Kanegasi's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2007
Posts: 666
Spell IDs in combat events are 0, both the cast and special returns like what spell was interrupted.
  Reply With Quote
03-03-20, 09:18 PM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,308
Also avoid checking for any argument returning a hard true. Many parts of the WoW API still return the old 1/nil flag. Instead, you should check for criticals like this.
Code:
if critical then
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Help with COMBAT_LOG_EVENT_UNFILTERED (CLASSIC)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off