mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
ICE-7
- 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:
@ -5,8 +5,8 @@
|
|||||||
## Notes: Another HUD addon
|
## Notes: Another HUD addon
|
||||||
## Version: 1.2 ($Revision$)
|
## Version: 1.2 ($Revision$)
|
||||||
## SavedVariables: IceCoreDB
|
## SavedVariables: IceCoreDB
|
||||||
## OptionalDeps: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, MobHealth, 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
|
## X-Embeds: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-2.0, LibMobHealth-4.0
|
||||||
## X-Category: UnitFrame
|
## X-Category: UnitFrame
|
||||||
## X-Date: $Date$
|
## X-Date: $Date$
|
||||||
## X-Website: http://www.wowace.com/forums/index.php/topic,1705.0.html
|
## X-Website: http://www.wowace.com/forums/index.php/topic,1705.0.html
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
<Script file="libs\Deformat-2.0\Deformat-2.0.lua"/>
|
<Script file="libs\Deformat-2.0\Deformat-2.0.lua"/>
|
||||||
<Script file="libs\Gratuity-2.0\Gratuity-2.0.lua"/>
|
<Script file="libs\Gratuity-2.0\Gratuity-2.0.lua"/>
|
||||||
<Include file="libs\LibDogTag-2.0\lib.xml"/>
|
<Include file="libs\LibDogTag-2.0\lib.xml"/>
|
||||||
|
<Include file="libs\LibMobHealth-4.0\lib.xml"/>
|
||||||
<Include file="libs\LibSharedMedia-2.0\lib.xml"/>
|
<Include file="libs\LibSharedMedia-2.0\lib.xml"/>
|
||||||
<Script file="libs\Waterfall-1.0\Waterfall-1.0.lua"/>
|
<Script file="libs\Waterfall-1.0\Waterfall-1.0.lua"/>
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
local AceOO = AceLibrary("AceOO-2.0")
|
local AceOO = AceLibrary("AceOO-2.0")
|
||||||
|
|
||||||
|
local MobHealth = nil
|
||||||
local TargetHealth = AceOO.Class(IceUnitBar)
|
local TargetHealth = AceOO.Class(IceUnitBar)
|
||||||
|
|
||||||
TargetHealth.prototype.color = nil
|
TargetHealth.prototype.color = nil
|
||||||
@ -12,6 +13,8 @@ function TargetHealth.prototype:init()
|
|||||||
self:SetDefaultColor("TargetHealthHostile", 231, 31, 36)
|
self:SetDefaultColor("TargetHealthHostile", 231, 31, 36)
|
||||||
self:SetDefaultColor("TargetHealthFriendly", 46, 223, 37)
|
self:SetDefaultColor("TargetHealthFriendly", 46, 223, 37)
|
||||||
self:SetDefaultColor("TargetHealthNeutral", 210, 219, 87)
|
self:SetDefaultColor("TargetHealthNeutral", 210, 219, 87)
|
||||||
|
|
||||||
|
MobHealth = AceLibrary:HasInstance("LibMobHealth-4.0") and AceLibrary("LibMobHealth-4.0") or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -30,6 +33,7 @@ function TargetHealth.prototype:GetDefaultSettings()
|
|||||||
settings["raidIconXOffset"] = 12
|
settings["raidIconXOffset"] = 12
|
||||||
settings["raidIconYOffset"] = 0
|
settings["raidIconYOffset"] = 0
|
||||||
settings["lockIconAlpha"] = false
|
settings["lockIconAlpha"] = false
|
||||||
|
settings["abbreviateHealth"] = true
|
||||||
|
|
||||||
return settings
|
return settings
|
||||||
end
|
end
|
||||||
@ -38,7 +42,7 @@ end
|
|||||||
-- OVERRIDE
|
-- OVERRIDE
|
||||||
function TargetHealth.prototype:GetOptions()
|
function TargetHealth.prototype:GetOptions()
|
||||||
local opts = TargetHealth.super.prototype.GetOptions(self)
|
local opts = TargetHealth.super.prototype.GetOptions(self)
|
||||||
|
|
||||||
opts["mobhealth"] = {
|
opts["mobhealth"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "MobHealth3 support",
|
name = "MobHealth3 support",
|
||||||
@ -55,7 +59,7 @@ function TargetHealth.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 40
|
order = 40
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["classColor"] = {
|
opts["classColor"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Class color bar",
|
name = "Class color bar",
|
||||||
@ -72,7 +76,7 @@ function TargetHealth.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 41
|
order = 41
|
||||||
}
|
}
|
||||||
|
|
||||||
opts["hideBlizz"] = {
|
opts["hideBlizz"] = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = "Hide Blizzard Frame",
|
name = "Hide Blizzard Frame",
|
||||||
@ -203,7 +207,23 @@ function TargetHealth.prototype:GetOptions()
|
|||||||
end,
|
end,
|
||||||
order = 54
|
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
|
return opts
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -274,12 +294,18 @@ function TargetHealth.prototype:Update(unit)
|
|||||||
if not AceLibrary:HasInstance("LibDogTag-2.0") then
|
if not AceLibrary:HasInstance("LibDogTag-2.0") then
|
||||||
self:SetBottomText1(math.floor(self.healthPercentage * 100))
|
self:SetBottomText1(math.floor(self.healthPercentage * 100))
|
||||||
|
|
||||||
-- assumption that if a unit's max health is 100, it's not actual amount
|
-- first see if we have LibMobHealth that we can piggyback on
|
||||||
-- but rather a percentage - this obviously has one caveat though
|
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)
|
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.health = self:Round(self.health)
|
||||||
self.maxHealth = self:Round(self.maxHealth)
|
self.maxHealth = self:Round(self.maxHealth)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user