Thread Tools Display Modes
02-20-11, 02:18 PM   #1
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Adding a gcd spark to a castbar

Hey there!

I'm trying to add a gcd spark to my castbar. Up to now, I've been using ouf_gcd by hungtar, but he discontinued support, and it stopped working (I guess because of the ouf update). Can anyone tell me how to do that now?
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
02-20-11, 03:33 PM   #2
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Have you tried to look at how he did it and tried to adept it right into your layout?
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
02-20-11, 04:07 PM   #3
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
There are two problem with that: First it adds a separate bar, which I'm trying to avoid now (I want that spark inside the usual cast bar). Second, I don't really understand how. oUF_gcd adds a new element, and I can use elements (well, some), but I don't know how to make an element work in my layout that does not work because it's not compatible with the new ouf (that's what I assume... there are actually no lua errors).

Doesn't mean I'd not try to, if that's the only way (I kinda assumed that ouf itself brings something to have a gcd spark). oUF_gcd is simple enough for me to basically understand what's going on, but I have no idea how to diagnose the problem, since there is no lua error...
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
02-20-11, 04:36 PM   #4
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Just did a quick search for "GCD" and it revealed 3 GCD plugins for oUF. Maybe take a look at this one.
__________________
Rock: "We're sub-standard DPS. Nerf Paper, Scissors are fine."
Paper: "OMG, WTF, Scissors!"
Scissors: "Rock is OP and Paper are QQers. We need PvP buffs."

"neeh the game wont be remembered as the game who made blizz the most money, it will be remembered as the game who had the most QQ'ers that just couldnt quit the game for some reason..."

  Reply With Quote
02-21-11, 02:50 AM   #5
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Yeah I know about that, but it's the base for hungar's gcd plugin, so I guess it suffers the same problem (it's much older, too). I'll give it a shot though
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote
02-21-11, 04:12 AM   #6
gagou
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 16
I've made my own gcd element for my personal layout, it's not very complicated to understand, it may help you so here is the code for the element:
Code:
local parent, ns = ...
local oUF = ns.oUF

local GetTime, GetSpellCooldown = GetTime, _G.GetSpellCooldown

local _, class = UnitClass('player')
local spellName
if class == 'DEATHKNIGHT' then
	spellName = GetSpellInfo(45902)
elseif class == 'DRUID' then
	spellName = GetSpellInfo(5176)
elseif class == 'HUNTER' then
	spellName = GetSpellInfo(3044)
elseif class == 'MAGE' then
	spellName = GetSpellInfo(133)
elseif class == 'PALADIN' then
	spellName = GetSpellInfo(20271)
elseif class == 'PRIEST' then
	spellName = GetSpellInfo(2061)
elseif class == 'ROGUE' then
	spellName = GetSpellInfo(1752)
elseif class == 'SHAMAN' then
	spellName = GetSpellInfo(331)
elseif class == 'WARLOCK' then
	spellName = GetSpellInfo(348)
elseif class == 'WARRIOR' then
	spellName = GetSpellInfo(772)
end

local function OnUpdate(self, elapsed)
	self.currentTime = self.currentTime + elapsed
	if self.currentTime >= self.endTime then
		self:Hide()
	end
	self.Spark:SetPoint('CENTER', self, 'LEFT', (self.currentTime - self.startTime) * self:GetWidth() / self.duration, 0)
end

local function Update(self, event)
	local gcd = self.TomGCD
	local start, duration, enable = GetSpellCooldown(spellName)
	if enable == 1 and start and duration > 0 and duration <= 1.5 then
		gcd.startTime = start
		gcd.currentTime = GetTime()
		gcd.duration = duration
		gcd.endTime = start + duration
		gcd:Show()
	else
		gcd:Hide()
	end
end

local ForceUpdate = function(element)
	return Update(element.__owner, 'ForceUpdate')
end

local function Enable(self, unit)
	local gcd = self.TomGCD
	if gcd then
		gcd.__owner = self
		gcd.ForceUpdate = ForceUpdate
		self:RegisterEvent('SPELL_UPDATE_COOLDOWN', Update)
		gcd:SetScript('OnUpdate', OnUpdate)
		gcd:Hide()
	end
end

local function Disable(self, unit)
	local gcd = self.TomGCD
	if gcd then
		self:UnregisterEvent('SPELL_UPDATE_COOLDOWN', Update)
		gcd:SetScript('OnUpdate', nil)
		gcd:Hide()
	end
end

oUF:AddElement('TomGCD', Update, Enable, Disable)
here is how I spawn it in my layout :


Code:
local function spawnGCDBar(self, width, height, ...)
	local gcd = CreateFrame('Frame', nil, UIParent)
	gcd:SetSize(width, height)
	gcd:SetBackdrop(backdrop)
	gcd:SetBackdropColor(0.25, 0.25, 0.25)

	local spark = gcd:CreateTexture(nil, 'OVERLAY')
	spark:SetTexture([[Interface\CastingBar\UI-CastingBar-Spark]])
	spark:SetBlendMode('ADD')
	spark:SetSize(20, height*2.2)
	gcd.Spark = spark

	gcd:SetPoint(...)
	return gcd
end
it should not be very complicated to adapt it to your needs

Last edited by gagou : 02-21-11 at 04:15 AM.
  Reply With Quote
02-24-11, 05:52 PM   #7
Pyrates
A Cliff Giant
 
Pyrates's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 77
Thanks for all your help Turns out I'm simply stupid and ouf_gcd is still working. Sorry for that...
__________________
" ... and the Vogon will do things to you that you wish you'd never been born, or, if you're a clearer minded thinker, that the Vogon had never been born."
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Adding a gcd spark to a castbar


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