mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 06:40:13 -05:00
- added a global toggle for DogTags so they can be enabled or disabled for the mod
- added an optional rare/elite/rare-elite indicator to the target health bar (off by default) - made configuration mode show target raid icons (and the new elite indicator as well)
This commit is contained in:
@ -18,11 +18,6 @@ IceBarElement.prototype.CurrScale = 1
|
||||
-- Constructor --
|
||||
function IceBarElement.prototype:init(name)
|
||||
IceBarElement.super.prototype.init(self, name)
|
||||
|
||||
if AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
DogTag = AceLibrary("LibDogTag-3.0")
|
||||
AceLibrary("LibDogTag-Unit-3.0")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -33,6 +28,11 @@ end
|
||||
function IceBarElement.prototype:Enable()
|
||||
IceBarElement.super.prototype.Enable(self)
|
||||
|
||||
if IceHUD.IceCore:ShouldUseDogTags() and AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
DogTag = AceLibrary("LibDogTag-3.0")
|
||||
AceLibrary("LibDogTag-Unit-3.0")
|
||||
end
|
||||
|
||||
if self.moduleSettings.myTagVersion < IceHUD.CurrTagVersion then
|
||||
local origDefaults = self:GetDefaultSettings()
|
||||
|
||||
|
10
IceCore.lua
10
IceCore.lua
@ -61,6 +61,8 @@ function IceCore.prototype:init()
|
||||
|
||||
barBlendMode = "BLEND",
|
||||
barBgBlendMode = "BLEND",
|
||||
|
||||
bShouldUseDogTags = true
|
||||
}
|
||||
|
||||
self:LoadPresets()
|
||||
@ -450,6 +452,14 @@ function IceCore.prototype:ConfigModeToggle(bWantConfig)
|
||||
end
|
||||
end
|
||||
|
||||
function IceCore.prototype:ShouldUseDogTags()
|
||||
return AceLibrary:HasInstance("LibDogTag-3.0") and self.settings.bShouldUseDogTags
|
||||
end
|
||||
|
||||
function IceCore.prototype:SetShouldUseDogTags(should)
|
||||
self.settings.bShouldUseDogTags = should
|
||||
end
|
||||
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Presets --
|
||||
|
28
IceHUD.lua
28
IceHUD.lua
@ -493,6 +493,34 @@ IceHUD.options =
|
||||
end,
|
||||
order = 95
|
||||
},
|
||||
|
||||
useDogTags = {
|
||||
type = 'toggle',
|
||||
name = 'Use Dog Tags',
|
||||
desc = 'Whether or not the addon should use the DogTag library (this will increase the CPU usage of the mod)\n\nNOTE: after changing this option, you must reload the UI or else bad things happen',
|
||||
get = function()
|
||||
return IceHUD.IceCore:ShouldUseDogTags()
|
||||
end,
|
||||
set = function(v)
|
||||
StaticPopupDialogs["ICEHUD_CHANGED_DOGTAG"] = {
|
||||
text = "This option requires the UI to be reloaded. Do you wish to reload it now?",
|
||||
button1 = "Yes",
|
||||
OnAccept = function()
|
||||
ReloadUI()
|
||||
end,
|
||||
button2 = "No",
|
||||
timeout = 0,
|
||||
whileDead = 1,
|
||||
hideOnEscape = 1
|
||||
};
|
||||
IceHUD.IceCore:SetShouldUseDogTags(v)
|
||||
StaticPopup_Show("ICEHUD_CHANGED_DOGTAG")
|
||||
end,
|
||||
hidden = function()
|
||||
return not AceLibrary:HasInstance("LibDogTag-3.0")
|
||||
end,
|
||||
order = 96
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -366,7 +366,7 @@ function FocusHealth.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.health/self.maxHealth, self.color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.healthPercentage * 100))
|
||||
|
||||
-- first see if we have LibMobHealth that we can piggyback on
|
||||
|
@ -85,7 +85,7 @@ function FocusMana.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.mana/self.maxMana, color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.manaPercentage * 100))
|
||||
self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color)
|
||||
end
|
||||
|
@ -112,7 +112,7 @@ function PetHealth.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.health/self.maxHealth, color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.healthPercentage * 100))
|
||||
end
|
||||
end
|
||||
|
@ -123,7 +123,7 @@ function PetMana.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.mana/self.maxMana, color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.manaPercentage * 100))
|
||||
end
|
||||
end
|
||||
|
@ -726,7 +726,7 @@ function PlayerHealth.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.health/self.maxHealth, color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.healthPercentage * 100))
|
||||
self:SetBottomText2(self:GetFormattedText(self.health, self.maxHealth), textColor)
|
||||
end
|
||||
@ -755,7 +755,9 @@ end
|
||||
|
||||
|
||||
function PlayerHealth.prototype:CreateTexCoord(texframe, icon, width, height, scale, left, right, top, bottom)
|
||||
texframe = self.frame:CreateTexture(nil, "BACKGROUND")
|
||||
if not texframe then
|
||||
texframe = self.frame:CreateTexture(nil, "BACKGROUND")
|
||||
end
|
||||
texframe:SetTexture(icon)
|
||||
texframe:SetTexCoord(left, right, top, bottom)
|
||||
self:SetTexScale(texframe, width, height, scale)
|
||||
@ -777,6 +779,10 @@ end
|
||||
|
||||
|
||||
function PlayerHealth.prototype:DestroyTexFrame(texframe)
|
||||
if not texframe then
|
||||
return nil
|
||||
end
|
||||
|
||||
texframe:SetTexture(nil)
|
||||
texframe:Hide()
|
||||
texframe:ClearAllPoints()
|
||||
|
@ -214,7 +214,7 @@ function PlayerMana.prototype:Update(unit)
|
||||
end
|
||||
end
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
-- extra hack for whiny rogues (are there other kind?)
|
||||
local displayPercentage = self.manaPercentage
|
||||
if (self.manaType == 3) then
|
||||
|
@ -14,15 +14,15 @@ function RangeCheck.prototype:init()
|
||||
if AceLibrary:HasInstance("LibRangeCheck-2.0") then
|
||||
LibRange = AceLibrary("LibRangeCheck-2.0")
|
||||
end
|
||||
|
||||
if AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
DogTag = AceLibrary("LibDogTag-3.0")
|
||||
end
|
||||
end
|
||||
|
||||
function RangeCheck.prototype:Enable(core)
|
||||
RangeCheck.super.prototype.Enable(self, core)
|
||||
|
||||
if IceHUD.IceCore:ShouldUseDogTags() then
|
||||
DogTag = AceLibrary("LibDogTag-3.0")
|
||||
end
|
||||
|
||||
self:RegisterFontStrings()
|
||||
end
|
||||
|
||||
|
@ -5,6 +5,15 @@ IceTargetHealth = AceOO.Class(IceUnitBar)
|
||||
IceTargetHealth.prototype.color = nil
|
||||
IceTargetHealth.prototype.determineColor = true
|
||||
IceTargetHealth.prototype.registerEvents = true
|
||||
IceTargetHealth.prototype.texWidth = 128
|
||||
IceTargetHealth.prototype.texHeight = 128
|
||||
IceTargetHealth.prototype.classLeft = 0
|
||||
IceTargetHealth.prototype.classRight = 0.9375
|
||||
IceTargetHealth.prototype.classTop = 0
|
||||
IceTargetHealth.prototype.classBottom = 0.78125
|
||||
IceTargetHealth.prototype.EliteTexture = IceElement.TexturePath .. "Elite"
|
||||
IceTargetHealth.prototype.RareEliteTexture = IceElement.TexturePath .. "RareElite"
|
||||
IceTargetHealth.prototype.RareTexture = IceElement.TexturePath .. "Rare"
|
||||
|
||||
-- Constructor --
|
||||
function IceTargetHealth.prototype:init(moduleName, unit)
|
||||
@ -35,6 +44,8 @@ function IceTargetHealth.prototype:GetDefaultSettings()
|
||||
settings["raidIconYOffset"] = 0
|
||||
settings["lockIconAlpha"] = false
|
||||
settings["abbreviateHealth"] = true
|
||||
settings["classIconOffset"] = {x=0, y=0}
|
||||
settings["showClassificationIcon"] = false
|
||||
|
||||
return settings
|
||||
end
|
||||
@ -191,11 +202,11 @@ function IceTargetHealth.prototype:GetOptions()
|
||||
end,
|
||||
order = 54
|
||||
}
|
||||
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
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',
|
||||
desc = 'If this is checked, then a health value of 1100 will display as 1.1k, otherwise it shows the number',
|
||||
get = function()
|
||||
return self.moduleSettings.abbreviateHealth
|
||||
end,
|
||||
@ -207,6 +218,64 @@ function IceTargetHealth.prototype:GetOptions()
|
||||
end,
|
||||
order = 40.1
|
||||
}
|
||||
end
|
||||
|
||||
opts["showClassificationIcon"] = {
|
||||
type = "toggle",
|
||||
name = "Show Elite Icon",
|
||||
desc = "Whether or not to show the rare/elite icon above this bar",
|
||||
get = function()
|
||||
return self.moduleSettings.showClassificationIcon
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.showClassificationIcon = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 60
|
||||
}
|
||||
|
||||
opts["classIconXOffset"] = {
|
||||
type = "range",
|
||||
name = "Elite Icon X Offset",
|
||||
desc = "How far to push the elite icon right or left",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.classIconOffset['x']
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classIconOffset['x'] = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 61
|
||||
}
|
||||
|
||||
opts["classIconYOffset"] = {
|
||||
type = "range",
|
||||
name = "Elite Icon Y Offset",
|
||||
desc = "How far to push the elite icon up or down",
|
||||
min = -300,
|
||||
max = 300,
|
||||
step = 1,
|
||||
get = function()
|
||||
return self.moduleSettings.classIconOffset['y']
|
||||
end,
|
||||
set = function(value)
|
||||
self.moduleSettings.classIconOffset['y'] = value
|
||||
self:Redraw()
|
||||
end,
|
||||
disabled = function()
|
||||
return not self.moduleSettings.enabled
|
||||
end,
|
||||
order = 62
|
||||
}
|
||||
|
||||
return opts
|
||||
end
|
||||
@ -246,7 +315,7 @@ function IceTargetHealth.prototype:Update(unit)
|
||||
return
|
||||
end
|
||||
|
||||
if not (UnitExists(unit)) then
|
||||
if unit and not (UnitExists(unit)) then
|
||||
self:Show(false)
|
||||
return
|
||||
else
|
||||
@ -255,6 +324,31 @@ function IceTargetHealth.prototype:Update(unit)
|
||||
|
||||
self:UpdateRaidTargetIcon()
|
||||
|
||||
local classification = UnitClassification(self.unit);
|
||||
if not self.moduleSettings.showClassificationIcon then
|
||||
self:DestroyTexFrame(self.frame.classIcon)
|
||||
else
|
||||
if not self.frame.classIcon then
|
||||
self.frame.classIcon = self:CreateTexCoord(self.frame.classIcon, self.EliteTexture, self.texWidth, self.texHeight,
|
||||
self.moduleSettings.scale / 3.0, self.classLeft, self.classRight, self.classTop, self.classBottom)
|
||||
end
|
||||
|
||||
self:SetTexLoc(self.frame.classIcon, self.moduleSettings.classIconOffset['x'], self.moduleSettings.classIconOffset['y'])
|
||||
self.frame.classIcon:Show()
|
||||
self.frame.classIcon:SetAlpha(self.alpha == 0 and 0 or math.min(1, self.alpha + 0.2))
|
||||
|
||||
if IceHUD.IceCore:IsInConfigMode() or classification == "worldboss" or classification == "elite" then
|
||||
self.frame.classIcon:SetTexture(self.EliteTexture)
|
||||
elseif classification == "rareelite" then
|
||||
self.frame.classIcon:SetTexture(self.RareEliteTexture)
|
||||
elseif classification == "rare" then
|
||||
self.frame.classIcon:SetTexture(self.RareTexture)
|
||||
else
|
||||
self:DestroyTexFrame(self.frame.classIcon)
|
||||
self.frame.classIcon:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if self.determineColor then
|
||||
self.color = "TargetHealthFriendly" -- friendly > 4
|
||||
|
||||
@ -280,7 +374,7 @@ function IceTargetHealth.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.health/self.maxHealth, self.color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.healthPercentage * 100))
|
||||
|
||||
if self.moduleSettings.abbreviateHealth then
|
||||
@ -297,6 +391,47 @@ function IceTargetHealth.prototype:Update(unit)
|
||||
end
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:CreateTexCoord(texframe, icon, width, height, scale, left, right, top, bottom)
|
||||
if not texframe then
|
||||
texframe = self.frame:CreateTexture(nil, "BACKGROUND")
|
||||
end
|
||||
|
||||
texframe:SetTexture(icon)
|
||||
if left and right and top and bottom then
|
||||
texframe:SetTexCoord(left, right, top, bottom)
|
||||
end
|
||||
self:SetTexScale(texframe, width, height, scale or 1)
|
||||
|
||||
return texframe
|
||||
end
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:SetTexLoc(texframe, xpos, ypos, anchorFrom, anchorTo)
|
||||
texframe:ClearAllPoints()
|
||||
texframe:SetPoint(anchorFrom or "TOPLEFT", self.frame, anchorTo or "TOPLEFT", xpos or 0, ypos or 0)
|
||||
end
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:SetTexScale(texframe, width, height, scale)
|
||||
texframe:SetWidth(width * scale)
|
||||
texframe:SetHeight(height * scale)
|
||||
end
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:DestroyTexFrame(texframe)
|
||||
if not texframe then
|
||||
return nil
|
||||
end
|
||||
|
||||
texframe:SetTexture(nil)
|
||||
texframe:Hide()
|
||||
texframe:ClearAllPoints()
|
||||
|
||||
return texframe
|
||||
end
|
||||
|
||||
|
||||
|
||||
function IceTargetHealth.prototype:CreateRaidIconFrame()
|
||||
if (not self.frame.raidIcon) then
|
||||
self.frame.raidIcon = CreateFrame("Frame", nil, self.frame)
|
||||
@ -329,12 +464,12 @@ function IceTargetHealth.prototype:UpdateRaidTargetIcon()
|
||||
self.frame.raidIcon:SetFrameStrata("LOW")
|
||||
end
|
||||
|
||||
if not (UnitExists(self.unit)) or not self.moduleSettings.showRaidIcon then
|
||||
if not self.moduleSettings.showRaidIcon or (not UnitExists(self.unit) and not IceHUD.IceCore:IsInConfigMode()) then
|
||||
self.frame.raidIcon:Hide()
|
||||
return
|
||||
end
|
||||
|
||||
local index = GetRaidTargetIndex(self.unit);
|
||||
local index = IceHUD.IceCore:IsInConfigMode() and 1 or GetRaidTargetIndex(self.unit);
|
||||
|
||||
if (index and (index > 0)) then
|
||||
SetRaidTargetIconTexture(self.frame.raidIcon.icon, index)
|
||||
|
@ -33,11 +33,6 @@ function TargetInfo.prototype:init()
|
||||
TargetInfo.super.prototype.init(self, "TargetInfo")
|
||||
|
||||
self.scalingEnabled = true
|
||||
|
||||
if AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
DogTag = AceLibrary("LibDogTag-3.0")
|
||||
AceLibrary("LibDogTag-Unit-3.0")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -48,6 +43,11 @@ end
|
||||
function TargetInfo.prototype:Enable(core)
|
||||
TargetInfo.super.prototype.Enable(self, core)
|
||||
|
||||
if IceHUD.IceCore:ShouldUseDogTags() then
|
||||
DogTag = AceLibrary("LibDogTag-3.0")
|
||||
AceLibrary("LibDogTag-Unit-3.0")
|
||||
end
|
||||
|
||||
self:RegisterEvent("UNIT_AURA", "AuraChanged")
|
||||
|
||||
self:RegisterEvent("UNIT_NAME_UPDATE", "TargetName")
|
||||
|
@ -107,7 +107,7 @@ function IceTargetMana.prototype:Update(unit)
|
||||
|
||||
self:UpdateBar(self.mana/self.maxMana, color)
|
||||
|
||||
if not AceLibrary:HasInstance("LibDogTag-3.0") then
|
||||
if not IceHUD.IceCore:ShouldUseDogTags() then
|
||||
self:SetBottomText1(math.floor(self.manaPercentage * 100))
|
||||
self:SetBottomText2(self:GetFormattedText(self.mana, self.maxMana), color)
|
||||
end
|
||||
|
BIN
textures/Elite.blp
Normal file
BIN
textures/Elite.blp
Normal file
Binary file not shown.
BIN
textures/Rare.blp
Normal file
BIN
textures/Rare.blp
Normal file
Binary file not shown.
BIN
textures/RareElite.blp
Normal file
BIN
textures/RareElite.blp
Normal file
Binary file not shown.
Reference in New Issue
Block a user