Thread Tools Display Modes
01-28-10, 10:22 PM   #1
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
(un)interruptable cast

i was wondering if oUF had a command / function or whatever its called ( not much a of a programmer ) which allowed us to change the color of the casticon/castbar border whether its interruptable or not, i.e. the shield u see in the default UI frames. thx in advance
  Reply With Quote
01-28-10, 10:39 PM   #2
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Not directly. You can use a custom PostCastStart/PostChannelStart function to identify if the spell is interruptible and change the display of the castbar based on that. You should also track the UNIT_SPELLCAST_INTERRUPTABLE/UNIT_SPELLCAST_NOT_INTERRUPTABLE events in case the interrupt-ability of the spell changes during cast (e.g. during the Twin Valkyrs).

To add to this, here's how I'm doing it (in my non-updated version):

Code:
local postCastStart = function(self, event, unit, name, rank, text, castid, interrupt)
	if( interrupt ) then
		self.Castbar.bg:Hide()
		self.Castbar.Shield:Show()
	else
		self.Castbar.bg:Show()
		self.Castbar.Shield:Hide()
	end
end

local spellInterruptable = function(self, event, unitID)
	if( self.unit == unitID ) then
		if( event == 'UNIT_SPELLCAST_NOT_INTERRUPTABLE' ) then
			self.Castbar.bg:Hide()
			self.Castbar.Shield:Show()
		else
			self.Castbar.bg:Show()
			self.Castbar.Shield:Hide()
		end
	end
end
and in the layout function:

Code:
self:RegisterEvent('UNIT_SPELLCAST_NOT_INTERRUPTABLE', spellInterruptable)
self:RegisterEvent('UNIT_SPELLCAST_INTERRUPTABLE', spellInterruptable)

Last edited by wurmfood : 01-29-10 at 12:36 AM.
  Reply With Quote
01-29-10, 05:26 AM   #3
yj589794
A Rage Talon Dragon Guard
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 314
self.Castbar.Shield is not a standard item, you will need to define this texture yourself.
  Reply With Quote
01-30-10, 06:15 AM   #4
alimjocox
A Warpwood Thunder Caller
AddOn Author - Click to view addons
Join Date: Oct 2009
Posts: 96
Originally Posted by wurmfood View Post
Code:
local postCastStart = function(self, event, unit, name, rank, text, castid, interrupt)
	if( interrupt ) then
		self.Castbar.bg:Hide()
		self.Castbar.Shield:Show()
	else
		self.Castbar.bg:Show()
		self.Castbar.Shield:Hide()
	end
end

local spellInterruptable = function(self, event, unitID)
	if( self.unit == unitID ) then
		if( event == 'UNIT_SPELLCAST_NOT_INTERRUPTABLE' ) then
			self.Castbar.bg:Hide()
			self.Castbar.Shield:Show()
		else
			self.Castbar.bg:Show()
			self.Castbar.Shield:Hide()
		end
	end
end
hey wurm thx for the reply i was just wondering if

local postCastStart = function(self, event, unit, name, rank, text, castid, interrupt)
if( interrupt ) then
self.Castbar.bg:Hide()
self.Castbar.Shield:Show()
else
self.Castbar.bg:Show()
self.Castbar.Shield:Hide()
end
end

is at all necessary?

Last edited by alimjocox : 01-30-10 at 06:17 AM.
  Reply With Quote
01-30-10, 02:52 PM   #5
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
The bg part isn't, really. However, you do need something to show or hide a texture that indicates if the spell can be interrupted or not. The event stuff only triggers if the spell becomes interruptible/not during the cast. Otherwise they don't trigger.
  Reply With Quote
01-30-10, 04:05 PM   #6
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Is there a place/way to test such code? Without a raid/group, if possible.
__________________
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
01-30-10, 04:12 PM   #7
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
The cast option changing? Not that I know of, and I've tried to find one.
  Reply With Quote
01-30-10, 05:00 PM   #8
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by Dawn View Post
Is there a place/way to test such code? Without a raid/group, if possible.
Do you mean the events OR just interruptable and non-interruptable casts?

If the latter, you can just target yourself and use your mount or hearthstone.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 01-30-10 at 05:04 PM.
  Reply With Quote
08-21-10, 07:33 PM   #9
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
You will need to add PostCastStart.

Originally Posted by wurmfood View Post
The event stuff only triggers if the spell becomes interruptible/not during the cast. Otherwise they don't trigger.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.
  Reply With Quote
08-22-10, 04:58 AM   #10
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
oUF already has castbar:PostCastInterruptible(unit) and castbar:PostCastNotInterruptible(unit).
__________________
「貴方は1人じゃないよ」
  Reply With Quote

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » (un)interruptable cast


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