Thread Tools Display Modes
11-22-10, 05:58 PM   #1
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 52
How to show target power only for worldboss level units

I was asked to add a power value to my target frames, however I personally don't feel that I want it all the time. Just for boss fights like LDW. I've tries to add it with the UnitClassification(unit) == "worldboss" but it doesn't seem to be working.

Does anyone have any input on how I might accomplish this? Or will I be stuck with values on every target.

Code:
	local ppval = lib.gen_fontstring(f, cfg.font, fontsize, "THINOUTLINE")
		if (UnitClassification(unit) == "worldboss") then
		ppval:SetPoint("RIGHT", f.Power, "RIGHT", 0, -12)
		ppval:SetJustifyH("RIGHT")
		else 
		ppval:ClearAllPoints()
	end
	
	if (UnitClassification(unit) == "worldboss") then
		f:Tag(ppval, "[karma:pp] [karma:power]")
	else
		f:Tag(ppval, "")
	end
  Reply With Quote
11-22-10, 06:08 PM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
You cannot do it that way. Because this is the spawn. Targets change all the time, setting the condition just in the target spawn is wrong. Instead move the condition to your power tags. Use the unit information in the tag to grab the unitlevel. If the target has level -1 it is a worldboss.
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
11-22-10, 06:11 PM   #3
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 52
Ahh I hadn't thought of that Zork, Thanks.
  Reply With Quote
11-24-10, 06:58 PM   #4
Sauerkraut
A Wyrmkin Dreamwalker
 
Sauerkraut's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 52
Took me a while to figure it all out, but I got it working. Thanks for the push in the right direction Zork. I really appreciate it.

Here is the code stripped down.

Code:
oUF.Tags['karma:bosspp'] = function(u)
	if UnitLevel(u) < 0 then 
		local _, str = UnitPowerType(u)
		if str then
			return hex(pcolors.power[str] or {250/255,  75/255,  60/255})..SVal(UnitPower(u))
		end
	end
end
oUF.TagEvents['karma:bosspp'] = 'UNIT_POWER'
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » How to show target power only for worldboss level units


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