Jump to content

Arena Junkies was shut down on July 1st, 2018. You're viewing an archive of this page from 2018-06-25 at 17:01. Thank you all for your support! Please get in touch via the Curse help desk if you need any support using this archive.

Photo

InterruptBar


  • Please log in to reply
26 replies to this topic

#1 Sebar

Sebar
  • Junkies
  • Goblinclass_name
  • US-Hyjal
  • Whirlwind
  • Posts: 21
  • Talents: Marksmanship

Posted 11 February 2010 - 04:39 AM

I was watching a video the other day and saw someone with interruptbar that had more than just the starter ones, had bladestorm and stuff. anyone know how to add these to it?
  • 0

#2 Dunc

Dunc
  • Junkies
  • Goblinclass_name
  • EU-Kazzak
  • Misery
  • Posts: 9,711
  • Talents: Shadow 1/1/2/0/2/1/2
  • LocationEngland

Posted 11 February 2010 - 04:51 AM

It's abit hard to explain but anyway, go to your Interrupt Bar folder and open InterruptBar.lua. You'll see all kinds of numbers, the ones most important are these three lists:

local spellids = {[6552] = 10, [72] = 12, [23920] = 10, [2139] = 24, [19647] = 24, [57994] = 6, [16979] = 15, [1766] = 10, [47528] = 10, [18499] = 30, [49039] = 120, [8643] = 20}, [10890] = 30


-- 6552 Pummel
-- 72 Shield Bash
-- 23920 Spell Reflect
-- 2139 Counterspell
-- 19647 Spell Lock
-- 57994 Wind Shear
-- 16979 Feral Charge
-- 1766 Kick
-- 47528 Mind Freeze
-- 49039 Lichborne
-- 8643 Kidney Shot
-- 18499 Berserker Rage
-- 10890 Psychic Scream


local order = {6552, 72, 23920, 2139, 19647, 57994, 1766, 18499, 47528, 16979, 8643, 49039, 10890}


The number before the '='(in the first list) is the SpellID, which you can find on wowhead.com. The number behind the '=' is the cooldown time(in seconds)'. Just type in whatever spell you want added, for example I'll add Psychic Scream. Searched it on wowhead.com and I get the url http://www.wowhead.com/?spell=10890 where 10890 is the SpellID.

I suggest to start off adding the name of the spell you want added in the second list and add the SpellID at the end of it for reference. For example:

-- 10890 Psychic Scream


Then you go back to the first list and in the back of all those numbers you add:

[10890] = 30

Make sure you seperate it from the other numbers with a comma + space.

Then as last, the third list should speak for itself. Just add the SpellID(10890) somewhere between the numbers depending on what order you want it to be in. Added it in bold so it's easy to see. Hope this makes sense!
  • 1
that's all we'll have when the world is through

#3 Sebar

Sebar
  • Junkies
  • Goblinclass_name
  • US-Hyjal
  • Whirlwind
  • Posts: 21
  • Talents: Marksmanship

Posted 11 February 2010 - 05:03 AM

sweet, thanks a bunch man ^_^
  • 0

#4 Ickz

Ickz
  • Junkies
  • Humanclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 448
  • Talents: Assassination 2/2/1/2/1/0/0
  • 2v2: 2325
  • 3v3: 957

Posted 11 February 2010 - 05:13 AM

Anyone know if there's an easy way to modify the lua so you can have two+ rows of spells?
  • 0

#5 Pharaun

Pharaun
  • LocationSeattle, WA

Posted 11 February 2010 - 04:01 PM

Anyone know if there's an easy way to modify the lua so you can have two+ rows of spells?


http://www.arenajunk...d.php?p=1898384
  • 0
"Who, after all, is today speaking of the destruction of the Armenians?"

-Adolf Hitler, 1939

#6 Aushe

Aushe
  • Junkies
  • Undeadclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 252
  • Talents: Frost 0/2/0/2/0/2
  • RBG: 2270

Posted 11 February 2010 - 05:31 PM

what should i open the .lua as? lol
  • 0

#7 huurka

huurka
  • Junkies
  • Humanclass_name
  • EU-Agamaggan
  • Blackout
  • Posts: 7,088
  • Talents: Shadow 0/././././.

Posted 11 February 2010 - 05:58 PM

notepad
  • 0

#8 Ickz

Ickz
  • Junkies
  • Humanclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 448
  • Talents: Assassination 2/2/1/2/1/0/0
  • 2v2: 2325
  • 3v3: 957

Posted 12 February 2010 - 10:22 AM

http://www.arenajunk...d.php?p=1898384


Judging by the posts in that thread, the extra bar doesn't have the feature that makes the spells hidden until they're used? If so, that is pewp.
  • 0

#9 Pharaun

Pharaun
  • LocationSeattle, WA

Posted 13 February 2010 - 08:39 PM

I have honestly no idea. I blindly hacked it in a few minutes and then ignored it.
  • 0
"Who, after all, is today speaking of the destruction of the Armenians?"

-Adolf Hitler, 1939

#10 Ickz

Ickz
  • Junkies
  • Humanclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 448
  • Talents: Assassination 2/2/1/2/1/0/0
  • 2v2: 2325
  • 3v3: 957

Posted 14 February 2010 - 06:16 AM

Meh, I found a nice solution for myself. Using the original interrupt bar, I just copied over the folder in my addons folder, renamed it Interrupt Bar2, went into the lua and added a 2 after every mentioning of interruptbar, interruptbardb, or /ib. Two interrupt bar addons that function the same and have different spells on each.
  • 0

