- updated to support LibDogTag-3.0

- on first run, forced reset all custom DogTags to the module default since some of the old default tags no longer work
This commit is contained in:
Parnic
2008-04-03 07:10:30 +00:00
parent 0ec9b2bb95
commit 55028c88fb
11 changed files with 50 additions and 26 deletions

View File

@ -23,8 +23,9 @@ IceBarElement.prototype.CurrScale = 1
function IceBarElement.prototype:init(name) function IceBarElement.prototype:init(name)
IceBarElement.super.prototype.init(self, name) IceBarElement.super.prototype.init(self, name)
if AceLibrary:HasInstance("LibDogTag-2.0") then if AceLibrary:HasInstance("LibDogTag-3.0") then
DogTag = AceLibrary("LibDogTag-2.0") DogTag = AceLibrary("LibDogTag-3.0")
AceLibrary("LibDogTag-Unit-3.0")
end end
end end
@ -41,6 +42,14 @@ function IceBarElement.prototype:Enable()
self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat") self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckCombat")
self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged") self:RegisterEvent("PLAYER_TARGET_CHANGED", "TargetChanged")
if self.moduleSettings.myTagVersion < IceHUD.CurrTagVersion then
local origDefaults = self:GetDefaultSettings()
self.moduleSettings.upperText = origDefaults["upperText"]
self.moduleSettings.lowerText = origDefaults["lowerText"]
self.moduleSettings.myTagVersion = IceHUD.CurrTagVersion
end
self:RegisterFontStrings() self:RegisterFontStrings()
end end
@ -48,10 +57,10 @@ end
function IceBarElement.prototype:RegisterFontStrings() function IceBarElement.prototype:RegisterFontStrings()
if DogTag ~= nil then if DogTag ~= nil then
if self.frame.bottomUpperText and self.moduleSettings.upperText then if self.frame.bottomUpperText and self.moduleSettings.upperText then
DogTag:AddFontString(self.frame.bottomUpperText, self.frame, self.unit, self.moduleSettings.upperText) DogTag:AddFontString(self.frame.bottomUpperText, self.frame, self.moduleSettings.upperText, "Unit", { unit = self.unit })
end end
if self.frame.bottomLowerText and self.moduleSettings.lowerText then if self.frame.bottomLowerText and self.moduleSettings.lowerText then
DogTag:AddFontString(self.frame.bottomLowerText, self.frame, self.unit, self.moduleSettings.lowerText) DogTag:AddFontString(self.frame.bottomLowerText, self.frame, self.moduleSettings.lowerText, "Unit", {unit = self.unit })
end end
end end
end end
@ -75,6 +84,7 @@ function IceBarElement.prototype:GetDefaultSettings()
settings["shouldAnimate"] = true settings["shouldAnimate"] = true
settings["desiredLerpTime"] = 0.2 settings["desiredLerpTime"] = 0.2
settings["barVisible"] = {bg = true, bar = true} settings["barVisible"] = {bg = true, bar = true}
settings["myTagVersion"] = 2
return settings return settings
end end
@ -327,7 +337,7 @@ function IceBarElement.prototype:GetOptions()
end, end,
set = function(v) set = function(v)
if DogTag ~= nil and v ~= '' and v ~= nil then if DogTag ~= nil and v ~= '' and v ~= nil then
v = DogTag:FixCodeStyle(v) v = DogTag:CleanCode(v)
end end
self.moduleSettings.upperText = v self.moduleSettings.upperText = v
@ -349,7 +359,7 @@ function IceBarElement.prototype:GetOptions()
end, end,
set = function(v) set = function(v)
if DogTag ~= nil and v ~= '' and v ~= nil then if DogTag ~= nil and v ~= '' and v ~= nil then
v = DogTag:FixCodeStyle(v) v = DogTag:CleanCode(v)
end end
self.moduleSettings.lowerText = v self.moduleSettings.lowerText = v

View File

@ -3,6 +3,8 @@ IceHUD = AceLibrary("AceAddon-2.0"):new("AceConsole-2.0", "AceDebug-2.0")
local waterfall = AceLibrary("Waterfall-1.0") local waterfall = AceLibrary("Waterfall-1.0")
local SML = AceLibrary("LibSharedMedia-2.0") local SML = AceLibrary("LibSharedMedia-2.0")
IceHUD.CurrTagVersion = 3
IceHUD.Location = "Interface\\AddOns\\IceHUD" IceHUD.Location = "Interface\\AddOns\\IceHUD"
IceHUD.options = IceHUD.options =
{ {

View File

@ -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, Deformat-2.0, LibDogTag-2.0 ## OptionalDeps: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-3.0
## X-Embeds: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-2.0, LibMobHealth-4.0 ## X-Embeds: Ace2, GratuityLib, LibSharedMedia-2.0, WaterfallLib, Deformat-2.0, LibDogTag-3.0, LibDogTag-Unit-3.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

View File

@ -10,7 +10,8 @@
<Script file="libs\AceAddon-2.0\AceAddon-2.0.lua"/> <Script file="libs\AceAddon-2.0\AceAddon-2.0.lua"/>
<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-3.0\lib.xml"/>
<Include file="libs\LibDogTag-Unit-3.0\lib.xml"/>
<Include file="libs\LibMobHealth-4.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"/>

View File

@ -111,7 +111,7 @@ function PetHealth.prototype:Update(unit)
self:UpdateBar(self.health/self.maxHealth, color) self:UpdateBar(self.health/self.maxHealth, color)
if not AceLibrary:HasInstance("LibDogTag-2.0") then if not AceLibrary:HasInstance("LibDogTag-3.0") then
self:SetBottomText1(math.floor(self.healthPercentage * 100)) self:SetBottomText1(math.floor(self.healthPercentage * 100))
end end
end end

View File

@ -122,7 +122,7 @@ function PetMana.prototype:Update(unit)
self:UpdateBar(self.mana/self.maxMana, color) self:UpdateBar(self.mana/self.maxMana, color)
if not AceLibrary:HasInstance("LibDogTag-2.0") then if not AceLibrary:HasInstance("LibDogTag-3.0") then
self:SetBottomText1(math.floor(self.manaPercentage * 100)) self:SetBottomText1(math.floor(self.manaPercentage * 100))
end end
end end

View File

@ -687,7 +687,7 @@ function PlayerHealth.prototype:Update(unit)
self:UpdateBar(self.health/self.maxHealth, color) self:UpdateBar(self.health/self.maxHealth, color)
if not AceLibrary:HasInstance("LibDogTag-2.0") then if not AceLibrary:HasInstance("LibDogTag-3.0") then
self:SetBottomText1(math.floor(self.healthPercentage * 100)) self:SetBottomText1(math.floor(self.healthPercentage * 100))
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), textColor) self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), textColor)
end end

View File

@ -185,7 +185,7 @@ function PlayerMana.prototype:Update(unit)
self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", self.moduleSettings.tickerAlpha)) self.tickerFrame:SetStatusBarColor(self:GetColor("PlayerEnergy", self.moduleSettings.tickerAlpha))
end end
if not AceLibrary:HasInstance("LibDogTag-2.0") then if not AceLibrary:HasInstance("LibDogTag-3.0") then
-- extra hack for whiny rogues (are there other kind?) -- extra hack for whiny rogues (are there other kind?)
local displayPercentage = self.manaPercentage local displayPercentage = self.manaPercentage
if (self.manaType == 3) then if (self.manaType == 3) then

View File

@ -27,7 +27,7 @@ function TargetHealth.prototype:GetDefaultSettings()
settings["classColor"] = false settings["classColor"] = false
settings["hideBlizz"] = true settings["hideBlizz"] = true
settings["upperText"] = "[PercentHP:Round]" settings["upperText"] = "[PercentHP:Round]"
settings["lowerText"] = "[Text([CurHP:Round]/[MaxHP:Round]):HPColor:Bracket]" settings["lowerText"] = "[(HP:Round \"/\" MaxHP:Round):HPColor:Bracket]"
settings["raidIconOnTop"] = true settings["raidIconOnTop"] = true
settings["showRaidIcon"] = true settings["showRaidIcon"] = true
settings["raidIconXOffset"] = 12 settings["raidIconXOffset"] = 12
@ -291,7 +291,7 @@ function TargetHealth.prototype:Update(unit)
self:UpdateBar(self.health/self.maxHealth, self.color) self:UpdateBar(self.health/self.maxHealth, self.color)
if not AceLibrary:HasInstance("LibDogTag-2.0") then if not AceLibrary:HasInstance("LibDogTag-3.0") then
self:SetBottomText1(math.floor(self.healthPercentage * 100)) self:SetBottomText1(math.floor(self.healthPercentage * 100))
-- first see if we have LibMobHealth that we can piggyback on -- first see if we have LibMobHealth that we can piggyback on

View File

