View Single Post
01-13-21, 01:49 AM   #1
devilArt
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 51
What's the proper way to update color of last class power bar?

This is my PostUpdate code for classpower

lua Code:
  1. local function PostUpdateClassPower(element, cur, max, hasMaxChanged, powerType)
  2.     local style = element.__owner.unitStyle
  3.     local gap = 3
  4.     local maxWidth
  5.  
  6.     if style == 'player' then
  7.         maxWidth = C.DB.unitframe.player_width
  8.     else
  9.         maxWidth = C.DB.nameplate.pp_width
  10.     end
  11.  
  12.     if hasMaxChanged then
  13.         for i = 1, max do
  14.             element[i]:SetWidth((maxWidth - (max - 1) * gap) / max)
  15.         end
  16.  
  17.         element[max]:SetStatusBarColor(unpack(lastBarColors[C.MyClass]))
  18.     end
  19. end

When I log into the game for the first time


After /reload it returns to normal


Dose anyone konw the reason?
  Reply With Quote