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
01-31-10, 03:25 AM   #9
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
I meant to find a cast that is un-interruptable, to be able to test the appearance of the texture I want to show for an un-interruptable cast. And to be able see if it works, ofc.

Are heartstone and mount really considered non-interruptable? Afaik, you just need to get hit and it's interrupted ...
__________________
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-31-10, 05:10 AM   #10
wurmfood
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Apr 2009
Posts: 122
Ah, sorry, I thought you meant casts that changed state. For the non-interrupt casts, various npcs and group quest bosses have casts that cannot be interrupted.

The easiest examples I know of offhand, though, are all dungeon bosses (black knight, Loken, Anub'arak...).

edit: Looks like transmutes are protected. At least, saronite to titanium is.

Last edited by wurmfood : 01-31-10 at 05:18 AM.
  Reply With Quote
01-31-10, 06:00 AM   #11
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by Dawn View Post
Are heartstone and mount really considered non-interruptable? Afaik, you just need to get hit and it's interrupted ...
They are believe it or not. They probably just have their own scripted event.
__________________
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
01-31-10, 06:17 AM   #12
Dawn
A Molten Giant
 
Dawn's Avatar
AddOn Author - Click to view addons
Join Date: May 2006
Posts: 918
Thanks, after all random heroic, ftw. The final boss from Ahn'kahet casts "Insanity", which worked fine.

However, heartstone keeps telling me it can be interrupted. Which means it's not a question of whether I believe it or not, it just won't show up that way. I don't care, though.
__________________
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
08-21-10, 01:11 PM   #13
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
I did not have a postCastStart in my layout and failed to create one so I tried to just manually listen for the event in the castbar code. Nothing happens though

Any ideas?

Code:
	------------- target castbar -----------
		elseif ( unit == 'target' ) then
			self.Castbar:RegisterEvent('UNIT_SPELLCAST_NOT_INTERRUPTABLE')
			self.Castbar:RegisterEvent('UNIT_SPELLCAST_INTERRUPTABLE')
			self.Castbar:SetScript('OnEvent', function(self, event, name)
				if (event == 'UNIT_SPELLCAST_INTERRUPTABLE') then
					self.Castbar.Text:SetTextColor(1,0,1)
					print("INTERRUPT")
				end
			end)
			
			self.Castbar.Text:SetWidth(275)
			self.Castbar.Time = self.Castbar:CreateFontString(nil, 'OVERLAY')		 
			self.Castbar.Time:SetFontObject(SystemFont_Tiny)		
			self.Castbar.CustomTimeText = function(self, duration)
				if self.casting then
					self.Time:SetFormattedText("%.1f", self.max - duration)
				elseif self.channeling then
					self.Time:SetFormattedText("%.1f", duration)
				end
			end

				self.Castbar:SetToplevel(true)
				self.Castbar:SetStatusBarColor(1, 1, 1, 0.4)
				self.Castbar:SetWidth(sett1ngs.mX)
				self.Castbar:SetHeight(sett1ngs.mhp)
				self.Castbar:SetParent(self.Health) 
				self.Castbar:SetPoint("TOPLEFT",'oUF_target',"TOPLEFT",0,0)

				self.Castbar.Spark = self.Castbar:CreateTexture(nil, 'OVERLAY')
				self.Castbar.Spark:SetHeight(sett1ngs.mhp+sett1ngs.mpower+28)
				self.Castbar.Spark:SetWidth(10)
				self.Castbar.Spark:SetBlendMode('ADD')

				self.Castbar.Text:SetPoint("TOP", self.Castbar, "TOP", 0, 0.5)
				self.Castbar.Text:SetJustifyH"CENTER"
				--self.Castbar.Text:SetTextColor(1,1,1)
				
				self.Castbar.Time:SetPoint("CENTER", self.Castbar, "CENTER", 0, -3)
				--self.Castbar.Time:SetTextColor(1,1,1)
				
				self.Castbar:SetFrameStrata("HIGH")
				
				self.Castbar.Button = CreateFrame('Frame', nil, self.Castbar)
				self.Castbar.Button:SetHeight(sett1ngs.cbplayerH-3)
				self.Castbar.Button:SetWidth(sett1ngs.cbplayerH-3)
				self.Castbar.Button:SetBackdrop(backdrop)
				self.Castbar.Button:SetBackdropColor(0, 0, 0)
				self.Castbar.Button:SetPoint('RIGHT', self.Castbar, 'LEFT', -3, -1)
				self.Castbar.Button.bd = SetBD(self.Castbar.Button, backdrop, sett1ngs.bcolor)
				self.Castbar.bd = SetBD(self.Castbar, backdrop, sett1ngs.bcolor)

				self.Castbar.Icon = self.Castbar.Button:CreateTexture(nil, 'ARTWORK')
				self.Castbar.Icon:SetAllPoints(self.Castbar.Button)
				self.Castbar.Icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
__________________

  Reply With Quote
08-21-10, 07:33 PM   #14
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   #15
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
08-22-10, 05:27 AM   #16
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
Originally Posted by haste View Post
oUF already has castbar:PostCastInterruptible(unit) and castbar:PostCastNotInterruptible(unit).
Why look at that. I take it registering the events is unnecessary as well then?
__________________
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, 05:41 AM   #17
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
Originally Posted by v6o View Post
Why look at that. I take it registering the events is unnecessary as well then?
Yep

The forum thinks my message is too short, so I present you the content of my selection clipboard: http://www.youtube.com/watch?v=xE9_3QjSE08&fmt=18
__________________
「貴方は1人じゃないよ」
  Reply With Quote
08-22-10, 04:30 PM   #18
sacrife
An Onyxian Warder
 
sacrife's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 384
I tried adding this under within the above posted code.
Got a nil value error for it. What did I do wrong?

Code:
		if self.Castbar:PostCastNotInterruptible(unit) then
			self.Castbar.Text:SetTextColor(1,0,0)
			self.Castbar.Time:SetTextColor(1,0,0)
		else
			self.Castbar.Text:SetTextColor(1,1,1)
			self.Castbar.Time:SetTextColor(1,1,1)
		end
__________________

  Reply With Quote
08-22-10, 06:22 PM   #19
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
I had a chance to look over 1.4. And please correct me if I'm wrong Haste (or someone else that know)

If all you want to do is show a frame (texture, text or whatever) then you can just define it as Castbar.Shield and it should show and hide automatically.

If you want to do something else, for example the code you posted sacrifice, then you will need to do the following.


Outside style function
Code:
local CastInterruptable = function(self, unit)
  -- Do your thing here
end
local CastNonInterruptable = function(self, unit)
  -- Do your thing here
end
local PostCastStart = function(self, unit, name, rank, castid)
  if self.interrupt then
    CastNonInterruptable(self, unit)
  else
    CastInterruptable(self, unit)
  end
end
Inside style function
Code:
Castbar.PostCastStart = PostCastStart 
Castbar.PostCastInterruptible = CastInterruptable
Castbar.PostCastNotInterruptible = CastNonInterruptable
__________________
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-23-10, 10:33 AM   #20
haste
Featured Artist
 
haste's Avatar
Premium Member
Featured
Join Date: Dec 2005
Posts: 1,027
That looks very much correct.
__________________
「貴方は1人じゃないよ」
  Reply With Quote

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

Thread Tools
Display Modes

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