- removed dependency on LibDogTag-2.0 by request. DogTag formatting is available if DogTag is present but IceHUD will use the old formatting otherwise

This commit is contained in:
Parnic
2008-01-22 02:04:26 +00:00
parent 134e0802e8
commit 37c253c98d
7 changed files with 133 additions and 78 deletions

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
IceBarElement = AceOO.Class(IceElement)
IceBarElement.virtual = true
@ -16,6 +17,10 @@ IceBarElement.prototype.target = nil
-- Constructor --
function IceBarElement.prototype:init(name)
IceBarElement.super.prototype.init(self, name)
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -239,11 +244,14 @@ function IceBarElement.prototype:GetOptions()
type = 'text',
name = 'Upper Text',
desc = 'The upper text to display under this bar (accepts LibDogTag formatting)\n\nSee http://www.wowace.com/wiki/LibDogTag-2.0/ for tag info',
disabled = function()
return DogTag == nil
end,
get = function()
return self.moduleSettings.upperText
end,
set = function(v)
if v ~= '' and v ~= nil then
if DogTag ~= nil and v ~= '' and v ~= nil then
v = DogTag:FixCasing(v)
end
@ -256,11 +264,14 @@ function IceBarElement.prototype:GetOptions()
type = 'text',
name = 'Lower Text',
desc = 'The lower text to display under this bar (accepts LibDogTag formatting)\n\nSee http://www.wowace.com/wiki/LibDogTag-2.0/ for tag info',
disabled = function()
return DogTag == nil
end,
get = function()
return self.moduleSettings.lowerText
end,
set = function(v)
if v ~= '' and v ~= nil then
if DogTag ~= nil and v ~= '' and v ~= nil then
v = DogTag:FixCasing(v)
end

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
local PetHealth = AceOO.Class(IceUnitBar)
@ -15,6 +16,10 @@ function PetHealth.prototype:init()
self:SetDefaultColor("PetHealthUnhappy", 164, 30, 30)
self.scalingEnabled = true
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -110,11 +115,15 @@ function PetHealth.prototype:Update(unit)
self:UpdateBar(self.health/self.maxHealth, color)
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("pet", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("pet", self.moduleSettings.lowerText))
if DogTag ~= nil then
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("pet", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("pet", self.moduleSettings.lowerText))
end
else
self:SetBottomText1(self.healthPercentage)
end
end

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
local PetMana = AceOO.Class(IceUnitBar)
@ -13,6 +14,10 @@ function PetMana.prototype:init()
self:SetDefaultColor("PetFocus", 242, 149, 98)
self.scalingEnabled = true
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -121,11 +126,15 @@ function PetMana.prototype:Update(unit)
self:UpdateBar(self.mana/self.maxMana, color)
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("player", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("player", self.moduleSettings.lowerText))
if DogTag ~= nil then
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("player", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("player", self.moduleSettings.lowerText))
end
else
self:SetBottomText1(self.manaPercentage)
end
end

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
local PlayerHealth = AceOO.Class(IceUnitBar)
@ -10,6 +11,10 @@ function PlayerHealth.prototype:init()
PlayerHealth.super.prototype.init(self, "PlayerHealth", "player")
self:SetDefaultColor("PlayerHealth", 37, 164, 30)
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -140,11 +145,16 @@ function PlayerHealth.prototype:Update(unit)
self:UpdateBar(self.health/self.maxHealth, color)
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("player", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("player", self.moduleSettings.lowerText))
if DogTag ~= nil then
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("player", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("player", self.moduleSettings.lowerText))
end
else
self:SetBottomText1(self.healthPercentage)
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), textColor)
end
end

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
local PlayerMana = AceOO.Class(IceUnitBar)
@ -14,6 +15,10 @@ function PlayerMana.prototype:init()
self:SetDefaultColor("PlayerMana", 62, 54, 152)
self:SetDefaultColor("PlayerRage", 171, 59, 59)
self:SetDefaultColor("PlayerEnergy", 218, 231, 31)
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -186,29 +191,29 @@ function PlayerMana.prototype:Update(unit)
self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", self.moduleSettings.tickerAlpha))
end
--[[
-- extra hack for whiny rogues (are there other kind?)
local displayPercentage = self.manaPercentage
if (self.manaType == 3) then
displayPercentage = self.mana
end
self:SetBottomText1(displayPercentage)
local amount = self:GetFormattedText(self.mana, self.maxMana)
-- druids get a little shorted string to make room for druid mana in forms
if (self.unitClass == "DRUID" and self.manaType ~= 0) then
amount = self:GetFormattedText(self.mana)
end
self:SetBottomText2(amount, color)
]]
if DogTag ~= nil then
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("player", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("player", self.moduleSettings.lowerText))
end
else
-- extra hack for whiny rogues (are there other kind?)
local displayPercentage = self.manaPercentage
if (self.manaType == 3) then
displayPercentage = self.mana
end
self:SetBottomText1(displayPercentage)
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("player", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("player", self.moduleSettings.lowerText))
local amount = self:GetFormattedText(self.mana, self.maxMana)
-- druids get a little shorted string to make room for druid mana in forms
if (self.unitClass == "DRUID" and self.manaType ~= 0) then
amount = self:GetFormattedText(self.mana)
end
self:SetBottomText2(amount, color)
end
end

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
local TargetHealth = AceOO.Class(IceUnitBar)
@ -13,6 +14,10 @@ function TargetHealth.prototype:init()
self:SetDefaultColor("TargetHealthHostile", 231, 31, 36)
self:SetDefaultColor("TargetHealthFriendly", 46, 223, 37)
self:SetDefaultColor("TargetHealthNeutral", 210, 219, 87)
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -168,33 +173,32 @@ function TargetHealth.prototype:Update(unit)
end
self:UpdateBar(self.health/self.maxHealth, self.color)
--[[
self:SetBottomText1(self.healthPercentage)
-- 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:Round(self.health)
self.maxHealth = self:Round(self.maxHealth)
end
if (self.maxHealth ~= 100) then
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), self.color)
if DogTag ~= nil then
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("target", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("target", self.moduleSettings.lowerText))
end
else
self:SetBottomText2()
end
]]
self:SetBottomText1(self.healthPercentage)
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("target", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("target", self.moduleSettings.lowerText))
-- 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:Round(self.health)
self.maxHealth = self:Round(self.maxHealth)
end
if (self.maxHealth ~= 100) then
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), self.color)
else
self:SetBottomText2()
end
end
end