@ -33,8 +33,9 @@ function TargetInfo.prototype:init()
self.scalingEnabled = true self.scalingEnabled = true
if AceLibrary:HasInstance("LibDogTag-2.0") then if AceLibrary:HasInstance("LibDogTag-3.0") then
DogTag = AceLibrary("LibDogTag-2.0") DogTag = AceLibrary("LibDogTag-3.0")
AceLibrary("LibDogTag-Unit-3.0")
end end
end end
@ -60,6 +61,15 @@ function TargetInfo.prototype:Enable(core)
RegisterUnitWatch(self.frame) RegisterUnitWatch(self.frame)
if self.moduleSettings.myTagVersion < IceHUD.CurrTagVersion then
local origDefaults = self:GetDefaultSettings()
self.moduleSettings.line1tag = origDefaults["line1tag"]
self.moduleSettings.line2tag = origDefaults["line2tag"]
self.moduleSettings.line3tag = origDefaults["line3tag"]
self.moduleSettings.myTagVersion = IceHUD.CurrTagVersion
end
self:RegisterFontStrings() self:RegisterFontStrings()
end end
@ -259,7 +269,7 @@ function TargetInfo.prototype:GetOptions()
return self.moduleSettings.line1Tag return self.moduleSettings.line1Tag
end, end,
set = function(v) set = function(v)
v = DogTag:FixCodeStyle(v) v = DogTag:CleanCode(v)
self.moduleSettings.line1Tag = v self.moduleSettings.line1Tag = v
self:RegisterFontStrings() self:RegisterFontStrings()
self:Redraw() self:Redraw()
@ -279,7 +289,7 @@ function TargetInfo.prototype:GetOptions()
return self.moduleSettings.line2Tag return self.moduleSettings.line2Tag
end, end,
set = function(v) set = function(v)
v = DogTag:FixCodeStyle(v) v = DogTag:CleanCode(v)
self.moduleSettings.line2Tag = v self.moduleSettings.line2Tag = v
self:RegisterFontStrings() self:RegisterFontStrings()
self:Redraw() self:Redraw()
@ -299,7 +309,7 @@ function TargetInfo.prototype:GetOptions()
return self.moduleSettings.line3Tag return self.moduleSettings.line3Tag
end, end,
set = function(v) set = function(v)
v = DogTag:FixCodeStyle(v) v = DogTag:CleanCode(v)
self.moduleSettings.line3Tag = v self.moduleSettings.line3Tag = v
self:RegisterFontStrings() self:RegisterFontStrings()
self:Redraw() self:Redraw()
@ -328,9 +338,10 @@ function TargetInfo.prototype:GetDefaultSettings()
defaults["mouseBuff"] = true defaults["mouseBuff"] = true
defaults["filter"] = "Never" defaults["filter"] = "Never"
defaults["perRow"] = 10 defaults["perRow"] = 10
defaults["line1Tag"] = "[NameHostile]" defaults["line1Tag"] = "[Name:HostileColor]"
defaults["line2Tag"] = "[Level:DifficultyColor] [ [IsPlayer ? Race ! CreatureType]:ClassColor] [ [IsPlayer ? Class]:ClassColor] [ [~PvP ? Text(PvE) ! Text(PvP)]:HostileColor] [Leader:Yellow] [InCombat:Red] [Classification]" defaults["line2Tag"] = "[Level:DifficultyColor] [[IsPlayer ? Race ! CreatureType]:ClassColor] [[IsPlayer ? Class]:ClassColor] [[~PvP ? \"PvE\" ! \"PvP\"]:HostileColor] [IsLeader ? \"Leader\":Yellow] [InCombat:Red] [Classification]"
defaults["line3Tag"] = "[Guild:Angle]" defaults["line3Tag"] = "[Guild:Angle]"
defaults["myTagVersion"] = 2
return defaults return defaults
end end
@ -340,21 +351,21 @@ function TargetInfo.prototype:RegisterFontStrings()
if DogTag ~= nil then if DogTag ~= nil then
if self.frame.targetName then if self.frame.targetName then
if self.moduleSettings.line1Tag ~= '' then if self.moduleSettings.line1Tag ~= '' then
DogTag:AddFontString(self.frame.targetName, self.frame, target, self.moduleSettings.line1Tag) DogTag:AddFontString(self.frame.targetName, self.frame, self.moduleSettings.line1Tag, "Unit", { unit = target })
else else
DogTag:RemoveFontString(self.frame.targetName) DogTag:RemoveFontString(self.frame.targetName)
end end
end end
if self.frame.targetInfo then if self.frame.targetInfo then
if self.moduleSettings.line2Tag ~= '' then if self.moduleSettings.line2Tag ~= '' then
DogTag:AddFontString(self.frame.targetInfo, self.frame, target, self.moduleSettings.line2Tag) DogTag:AddFontString(self.frame.targetInfo, self.frame, self.moduleSettings.line2Tag, "Unit", { unit = target })
else else
DogTag:RemoveFontString(self.frame.targetInfo) DogTag:RemoveFontString(self.frame.targetInfo)
end end
end end
if self.frame.targetGuild then if self.frame.targetGuild then
if self.moduleSettings.line3Tag ~= '' then if self.moduleSettings.line3Tag ~= '' then
DogTag:AddFontString(self.frame.targetGuild, self.frame, target, self.moduleSettings.line3Tag) DogTag:AddFontString(self.frame.targetGuild, self.frame, self.moduleSettings.line3Tag, "Unit", { unit = target })
else else
DogTag:RemoveFontString(self.frame.targetGuild) DogTag:RemoveFontString(self.frame.targetGuild)
end end

View File

@ -79,7 +79,7 @@ function TargetMana.prototype:Update(unit)
self:UpdateBar(self.mana/self.maxMana, color) self:UpdateBar(self.mana/self.maxMana, color)
if not AceLibrary:HasInstance("LibDogTag-2.0") then if not AceLibrary:HasInstance("LibDogTag-3.0") then
self:SetBottomText1(math.floor(self.manaPercentage * 100)) self:SetBottomText1(math.floor(self.manaPercentage * 100))
self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color) self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color)
end end