diff --git a/IceHUD.toc b/IceHUD.toc
index 380bde1..5ef33a6 100644
--- a/IceHUD.toc
+++ b/IceHUD.toc
@@ -1,12 +1,12 @@
-## Interface: 20200
+## Interface: 20300
## Author: Iceroth
## Name: IceHUD
## Title: IceHUD |cff7fff7f -Ace2-|r
## Notes: Another HUD addon
## Version: 1.0 ($Revision$)
## SavedVariables: IceCoreDB
-## OptionalDeps: Ace2, GratuityLib, SharedMediaLib, WaterfallLib, MobHealth
-## X-Embeds: Ace2, GratuityLib, SharedMediaLib, WaterfallLib
+## OptionalDeps: Ace2, GratuityLib, LibSharedMedia, WaterfallLib, MobHealth
+## X-Embeds: Ace2, GratuityLib, LibSharedMedia, WaterfallLib
## X-Category: UnitFrame
## X-Date: $Date$
## X-Website: http://www.wowace.com/forums/index.php/topic,1705.0.html
@@ -38,4 +38,3 @@ modules\ComboPoints.lua
modules\CastBar.lua
modules\TargetCast.lua
modules\MirrorBar.lua
-
diff --git a/IceUnitBar.lua b/IceUnitBar.lua
index 4db109f..ae80284 100644
--- a/IceUnitBar.lua
+++ b/IceUnitBar.lua
@@ -13,6 +13,7 @@ IceUnitBar.prototype.healthPercentage = nil
IceUnitBar.prototype.mana = nil
IceUnitBar.prototype.maxMana = nil
IceUnitBar.prototype.manaPercentage = nil
+IceUnitBar.prototype.scaleColorInst = nil
IceUnitBar.prototype.unitClass = nil
IceUnitBar.prototype.hasPet = nil
@@ -30,15 +31,23 @@ function IceUnitBar.prototype:init(name, unit)
self:SetDefaultColor("Dead", 0.5, 0.5, 0.5)
self:SetDefaultColor("Tapped", 0.8, 0.8, 0.8)
+ self:SetDefaultColor("ScaledHealthColor", 0, 1, 0)
+ self:SetDefaultColor("ScaledManaColor", 0, 0, 1)
+ self:SetDefaultColor("MaxHealthColor", 37, 200, 30)
+ self:SetDefaultColor("MinHealthColor", 200, 37, 30)
+ self:SetDefaultColor("MaxManaColor", 0, 0, 255)
+ self:SetDefaultColor("MinManaColor", 255, 0, 255)
end
-- OVERRIDE
function IceUnitBar.prototype:GetDefaultSettings()
local settings = IceUnitBar.super.prototype.GetDefaultSettings(self)
-
+
settings["lowThreshold"] = 0
-
+ settings["scaleHealthColor"] = true
+ settings["scaleManaColor"] = true
+
return settings
end
@@ -141,6 +150,9 @@ end
-- OVERRIDE
function IceUnitBar.prototype:Update()
+ local maxColor = {r = 0, g = 0, b = 0}
+ local minColor = {r = 0, g = 0, b = 0}
+
IceUnitBar.super.prototype.Update(self)
self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit))
@@ -153,6 +165,30 @@ function IceUnitBar.prototype:Update()
self.manaPercentage = math.floor( (self.mana/self.maxMana)*100 )
_, self.unitClass = UnitClass(self.unit)
+
+ if( self.moduleSettings.scaleHealthColor ) then
+ minColor.r,minColor.g,minColor.b = self:GetColor("MinHealthColor")
+ maxColor.r,maxColor.g,maxColor.b = self:GetColor("MaxHealthColor")
+ self:SetScaledColor(self.healthPercentage/100, maxColor, minColor)
+ self:SetColor("ScaledHealthColor", self.scaleColorInst.r, self.scaleColorInst.g, self.scaleColorInst.b)
+ end
+ if( self.moduleSettings.scaleManaColor ) then
+ minColor.r,minColor.g,minColor.b = self:GetColor("MinManaColor")
+ maxColor.r,maxColor.g,maxColor.b = self:GetColor("MaxManaColor")
+ self:SetScaledColor(self.manaPercentage/100, maxColor, minColor)
+ self:SetColor("ScaledManaColor", self.scaleColorInst.r, self.scaleColorInst.g, self.scaleColorInst.b)
+ end
+end
+
+
+function IceUnitBar.prototype:SetScaledColor(percent, maxColor, minColor)
+ if( not self.scaleColorInst ) then
+ self.scaleColorInst = { r = 0, g = 0, b = 0 }
+ end
+
+ self.scaleColorInst.r = ((maxColor.r - minColor.r) * percent) + minColor.r
+ self.scaleColorInst.g = ((maxColor.g - minColor.g) * percent) + minColor.g
+ self.scaleColorInst.b = ((maxColor.b - minColor.b) * percent) + minColor.b
end
@@ -206,3 +242,7 @@ function IceUnitBar.prototype:OnFlashUpdate()
end
+function IceUnitBar.prototype:SetScaleColorEnabled(enabled)
+ self.moduleSettings.scaleColor = enabled
+end
+
diff --git a/embeds.xml b/embeds.xml
index 19ae5a2..42d9af9 100644
--- a/embeds.xml
+++ b/embeds.xml
@@ -9,7 +9,7 @@
-
+
diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua
index 4eb3712..a3e1620 100644
--- a/modules/PetHealth.lua
+++ b/modules/PetHealth.lua
@@ -93,6 +93,10 @@ function PetHealth.prototype:Update(unit)
elseif(self.happiness == 1) then
color = "PetHealthUnhappy"
end
+
+ if (self.moduleSettings.scaleColor) then
+ color = "ScaledHealthColor"
+ end
if not (self.alive) then
color = "Dead"
@@ -104,6 +108,31 @@ function PetHealth.prototype:Update(unit)
end
+-- OVERRIDE
+function PetHealth.prototype:GetOptions()
+ local opts = PetHealth.super.prototype.GetOptions(self)
+
+ opts["scaleHealthColor"] = {
+ type = "toggle",
+ name = "Color bar by health %",
+ desc = "Colors the health bar from MaxHealthColor to MinHealthColor based on current health %",
+ get = function()
+ return self.moduleSettings.scaleHealthColor
+ end,
+ set = function(value)
+ self.moduleSettings.scaleHealthColor = value
+ self:Redraw()
+ end,
+ disabled = function()
+ return not self.moduleSettings.enabled
+ end,
+ order = 41
+ }
+
+ return opts
+end
+
+
-- Load us up
IceHUD.PetHealth = PetHealth:new()
diff --git a/modules/PetMana.lua b/modules/PetMana.lua
index 7e3b1c0..672476d 100644
--- a/modules/PetMana.lua
+++ b/modules/PetMana.lua
@@ -99,6 +99,9 @@ function PetMana.prototype:Update(unit)
end
local color = "PetMana"
+ if (self.moduleSettings.scaleManaColor) then
+ color = "ScaledManaColor"
+ end
if not (self.alive) then
color = "Dead"
else
@@ -116,6 +119,31 @@ function PetMana.prototype:Update(unit)
end
+-- OVERRIDE
+function PetMana.prototype:GetOptions()
+ local opts = PetMana.super.prototype.GetOptions(self)
+
+ opts["scaleManaColor"] = {
+ type = "toggle",
+ name = "Color bar by mana %",
+ desc = "Colors the mana bar from MaxManaColor to MinManaColor based on current mana %",
+ get = function()
+ return self.moduleSettings.scaleManaColor
+ end,
+ set = function(value)
+ self.moduleSettings.scaleManaColor = value
+ self:Redraw()
+ end,
+ disabled = function()
+ return not self.moduleSettings.enabled
+ end,
+ order = 51
+ }
+
+ return opts
+end
+
+
-- Load us up
IceHUD.PetMana = PetMana:new()
diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua
index 3db685c..d7eba00 100644
--- a/modules/PlayerHealth.lua
+++ b/modules/PlayerHealth.lua
@@ -80,6 +80,23 @@ function PlayerHealth.prototype:GetOptions()
end,
order = 41
}
+
+ opts["scaleHealthColor"] = {
+ type = "toggle",
+ name = "Color bar by health %",
+ desc = "Colors the health bar from MaxHealthColor to MinHealthColor based on current health %",
+ get = function()
+ return self.moduleSettings.scaleHealthColor
+ end,
+ set = function(value)
+ self.moduleSettings.scaleHealthColor = value
+ self:Redraw()
+ end,
+ disabled = function()
+ return not self.moduleSettings.enabled
+ end,
+ order = 42
+ }
return opts
end
@@ -103,6 +120,10 @@ function PlayerHealth.prototype:Update(unit)
color = self.unitClass
end
+ if (self.moduleSettings.scaleHealthColor) then
+ color = "ScaledHealthColor"
+ end
+
if not (self.alive) then
color = "Dead"
end
diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua
index 08e3d14..744323f 100644
--- a/modules/PlayerMana.lua
+++ b/modules/PlayerMana.lua
@@ -68,6 +68,23 @@ function PlayerMana.prototype:GetOptions()
end,
order = 52
}
+
+ opts["scaleManaColor"] = {
+ type = "toggle",
+ name = "Color bar by mana %",
+ desc = "Colors the mana bar from MaxManaColor to MinManaColor based on current mana %",
+ get = function()
+ return self.moduleSettings.scaleManaColor
+ end,
+ set = function(value)
+ self.moduleSettings.scaleManaColor = value
+ self:Redraw()
+ end,
+ disabled = function()
+ return not self.moduleSettings.enabled
+ end,
+ order = 53
+ }
return opts
end
@@ -142,6 +159,9 @@ function PlayerMana.prototype:Update(unit)
end
local color = "PlayerMana"
+ if (self.moduleSettings.scaleManaColor) then
+ color = "ScaledManaColor"
+ end
if not (self.alive) then
color = "Dead"
else
@@ -183,7 +203,7 @@ end
-- OVERRIDE
function PlayerMana.prototype:UpdateBar(scale, color, alpha)
self.noFlash = (self.manaType ~= 0)
-
+
PlayerMana.super.prototype.UpdateBar(self, scale, color, alpha)
end
diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua
index 3594f9d..c8f2611 100644
--- a/modules/TargetHealth.lua
+++ b/modules/TargetHealth.lua
@@ -84,6 +84,23 @@ function TargetHealth.prototype:GetOptions()
end,
order = 42
}
+
+ opts["scaleHealthColor"] = {
+ type = "toggle",
+ name = "Color bar by health %",
+ desc = "Colors the health bar from MaxHealthColor to MinHealthColor based on current health %",
+ get = function()
+ return self.moduleSettings.scaleHealthColor
+ end,
+ set = function(value)
+ self.moduleSettings.scaleHealthColor = value
+ self:Redraw()
+ end,
+ disabled = function()
+ return not self.moduleSettings.enabled
+ end,
+ order = 43
+ }
return opts
end
@@ -137,6 +154,10 @@ function TargetHealth.prototype:Update(unit)
self.color = self.unitClass
end
+ if (self.moduleSettings.scaleHealthColor) then
+ self.color = "ScaledHealthColor"
+ end
+
if (self.tapped) then
self.color = "Tapped"
end
diff --git a/modules/TargetMana.lua b/modules/TargetMana.lua
index 511a746..9c4a748 100644
--- a/modules/TargetMana.lua
+++ b/modules/TargetMana.lua
@@ -58,6 +58,9 @@ function TargetMana.prototype:Update(unit)
local manaType = UnitPowerType(self.unit)
local color = "TargetMana"
+ if (self.moduleSettings.scaleManaColor) then
+ color = "ScaledManaColor"
+ end
if (manaType == 1) then
color = "TargetRage"
elseif (manaType == 2) then
@@ -76,6 +79,30 @@ function TargetMana.prototype:Update(unit)
end
+-- OVERRIDE
+function TargetMana.prototype:GetOptions()
+ local opts = TargetMana.super.prototype.GetOptions(self)
+
+ opts["scaleManaColor"] = {
+ type = "toggle",
+ name = "Color bar by mana %",
+ desc = "Colors the mana bar from MaxManaColor to MinManaColor based on current mana %",
+ get = function()
+ return self.moduleSettings.scaleManaColor
+ end,
+ set = function(value)
+ self.moduleSettings.scaleManaColor = value
+ self:Redraw()
+ end,
+ disabled = function()
+ return not self.moduleSettings.enabled
+ end,
+ order = 51
+ }
+
+ return opts
+end
+
-- Load us up
IceHUD.TargetMana = TargetMana:new()