Index: otravi_UnitFrames.lua =================================================================== --- otravi_UnitFrames.lua (revision 5397) +++ otravi_UnitFrames.lua (working copy) @@ -1,7 +1,7 @@ local Menu = {} local Default = { ["player"] = { - ["Buff"] = false, + ["Buff"]= false, ["DebuffSize"] = 18, ["HPTex"] = "Default", ["HPSmooth"] = true, @@ -21,6 +21,7 @@ ["font"] = 11, ["barLength"] = 90, ["Portrait"] = false, + ["HBDebuff"] = false, }, ["target"] = { ["Buff"] = true, @@ -43,6 +44,7 @@ ["font"] = 11, ["barLength"] = 90, ["Portrait"] = false, + ["HBDebuff"] = false, }, ["targettarget"] = { ["Buff"] = false, @@ -64,6 +66,7 @@ ["Scale"] = .64, ["font"] = 11, ["barLength"] = 90, + ["HBDebuff"] = false, }, ["party"] = { ["Buff"] = true, @@ -86,6 +89,7 @@ ["font"] = 11, ["barLength"] = 90, ["Portrait"] = false, + ["HBDebuff"] = false, }, ["pet"] = { ["Buff"] = true, @@ -108,6 +112,7 @@ ["font"] = 11, ["barLength"] = 90, ["Portrait"] = false, + ["HBDebuff"] = false, }, ["partypet"] = { ["Buff"] = false, @@ -130,6 +135,7 @@ ["font"] = 11, ["barLength"] = 90, ["Portrait"] = false, + ["HBDebuff"] = false, }, ["pos"] = { ["party3"] = "11.99999984169601 676.0000051515724", @@ -627,12 +633,16 @@ s = u end + if not self.frames[u].HB_Debuffs then self.frames[u]["HPBar"]:SetStatusBarColor(Colors.HealthBar[0].r1, Colors.HealthBar[0].g1, Colors.HealthBar[0].b1, 1) + end self.frames[u]["HPBar"]:SetMinMaxValues(0, vmax) self.frames[u]["HPBar"]:SetValue(vcur) - if(self.db.profile[s] and self.db.profile[s].HPSmooth) then - self:SetSmoothBarColor("HealthBar", "HPBar", u, 1) + if not self.frames[u].HB_Debuffs then + if(self.db.profile[s] and self.db.profile[s].HPSmooth) then + self:SetSmoothBarColor("HealthBar", "HPBar", u, 1) + end end self:updateHealthBarText(u, s, vcur, vmax) @@ -741,6 +751,7 @@ if blue > .5 then blue = 2 - (blue - Colors[BarType][0].b2) * percentage * 2 else blue = Colors[BarType][0].b2 end end + self.frames[u][bar]:SetStatusBarColor(red, green, blue, alpha) end @@ -817,9 +828,18 @@ function oUF:updateBuff() local u = arg1 + local s if(self["frames"][u]) then if(self["frames"][u].Buffs) then self:updateBuffs(u) end if(self["frames"][u].Debuffs) then self:updateDebuffs(u) end + if string.find(u, "partypet") then + s = "partypet" + elseif string.find(u, "party") then + s = "party" + else + s = u + end + if(self.db.profile[s].HBDebuff and self.frames[u].HPBar)then self:HBupdateDebuffs(u) end end end @@ -840,9 +860,8 @@ end function oUF:updateDebuffs(u) - if (not self.frames[u].Debuffs) then return end + if (not self.frames[u].Debuffs)then return end local b, debuff, stack, type, color - for i=1, 16 do if (string.find(u, "party")) then debuff, stack, type = UnitDebuff(u, i, SHOW_DISPELLABLE_DEBUFFS) @@ -853,7 +872,6 @@ if (debuff) then self.frames[u].Debuffs[i]:Show() self.frames[u].Debuffs[i].Icon:SetTexture(debuff) - if (string.find(u, "party")) then if (type) then color = DebuffTypeColor[type] @@ -877,6 +895,42 @@ end end +function oUF:HBupdateDebuffs(u) +local debuff, stack, type, color, s +if string.find(u, "partypet") then + s = "partypet" +elseif string.find(u, "party") then + s = "party" +else + s = u +end +if (not self.db.profile[s].HBDebuff) then return end +-- Coloring for healthbar based on the first debuff, commented out coloring when buff is not cureable. + if (string.find(u, "party")) then + debuff, stack, type = UnitDebuff(u, 1, SHOW_DISPELLABLE_DEBUFFS) + else + debuff, stack, type = UnitDebuff(u, 1) + end + + if (debuff and type) then + self.frames[u].HB_Debuffs = 1 + color = DebuffTypeColor[type] + self.frames[u]["HPBar"]:SetStatusBarColor(color.r, color.g, color.b) +--[[ elseif (not type) and debuff then + self.frames[u].HB_Debuffs = 1 + color = DebuffTypeColor["none"] + self.frames[u]["HPBar"]:SetStatusBarColor(color.r, color.g, color.b) ]]-- + else + self.frames[u].HB_Debuffs = nil + if(self.db.profile[s] and self.db.profile[s].HPSmooth) then + self:SetSmoothBarColor("HealthBar", "HPBar", u, 1) + else + self.frames[u]["HPBar"]:SetStatusBarColor(Colors.HealthBar[0].r1, Colors.HealthBar[0].g1, Colors.HealthBar[0].b1, 1) + end + + end +end + function oUF:updateRaidTarget(u) local index = GetRaidTargetIndex(u) if (UnitExists(u) and self.frames[u].RaidTarget and index) then @@ -1156,6 +1210,17 @@ end, 'checked', self:isSmooth(self.unit, "HP") ) + self.dew:AddLine( + 'text', 'Debuff Coloring', + 'func', function() + if(self.db.profile[self.unit].HBDebuff) then + self.db.profile[self.unit].HBDebuff = false + else + self.db.profile[self.unit].HBDebuff = true + end + end, + 'checked', self:isHBDebuff(self.unit, "HB") + ) elseif value == "Power" then self.dew:AddLine( 'text', "Texture", @@ -1458,6 +1523,10 @@ return self.db.profile[u][b.."Smooth"] end +function oUF:isHBDebuff(u, b, s) + return self.db.profile[u][b.."Debuff"] +end + function oUF:togglePower(u) local p,s = self.db.profile[u] @@ -1546,4 +1615,4 @@ function oUF.round(num) return floor(oUF.tonum(num)+.5) -end \ No newline at end of file +end