#Hide when UNIT_SPELLCAST_SUCCEEDED?

2 messages · Page 1 of 1 (latest)

dense turtle
#

Hello,

I want to hide the icon when the event 'UNIT_SPELLCAST_SUCCEDED' fired and my if-condition matches. WeakAura: https://wago.io/qE5dvUZ1v

A simple "return false" doesn't work as it seems like. It should be timed = 5sec, but if PS has been applied, it should be hidden accordingly.

This WeakAura will alert you, if your Tank requests Pain Suppression. It accepts the following key words: - ps - ps me

#
function(event, msg, target, spellID, _, _, _, _, _, _, _, _, guid)
    if event == "CHAT_MSG_PARTY" or event == "CHAT_MSG_PARTY_LEADER" then
        if msg then
            local msg = string.lower(msg)
            local unit = UnitTokenFromGUID(guid)
            local spellInfo = C_Spell.GetSpellInfo(33206)
            local spellCD = C_Spell.GetSpellCooldown(33206)
            local spellCharges = C_Spell.GetSpellCharges(33206)
            local role = UnitGroupRolesAssigned(unit)
            
            --if role ~= "TANK" then return end
            if aura_env.psPhrases[msg] then
                if spellCharges.currentCharges == 0 then
                    local cdLeft = math.floor(spellCD.startTime + spellCD.duration - GetTime()) / 60
                    
                    if cdLeft < 1 then
                        SendChatMessage("No PS available - next PS ready in " .. string.format("%.0f", cdLeft * 60) .. " seconds", "PARTY")
                    else
                        SendChatMessage("No PS available - next PS ready in " .. string.format("%.1f", cdLeft) .. " minutes", "PARTY")
                    end
                else
                    aura_env.usePS = true
                    return true
                end
            end
        end
    elseif event == "CHAT_MSG_WHISPER" or event == "CHAT_MSG_WHISPER_INFORM" then
        if msg then
            local msg = string.lower(msg)
            local unit = UnitTokenFromGUID(guid)
            local spellInfo = C_Spell.GetSpellInfo(33206)
            local spellCD = C_Spell.GetSpellCooldown(33206)
            local spellCharges = C_Spell.GetSpellCharges(33206)
            local role = UnitGroupRolesAssigned(unit)
            
            --if role ~= "TANK" then return end
            if aura_env.psPhrases[msg] then
                if spellCharges.currentCharges == 0 then
                    local cdLeft = math.floor(spellCD.startTime + spellCD.duration - GetTime()) / 60
                    
                    if cdLeft < 1 then
                        SendChatMessage("No PS available - next PS ready in " .. string.format("%.0f", cdLeft * 60) .. " seconds", "WHISPER", nil, target)
                    else
                        SendChatMessage("No PS available - next PS ready in " .. string.format("%.1f", cdLeft) .. " minutes", "WHISPER", nil, target)
                    end
                else
                    aura_env.usePS = true
                    return true
                end
            end
        end
    elseif event == "UNIT_SPELLCAST_SUCCEEDED" then
        if spellID == 33206 and aura_env.usePS then
            SendChatMessage("Pain Suppression applied.", "PARTY")
            aura_env.usePS = false
            return false
        end
    end
end```