Thread Tools Display Modes
01-15-17, 12:46 PM   #1
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Cooldown Help

Hi everyone i'm using the blizzard countdown cooldown, and i want to change the colors.

for like hours it should be white
for minuts yellow
for secounds red

hope someone can help!

Lua Code:
  1. hooksecurefunc("CooldownFrame_Set", function(self, start, duration, enable, charges, maxcharges, forceShowdrawedge)
  2.     local CooldownCount = GetCVar("countdownForCooldowns")
  3.    
  4.     if CooldownCount then
  5.         if not self.IsCooldownEdited then
  6.             local NumRegions = self:GetNumRegions()
  7.             self:SetFrameStrata("HIGH")
  8.            
  9.             for i = 1, NumRegions do
  10.                 local Region = select(i, self:GetRegions())
  11.                
  12.                 if Region.GetText then
  13.                     local ScaleEffective = self:GetEffectiveScale()
  14.                     local Scale = UIParent:GetScale()
  15.                     Region:SetPoint("CENTER", 1, 0)
  16.                     Region:SetFont(C.Media.Font2, ScaleEffective / Scale * C.Cooldowns.FontSize, "OUTLINE")
  17.                
  18.                 end
  19.             end
  20.  
  21.             self.IsCooldownEdited = true
  22.         end
  23.     end
  24. end)
  Reply With Quote
01-15-17, 07:27 PM   #2
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
You can take a look at CooldownWatch. It does something similar along with its limited set of features.

Note: Cooldown:SetHideCountdownNumbers() only controls which frames are configured to show their text. The countdownForCooldowns CVar is a global switch applied from C code. Also, it isn't necessary to loop through all regions. The embedded text object is always the first return.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 01-15-17 at 07:36 PM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Cooldown Help


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off