08-24-11, 05:26 AM | #1 |
oUF Powerbar editing
I downloaded the oUF_Phanx setup and I'm trying to edit the Powerbar, healthbar, and their respective texts.
Currently in the oUF_Phanx setup the bars only show a percentage text when injured/not at max mana, and show an exact deficit text once you mouseover. I'm trying to increase the size of the mana text (power text) and change its colour and position. These are two extracts from Core.lua (oUF_Phanx) that I THINK are responsible for those things. Code:
------------------------------------------------------------------------ ns.PostUpdatePower = function(self, unit, cur, max) local shown = self:IsShown() if max == 0 then if shown then self:Hide() end return elseif not shown then self:Show() end if UnitIsDeadOrGhost(unit) then self:SetValue(0) if self.value then self.value:SetText(nil) end return end if cur > 0 then self:GetStatusBarTexture():SetTexCoord(0, cur / max, 0, 1) end if not self.value then return end local _, type = UnitPowerType(unit) local color = colors.power[type] or colors.power.FUEL if cur < max then if self.__owner.isMouseOver then self.value:SetFormattedText("%s.|cff%02x%02x%02x%s|r", si(UnitPower(unit)), color[1] * 255, color[2] * 255, color[3] * 255, si(UnitPowerMax(unit))) elseif type == "MANA" then self.value:SetFormattedText("%d|cff%02x%02x%02x%%|r", floor(UnitPower(unit) / UnitPowerMax(unit) * 100 + 0.5), color[1] * 255, color[2] * 255, color[3] * 255) elseif cur > 0 then self.value:SetFormattedText("%d|cff%02x%02x%02x|r", floor(UnitPower(unit) / UnitPowerMax(unit) * 100 + 0.5), color[1] * 255, color[2] * 255, color[3] * 255) else self.value:SetText(nil) end elseif type == "MANA" and self.__owner.isMouseOver then self.value:SetFormattedText("|cff%02x%02x%02x%s|r", color[1] * 255, color[2] * 255, color[3] * 255, si(UnitPowerMax(unit))) else self.value:SetText(nil) end end ------------------------------------------------------------------------ Code:
if uconfig.power then local power = ns.CreateStatusBar(self, ( uconfig.width or 1 ) > 0.75 and 16, "LEFT", true ) power:SetFrameLevel( self.Health:GetFrameLevel() + 2 ) power:SetPoint( "BOTTOMLEFT", self, "BOTTOMLEFT", 1, 1 ) power:SetPoint( "BOTTOMRIGHT", self, "BOTTOMRIGHT", -1, 1 ) power:SetHeight( config.height * config.powerHeight ) self.Power = power if power.value then power.value:SetPoint( "BOTTOMLEFT", self, "BOTTOMLEFT", 4, config.height * config.powerHeight - 2 ) power.value:SetPoint( "BOTTOMRIGHT", self.Health.value, "BOTTOMLEFT", -8, 0 ) tinsert( self.mouseovers,power ) end local powerColorMode = config.powerColorMode power.colorClass = powerColorMode == "CLASS" power.colorReaction = powerColorMode == "CLASS" power.colorPower = powerColorMode == "POWER" local powerBG = config.powerBG power.bg.multiplier = powerBG if powerColorMode == "CUSTOM" then local r, g, b = unpack( config.powerColor ) power:SetStatusBarColor( r, g, b ) power.bg:SetVertexColor( r / powerBG, g / powerBG, b / powerBG ) end power.frequentUpdates = unit == "player" power.PostUpdate = ns.PostUpdatePower end |
|
08-24-11, 06:09 AM | #2 |
Hey!
Code:
local power = ns.CreateStatusBar(self, ( uconfig.width or 1 ) > 0.75 and 16, "LEFT", true ) Code:
if power.value then power.value:SetPoint( "BOTTOMLEFT", self, "BOTTOMLEFT", 4, config.height * config.powerHeight - 2 ) power.value:SetPoint( "BOTTOMRIGHT", self.Health.value, "BOTTOMLEFT", -8, 0 ) * Fontsize * Position, play with the values. changing 4 too 40 for example would move the power text more to the center of the uf's. About coloring, what do you want too color? Code:
color[1] * 255, color[2] * 255, color[3] * 255 Edited: What phanx said.. thanks :-) hope that helps, Good luck! Last edited by nin : 08-26-11 at 04:01 AM. |
|
08-25-11, 06:41 PM | #3 | |
You would actually need to change this line in the PostUpdatePower function: Code:
local color = colors.power[type] or colors.power.FUEL |
||
WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » oUF Powerbar editing |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|