jp-ganis / JPS

Protected LUA DPS Addon
32 stars 46 forks source link

Problems With Multi-Rotations #426

Open kirk24788 opened 9 years ago

kirk24788 commented 9 years ago

When having multiple Rotations and OOC Rotations (i.e. Warlock Destro by default) you won't see the Rotation Dropdown.

from jprotations.lua:

function jps.activeRotation(rotationTable)
    if rotationTable == nil then
        local oocCount = tableCount(oocRotations, getCurrentKey())
        if not jps.Combat and oocCount > 0 then return jps.activeRotation(oocRotations) end
        if jps.PvP then return jps.activeRotation(pvpRotations) else return jps.activeRotation(pveRotations) end
    end

    if not rotationTable[getCurrentKey()] then return nil end
    local countRotations = 0

    for k,v in pairs(rotationTable[getCurrentKey()]) do
        countRotations = countRotations+1 
        jps.ToggleRotationName[k] = v.tooltip
    end

    if jps.initializedRotation == false then
        if countRotations > 1 and jps.getConfigVal("rotation dropdown visible") == 1 then
            jps.MultiRotation = true
            UIDropDownMenu_SetText(DropDownRotationGUI, jps.ToggleRotationName[activeRotation])
            rotationDropdownHolder:Show()
            jps.deleteFunctionFromQueue(hideDropdown,"gui_loaded")
        else  
            rotationDropdownHolder:Hide()
            jps.addTofunctionQueue(hideDropdown,"gui_loaded")
        end
        jps.firstInitializingLoop = true
    end

    jps.initializedRotation = true

    if not rotationTable[getCurrentKey()][activeRotation] then return nil end
    jps.Count = activeRotation
    jps.Tooltip = rotationTable[getCurrentKey()][activeRotation].tooltip
    return rotationTable[getCurrentKey()][activeRotation]
end

Here's the problem....if you have OOC Rotations this function gets called pretty early and will count the OOC Rotations:

    for k,v in pairs(rotationTable[getCurrentKey()]) do
        countRotations = countRotations+1 
        jps.ToggleRotationName[k] = v.tooltip
    end

Which should be one - so the next condition is always false an no DropDown is shown:

    if countRotations > 1 and jps.getConfigVal("rotation dropdown visible") == 1 then
            jps.MultiRotation = true
            UIDropDownMenu_SetText(DropDownRotationGUI, jps.ToggleRotationName[activeRotation])
            rotationDropdownHolder:Show()
            jps.deleteFunctionFromQueue(hideDropdown,"gui_loaded")
        else  

Any ideas? I'm using a third Destruction Rotation in a separate AddOn, but without DropDown it's pretty useless.

ghost commented 9 years ago

We need a function that does the following: everytime a new rotation is registered there should be something that counts the rotations and toggles the visibility of the dropdown - not only once. I look later into

ghost commented 9 years ago

this should fix the problem