View Single Post
06-01-11, 11:52 AM   #18
Mischback
A Cobalt Mageweaver
 
Mischback's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 221
Originally Posted by Coldkil View Post
I have a similar problem with druids. (i hate they multiple forms)

I have made the combobar as a simple frame with 5 text strings, that stay at .2 alpha when not up, then go at alpha 1 when the combo builds up.

The fact is that i want to register the shapeshift events for make them disappear completely when the druid isn't in cat form.

Same would be good for eclipse bar, displaying it only when in moonkin form.

Is it possible or it's something that i canot achieve? thanks.
No, I didn't want to suggest an altering of oUF's core! At least not on parts, that are working perfectly.
On the other hand, the cpoints-module doesn't include a PostUpdate (hint at haste!), so you'll have to put some effort into it!

Go and style your CPoints in your layout as you want them to be. Don't include any conditions to them, though.

The oUF-module DOES include the possibility to override the original update-function, and this would be the way to go!

You can merely use, what you already got and put it into a function inside of your layout

lua Code:
  1. local function CPointsOverride(self, event, unit)
  2.         if (unit == 'pet') then return end
  3.     local cp = nil
  4.     if(UnitHasVehicleUI'player') then
  5.         cp = GetComboPoints('vehicle', 'target')
  6.     else
  7.         cp = GetComboPoints('player', 'target')
  8.     end
  9.  
  10.         local cpoints = self.CPoints
  11.         if (cp) then
  12.                 cpoints:Show()
  13.             for i=1, MAX_COMBO_POINTS do
  14.                 if(i <= cp) then
  15.                     cpoints[i]:SetAlpha(1)
  16.                 else
  17.                     cpoints[i]:SetAlpha(0.2)
  18.                 end
  19.             end
  20.         else
  21.                 cpoints:Hide()
  22.         end
  23. end

This way, you're getting your CPoints shown everytime, when CPoints are on the target, regardless of your class. If there is at least one combo point, the whole element is shown and updated as you want it with the alpha settings.

Note: You don't have to include those cpoints:Show() / :Hide() stuff, it would be my approach.
If you want your CPoints always visible if you're in cat-form or on an rogue, just show them all the time (rogue) or if you're in cat (drood).

Create a frame and register the "UPDATE_SHAPESHIFT_FORM"-event and apply a script to this event

lua Code:
  1. local function ShapeshiftControl()
  2.     if (currentform == CAT) then
  3.         ShowCPoints()
  4.     else
  5.         HideCPoints()
  6.     end
  7. end

This is of course pseudo-code, you will have to fill it with life.

edit: Second approach is easily modified to handle eclipse-bar, too!
__________________
  Reply With Quote