Thread: nUI + PTR 4.3
View Single Post
09-28-11, 03:53 PM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,927
The UnitPower problem is due to the following block of code:

Code:
function nUI_Unit:updatePowerInfo( unit_id, unit_info )

--	nUI_ProfileStart( ProfileCounter, "updatePowerInfo" );
	
	modified  = false;
	
	if unit_info then

		-- check the unit's current power data
		
		power_type = UnitPowerType( unit_id );
		cur_power  = UnitPower( unit_id, power_type );
		max_power  = UnitPowerMax( unit_id, power_type );
		print(power_type, cur_power, max_power)
		
		if cur_power and max_power then
			pct_power = max( 0, min( cur_power / max_power, 1 ));
		end
on any character/animal etc that doesn't have a power value it will do a divide by zero error. This so far includes vanity pets and bank tellers, I would guess the test dummies are the same as they do not fight back.

Just changing that if statement to the following stops that error when mousing over entities that do not have a power value.

Code:
		if cur_power and max_power and max_power > 0 then
			pct_power = max( 0, min( cur_power / max_power, 1 ));
		end
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818