This is the mana bar build function, the fill things are at the bottom function DUF_ManaBar_Update() if ((not this.mana) or (not this.manamax) or this.manamax == 0) then if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].hideifnomana and (not DUF_OPTIONS_VISIBLE)) then getglobal(this:GetName().."_ManaBar"):Hide(); return; else if ((not DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].hide) and (not DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].mouseover)) then getglobal(this:GetName().."_ManaBar"):Show(); else return; end if (DUF_OPTIONS_VISIBLE) then this.mana = 100; this.manamax = 100; this.lastmana = 100; else this.mana = 0; this.manamax = 0; this.lastmana = 0; end end elseif ((not DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].hide) and (not DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].mouseover)) then getglobal(this:GetName().."_ManaBar"):Show(); end if (not this.mana) then this.mana = 0 end local value = this.mana / this.manamax * 100; local value2 = 0; if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].fade and this.lastmana < this.manamax) then value2 = this.lastmana / this.manamax * 100; end if (this.manamax == 0) then value = 0; value2 = 0; end if (this.lastmana > this.mana and value2 > 0) then this.lastmanaalpha = 1; end this.lastmana = this.mana; local width = DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].width; if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].resizemax and this.lastmanamax ~= this.manamax) then this.lastmanamax = this.manamax; local percent = this.manamax / UnitManaMax("player"); width = width * percent; local padding = DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].bgpadding * 2; getglobal(this:GetName().."_ManaBar").dynamicsize = percent; getglobal(this:GetName().."_ManaBar_Background"):SetWidth(width + padding); end if (DUF_Settings[DUF_INDEX][DUF_FRAME_DATA[this.unit].index].StatusBar[2].fill) then DUF_StatusBar_SetValue(getglobal(this:GetName().."_ManaBar_Bar"), 100 - value, 1, width); DUF_StatusBar_SetValue(getglobal(this:GetName().."_ManaBar_Bar2"), 0, 1, width); else DUF_StatusBar_SetValue(getglobal(this:GetName().."_ManaBar_Bar"), value, 1, width); DUF_StatusBar_SetValue(getglobal(this:GetName().."_ManaBar_Bar2"), value2, 1, width); end end X X X X X X X X X And this is the statusbar setvalue function. function DUF_StatusBar_SetValue(bar, value) if (value == 0) then value = .01; end value = value / 100; if (value > 1) then value = 1; end if (bar.direction < 3) then bar:SetWidth(bar.length * value); else bar:SetHeight(bar.length * value); end if (bar.direction == 1) then bar:SetTexCoord(0, value, 0, 1); elseif (bar.direction == 2) then bar:SetTexCoord(value, 0, 0, 1); elseif (bar.direction == 3) then bar:SetTexCoord(0, 1, value, 0); elseif (bar.direction == 4) then bar:SetTexCoord(0, 1, 0, value); end end