|
View Bug Report
|
| Nameplate Health Text shows 0% before unit is dead |
| Bug #: |
5132 |
| File: |
Aloft (Beta) |
| Date: |
11-11-08 04:42 PM |
| By: |
Gnarfoz |
| Status: |
Fixed
|
During your conversion from MobHealth to just plain UnitHealthMax() usage, you must have somewhere used a floor() call instead of ceil(). Can't find it, but that's what must be the problem:
Units that have less than 1% but more than 0% (i.e. 0.9%) health will show as 0% even though they're not dead, yet.
Previously, that would show as 1%.
math.ceil(UnitHealth(unit) / UnitHealthMax(unit) * 100) should be the simplest implementation of "unit hp in percent", to explain what I'm talking about. ;)
ceil() would turn 0.1 into 1, floor() would turn 0.9 into 0.
The latter is happening. ^^
I hope I'm making sense at all. :D |
|
Notes |
| By: acapela - 11-11-08 06:57 PM |
yeah, for "[HealthFraction]", this could well be the case. i could see how for a boss with a huge amount of health, reaching "0%" could happen well before the boss is anywhere actually on the point of death (could have quite a few HPs left).
Aloft actually doesn't use UnitHealth() / UnitHealthMax(). one reason is that Aloft doesn't always have a unitid to use to drive those functions (i.e. in a multi-target/AOE situation), and another reason is that (now, in 3.0.2+) the the Blizzard StatusBar object that comprises the health bar in the underlying/default Blizzard nameplate "correct" health values in it, and Aloft just uses those (posted via the "OnValueChanged" event handler and gathered via StatusBar:GetMinMaxValues(), which is all a lot easier and more efficient that a health estimation addon).
but Aloft does calculate fractional health itself, from these values... so i will go make certain that ceil() is used properly in that calculation, just as you suggest.
|
|
|
Stats
|
|
Files: 4
Downloads: 586,740
Favorites: 1,173
|
New & Updated
|
|
WOWInterface
|
|
|
|