#11 Verb

Verb
  • Members
  • Dwarfclass_name
  • US-Dalaran
  • Stormstrike
  • Posts: 428
  • Talents: Discipline

Posted 14 February 2010 - 06:20 AM

Meh, I found a nice solution for myself. Using the original interrupt bar, I just copied over the folder in my addons folder, renamed it Interrupt Bar2, went into the lua and added a 2 after every mentioning of interruptbar, interruptbardb, or /ib. Two interrupt bar addons that function the same and have different spells on each.


Same thing I did, works perfectly
  • 0

#12 Pharaun

Pharaun
  • LocationSeattle, WA

Posted 14 February 2010 - 07:26 AM

That's more or less exactly what I did. I didn't touch the slash commands, but I did add in an anchoring process where one of the addons anchors on the other (which basically just involves creating a global name for one and a dependency / setpoint command on the other).

Seems the version of InterruptBar I used as a template was off somehow >.<
  • 0
"Who, after all, is today speaking of the destruction of the Armenians?"

-Adolf Hitler, 1939

#13 Mantraz

Mantraz
  • Junkies
  • Undeadclass_name
  • EU-Al'Akir
  • Blackout
  • Posts: 633
  • Talents: Fire

Posted 14 February 2010 - 08:11 PM

That's more or less exactly what I did. I didn't touch the slash commands, but I did add in an anchoring process where one of the addons anchors on the other (which basically just involves creating a global name for one and a dependency / setpoint command on the other).

Seems the version of InterruptBar I used as a template was off somehow >.<

Would greatly appreciate an upload
  • 0
Spoiler

#14 Pharaun

Pharaun
  • LocationSeattle, WA

Posted 14 February 2010 - 08:46 PM

http://www.google.co...=utf-8&oe=utf-8
  • 0
"Who, after all, is today speaking of the destruction of the Armenians?"

-Adolf Hitler, 1939

#15 bens

bens
  • Benys
  • Junkies
  • Humanclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 491
  • Talents: Affliction
  • RBG: 2565

Posted 14 February 2010 - 10:24 PM

Meh, I found a nice solution for myself. Using the original interrupt bar, I just copied over the folder in my addons folder, renamed it Interrupt Bar2, went into the lua and added a 2 after every mentioning of interruptbar, interruptbardb, or /ib. Two interrupt bar addons that function the same and have different spells on each.


could you upload it please ? :)
  • 0

#16 Fïvegoldplz1296683424

Fïvegoldplz1296683424

Posted 14 February 2010 - 11:02 PM

Epic... Thx for sharing
  • 0

#17 Mantraz

Mantraz
  • Junkies
  • Undeadclass_name
  • EU-Al'Akir
  • Blackout
  • Posts: 633
  • Talents: Fire

Posted 15 February 2010 - 03:00 PM

Meh, I found a nice solution for myself. Using the original interrupt bar, I just copied over the folder in my addons folder, renamed it Interrupt Bar2, went into the lua and added a 2 after every mentioning of interruptbar, interruptbardb, or /ib. Two interrupt bar addons that function the same and have different spells on each.


Tried my best to do this myself, failed, though.

Here's a picture of the LUA errorlog ingame

http://i48.tinypic.com/29w3fwy.jpg

and here's the file i created (I also edited the .TOC file to include Interrupt Bar2.)

----------------------------------------------------
-- Interrupt Bar2 by Kollektiv
----------------------------------------------------

InterruptBarDB2 = InterruptBarDB2 or { scale = 1, hidden = false, lock = false, }
local abilities = {}
local order
local band = bit.band

local spellids = {[72] = 12, [8643] = 20, [10890] = 26, [46924] = 75, [23920] = 10}
for spellid,time in pairs(spellids) do
	local name,_,spellicon = GetSpellInfo(spellid)	
	abilities[name] = { icon = spellicon, duration = time }
end

-----------------------------------------------------
-- Edit this table to change the order
-----------------------------------------------------
-- 72 Shield Bash
-- 8643 Kidney Shot
-- 10890 Psychic Scream
-- 31224 Cloak Of Shadows
-- 46924 Bladestorm
-- 23920 Spell Reflect
-----------------------------------------------------

local order = {72, 8643, 10890, 31224, 46924, 23920}

-----------------------------------------------------
-----------------------------------------------------

for k,v in ipairs(order) do order[k] = GetSpellInfo(v) end

local frame
local bar

local GetTime = GetTime
local ipairs = ipairs
local pairs = pairs
local select = select
local floor = floor
local band = bit.band
local GetSpellInfo = GetSpellInfo

local GROUP_UNITS = bit.bor(0x00000010, 0x00000400)

local activetimers = {}

local size = 0
local function getsize()
	size = 0
	for k in pairs(activetimers) do
		size = size + 1
	end
end

