WoWInterface - View Single Post - Raid Frame Range Value
View Single Post
03-18-09, 09:58 AM   #2
nUI's Author
spiel2001's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 7,724
I've moved this over into the developer chat thread as it's not actually modifying the layout as a customization you can make... it modifying core code and, frankly, really can't be done in a logic sense.

On your action bars there's no "value" for what out of range is, it's actually determined by the Bliz IsActionInRange() API method call which returns true/false for whether or not the action is currently within range of the target.

On the unit frames, that's more complicated. Any unit which is not in the same zone is by definition, out of range. Any unit which is more than 100 yards away is by definition, out of range. After that it turns into black magic and can only be determined by looking to see what spells you have that can be used on the unit and what their min and max ranges are.

If the unit is in range of the usable spell, then we know their distance to be between that min and max. I have to spin the list of spells you know and keep adjusting the min and max to try and narrow down the range and guess because Bliz does not offer a real, discrete, way to determine distance to a unit. So I can only assume the unit is somewhere between the greatest minimum distance that I found a usable spell for and the smallest maximum distance. If I can't find any spell you can use on the unit, I have to assume it's because it is out of range of all of your spells and it gets flagged as out of range. It is not an exact science. but there's still no magic number.

If you look at the code in [ Interface > AddOns > nUI > Units > nUI_UnitStatus.lua ] you'll see on line 233 where I flag the unit as out of range if the distance to the unit is over 40 yards... that's because the only way the distance can be known over 40 yards is if the unit is in a different zone, is not loaded by Bliz (over 100 yards away) or you have no spells that you can use on the unit. If the distance to the unit is less than or equal to 40 yards, it can only be because you have spells you can use on it and therefore it is by definition in range.

What people don't get is that I am, ultimately, an artist at heart.
My brush has two colors, 1 and 0, and my canvas is made of silicon.

Official nUI Web Site: http://www.nUIaddon.com
Official nUI Support Forum: http://forums.nUIaddon.com
My day job: http://www.presidio.com/