From cb77e8358b829510c921794b00e7c49d2d7534eb Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 17 Oct 2010 20:20:00 +0000 Subject: [PATCH] - fixed 'inverse' mode to work with potential SnD bar - expanded range of class power counters (shards, holy power) by request - fixed lacerate and sunder count modules to work with 3 max charges instead of 5 as per the new patch (these *really* need to go away and be auto-replaced by custom counters...) - yet another fix for text sometimes displaying the unit name for PetHealth - fixed how the 'second highest threat' bar is drawn so that it actually works with all textures --- IceBarElement.lua | 16 ++++++++-------- modules/ClassPowerCounter.lua | 2 +- modules/LacerateCount.lua | 15 +++++++++------ modules/PetHealth.lua | 13 +++---------- modules/SliceAndDice.lua | 29 ++++++++++++++++++----------- modules/SunderCount.lua | 15 +++++++++------ modules/Threat.lua | 21 ++++++++++----------- 7 files changed, 58 insertions(+), 53 deletions(-) diff --git a/IceBarElement.lua b/IceBarElement.lua index ae7ab41..88b3312 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -55,7 +55,7 @@ function IceBarElement.prototype:Enable() self.moduleSettings.reverse = false self.moduleSettings.inverse = true - self:SetBarFramePoints() + self:SetBarFramePoints(self.barFrame) end end @@ -224,7 +224,7 @@ function IceBarElement.prototype:GetOptions() end, set = function(info, value) self.moduleSettings.inverse = value - self:SetBarFramePoints() + self:SetBarFramePoints(self.barFrame) self:Redraw() end, disabled = function() @@ -243,7 +243,7 @@ function IceBarElement.prototype:GetOptions() end, set = function(info, value) self.moduleSettings.reverse = value - self:SetBarFramePoints() + self:SetBarFramePoints(self.barFrame) self:Redraw() end, disabled = function() @@ -770,12 +770,12 @@ function IceBarElement.prototype:SetBarVisibility(visible) end end -function IceBarElement.prototype:SetBarFramePoints() - self.barFrame:ClearAllPoints() +function IceBarElement.prototype:SetBarFramePoints(frame) + frame:ClearAllPoints() if (self.moduleSettings.inverse) then - self.barFrame:SetPoint("TOPLEFT", self.frame, "TOPLEFT") + frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT") else - self.barFrame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT") + frame:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT") end end @@ -894,7 +894,7 @@ function IceBarElement.prototype:CreateBar() end self.barFrame:SetFrameStrata("LOW") - self:SetBarFramePoints() + self:SetBarFramePoints(self.barFrame) self.barFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0)) self.barFrame:SetHeight(self.settings.barHeight) diff --git a/modules/ClassPowerCounter.lua b/modules/ClassPowerCounter.lua index fca6843..31d9bf8 100644 --- a/modules/ClassPowerCounter.lua +++ b/modules/ClassPowerCounter.lua @@ -35,7 +35,7 @@ function IceClassPowerCounter.prototype:GetOptions() self:Redraw() end, min = -300, - max = 300, + max = 700, step = 1, disabled = function() return not self.moduleSettings.enabled diff --git a/modules/LacerateCount.lua b/modules/LacerateCount.lua index d61712c..cd945ec 100644 --- a/modules/LacerateCount.lua +++ b/modules/LacerateCount.lua @@ -2,6 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local LacerateCount = IceCore_CreateClass(IceElement) LacerateCount.prototype.lacerateSize = 20 +LacerateCount.prototype.numLacerates = 3 -- Constructor -- function LacerateCount.prototype:init() @@ -137,6 +138,8 @@ function LacerateCount.prototype:GetOptions() order = 34 } + opts.gradient.desc = string.gsub(opts.gradient.desc, "5", tostring(self.numLacerates)) + return opts end @@ -188,7 +191,7 @@ function LacerateCount.prototype:CreateFrame() LacerateCount.super.prototype.CreateFrame(self) self.frame:SetFrameStrata("BACKGROUND") - self.frame:SetWidth(self.lacerateSize*5) + self.frame:SetWidth(self.lacerateSize*self.numLacerates) self.frame:SetHeight(1) self.frame:ClearAllPoints() self.frame:SetPoint("TOP", self.parent, "BOTTOM", self.moduleSettings.hpos, self.moduleSettings.vpos) @@ -216,7 +219,7 @@ function LacerateCount.prototype:CreateLacerateFrame(doTextureUpdate) end -- create backgrounds - for i = 1, 5 do + for i = 1, self.numLacerates do if (not self.frame.graphicalBG[i]) then local frame = CreateFrame("Frame", nil, self.frame) self.frame.graphicalBG[i] = frame @@ -247,7 +250,7 @@ function LacerateCount.prototype:CreateLacerateFrame(doTextureUpdate) end -- create lacerates - for i = 1, 5 do + for i = 1, self.numLacerates do if (not self.frame.graphical[i]) then local frame = CreateFrame("Frame", nil, self.frame) self.frame.graphical[i] = frame @@ -272,7 +275,7 @@ function LacerateCount.prototype:CreateLacerateFrame(doTextureUpdate) local r, g, b = self:GetColor("LacerateCount") if (self.moduleSettings.gradient) then - g = g - (0.15*i) + g = g - ((0.75 / self.numLacerates) * i) end self.frame.graphical[i].texture:SetVertexColor(r, g, b) @@ -284,7 +287,7 @@ end function LacerateCount.prototype:UpdateLacerateCount() local points if IceHUD.IceCore:IsInConfigMode() then - points = 5 + points = self.numLacerates else points = IceHUD:GetDebuffCount("target", "Ability_Druid_Lacerate", true) end @@ -296,7 +299,7 @@ function LacerateCount.prototype:UpdateLacerateCount() if (self.moduleSettings.lacerateMode == "Numeric") then local r, g, b = self:GetColor("LacerateCount") if (self.moduleSettings.gradient and points) then - g = g - (0.15*points) + g = g - ((0.75 / self.numLacerates) * points) end self.frame.numeric:SetTextColor(r, g, b, 0.7) diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index 229d100..30ea71a 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -34,21 +34,14 @@ end -- OVERRIDE ---[[ function PetHealth.prototype:CreateFrame() PetHealth.super.prototype.CreateFrame(self) - local point, relativeTo, relativePoint, xoff, yoff = self.frame.bottomUpperText:GetPoint() - if (point == "TOPLEFT") then - point = "BOTTOMLEFT" - else - point = "BOTTOMRIGHT" + if not UnitExists(self.unit) then + self.frame.bottomUpperText:Hide() + self.frame.bottomLowerText:Hide() end - - self.frame.bottomUpperText:ClearAllPoints() - self.frame.bottomUpperText:SetPoint(point, relativeTo, relativePoint, 0, 0) end -]] function PetHealth.prototype:Enable(core) PetHealth.super.prototype.Enable(self, core) diff --git a/modules/SliceAndDice.lua b/modules/SliceAndDice.lua index bb97973..f732d08 100644 --- a/modules/SliceAndDice.lua +++ b/modules/SliceAndDice.lua @@ -141,6 +141,7 @@ function SliceAndDice.prototype:CreateDurationBar() end self.durationFrame:SetFrameStrata("BACKGROUND") + self:SetBarFramePoints(self.durationFrame) self.durationFrame:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0)) self.durationFrame:SetHeight(self.settings.barHeight) @@ -149,17 +150,12 @@ function SliceAndDice.prototype:CreateDurationBar() end self.durationFrame.bar:SetTexture(IceElement.TexturePath .. self:GetMyBarTexture()) - self.durationFrame.bar:SetPoint("BOTTOMLEFT",self.frame,"BOTTOMLEFT") - self.durationFrame.bar:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT") - + self.durationFrame.bar:SetAllPoints(self.durationFrame) self.durationFrame.bar:SetVertexColor(self:GetColor("SliceAndDicePotential", self.alpha * self.moduleSettings.durationAlpha)) self.durationFrame.bar:SetHeight(0) self:UpdateBar(1, "undef") - self.durationFrame:ClearAllPoints() - self.durationFrame:SetPoint("BOTTOM", self.frame, "BOTTOM", 0, 0) - -- force update the bar...if we're in here, then either the UI was just loaded or the player is jacking with the options. -- either way, make sure the duration bar matches accordingly self:UpdateDurationBar() @@ -295,12 +291,23 @@ function SliceAndDice.prototype:UpdateDurationBar(event, unit) scale = IceHUD:Clamp(PotentialSnDDuration / CurrMaxSnDDuration, 0, 1) -- sadly, animation uses bar-local variables so we can't use the animation for 2 bar textures on the same bar element - if (self.moduleSettings.side == IceCore.Side.Left) then - self.durationFrame.bar:SetTexCoord(1, 0, 1-scale, 1) - else - self.durationFrame.bar:SetTexCoord(0, 1, 1-scale, 1) + if (self.moduleSettings.reverse) then + scale = 1 - scale end - self.durationFrame.bar:SetHeight(self.settings.barHeight * scale) + if (self.moduleSettings.inverse) then + min_y = 0 + max_y = scale + else + min_y = 1-scale + max_y = 1 + end + + if (self.moduleSettings.side == IceCore.Side.Left) then + self.durationFrame.bar:SetTexCoord(1, 0, min_y, max_y) + else + self.durationFrame.bar:SetTexCoord(0, 1, min_y, max_y) + end + self.durationFrame:SetHeight(self.settings.barHeight * scale) if scale == 0 then self.durationFrame.bar:Hide() diff --git a/modules/SunderCount.lua b/modules/SunderCount.lua index f0c1406..d1dda87 100644 --- a/modules/SunderCount.lua +++ b/modules/SunderCount.lua @@ -2,6 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local SunderCount = IceCore_CreateClass(IceElement) SunderCount.prototype.sunderSize = 20 +SunderCount.prototype.numSunders = 3 -- Constructor -- function SunderCount.prototype:init() @@ -117,6 +118,8 @@ function SunderCount.prototype:GetOptions() order = 34 } + opts.gradient.desc = string.gsub(opts.gradient.desc, "5", tostring(self.numSunders)) + return opts end @@ -167,7 +170,7 @@ function SunderCount.prototype:CreateFrame() SunderCount.super.prototype.CreateFrame(self) self.frame:SetFrameStrata("BACKGROUND") - self.frame:SetWidth(self.sunderSize*5) + self.frame:SetWidth(self.sunderSize*self.numSunders) self.frame:SetHeight(1) self.frame:ClearAllPoints() self.frame:SetPoint("TOP", self.parent, "BOTTOM", 0, self.moduleSettings.vpos) @@ -195,7 +198,7 @@ function SunderCount.prototype:CreateSunderFrame(doTextureUpdate) end -- create backgrounds - for i = 1, 5 do + for i = 1, self.numSunders do if (not self.frame.graphicalBG[i]) then local frame = CreateFrame("Frame", nil, self.frame) self.frame.graphicalBG[i] = frame @@ -226,7 +229,7 @@ function SunderCount.prototype:CreateSunderFrame(doTextureUpdate) end -- create sunders - for i = 1, 5 do + for i = 1, self.numSunders do if (not self.frame.graphical[i]) then local frame = CreateFrame("Frame", nil, self.frame) self.frame.graphical[i] = frame @@ -251,7 +254,7 @@ function SunderCount.prototype:CreateSunderFrame(doTextureUpdate) local r, g, b = self:GetColor("SunderCount") if (self.moduleSettings.gradient) then - g = g - (0.15*i) + g = g - ((0.75 / self.numSunders) * i) end self.frame.graphical[i].texture:SetVertexColor(r, g, b) @@ -263,7 +266,7 @@ end function SunderCount.prototype:UpdateSunderCount() local points if IceHUD.IceCore:IsInConfigMode() then - points = 5 + points = self.numSunders else points = IceHUD:GetDebuffCount("target", "Ability_Warrior_Sunder") end @@ -275,7 +278,7 @@ function SunderCount.prototype:UpdateSunderCount() if (self.moduleSettings.sunderMode == "Numeric") then local r, g, b = self:GetColor("SunderCount") if (self.moduleSettings.gradient and points) then - g = g - (0.15*points) + g = g - ((0.75 / self.numSunders) * points) end self.frame.numeric:SetTextColor(r, g, b, 0.7) diff --git a/modules/Threat.lua b/modules/Threat.lua index 2d05bd0..fd1fef1 100644 --- a/modules/Threat.lua +++ b/modules/Threat.lua @@ -240,12 +240,7 @@ function IceThreat.prototype:CreateSecondThreatBar() self.secondThreatBar:SetFrameStrata("MEDIUM") self.secondThreatBar:SetWidth(self.settings.barWidth + (self.moduleSettings.widthModifier or 0)) self.secondThreatBar:SetHeight(self.settings.barHeight) - self.secondThreatBar:ClearAllPoints() - if self.moduleSettings.inverse then - self.secondThreatBar:SetPoint("TOPLEFT", self.frame, "TOPLEFT") - else - self.secondThreatBar:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT") - end + self:SetBarFramePoints(self.secondThreatBar) if not (self.secondThreatBar.bar) then self.secondThreatBar.bar = self.secondThreatBar:CreateTexture(nil, "OVERLAY") @@ -416,17 +411,21 @@ function IceThreat.prototype:UpdateSecondHighestThreatBar(secondHighestThreat, t pos = 1-pos end - local min_y = 0 - local max_y = pos - if self.moduleSettings.inverse then + if (self.moduleSettings.reverse) then + pos = 1 - pos + end + if (self.moduleSettings.inverse) then + min_y = 0 + max_y = pos + else min_y = 1-pos max_y = 1 end if ( self.moduleSettings.side == IceCore.Side.Left ) then - self.secondThreatBar.bar:SetTexCoord(1, 0, max_y, min_y) + self.secondThreatBar.bar:SetTexCoord(1, 0, min_y, max_y) else - self.secondThreatBar.bar:SetTexCoord(0, 1, max_y, min_y) + self.secondThreatBar.bar:SetTexCoord(0, 1, min_y, max_y) end local r, g, b = self:GetColor("ThreatSecondPlace")