Yatabar

Yatabar

35.8k Downloads

Water totems are misplaced/missing on the screen

keolwyn opened this issue ยท 0 comments

commented

Again, my level 27 shaman, clean installation of the Yarabar, no files in WTF folder. After logging in, both water totems I have are shown for a short amount of time ( ~5 seconds) and then gone.

(shortly after the login)
Screenshot_4

(5 seconds late)
Screenshot_14

On every relog, these two water totems are shown higher and higher
Screenshot_7

I checked Yatabar.lua in WTF\Account\xxx\SavedVariables folder and found out that these two totems were added to the profile multiple times

YatabarDB = {
    ["profileKeys"] = {
        ["xxx - xxx"] = "profile",
    },
    ["profiles"] = {
        ["profile"] = {
            ["orderTotemsInElement"] = {
                ["FIRE"] = {
	            {
			["id"] = 6363,
			["duration"] = 30,
			["name"] = "Searing Totem",
	             }, -- [1]
		},
		["WATER"] = {
		    {
		        ["id"] = 5394,
			["duration"] = 60,
			["name"] = "Healing Stream Totem",
		    }, -- [1]
		    {
			["id"] = 5675,
			["duration"] = 60,
			["name"] = "Mana Spring Totem",
                     }, -- [2]
		    {
		        ["id"] = 5394,
			["duration"] = 60,
			["name"] = "Healing Stream Totem",
		    }, -- [3]
		    {
			["id"] = 5675,
			["duration"] = 60,
			["name"] = "Mana Spring Totem",
                     }, -- [4]
		    {
		        ["id"] = 5394,
			["duration"] = 60,
			["name"] = "Healing Stream Totem",
		    }, -- [5]
		    {
			["id"] = 5675,
			["duration"] = 60,
			["name"] = "Mana Spring Totem",
                     }, -- [6]
		    {
		        ["id"] = 5394,
			["duration"] = 60,
			["name"] = "Healing Stream Totem",
		    }, -- [7]
		    {
			["id"] = 5675,
			["duration"] = 60,
			["name"] = "Mana Spring Totem",
                    }, -- [8]
                    ....
                },
	    },
        },
    },
}

I dug a bit and found out that in function SetOrderTotemSpells(), when you are checking for the first fill

if Yatabar.orderTotemsInElement[element][1] == nil then
    firstFill = true
end

for some odd reason Yatabar.orderTotemsInElement[element][1] is always nil for water totems and they are added to the Yatabar.orderTotemsInElement[element] table again and again.

To fix this behavior I reassigned firstFill variable to false after spells are added to the table

if firstFill then
    for k, spell in pairs(spells) do
        if k ~= "count" then 	
            table.insert(Yatabar.orderTotemsInElement[element],spell)
        end
    end
    firstFill = false
else
    ...
end

!Important, you need to delete Yatabar.lua from WTF folder to get this working

Screenshot_9

Now water totems are shown in the right place, but the popup menu for them is activated. For this time BugSack was able to catch an error, which caused this behavior

Screenshot_10

And one more time reason for this was my low level. Inside the function HidePopups() you are calling Yatabar["TotemHeader"..element]:Execute() on all totem frames, while there is no such frame for the AIR element, cause I don't have air totems yet, so function failed before it was able to hide water totems popup.

Screenshot_15

You could check if totem frame != nil to fix it

function Yatabar:HidePopups()
    for element, idx in pairs(Yatabar.orderElements) do
        if Yatabar["TotemHeader"..element] ~= nil then
	    Yatabar["TotemHeader"..element]:Execute([[
	    control:Run(close)
	    ]])
	end
    end
end

Screenshot_16