Watcher

9 - Updated gcds.lua With GCD For All Classes

I have updated the gcds.lua file to have the GCD for each of the classes, with this update, the GCD function will need to be removed from the class LUA's such as druid.lua, etc... The following is the new code:

if not Watcher then return end

local LBF = LibStub("LibButtonFacade", true)
local L = LibStub("AceLocale-3.0"):GetLocale("Watcher")
local media = LibStub:GetLibrary("LibSharedMedia-3.0");
local C = Watcher.constants

Watcher:addicon("Plague Strike", 45462)
Watcher:addicon("Moonfire", 8921)
Watcher:addicon("Beast Lore", 1462)
Watcher:addicon("Arcane Intellect", 1459)
Watcher:addicon("Blessing of Might", 19740)
Watcher:addicon("Fortitude", 21562)
Watcher:addicon("Sinister Strike", 1752)
Watcher:addicon("Lightning Shield", 324)
Watcher:addicon("Corruption", 172)
Watcher:addicon("Heroic Strike", 78)

if select(2, UnitClass('player')) == "DEATHKNIGHT" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Plague Strike Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Plague Strike"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft, optionnum)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end  
end
	
if select(2, UnitClass('player')) == "DRUID" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Moonfire Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Moonfire"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end 
end

if select(2, UnitClass('player')) == "HUNTER" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Beast Lore Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Beast Lore"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end 
end

if select(2, UnitClass('player')) == "MAGE" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Arcane Intellect Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Arcane Intellect"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end  
end
	
if select(2, UnitClass('player')) == "PALADIN" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Blessing of Might Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Blessing of Might"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end
end

if select(2, UnitClass('player')) == "PRIEST" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Fortitude Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Fortitude"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)

		end
	end  
end
	
if select(2, UnitClass('player')) == "ROGUE" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Sinister Strike Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Sinister Strike"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end 
end

if select(2, UnitClass('player')) == "SHAMAN" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Lightning Shield Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Lightning Shield"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)

		end
	end  
end
	
if select(2, UnitClass('player')) == "WARLOCK" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Corruption Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Corruption"])
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then
			FrameName:SetAlpha(0)
		end
	end  
end

if select(2, UnitClass('player')) == "WARRIOR" then 
	Watcher.priorityTable.name["gcd"] = "GCD"
	Watcher.priorityTable.icon["gcd"] = C["Heroic Strike Icon"]
	Watcher.priorityTable.check["gcd"] =  
	function (FrameName, optionnum) 	
		local start, duration = GetSpellCooldown(C["Heroic Strike"])
		if duration == nil  or start == nil then
		duration = 0
		start = 0
		end
		if duration > 0 then
			FrameName:SetAlpha(1)
			local timeleft = start + duration - GetTime()
			Watcher:MoveGCD(FrameName, timeleft)
			return
		end
		if start == 0 then

			FrameName:SetAlpha(0)
		end
	end 
end
Name Size MD5
gcds.lua 5.9 KiB d6021c748f98...
User When Change
LunaEclipse Oct 31, 2010 at 10:25 UTC

Added attachment gcds.lua

LunaEclipse Oct 31, 2010 at 10:24 UTC Changed description:
  	Watcher.priorityTable.icon["gcd"] = C["Moonfire Icon"]
  	Watcher.priorityTable.check["gcd"] =
  	function (FrameName, optionnum)
- 		local start, duration = GetSpellCooldown(C["Moonfire Icon"])
+ 		local start, duration = GetSpellCooldown(C["Moonfire"])
  		if duration > 0 then
  			FrameName:SetAlpha(1)
  			local timeleft = start + duration - GetTime()
LunaEclipse Oct 31, 2010 at 10:23 UTC

Deleted attachment gcds.lua: Incorrect file contents.

LunaEclipse Oct 31, 2010 at 10:21 UTC Changed description:
LunaEclipse Oct 31, 2010 at 10:19 UTC

Added attachment gcds.lua

LunaEclipse Oct 31, 2010 at 10:19 UTC Create

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

Facts

Last updated
Oct 31, 2010
Reported
Oct 31, 2010
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.
Votes
0

Reported by

Possible assignees