Untitled

possible pair listing code for WoW
mail@pastecode.io avatar
unknown
lua
12 days ago
2.4 kB
3
Indexable
Never
function()
    aura_env.playerPairs = aura_env.playerPairs or {}  -- Initialize or reset the player pairs table
    aura_env.last = aura_env.last or 0  -- Last time the function was run

    -- If more than 0.25 seconds have passed since the last update
    if aura_env.last < GetTime() - 0.25 then
        aura_env.last = GetTime()  -- Update the last run time
        aura_env.playerPairs = {}  -- Clear the previous pairs

        -- Assuming that `aura_env.state` holds information about all affected players and their pairs
        if aura_env.state and aura_env.state.pairs then
            -- Loop through each pair in the state data
            for _, pairInfo in ipairs(aura_env.state.pairs) do
                local player1 = pairInfo.player1Name  -- Name of the first player in the pair
                local player2 = pairInfo.player2Name  -- Name of the second player in the pair

                -- Apply class color formatting to the names
                local coloredPlayer1 = WA_ClassColorName(player1)
                local coloredPlayer2 = WA_ClassColorName(player2)

                local immune1, immune2 = false, false

                -- Check if either player is immune
                for k, v in pairs(aura_env.immunes) do
                    if v and WA_GetUnitAura(player1, k, aura_env.debug) then
                        immune1 = true
                    end
                    if v and WA_GetUnitAura(player2, k, aura_env.debug) then
                        immune2 = true
                    end
                end

                -- Add immunity status to the names if needed
                local displayPlayer1 = immune1 and "|cFF00FF00" .. coloredPlayer1 .. " (Immuning)" or coloredPlayer1
                local displayPlayer2 = immune2 and "|cFF00FF00" .. coloredPlayer2 .. " (Immuning)" or coloredPlayer2

                -- Insert the pair into the list
                table.insert(aura_env.playerPairs, displayPlayer1 .. " - " .. displayPlayer2)
            end
        end
    end

    -- Create a string that shows all the pairs
    local result = ""
    for _, pair in ipairs(aura_env.playerPairs) do
        result = result .. pair .. "\n"  -- Add each pair to the result string
    end

    return result  -- Return the list of all pairs as a formatted string
end
Leave a Comment