WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   oUF (Otravi Unit Frames) (https://www.wowinterface.com/forums/forumdisplay.php?f=87)
-   -   oUF PP (https://www.wowinterface.com/forums/showthread.php?t=54165)

badness 08-08-16 03:01 PM

oUF PP
 
I've noticed a problem with pp when it comes to certain bosses like Iron Reaver,Kilrogg,Mannoroth etc that all use I'm guessing a different type of power that fills up.

This is how its implemented in the layout:
Lua Code:
  1. local hpp = createFont(hp, "OVERLAY", font, fontsize, fontflag, 1, 1, 1)
  2.         hpp:SetPoint("RIGHT", hp, -2, 0)
  3.  
  4.         if(unit == "player" or unit == "party") then
  5.             self:Tag(hpp, '[freeb:hp]')
  6.         else
  7.             self:Tag(hpp, '[freeb:pp]  [freeb:hp]')
  8.         end
  9.  
  10.         hp.hpp = hpp
  11.     end
  12.  
  13.     hp.bg = hpbg
  14.     self.Health = hp
This is what it looks like currently :
http://imgur.com/a/hJii8
http://imgur.com/a/0r0oF

So I'm wondering if its the way it is implement that is causing the problem or maybe its the oUF element?What can I do to correct the issue?

p3lim 08-08-16 03:38 PM

You have a problem with a tag, yet you didn't post the code for the tag *shrugs*

badness 08-08-16 03:48 PM

Quote:

Originally Posted by p3lim (Post 317671)
You have a problem with a tag, yet you didn't post the code for the tag *shrugs*

Sorry I'm still learning...here is the tag part

Lua Code:
  1. oUF.Tags.Methods['freeb:pp'] = function(u)
  2.     local power, powermax = UnitPower(u), UnitPowerMax(u)
  3.  
  4.     if power > 0 then
  5.         local _, str, r, g, b = UnitPowerType(u)
  6.         local t = oUF.colors.power[str]
  7.  
  8.         if t then
  9.             r, g, b = t[1], t[2], t[3]
  10.         end
  11.  
  12.         local perc = floor((power/powermax)*100+.5)
  13.         perc = powermax > 150 and " | "..perc.."%|r" or ""
  14.        
  15.         return hex(r, g, b)..siValue(power)..perc.."|r"
  16.     end
  17. end
  18. oUF.Tags.Events['freeb:pp'] = 'UNIT_POWER'

Freebaser 08-08-16 04:51 PM

Try using the type instead

Code:

local ptype, str, r, g, b = UnitPowerType(u)
local t = oUF.colors.power[ptype]


badness 08-08-16 05:18 PM

Quote:

Originally Posted by Freebaser (Post 317677)
Try using the type instead

Code:

local ptype, str, r, g, b = UnitPowerType(u)
local t = oUF.colors.power[ptype]


Replace lines 2-17 with this?

Freebaser 08-08-16 05:32 PM

No, just 5-6.

badness 08-08-16 06:41 PM

Thanks that fixed the tag issue but now the ppbar doesn't update and it isnt colored e.g Iron Reaver's Bar usually fills up for when she is fully charged to go into the air phase.

Freebaser 08-08-16 09:32 PM

Not sure why that is. If you attach your freeb.lua file, I'll look it over.

badness 08-08-16 09:51 PM

1 Attachment(s)
Yea sure thing!
Attachment 8775

Freebaser 08-09-16 01:08 PM

I'm not seeing any problems with the code. Is altpower and powerbar working correctly on the player and target frames?

badness 08-09-16 01:56 PM

Altpower seems to to work properly in places like Darkmoon Faire and for Sha of Anger, but I haven't tested it in HFC for Kilrogg since pre-patch. After my raid tonight I can get back to you with a solid answer. The powerbar seems to work for players and targetted players/npcs correctly, only on Iron Reaver so far I noticed it doesn't start empty and fills up. But like I said after my raid tonight I will post all of my findings here.

badness 08-10-16 05:53 AM

Ok so here is what I noticed:

1) Altpower seems to work fine I got the bar under my unitframe for Kilrogg
2) The tags on the targetframe seem to work numerically but display the wrong color for the pp
3) Iron reaver's power bar stays full and with the wrong color power (e.g http://imgur.com/a/snLA4)
4) The power bar works for players/NPCs but it has an issue with bosses hence Iron Reaver,Mannoroth,Kilrogg issue
5) Council fights like Conclave of Wind and Omnotron Defense System show the correct color for the power bar but the wrong color for the tag and they also seem to always be full iirc.
6) This all occurred after the change i had to make to the tag in order to get it to work for IR,Mannoroth etc

Freebaser 08-11-16 08:44 PM

Here is a power tag that should match the power bar.

Code:

