WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Tracking boss spells with and without cast time (https://www.wowinterface.com/forums/showthread.php?t=52080)

Namir 03-12-15 04:35 PM

Tracking boss spells with and without cast time
 
I am writing a Weakaura with custom LUA code to track and count the Shattering Smashes from Blackhand which have a cast time. So far I was able to generally count the smashes with the following code:
Code:

function(event,...)
    if event == "COMBAT_LOG_EVENT_UNFILTERED" then
        local type = select(2, ...)
        if type == "SPELL_CAST_SUCCESS" then
            local spellId = select(12, ...)
            if (spellId == 155992 or spellId == 159142 or spellId == 158054) then -- (Massive) Shattering Smash
                if WA_BlackhandSmashCount == nil then
                    WA_BlackhandSmashCount = 1
                else
                    WA_BlackhandSmashCount = WA_BlackhandSmashCount + 1
                end
            end
        end
    end

    -- JUMP TO NEXT FLOOR CODE DISCUSSED BELOW
end

In another aura the variable WA_BlackhandSmashCount is set to 1 when the encounter starts so there should be no issues. Now I want to reset the counter each phase. There are two hidden spells which he "casts" to start the next phase. I would try to intercept them like this

Code:

if event == "UNIT_SPELLCAST_SUCCEEDED" then
    local spellId = select(5, ...)
    if spellId == 161347 then -- Jump to second floor
        WA_BlackhandPhase = 2
        WA_BlackhandSmashCount = 1
    end
    if spellId == 161348 then -- Jump to third floor
        WA_BlackhandPhase = 3
        WA_BlackhandSmashCount = 1
    end
end

So the idea is to wait for the UNIT_SPELLCAST_SUCCEEDED event and because the two spells are specific to Blackhand there should be no issues. So I have to questions right now:
  • Would this code work like this? I am especially unsure about all the parameters in ... I am trying to process.
  • How may I simplify this code?


All times are GMT -6. The time now is 09:48 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI