Quantcast oUF PP - WoWInterface
 
Thread Tools Display Modes
08-08-16, 03:01 PM   #1
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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?
  Reply With Quote
08-08-16, 03:38 PM   #2
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,696
You have a problem with a tag, yet you didn't post the code for the tag *shrugs*
  Reply With Quote
08-08-16, 03:48 PM   #3
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
Originally Posted by p3lim View Post
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'
  Reply With Quote
08-08-16, 04:51 PM   #4
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Try using the type instead

Code:
local ptype, str, r, g, b = UnitPowerType(u)
local t = oUF.colors.power[ptype]
  Reply With Quote
08-08-16, 05:18 PM   #5
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
Originally Posted by Freebaser View Post
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?
  Reply With Quote
08-08-16, 05:32 PM   #6
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
No, just 5-6.
  Reply With Quote
08-08-16, 06:41 PM   #7
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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.
  Reply With Quote
08-08-16, 09:32 PM   #8
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
Not sure why that is. If you attach your freeb.lua file, I'll look it over.
  Reply With Quote
08-08-16, 09:51 PM   #9
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
Yea sure thing!
freeb.lua
  Reply With Quote
08-09-16, 01:08 PM   #10
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
I'm not seeing any problems with the code. Is altpower and powerbar working correctly on the player and target frames?
  Reply With Quote
08-09-16, 01:56 PM   #11
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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.
  Reply With Quote
08-10-16, 05:53 AM   #12
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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
  Reply With Quote
08-11-16, 08:44 PM   #13
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
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'

Last edited by Freebaser : 08-11-16 at 09:10 PM. Reason: updated code
  Reply With Quote
08-11-16, 09:08 PM   #14
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
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.
  Reply With Quote
08-11-16, 10:06 PM   #15
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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
  Reply With Quote
08-12-16, 10:43 AM   #16
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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

Last edited by badness : 08-12-16 at 02:23 PM.
  Reply With Quote
08-17-16, 09:38 PM   #17
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
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
  Reply With Quote
08-18-16, 10:10 AM   #18
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
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"
  Reply With Quote
08-18-16, 07:43 PM   #19
Freebaser
A Molten Kobold Bandit
 
Freebaser's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 135
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
  Reply With Quote
08-20-16, 07:09 AM   #20
badness
A Cliff Giant
 
badness's Avatar
Join Date: May 2010
Posts: 74
Originally Posted by Freebaser View Post
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!
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » oUF PP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off