mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- bump toc
- added the ability to scale most health/power bars by the amount they're filled up with a customizable max/min color (health can go green to red, for example) - updated from SharedMedia-1.0 to LibSharedMedia-2.0
This commit is contained in:
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
<Script file="libs\AceConsole-2.0\AceConsole-2.0.lua"/>
|
||||
<Script file="libs\AceAddon-2.0\AceAddon-2.0.lua"/>
|
||||
<Script file="libs\Gratuity-2.0\Gratuity-2.0.lua"/>
|
||||
<Script file="libs\SharedMedia-1.0\SharedMedia-1.0.lua"/>
|
||||
<Include file="libs\LibSharedMedia-2.0\lib.xml"/>
|
||||
<Script file="libs\Waterfall-1.0\Waterfall-1.0.lua"/>
|
||||
|
||||
</Ui>
|
||||
|
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
Reference in New Issue
Block a user