WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Help with COMBAT_LOG_EVENT_UNFILTERED (CLASSIC) (https://www.wowinterface.com/forums/showthread.php?t=57858)

kneeki 03-02-20 12:40 PM

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);


myrroddin 03-02-20 01:20 PM

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


kneeki 03-02-20 02:18 PM

Thanks for the info!

Kanegasi 03-02-20 02:25 PM

Spell IDs in combat events are 0, both the cast and special returns like what spell was interrupted.

SDPhantom 03-03-20 09:18 PM

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


All times are GMT -6. The time now is 04:01 AM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI