- added LibMobHealth-4.0 to externals/embeds so people without other ace mods get estimated health values properly
- added an option to allow shortening health values or not (1100 => 1.1k) for non-dogtag people
This commit is contained in:
Parnic
2008-02-17 21:57:10 +00:00
parent 5bf246f527
commit 571bfeacb9
3 changed files with 36 additions and 9 deletions

View File

@ -5,8 +5,8 @@
## Notes: Another HUD addon
## Version: 1.2 ($Revision$)
## SavedVariables: IceCoreDB
## OptionalDeps: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, MobHealth, Deformat-2.0, LibDogTag-2.0
## X-Embeds: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-2.0
## OptionalDeps: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-2.0
## X-Embeds: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-2.0, LibMobHealth-4.0
## X-Category: UnitFrame
## X-Date: $Date$
## X-Website: http://www.wowace.com/forums/index.php/topic,1705.0.html

View File

@ -11,6 +11,7 @@
<Script file="libs\Deformat-2.0\Deformat-2.0.lua"/>
<Script file="libs\Gratuity-2.0\Gratuity-2.0.lua"/>
<Include file="libs\LibDogTag-2.0\lib.xml"/>
<Include file="libs\LibMobHealth-4.0\lib.xml"/>
<Include file="libs\LibSharedMedia-2.0\lib.xml"/>
<Script file="libs\Waterfall-1.0\Waterfall-1.0.lua"/>

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local MobHealth = nil
local TargetHealth = AceOO.Class(IceUnitBar)
TargetHealth.prototype.color = nil
@ -12,6 +13,8 @@ function TargetHealth.prototype:init()
self:SetDefaultColor("TargetHealthHostile", 231, 31, 36)
self:SetDefaultColor("TargetHealthFriendly", 46, 223, 37)
self:SetDefaultColor("TargetHealthNeutral", 210, 219, 87)
MobHealth = AceLibrary:HasInstance("LibMobHealth-4.0") and AceLibrary("LibMobHealth-4.0") or nil
end
@ -30,6 +33,7 @@ function TargetHealth.prototype:GetDefaultSettings()
settings["raidIconXOffset"] = 12
settings["raidIconYOffset"] = 0
settings["lockIconAlpha"] = false
settings["abbreviateHealth"] = true
return settings
end
@ -204,6 +208,22 @@ function TargetHealth.prototype:GetOptions()
order = 54
}
opts["shortenHealth"] = {
type = 'toggle',
name = 'Abbreviate estimated health',
desc = 'If this is checked, then a health value of 1100 will display as 1.1k, otherwise it shows the number\n\nNote: this only applies if you are NOT using DogTag',
get = function()
return self.moduleSettings.abbreviateHealth
end,
set = function(v)
self.moduleSettings.abbreviateHealth = v
end,
disabled = function()
return not self.moduleSettings.enabled
end,
order = 40.1
}
return opts
end
@ -274,12 +294,18 @@ function TargetHealth.prototype:Update(unit)
if not AceLibrary:HasInstance("LibDogTag-2.0") then
self:SetBottomText1(math.floor(self.healthPercentage * 100))
-- first see if we have LibMobHealth that we can piggyback on
if MobHealth then
self.health = MobHealth:GetUnitCurrentHP(self.unit)
self.maxHealth = MobHealth:GetUnitMaxHP(self.unit)
elseif (self.maxHealth == 100 and self.moduleSettings.mobhealth and MobHealth3) then
-- 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
if (self.maxHealth == 100 and self.moduleSettings.mobhealth and MobHealth3) then
self.health, self.maxHealth, _ = MobHealth3:GetUnitHealth(self.unit, self.health, self.maxHealth)
end
if self.moduleSettings.abbreviateHealth then
self.health = self:Round(self.health)
self.maxHealth = self:Round(self.maxHealth)
end