mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
Added rounding for MobHealth3 numbers
This commit is contained in:
@ -100,8 +100,12 @@ function TargetHealth.prototype:Update(unit)
|
|||||||
|
|
||||||
if (self.moduleSettings.mobhealth and MobHealth3) then
|
if (self.moduleSettings.mobhealth and MobHealth3) then
|
||||||
self.health, self.maxHealth, _ = MobHealth3:GetUnitHealth(self.unit, self.health, self.maxHealth)
|
self.health, self.maxHealth, _ = MobHealth3:GetUnitHealth(self.unit, self.health, self.maxHealth)
|
||||||
|
|
||||||
|
self.health = self:Round(self.health)
|
||||||
|
self.maxHealth = self:Round(self.maxHealth)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- assumption that if a unit's max health is 100, it's not actual amount
|
-- assumption that if a unit's max health is 100, it's not actual amount
|
||||||
-- but rather a percentage - this obviously has one caveat though
|
-- but rather a percentage - this obviously has one caveat though
|
||||||
|
|
||||||
@ -113,6 +117,21 @@ function TargetHealth.prototype:Update(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function TargetHealth.prototype:Round(health)
|
||||||
|
if (health > 1000000) then
|
||||||
|
return self:MathRound(health/100000, 1) .. "M"
|
||||||
|
end
|
||||||
|
if (health > 1000) then
|
||||||
|
return self:MathRound(health/1000, 1) .. "k"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function TargetHealth.prototype:MathRound(num, idp)
|
||||||
|
local mult = 10^(idp or 0)
|
||||||
|
return math.floor(num * mult + 0.5) / mult
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Load us up
|
-- Load us up
|
||||||
TargetHealth:new()
|
TargetHealth:new()
|
||||||
|
Reference in New Issue
Block a user