LibGetFrame

LibGetFrame

716k Downloads

Errors since 3 september 2020 update

yourbytecode opened this issue ยท 1 comments

commented

268x LibGetFrame-1.0\LibGetFrame-1.0-21.lua:230: bad argument #1 to 'pairs' (table expected, got nil)
[string "@LibGetFrame-1.0\LibGetFrame-1.0-21.lua"]:230: in function `GetUnitFrame'
[string "--[==[ Error in 'Targeted Spells' ]==] return function(allstates, event, sourceUnit)
if not aura_env.loaded then return false end
if event == "ENCOUNTER_END" then
-- reset aura state to avoid ghost icons between pulls
for _,cast in pairs(aura_env.allcasts) do
if cast.nameplate then
aura_env.removeFontFromNameplate(cast.nameplate)
end
end
aura_env.allcasts = {}
for _,state in pairs(allstates) do
state.show = false
state.changed = true
end
return true
end
if sourceUnit and UnitIsEnemy(sourceUnit, "player") then
local allcasts = aura_env.allcasts
local sourceGUID = UnitGUID(sourceUnit)
local iconChanged = false
local cast = allcasts[sourceGUID]

    if event == "UNIT_SPELLCAST_START"
    or event == "UNIT_SPELLCAST_DELAYED" 
    or event == "UNIT_SPELLCAST_CHANNEL_START"
    or event == "UNIT_SPELLCAST_CHANNEL_UPDATE"
    or event == "UNIT_TARGET"
    then
        if not cast then
            -- check if unit is casting
            local castType
            local name,_,texture,castStart,castEnd,_,_,notInterruptible,spellId = UnitCastingInfo(sourceUnit)
            if name then
                castType = "cast"
            else
                name,_,texture,castStart,castEnd,_,notInterruptible,spellId = UnitChannelInfo(sourceUnit)
                if name then
                    castType = "channel"
                end
            end
            
            if spellId and not aura_env.isBlackListed(spellId, sourceUnit) then
                local spellInList = aura_env.spells[spellId]
                -- find npc's target
                local targetUnit = sourceUnit.."target"
                if UnitExists(targetUnit) then
                    for groupmember in WA_IterateGroupMembers() do
                        if UnitIsUnit(targetUnit, groupmember) then
                            local targetGUID = UnitGUID(groupmember)
                            local targeted = targetGUID == WeakAuras.myGUID
                            local showIcon = (spellInList and spellInList.icon) or (not spellInList and aura_env.config.icon.enable)
                            local showGlow = spellInList and spellInList.glow
                            local showNameplate
                            if aura_env.config.nameplate.enable == 1 then
                                showNameplate = true
                            elseif aura_env.config.nameplate.enable == 2 then
                                showNameplate = (spellInList and spellInList.nameplate) or (not spellInList)
                            elseif aura_env.config.nameplate.enable == 3 then
                                showNameplate = spellInList and spellInList.nameplate
                            elseif aura_env.config.nameplate.enable == 4 then
                                showNameplate = false
                            end
                            local playSound = targeted and spellInList and spellInList.sound
                            local bigIcon = targeted and spellInList and spellInList.bigIcon
                            allcasts[sourceGUID] = {
                                name = name,
                                icon = texture,
                                start = castStart/1000,
                                expirationTime = castEnd/1000,
                                spellId = spellId,
                                target = groupmember,
                                targetGUID = targetGUID,
                                targeted = targeted,
                                spellInList = spellInList,
                                notInterruptible = notInterruptible,
                                castType = castType,
                                showIcon = showIcon,
                                showGlow = showGlow,
                                bigIcon = bigIcon,
                                showNameplate = showNameplate,
                                nameplate = showNameplate and aura_env.addFontToNameplate(
                                    sourceUnit,
                                    groupmember
                                ),
                                playSound = playSound
                            }
                            iconChanged = true
                            break
                        end
                    end
                end
            end
        else
            if UnitExists(sourceUnit) then
                if event == "UNIT_SPELLCAST_DELAYED" 
                or event == "UNIT_SPELLCAST_CHANNEL_UPDATE"
                or event == "UNIT_SPELLCAST_CHANNEL_START"
                then
                    local castType
                    local name,_,_,castStart,castEnd,_,_,notInterruptible,spellId = UnitCastingInfo(sourceUnit)
                    if name then
                        castType = "cast"
                    else
                        name,_,_,castStart,castEnd,_,notInterruptible,spellId = UnitChannelInfo(sourceUnit)
                        if name then
                            castType = "channel"
                        end
                    end
                    if spellId then
                        cast.notInterruptible = notInterruptible
                        cast.castType = castType
                        cast.start = castStart/1000
                        cast.expirationTime = castEnd/1000
                        cast.changed = true
                        iconChanged = true
                    end
                elseif event == "UNIT_TARGET" then
                    local targetUnit = sourceUnit.."target"
                    if UnitExists(targetUnit) then
                        for groupmember in WA_IterateGroupMembers() do
                            if UnitIsUnit(targetUnit, groupmember) then
                                if cast.nameplate then
                                    aura_env.removeFontFromNameplate(cast.nameplate)
                                end
                                
                                local targetGUID = UnitGUID(groupmember)
                                local targeted = targetGUID == WeakAuras.myGUID
                                local spellId = cast.spellId
                                cast.changed = true
                                cast.target = groupmember
                                cast.targetGUID = targetGUID
                                cast.targeted = targeted
                                
                                if cast.showNameplate then
                                    cast.nameplate = aura_env.addFontToNameplate(
                                        sourceUnit,
                                        groupmember
                                    )
                                end
                                
                                iconChanged = true
                                break
                            end
                        end
                    end
                end
            end
        end
    elseif cast then
        if event == "UNIT_SPELLCAST_STOP" --  or event == "UNIT_SPELLCAST_SUCCEEDED"
        or event == "UNIT_SPELLCAST_INTERRUPTED"
        or event == "UNIT_SPELLCAST_FAILED"
        or event == "UNIT_SPELLCAST_FAILED_QUIET"
        or event == "UNIT_SPELLCAST_CHANNEL_STOP"
        then
            if cast.nameplate then
                aura_env.removeFontFromNameplate(cast.nameplate)
            end
            allcasts[sourceGUID] = nil
            iconChanged = true
        elseif event == "NAME_PLATE_UNIT_REMOVED" then
            if cast.nameplate then
                aura_env.removeFontFromNameplate(cast.nameplate)
            end
        elseif event == "NAME_PLATE_UNIT_ADDED" then
            if cast.showNameplate then
                cast.nameplate = aura_env.addFontToNameplate(
                    sourceUnit,
                    cast.target
                )
            end
        end
    end
    
    if iconChanged then
        local change = false
        -- update allstates from allcasts
        for sourceGUID, cast in pairs(allcasts) do
            -- index for allstates is "spellId_targetGUID"
            local index = ("%s_%s"):format(cast.spellId, cast.targetGUID)
            
            local state = allstates[index]
            
            if state and state.show then
                state.casts[sourceGUID] = true
                if cast.expirationTime > state.expirationTime then
                    state.expirationTime = cast.expirationTime
                    state.changed = true
                    change = true
                end
            else
                allstates[index] = {
                    show = true,
                    name = cast.name,
                    icon = cast.icon,
                    changed = true,
                    autoHide = true,
                    progressType = "timed",
                    duration = cast.expirationTime - cast.start,
                    expirationTime = cast.expirationTime,
                    spellId = cast.spellId,
                    castType = cast.castType,
                    notInterruptible = cast.notInterruptible,
                    target = cast.target,
                    unit = cast.showIcon and cast.target,
                    targetGUID = cast.targetGUID,
                    frame = WeakAuras.GetUnitFrame(cast.target),
                    casts = {
                        [sourceGUID] = true
                    },
                    targeted = cast.targeted,
                    showGlow = cast.showGlow,
                    playSound = cast.playSound,
                    bigIcon = cast.bigIcon,
                    showIcon = cast.showIcon,
                }
                change = true
            end
        end
        
        -- count how much of the same cast is showing each icon
        -- remove casts stopped from state.casts
        -- remove state if state.casts is empty
        for index, state in pairs(allstates) do 
            if state.show and state.showIcon then
                local countcasts = 0
                for sourceGUID,_ in pairs(state.casts) do
                    local cast = allcasts[sourceGUID]
                    if not cast
                    or (cast and cast.targetGUID ~= state.targetGUID)
                    then
                        state.casts[sourceGUID] = nil
                    else 
                        countcasts = countcasts + 1
                    end
                end
                if state.stacks ~= countcasts then
                    state.stacks = countcasts
                    state.changed = true
                    change = true
                end
                -- hide if no cast
                if countcasts == 0 then
                    state.show = false 
                    state.changed = true
                    change = true
                end
            end
        end
        if change then
            return true 
        end
    end
end

end"]:207: in function <[string "--[==[ Error in 'Targeted Spells' ]==] retu..."]:1>
[string "=[C]"]: in function xpcall' [string "@WeakAuras\GenericTrigger.lua"]:548: in function <WeakAuras\GenericTrigger.lua:541> [string "@WeakAuras\GenericTrigger.lua"]:737: in function ScanEventsInternal'
[string "@WeakAuras\GenericTrigger.lua"]:698: in function `ScanEvents'
[string "@WeakAuras\GenericTrigger.lua"]:850: in function <WeakAuras\GenericTrigger.lua:835>

Locals:
Skipped (In Encounter)

commented

fixed with 02d91c1