local function InterruptBar2_AddIcons()
	local x = -45
	for _,ability in ipairs(order) do
		local btn = CreateFrame("Frame",nil,bar)
		btn:SetWidth(30)
		btn:SetHeight(30)
		btn:SetPoint("CENTER",bar,"CENTER",x,0)
		btn:SetFrameStrata("LOW")
		
		local cd = CreateFrame("Cooldown",nil,btn)
		cd.noomnicc = true
		cd:SetAllPoints(true)
		cd:SetFrameStrata("MEDIUM")
		cd:Hide()
		
		local texture = btn:CreateTexture(nil,"BACKGROUND")
		texture:SetAllPoints(true)
		texture:SetTexture(abilities[ability].icon)
		texture:SetTexCoord(0.07,0.9,0.07,0.90)
	
		local text = cd:CreateFontString(nil,"ARTWORK")
		text:SetFont(STANDARD_TEXT_FONT,18,"OUTLINE")
		text:SetTextColor(1,1,0,1)
		text:SetPoint("LEFT",btn,"LEFT",2,0)
		
		btn.texture = texture
		btn.text = text
		btn.duration = abilities[ability].duration
		btn.cd = cd
		
		bar[ability] = btn
		
		x = x + 30
	end
end

local function InterruptBar2_SavePosition()
	local point, _, relativePoint, xOfs, yOfs = bar:GetPoint()
	if not InterruptBarDB2.Position then 
		InterruptBarDB2.Position = {}
	end
	InterruptBarDB2.Position.point = point
	InterruptBarDB2.Position.relativePoint = relativePoint
	InterruptBarDB2.Position.xOfs = xOfs
	InterruptBarDB2.Position.yOfs = yOfs
end

local function InterruptBar2_LoadPosition()
	if InterruptBarDB2.Position then
		bar:SetPoint(InterruptBarDB2.Position.point,UIParent,InterruptBarDB2.Position.relativePoint,InterruptBarDB2.Position.xOfs,InterruptBarDB2.Position.yOfs)
	else
		bar:SetPoint("CENTER", UIParent, "CENTER")
	end
end

local function InterruptBar2_UpdateBar()
	bar:SetScale(InterruptBarDB2.scale)
	if InterruptBarDB2.hidden then
		for _,v in ipairs(order) do bar[v]:Hide() end
	else
		for _,v in ipairs(order) do bar[v]:Show() end
	end
	if InterruptBarDB2.lock then
		bar:EnableMouse(false)
	else
		bar:EnableMouse(true)
	end
end

local function InterruptBar2_CreateBar()
	bar = CreateFrame("Frame", nil, UIParent)
	bar:SetMovable(true)
	bar:SetWidth(120)
	bar:SetHeight(30)
	bar:SetClampedToScreen(true) 
	bar:SetScript("OnMouseDown",function(self,button) if button == "LeftButton" then self:StartMoving() end end)
	bar:SetScript("OnMouseUp",function(self,button) if button == "LeftButton" then self:StopMovingOrSizing() InterruptBar2_SavePosition() end end)
	bar:Show()
	
	InterruptBar2_AddIcons()
	InterruptBar2_UpdateBar()
	InterruptBar2_LoadPosition()
end

local function InterruptBar2_UpdateText(text,cooldown)
	if cooldown < 10 then 
		if cooldown <= 0.5 then
			text:SetText("")
		else
			text:SetFormattedText(" %d",cooldown)
		end
	else
		text:SetFormattedText("%d",cooldown)
	end
	if cooldown < 6 then 
		text:SetTextColor(1,0,0,1)
	else 
		text:SetTextColor(1,1,0,1) 
	end
end

local function InterruptBar2_StopAbility(ref,ability)
	if InterruptBarDB2.hidden then ref:Hide() end
	if activetimers[ability] then activetimers[ability] = nil end
	ref.text:SetText("")
	ref.cd:Hide()
end

local time = 0
local function InterruptBar2_OnUpdate(self, elapsed)
	time = time + elapsed
	if time > 0.25 then
		getsize()
		for ability,ref in pairs(activetimers) do
			ref.cooldown = ref.start + ref.duration - GetTime()
			if ref.cooldown <= 0 then
				InterruptBar2_StopAbility(ref,ability)
			else 
				InterruptBar2_UpdateText(ref.text,floor(ref.cooldown+0.5))
			end
		end
		if size == 0 then frame:SetScript("OnUpdate",nil) end
		time = time - 0.25
	end
end

local function InterruptBar2_StartTimer(ref,ability)
	if InterruptBarDB2.hidden then
		ref:Show()
	end
	if not activetimers[ability] then
		local duration
		activetimers[ability] = ref
		ref.cd:Show()
		ref.cd:SetCooldown(GetTime()-0.40,ref.duration)
		ref.start = GetTime()
		InterruptBar2_UpdateText(ref.text,ref.duration)
	end
	frame:SetScript("OnUpdate",InterruptBar2_OnUpdate)
end

local function InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED(...)
	local spellID, ability, useSecondDuration
	return function(_, eventtype, _, srcName, srcFlags, _, dstName, dstFlags, id)
		if (band(srcFlags, 0x00000040) == 0x00000040 and eventtype == "SPELL_CAST_SUCCESS") then 
			spellID = id
		else
			return
		end
		useSecondDuration = false
		if spellID == 49376 then spellID = 16979; useSecondDuration = true end -- Feral Charge - Cat -> Feral Charge - Bear
		ability = GetSpellInfo(spellID)
		if abilities[ability] then
			if useSecondDuration and spellID == 16979 then
				bar[ability].duration = 30
			elseif spellID == 16979 then
				bar[ability].duration = 15
			end
			InterruptBar2_StartTimer(bar[ability],ability)
		end
	end
end

InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED = InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED()

local function InterruptBar2_ResetAllTimers()
	for _,ability in ipairs(order) do
		InterruptBar2_StopAbility(bar[ability])
	end
	active = 0
end