oUF.Tags.Methods['freeb:pp'] = function(u)
        local power, powermax = UnitPower(u), UnitPowerMax(u)

        if power > 0 then
                local ptype, ptoken, r, g, b = UnitPowerType(u)
                local t = oUF.colors.power[ptoken]

                if(not t and r) then
                        if(r > 1) or (g > 1) or (b > 1) then
                                r, g, b = r / 255, g / 255, b / 255
                        end
                else
                        t = oUF.colors.power[ptype]
                end

                if(t) then
                        r, g, b = t[1], t[2], t[3]
                end

                local perc = floor((power/powermax)*100+.5)
                perc = powermax > 150 and " | "..perc.."%|r" or ""

                return hex(r, g, b)..siValue(power)..perc.."|r"
        end
end
oUF.Tags.Events['freeb:pp'] = 'UNIT_POWER UNIT_MAXPOWER'


Freebaser 08-11-16 09:08 PM

Ok, it looks like this was fixed in a pull request on github. You should download an updated oUF from here. I will revise the tag in my previous post as well.

badness 08-11-16 10:06 PM

Thanks a bunch for the help and support, in the limited testing I did all the issues seem to have been corrected..if I come across anything else I would leave you a message :)

badness 08-12-16 10:43 AM

The powerbars seem to be working again correctly but the tag issue is back since you gave me the updated tag function. Only got an issue on Mannoroth,Hellfire Assault Cannons,Kilrogg,Hulking Terrors

http://imgur.com/a/SwvFX

Freebaser 08-17-16 09:38 PM

Guess we can try updating the hex function instead. Replace it with this.

Code:

local function hex(r, g, b)
  if(type(r) == 'table') then
    if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
  end

  if(r > 1) then
    return ('|cff%02x%02x%02x'):format(r, g, b)
  else
    return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255)
  end
end

And update the power tag again.

Code:

oUF.Tags.Methods['freeb:pp'] = function(u)
        local power, powermax = UnitPower(u), UnitPowerMax(u)

        if power > 0 then
                local ptype, ptoken, r, g, b = UnitPowerType(u)
                local t = oUF.colors.power[ptoken]

                if(not t and not r) then
                        t = oUF.colors.power[ptype]
                end

                if(t) then
                        r, g, b = t[1], t[2], t[3]
                end

                local perc = floor((power/powermax)*100+.5)
                perc = powermax > 150 and " | "..perc.."%|r" or ""

                return hex(r, g, b)..siValue(power)..perc.."|r"
        end
end


badness 08-18-16 10:10 AM

Seems to have fixed the problem but when I joined a party I got this error:
Code:

Message: Interface\AddOns\oUF_Freeb\ftags.lua:17: attempt to compare number with nil
Time: 08/18/16 12:09:00
Count: 1
Stack: Interface\AddOns\oUF_Freeb\ftags.lua:17: in function <Interface\AddOns\oUF_Freeb\ftags.lua:12>
(tail call): ?
Interface\AddOns\oUF\elements\tags.lua:620: in function `UpdateTag'
Interface\AddOns\oUF\elements\tags.lua:452: in function `func'
Interface\AddOns\oUF\ouf.lua:163: in function `UpdateAllElements'
Interface\AddOns\oUF\ouf.lua:63: in function <Interface\AddOns\oUF\ouf.lua:38>
Interface\AddOns\oUF\ouf.lua:86: in function <Interface\AddOns\oUF\ouf.lua:79>
[C]: in function `SetAttribute'
Interface\FrameXML\SecureGroupHeaders.lua:203: in function <Interface\FrameXML\SecureGroupHeaders.lua:123>
Interface\FrameXML\SecureGroupHeaders.lua:488: in function <Interface\FrameXML\SecureGroupHeaders.lua:387>
[C]: in function `Show'
Interface\FrameXML\SecureStateDriver.lua:100: in function <Interface\FrameXML\SecureStateDriver.lua:95>
Interface\FrameXML\SecureStateDriver.lua:127: in function <Interface\FrameXML\SecureStateDriver.lua:119>

Locals: r = nil
g = nil
b = nil
(*temporary) = "nil"
(*temporary) = nil
(*temporary) = "nil"
(*temporary) = nil
(*temporary) = nil
(*temporary) = "attempt to compare number with nil"


Freebaser 08-18-16 07:43 PM

Adding a check for r and returning a value should fix that. Update the hex function to this.

Code:

local function hex(r, g, b)
  if(not r) then return "|cffFFFFFF" end

  if(type(r) == 'table') then
    if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
  end

  if(r > 1) then
    return ('|cff%02x%02x%02x'):format(r, g, b)
  else
    return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255)
  end
end


badness 08-20-16 07:09 AM

Quote:

Originally Posted by Freebaser (Post 318051)
Adding a check for r and returning a value should fix that. Update the hex function to this.

Code:

local function hex(r, g, b)
  if(not r) then return "|cffFFFFFF" end

  if(type(r) == 'table') then
    if(r.r) then r, g, b = r.r, r.g, r.b else r, g, b = unpack(r) end
  end

  if(r > 1) then
    return ('|cff%02x%02x%02x'):format(r, g, b)
  else
    return ('|cff%02x%02x%02x'):format(r * 255, g * 255, b * 255)
  end
end


Yup that fixed it and everything seems to be working perfectly again. Thanks alot Freebaser!


All times are GMT -6. The time now is 11:53 PM.

vBulletin © 2020, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI