BetterCC

This project has become inactive.

This project is inactive and its default file will likely not work with the most recent version of Warhammer Online: Age of Reckoning. The author may have abandoned it, or it may have outlived its usefulness.

default

BetterCC

  • Better Cooldown Count

Information

  • Formats the cooldown text in a more betterer way.
  • removes the GCD from displaying on buttons, because that bothers me.
  • when cooldown is less than 10 seconds the text changes colors to red
  • when cooldown is over, the button pulses to notify you that the cooldown is up

You must login to post a comment. Don't have an account? Register to get one!

  • 1 comment
  • Avatar of Thrae Thrae Wed, 05 Nov 2008 00:29:44

    How to fix BetterCC:

    - Open up BetterCC.lua
    - Replace with contents below:

    --[[--------------------------------------------------------------------------------------------------------------
    Copyright (c) 2008 Brad Bates
    
    Permission is hereby granted, free of charge, to any person
    obtaining a copy of this software and associated documentation
    files (the "Software"), to deal in the Software without
    restriction, including without limitation the rights to use,
    copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the
    Software is furnished to do so, subject to the following
    conditions:
    
    The above copyright notice and this permission notice shall be
    included in all copies or substantial portions of the Software.
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.
    --]]--------------------------------------------------------------------------------------------------------------
    BetterCC = 
    {
    	COOLDOWN_GRANULARITY = 0.1,
    }
    
    local uiscale = InterfaceCore.GetScale()
    local pulses = {}
    local activePulses = {}
    
    local DAY, HOUR, MINUTE, SHORT = 86400, 3600, 60, 5 --values for time
    local floor = math.floor
    local min, max = math.min, math.max
    
    local OrigUpdateCooldownAnimation
    function BetterCC.Initialize()
            OrigUpdateCooldownAnimation = ActionButton.UpdateCooldownAnimation or false
    	ActionButton.UpdateCooldownAnimation = BetterCC.BetterCCAnim
    	
    end
    
    function BetterCC.BetterCCAnim(self, timeElapsed, updateCooldown, ...)
    	local BASE_ICON         = 0
    	local BUTTON_TEXT       = 1
    	local COOLDOWN          = 2
    	local COOLDOWN_TIMER    = 3
    	local FLASH_ANIM        = 4
    	local ACTIVE_ANIM       = 5
    	local GLOW_ANIM         = 6
    	local STACK_COUNT_TEXT  = 7
    		
    	local cooldownFrame     = self.m_Windows[COOLDOWN]
    	local timerFrame        = self.m_Windows[COOLDOWN_TIMER]
    	local updateCooldown    = updateCooldown or self.m_RequiresFullUpdate
    		
            local m_Cooldown, m_MaxCooldown, isShown = self.m_Cooldown, self.m_MaxCooldown, cooldownFrame:IsShowing()
            if OrigUpdateCooldownAnimation then
                OrigUpdateCooldownAnimation(self, timeElapsed, updateCooldown, ...)
            end
            self.m_Cooldown, self.m_MaxCooldown = m_Cooldown, m_MaxCooldown
            cooldownFrame:Show(isShown)
    
    	if (updateCooldown) then
    		self.m_Cooldown, self.m_MaxCooldown = GetHotbarCooldown(self:GetSlot())
    	end
    		
    	if ((self.m_Cooldown > 0) and (self.m_MaxCooldown > 2)) then 
    		local oldTime       = TimeUtils.FormatRoundedSeconds(self.m_Cooldown, BetterCC.COOLDOWN_GRANULARITY)
    		local updateLabel   = false
    			
    		self.m_Cooldown = self.m_Cooldown - timeElapsed
    			
    		if (TimeUtils.FormatRoundedSeconds(self.m_Cooldown, BetterCC.COOLDOWN_GRANULARITY) < oldTime) then
    	        updateLabel = true
    	    end
    			
    		if (updateLabel or updateCooldown) then
    			local labelTime
    
    			if(self.m_Cooldown >= DAY)then
    				labelTime = string.format("%dd", floor(self.m_Cooldown/DAY + 0.5))
    			elseif(self.m_Cooldown >= HOUR)then
    				labelTime = string.format("%dh", floor(self.m_Coodlown/HOUR + 0.5))
    			elseif(self.m_Cooldown >= MINUTE)then	
    				labelTime = string.format("%d:%02d", floor(self.m_Cooldown/60), self.m_Cooldown % MINUTE)
    			else
    				labelTime = string.format("%d", floor(self.m_Cooldown + 0.5))
    			end
    	            
    			timerFrame:SetText(labelTime)
    			timerFrame:SetFont("font_clear_medium_bold", WindowUtils.FONT_DEFAULT_TEXT_LINESPACING)
    			timerFrame:SetTextColor(255, 255, 0)
    			if(self.m_Cooldown <= 10)then
    				timerFrame:SetTextColor(255, 0, 0)
    			end
    		end
    			
    	    local newAlpha  = 0.5 
    	            
    	    cooldownFrame:SetAlpha(newAlpha)			
    	    cooldownFrame:Show(true)
    	elseif (self.m_Cooldown <= 1 and cooldownFrame:IsShowing()) then
    		cooldownFrame:SetAlpha(0)
    		cooldownFrame:Show(false)
    	        
    		self.m_Cooldown     = 0
    		self.m_MaxCooldown  = 0
    		BetterCC.StartPulseAnimation(self, self.m_Cooldown)
    	end
    end
    
    function BetterCC.CreateCooldownPulse(frame, parent)
    	local pulse = frame
    	
    	
    	pulses[parent] = pulse
    	
    	return (pulse)
    end
    
    function BetterCC.StartPulseAnimation(info, timer)
    	--d(info)
    	local texture, x, y, disabledTexture = GetIconData(info.m_IconNum)
    	
    	if(texture)then
    		local pulse = pulses[info.m_Name] or BetterCC.CreateCooldownPulse(info, info.m_Name)
    		if(pulse) then
    			pulse.scale = 1
    			
    			activePulses[pulse] = true
    			pulse:Show(true)		
    		end
    	end
    end
    
    function BetterCC.UpdateAll(timePassed)
    	if(next(activePulses))then
    		for k in pairs(activePulses) do
    			BetterCC.UpdatePulse(k, timePassed)
    		end
    	end
    end
    
    function BetterCC.UpdatePulse(pulse, timePassed)
    	local windowName = pulse.m_Name.."ActionIcon"
    	local windowScale = WindowGetScale(pulse.m_Name)
    	
    	if pulse.scale >= 2 then
    		pulse.dec = 1
    	end
    
    	pulse.scale = max(min(pulse.scale + (pulse.dec and -1 or 1) * pulse.scale * (timePassed/0.5), 2), 1)
    	
    	if pulse.scale <= 1 then
    		activePulses[pulse] = nil
    		pulse.dec = nil
    		WindowSetAlpha(windowName, 1)
    		WindowClearAnchors(windowName)
    		WindowSetParent(windowName, pulse.m_Name)
    		WindowAddAnchor(windowName, "center", pulse.m_Name, "center", 0, 0)
    		WindowSetLayer(windowName, 0)
    		WindowSetScale(windowName, windowScale)
    	else
    		WindowSetAlpha(windowName, 0.5)
    		WindowClearAnchors(windowName)
    		WindowSetParent(windowName, "Root")
    		WindowAddAnchor(windowName, "center", pulse.m_Name, "center", 0, 0)
    		WindowSetLayer(windowName, 4)
    		WindowSetScale(windowName, pulse.scale * windowScale)
    	end
    end
    

    I take no ownership or responsibility for these edits.

  • 1 comment

Table of contents

  1. 1 BetterCC
  2. 2 Information

Facts

Date created
20 Oct 2008
Categories
Last update
20 Oct 2008
Development stage
Inactive
License
MIT License
Curse link
BetterCC
Recent file

Authors