local function InterruptBar2_PLAYER_ENTERING_WORLD(self)
	InterruptBar2_ResetAllTimers()
end

local function InterruptBar2_Reset()
	InterruptBarDB2 = { scale = 1, hidden = false, lock = false }
	InterruptBar2_UpdateBar()
	InterruptBar2_LoadPosition()
end

local function InterruptBar2_Test()
	for _,ability in ipairs(order) do
		InterruptBar2_StartTimer(bar[ability],ability)
	end
end

local cmdfuncs = {
	scale = function(v) InterruptBarDB2.scale = v; InterruptBar2_UpdateBar() end,
	hidden = function() InterruptBarDB2.hidden = not InterruptBarDB2.hidden; InterruptBar2_UpdateBar() end,
	lock = function() InterruptBarDB2.lock = not InterruptBarDB2.lock; InterruptBar2_UpdateBar() end,
	reset = function() InterruptBar2_Reset() end,
	test = function() InterruptBar2_Test() end,
}

local cmdtbl = {}
function InterruptBar2_Command(cmd)
	for k in ipairs(cmdtbl) do
		cmdtbl[k] = nil
	end
	for v in gmatch(cmd, "[^ ]+") do
  	tinsert(cmdtbl, v)
  end
  local cb = cmdfuncs[cmdtbl[1]] 
  if cb then
  	local s = tonumber(cmdtbl[2])
  	cb(s)
  else
  	ChatFrame1:AddMessage("InterruptBar2 Options | /ib2 <option>",0,1,0)  	
  	ChatFrame1:AddMessage("-- scale <number> | value: " .. InterruptBarDB2.scale,0,1,0)
  	ChatFrame1:AddMessage("-- hidden (toggle) | value: " .. tostring(InterruptBarDB2.hidden),0,1,0)
  	ChatFrame1:AddMessage("-- lock (toggle) | value: " .. tostring(InterruptBarDB2.lock),0,1,0)
  	ChatFrame1:AddMessage("-- test (execute)",0,1,0)
  	ChatFrame1:AddMessage("-- reset (execute)",0,1,0)
  end
end

local function InterruptBar2_OnLoad(self)
	self:RegisterEvent("PLAYER_ENTERING_WORLD")
	self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
	if not InterruptBarDB2.scale then InterruptBarDB.scale = 1 end
	if not InterruptBarDB2.hidden then InterruptBarDB.hidden = false end
	if not InterruptBarDB2.lock then InterruptBarDB2.lock = false end
	InterruptBar2_CreateBar()
	
	SlashCmdList["InterruptBar2"] = InterruptBar_Command
	SLASH_InterruptBar1 = "/ib2"
	
	ChatFrame1:AddMessage("Interrupt Bar by Kollektiv. Type /ib2 for options.",0,1,0)
end

local eventhandler = {
	["VARIABLES_LOADED"] = function(self) InterruptBar2_OnLoad(self) end,
	["PLAYER_ENTERING_WORLD"] = function(self) InterruptBar2_PLAYER_ENTERING_WORLD(self) end,
	["COMBAT_LOG_EVENT_UNFILTERED"] = function(self,...) InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED(...) end,
}

local function InterruptBar2_OnEvent(self,event,...)
	eventhandler[event](self,...)
end

frame = CreateFrame("Frame",nil,UIParent)
frame:SetScript("OnEvent",InterruptBar2_OnEvent)
frame:RegisterEvent("VARIABLES_LOADED")


  • 0
Spoiler

#18 Pharaun

Pharaun
  • LocationSeattle, WA

Posted 15 February 2010 - 06:34 PM

Too hard to tell without seeing all of your code. Can up upload both folders?
  • 0
"Who, after all, is today speaking of the destruction of the Armenians?"

-Adolf Hitler, 1939

#19 Mantraz

Mantraz
  • Junkies
  • Undeadclass_name
  • EU-Al'Akir
  • Blackout
  • Posts: 633
  • Talents: Fire

Posted 15 February 2010 - 06:42 PM

Thanks for taking a look at this for me Phara- you've already made my life a lot easier with the CombatLogClearer;)

this is the LUA of interruptbar(1 first, then 2) along with the .toc of IB2, its so short that it shouldn't be an issue to not upload the original. I havnt touched neither of them

(This addon works fine by itself, and even when i have IB2 enabled, they dont crash, but IB2 doesnt work at all)

Interruptbar.lua :

----------------------------------------------------
-- Interrupt Bar by Kollektiv
----------------------------------------------------

InterruptBarDB = InterruptBarDB or { scale = 1, hidden = false, lock = false, }
local abilities = {}
local order
local band = bit.band

local spellids = {[6552] = 10, [2139] = 24, [19647] = 24, [16979] = 15, [1766] = 10, [47528] = 10}
for spellid,time in pairs(spellids) do
	local name,_,spellicon = GetSpellInfo(spellid)	
	abilities[name] = { icon = spellicon, duration = time }
end

-----------------------------------------------------
-- Edit this table to change the order
-----------------------------------------------------
-- 6552  Pummel
-- 2139  Counterspell
-- 19647 Spell Lock
-- 16979 Feral Charge 
-- 1766  Kick
-- 47528 Mind Freeze
-----------------------------------------------------

local order = {6552, 2139, 19647, 1766, 47528, 16979}

-----------------------------------------------------
-----------------------------------------------------

for k,v in ipairs(order) do order[k] = GetSpellInfo(v) end

local frame
local bar