View File

@ -1,5 +1,6 @@
local AceOO = AceLibrary("AceOO-2.0")
local DogTag = AceLibrary("LibDogTag-2.0")
local DogTag = nil
local TargetMana = AceOO.Class(IceUnitBar)
@ -12,6 +13,10 @@ function TargetMana.prototype:init()
self:SetDefaultColor("TargetRage", 235, 44, 26)
self:SetDefaultColor("TargetEnergy", 228, 242, 31)
self:SetDefaultColor("TargetFocus", 242, 149, 98)
if AceLibrary:HasInstance("LibDogTag-2.0") then
DogTag = AceLibrary("LibDogTag-2.0")
end
end
@ -80,14 +85,16 @@ function TargetMana.prototype:Update(unit)
self:UpdateBar(self.mana/self.maxMana, color)
-- self:SetBottomText1(self.manaPercentage)
-- self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color)
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("target", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("target", self.moduleSettings.lowerText))
if DogTag ~= nil then
if self.moduleSettings.upperText ~= nil and self.moduleSettings.upperText ~= '' then
self:SetBottomText1(DogTag:Evaluate("target", self.moduleSettings.upperText))
end
if self.moduleSettings.lowerText ~= nil and self.moduleSettings.lowerText ~= '' then
self:SetBottomText2(DogTag:Evaluate("target", self.moduleSettings.lowerText))
end
else
self:SetBottomText1(self.manaPercentage)
self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color)
end
end