local GetTime = GetTime
local ipairs = ipairs
local pairs = pairs
local select = select
local floor = floor
local band = bit.band
local GetSpellInfo = GetSpellInfo

local GROUP_UNITS = bit.bor(0x00000010, 0x00000400)

local activetimers = {}

local size = 0
local function getsize()
	size = 0
	for k in pairs(activetimers) do
		size = size + 1
	end
end

local function InterruptBar_AddIcons()
	local x = -45
	for _,ability in ipairs(order) do
		local btn = CreateFrame("Frame",nil,bar)
		btn:SetWidth(30)
		btn:SetHeight(30)
		btn:SetPoint("CENTER",bar,"CENTER",x,0)
		btn:SetFrameStrata("LOW")
		
		local cd = CreateFrame("Cooldown",nil,btn)
		cd.noomnicc = true
		cd:SetAllPoints(true)
		cd:SetFrameStrata("MEDIUM")
		cd:Hide()
		
		local texture = btn:CreateTexture(nil,"BACKGROUND")
		texture:SetAllPoints(true)
		texture:SetTexture(abilities[ability].icon)
		texture:SetTexCoord(0.07,0.9,0.07,0.90)
	
		local text = cd:CreateFontString(nil,"ARTWORK")
		text:SetFont(STANDARD_TEXT_FONT,18,"OUTLINE")
		text:SetTextColor(1,1,0,1)
		text:SetPoint("LEFT",btn,"LEFT",2,0)
		
		btn.texture = texture
		btn.text = text
		btn.duration = abilities[ability].duration
		btn.cd = cd
		
		bar[ability] = btn
		
		x = x + 30
	end
end

local function InterruptBar_SavePosition()
	local point, _, relativePoint, xOfs, yOfs = bar:GetPoint()
	if not InterruptBarDB.Position then 
		InterruptBarDB.Position = {}
	end
	InterruptBarDB.Position.point = point
	InterruptBarDB.Position.relativePoint = relativePoint
	InterruptBarDB.Position.xOfs = xOfs
	InterruptBarDB.Position.yOfs = yOfs
end

local function InterruptBar_LoadPosition()
	if InterruptBarDB.Position then
		bar:SetPoint(InterruptBarDB.Position.point,UIParent,InterruptBarDB.Position.relativePoint,InterruptBarDB.Position.xOfs,InterruptBarDB.Position.yOfs)
	else
		bar:SetPoint("CENTER", UIParent, "CENTER")
	end
end

local function InterruptBar_UpdateBar()
	bar:SetScale(InterruptBarDB.scale)
	if InterruptBarDB.hidden then
		for _,v in ipairs(order) do bar[v]:Hide() end
	else
		for _,v in ipairs(order) do bar[v]:Show() end
	end
	if InterruptBarDB.lock then
		bar:EnableMouse(false)
	else
		bar:EnableMouse(true)
	end
end

local function InterruptBar_CreateBar()
	bar = CreateFrame("Frame", nil, UIParent)
	bar:SetMovable(true)
	bar:SetWidth(120)
	bar:SetHeight(30)
	bar:SetClampedToScreen(true) 
	bar:SetScript("OnMouseDown",function(self,button) if button == "LeftButton" then self:StartMoving() end end)
	bar:SetScript("OnMouseUp",function(self,button) if button == "LeftButton" then self:StopMovingOrSizing() InterruptBar_SavePosition() end end)
	bar:Show()
	
	InterruptBar_AddIcons()
	InterruptBar_UpdateBar()
	InterruptBar_LoadPosition()
end

local function InterruptBar_UpdateText(text,cooldown)
	if cooldown < 10 then 
		if cooldown <= 0.5 then
			text:SetText("")
		else
			text:SetFormattedText(" %d",cooldown)
		end
	else
		text:SetFormattedText("%d",cooldown)
	end
	if cooldown < 6 then 
		text:SetTextColor(1,0,0,1)
	else 
		text:SetTextColor(1,1,0,1) 
	end
end

local function InterruptBar_StopAbility(ref,ability)
	if InterruptBarDB.hidden then ref:Hide() end
	if activetimers[ability] then activetimers[ability] = nil end
	ref.text:SetText("")
	ref.cd:Hide()
end

local time = 0
local function InterruptBar_OnUpdate(self, elapsed)
	time = time + elapsed
	if time > 0.25 then
		getsize()
		for ability,ref in pairs(activetimers) do
			ref.cooldown = ref.start + ref.duration - GetTime()
			if ref.cooldown <= 0 then
				InterruptBar_StopAbility(ref,ability)
			else 
				InterruptBar_UpdateText(ref.text,floor(ref.cooldown+0.5))
			end
		end
		if size == 0 then frame:SetScript("OnUpdate",nil) end
		time = time - 0.25
	end
end

local function InterruptBar_StartTimer(ref,ability)
	if InterruptBarDB.hidden then
		ref:Show()
	end
	if not activetimers[ability] then
		local duration
		activetimers[ability] = ref
		ref.cd:Show()
		ref.cd:SetCooldown(GetTime()-0.40,ref.duration)
		ref.start = GetTime()
		InterruptBar_UpdateText(ref.text,ref.duration)
	end
	frame:SetScript("OnUpdate",InterruptBar_OnUpdate)
end

local function InterruptBar_COMBAT_LOG_EVENT_UNFILTERED(...)
	local spellID, ability, useSecondDuration
	return function(_, eventtype, _, srcName, srcFlags, _, dstName, dstFlags, id)
		if (band(srcFlags, 0x00000040) == 0x00000040 and eventtype == "SPELL_CAST_SUCCESS") then 
			spellID = id
		else
			return
		end
		useSecondDuration = false
		if spellID == 49376 then spellID = 16979; useSecondDuration = true end -- Feral Charge - Cat -> Feral Charge - Bear
		ability = GetSpellInfo(spellID)
		if abilities[ability] then
			if useSecondDuration and spellID == 16979 then
				bar[ability].duration = 30
			elseif spellID == 16979 then
				bar[ability].duration = 15
			end
			InterruptBar_StartTimer(bar[ability],ability)
		end
	end
end

InterruptBar_COMBAT_LOG_EVENT_UNFILTERED = InterruptBar_COMBAT_LOG_EVENT_UNFILTERED()

local function InterruptBar_ResetAllTimers()
	for _,ability in ipairs(order) do
		InterruptBar_StopAbility(bar[ability])
	end
	active = 0
end

local function InterruptBar_PLAYER_ENTERING_WORLD(self)
	InterruptBar_ResetAllTimers()
end

local function InterruptBar_Reset()
	InterruptBarDB = { scale = 1, hidden = false, lock = false }
	InterruptBar_UpdateBar()
	InterruptBar_LoadPosition()
end

local function InterruptBar_Test()
	for _,ability in ipairs(order) do
		InterruptBar_StartTimer(bar[ability],ability)
	end
end

local cmdfuncs = {
	scale = function(v) InterruptBarDB.scale = v; InterruptBar_UpdateBar() end,
	hidden = function() InterruptBarDB.hidden = not InterruptBarDB.hidden; InterruptBar_UpdateBar() end,
	lock = function() InterruptBarDB.lock = not InterruptBarDB.lock; InterruptBar_UpdateBar() end,
	reset = function() InterruptBar_Reset() end,
	test = function() InterruptBar_Test() end,
}

local cmdtbl = {}
function InterruptBar_Command(cmd)
	for k in ipairs(cmdtbl) do
		cmdtbl[k] = nil
	end
	for v in gmatch(cmd, "[^ ]+") do
  	tinsert(cmdtbl, v)
  end
  local cb = cmdfuncs[cmdtbl[1]] 
  if cb then
  	local s = tonumber(cmdtbl[2])
  	cb(s)
  else
  	ChatFrame1:AddMessage("InterruptBar Options | /ib <option>",0,1,0)  	
  	ChatFrame1:AddMessage("-- scale <number> | value: " .. InterruptBarDB.scale,0,1,0)
  	ChatFrame1:AddMessage("-- hidden (toggle) | value: " .. tostring(InterruptBarDB.hidden),0,1,0)
  	ChatFrame1:AddMessage("-- lock (toggle) | value: " .. tostring(InterruptBarDB.lock),0,1,0)
  	ChatFrame1:AddMessage("-- test (execute)",0,1,0)
  	ChatFrame1:AddMessage("-- reset (execute)",0,1,0)
  end
end

local function InterruptBar_OnLoad(self)
	self:RegisterEvent("PLAYER_ENTERING_WORLD")
	self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
	if not InterruptBarDB.scale then InterruptBarDB.scale = 1 end
	if not InterruptBarDB.hidden then InterruptBarDB.hidden = false end
	if not InterruptBarDB.lock then InterruptBarDB.lock = false end
	InterruptBar_CreateBar()
	
	SlashCmdList["InterruptBar"] = InterruptBar_Command
	SLASH_InterruptBar1 = "/ib"
	
	ChatFrame1:AddMessage("Interrupt Bar by Kollektiv. Type /ib for options.",0,1,0)
end

local eventhandler = {
	["VARIABLES_LOADED"] = function(self) InterruptBar_OnLoad(self) end,
	["PLAYER_ENTERING_WORLD"] = function(self) InterruptBar_PLAYER_ENTERING_WORLD(self) end,
	["COMBAT_LOG_EVENT_UNFILTERED"] = function(self,...) InterruptBar_COMBAT_LOG_EVENT_UNFILTERED(...) end,
}

local function InterruptBar_OnEvent(self,event,...)
	eventhandler[event](self,...)
end

frame = CreateFrame("Frame",nil,UIParent)
frame:SetScript("OnEvent",InterruptBar_OnEvent)
frame:RegisterEvent("VARIABLES_LOADED")

Here's my losely made IB2 addon, i've searched for /ib, interruptbarDB and /interruptbar and replaced ALL of these with /Ib2, interruptbarDB2 and /interruptbar2

----------------------------------------------------
-- Interrupt Bar2 by Kollektiv
----------------------------------------------------

InterruptBarDB2 = InterruptBarDB2 or { scale = 1, hidden = false, lock = false, }
local abilities = {}
local order
local band = bit.band

local spellids = {[72] = 12, [8643] = 20, [10890] = 26, [46924] = 75, [23920] = 10}
for spellid,time in pairs(spellids) do
	local name,_,spellicon = GetSpellInfo(spellid)	
	abilities[name] = { icon = spellicon, duration = time }
end

-----------------------------------------------------
-- Edit this table to change the order
-----------------------------------------------------
-- 72 Shield Bash
-- 8643 Kidney Shot
-- 10890 Psychic Scream
-- 31224 Cloak Of Shadows
-- 46924 Bladestorm
-- 23920 Spell Reflect
-----------------------------------------------------

local order = {72, 8643, 10890, 31224, 46924, 23920}

-----------------------------------------------------
-----------------------------------------------------

for k,v in ipairs(order) do order[k] = GetSpellInfo(v) end

local frame
local bar

local GetTime = GetTime
local ipairs = ipairs
local pairs = pairs
local select = select
local floor = floor
local band = bit.band
local GetSpellInfo = GetSpellInfo

local GROUP_UNITS = bit.bor(0x00000010, 0x00000400)

local activetimers = {}

local size = 0
local function getsize()
	size = 0
	for k in pairs(activetimers) do
		size = size + 1
	end
end

local function InterruptBar2_AddIcons()
	local x = -45
	for _,ability in ipairs(order) do
		local btn = CreateFrame("Frame",nil,bar)
		btn:SetWidth(30)
		btn:SetHeight(30)
		btn:SetPoint("CENTER",bar,"CENTER",x,0)
		btn:SetFrameStrata("LOW")
		
		local cd = CreateFrame("Cooldown",nil,btn)
		cd.noomnicc = true
		cd:SetAllPoints(true)
		cd:SetFrameStrata("MEDIUM")
		cd:Hide()
		
		local texture = btn:CreateTexture(nil,"BACKGROUND")
		texture:SetAllPoints(true)
		texture:SetTexture(abilities[ability].icon)
		texture:SetTexCoord(0.07,0.9,0.07,0.90)
	
		local text = cd:CreateFontString(nil,"ARTWORK")
		text:SetFont(STANDARD_TEXT_FONT,18,"OUTLINE")
		text:SetTextColor(1,1,0,1)
		text:SetPoint("LEFT",btn,"LEFT",2,0)
		
		btn.texture = texture
		btn.text = text
		btn.duration = abilities[ability].duration
		btn.cd = cd
		
		bar[ability] = btn
		
		x = x + 30
	end
end

local function InterruptBar2_SavePosition()
	local point, _, relativePoint, xOfs, yOfs = bar:GetPoint()
	if not InterruptBarDB2.Position then 
		InterruptBarDB2.Position = {}
	end
	InterruptBarDB2.Position.point = point
	InterruptBarDB2.Position.relativePoint = relativePoint
	InterruptBarDB2.Position.xOfs = xOfs
	InterruptBarDB2.Position.yOfs = yOfs
end

local function InterruptBar2_LoadPosition()
	if InterruptBarDB2.Position then
		bar:SetPoint(InterruptBarDB2.Position.point,UIParent,InterruptBarDB2.Position.relativePoint,InterruptBarDB2.Position.xOfs,InterruptBarDB2.Position.yOfs)
	else
		bar:SetPoint("CENTER", UIParent, "CENTER")
	end
end

local function InterruptBar2_UpdateBar()
	bar:SetScale(InterruptBarDB2.scale)
	if InterruptBarDB2.hidden then
		for _,v in ipairs(order) do bar[v]:Hide() end
	else
		for _,v in ipairs(order) do bar[v]:Show() end
	end
	if InterruptBarDB2.lock then
		bar:EnableMouse(false)
	else
		bar:EnableMouse(true)
	end
end

local function InterruptBar2_CreateBar()
	bar = CreateFrame("Frame", nil, UIParent)
	bar:SetMovable(true)
	bar:SetWidth(120)
	bar:SetHeight(30)
	bar:SetClampedToScreen(true) 
	bar:SetScript("OnMouseDown",function(self,button) if button == "LeftButton" then self:StartMoving() end end)
	bar:SetScript("OnMouseUp",function(self,button) if button == "LeftButton" then self:StopMovingOrSizing() InterruptBar2_SavePosition() end end)
	bar:Show()
	
	InterruptBar2_AddIcons()
	InterruptBar2_UpdateBar()
	InterruptBar2_LoadPosition()
end

local function InterruptBar2_UpdateText(text,cooldown)
	if cooldown < 10 then 
		if cooldown <= 0.5 then
			text:SetText("")
		else
			text:SetFormattedText(" %d",cooldown)
		end
	else
		text:SetFormattedText("%d",cooldown)
	end
	if cooldown < 6 then 
		text:SetTextColor(1,0,0,1)
	else 
		text:SetTextColor(1,1,0,1) 
	end
end

local function InterruptBar2_StopAbility(ref,ability)
	if InterruptBarDB2.hidden then ref:Hide() end
	if activetimers[ability] then activetimers[ability] = nil end
	ref.text:SetText("")
	ref.cd:Hide()
end

local time = 0
local function InterruptBar2_OnUpdate(self, elapsed)
	time = time + elapsed
	if time > 0.25 then
		getsize()
		for ability,ref in pairs(activetimers) do
			ref.cooldown = ref.start + ref.duration - GetTime()
			if ref.cooldown <= 0 then
				InterruptBar2_StopAbility(ref,ability)
			else 
				InterruptBar2_UpdateText(ref.text,floor(ref.cooldown+0.5))
			end
		end
		if size == 0 then frame:SetScript("OnUpdate",nil) end
		time = time - 0.25
	end
end

local function InterruptBar2_StartTimer(ref,ability)
	if InterruptBarDB2.hidden then
		ref:Show()
	end
	if not activetimers[ability] then
		local duration
		activetimers[ability] = ref
		ref.cd:Show()
		ref.cd:SetCooldown(GetTime()-0.40,ref.duration)
		ref.start = GetTime()
		InterruptBar2_UpdateText(ref.text,ref.duration)
	end
	frame:SetScript("OnUpdate",InterruptBar2_OnUpdate)
end

local function InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED(...)
	local spellID, ability, useSecondDuration
	return function(_, eventtype, _, srcName, srcFlags, _, dstName, dstFlags, id)
		if (band(srcFlags, 0x00000040) == 0x00000040 and eventtype == "SPELL_CAST_SUCCESS") then 
			spellID = id
		else
			return
		end
		useSecondDuration = false
		if spellID == 49376 then spellID = 16979; useSecondDuration = true end -- Feral Charge - Cat -> Feral Charge - Bear
		ability = GetSpellInfo(spellID)
		if abilities[ability] then
			if useSecondDuration and spellID == 16979 then
				bar[ability].duration = 30
			elseif spellID == 16979 then
				bar[ability].duration = 15
			end
			InterruptBar2_StartTimer(bar[ability],ability)
		end
	end
end

InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED = InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED()

local function InterruptBar2_ResetAllTimers()
	for _,ability in ipairs(order) do
		InterruptBar2_StopAbility(bar[ability])
	end
	active = 0
end

local function InterruptBar2_PLAYER_ENTERING_WORLD(self)
	InterruptBar2_ResetAllTimers()
end

local function InterruptBar2_Reset()
	InterruptBarDB2 = { scale = 1, hidden = false, lock = false }
	InterruptBar2_UpdateBar()
	InterruptBar2_LoadPosition()
end

local function InterruptBar2_Test()
	for _,ability in ipairs(order) do
		InterruptBar2_StartTimer(bar[ability],ability)
	end
end

local cmdfuncs = {
	scale = function(v) InterruptBarDB2.scale = v; InterruptBar2_UpdateBar() end,
	hidden = function() InterruptBarDB2.hidden = not InterruptBarDB2.hidden; InterruptBar2_UpdateBar() end,
	lock = function() InterruptBarDB2.lock = not InterruptBarDB2.lock; InterruptBar2_UpdateBar() end,
	reset = function() InterruptBar2_Reset() end,
	test = function() InterruptBar2_Test() end,
}

local cmdtbl = {}
function InterruptBar2_Command(cmd)
	for k in ipairs(cmdtbl) do
		cmdtbl[k] = nil
	end
	for v in gmatch(cmd, "[^ ]+") do
  	tinsert(cmdtbl, v)
  end
  local cb = cmdfuncs[cmdtbl[1]] 
  if cb then
  	local s = tonumber(cmdtbl[2])
  	cb(s)
  else
  	ChatFrame1:AddMessage("InterruptBar2 Options | /ib2 <option>",0,1,0)  	
  	ChatFrame1:AddMessage("-- scale <number> | value: " .. InterruptBarDB2.scale,0,1,0)
  	ChatFrame1:AddMessage("-- hidden (toggle) | value: " .. tostring(InterruptBarDB2.hidden),0,1,0)
  	ChatFrame1:AddMessage("-- lock (toggle) | value: " .. tostring(InterruptBarDB2.lock),0,1,0)
  	ChatFrame1:AddMessage("-- test (execute)",0,1,0)
  	ChatFrame1:AddMessage("-- reset (execute)",0,1,0)
  end
end

local function InterruptBar2_OnLoad(self)
	self:RegisterEvent("PLAYER_ENTERING_WORLD")
	self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
	if not InterruptBarDB2.scale then InterruptBarDB.scale = 1 end
	if not InterruptBarDB2.hidden then InterruptBarDB.hidden = false end
	if not InterruptBarDB2.lock then InterruptBarDB2.lock = false end
	InterruptBar2_CreateBar()
	
	SlashCmdList["InterruptBar2"] = InterruptBar_Command
	SLASH_InterruptBar1 = "/ib2"
	
	ChatFrame1:AddMessage("Interrupt Bar by Kollektiv. Type /ib2 for options.",0,1,0)
end

local eventhandler = {
	["VARIABLES_LOADED"] = function(self) InterruptBar2_OnLoad(self) end,
	["PLAYER_ENTERING_WORLD"] = function(self) InterruptBar2_PLAYER_ENTERING_WORLD(self) end,
	["COMBAT_LOG_EVENT_UNFILTERED"] = function(self,...) InterruptBar2_COMBAT_LOG_EVENT_UNFILTERED(...) end,
}

local function InterruptBar2_OnEvent(self,event,...)
	eventhandler[event](self,...)
end

frame = CreateFrame("Frame",nil,UIParent)
frame:SetScript("OnEvent",InterruptBar2_OnEvent)
frame:RegisterEvent("VARIABLES_LOADED")

here's the .toc file. Very small so i doubt this is it (unless i wasnt supposed to change this at all, that is. Mind you my knowledge of LUA is about nonexistant.

## Interface: 30000
## Title: Interrupt Bar2
## Notes: Tracks interrupts
## Version: 1.15
## Author: Kollektiv
## DefaultState: Enabled
## SavedVariables: InterruptBarDB2

InterruptBar2.lua

  • 0
Spoiler

#20 sauronjag

sauronjag
  • Members
  • Blood Elfclass_name
  • US-Tichondrius
  • Bloodlust
  • Posts: 15
  • Talents: Discipline

Posted 15 February 2010 - 08:29 PM

i'm having same issues as mantraz. ib2 doesnt' work.

could verb or ickz post code for interruptbar2.lua and .toc?
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users