Thread Tools Display Modes
02-16-12, 10:49 AM   #1
Paolo242
An Aku'mai Servant
 
Paolo242's Avatar
Join Date: Jul 2010
Posts: 31
Addon to announce when Boss Misses

I am looking to create an addon to announce when a boss misses me in a dungeon.

Is this something that is easy to do?

I know how to call for an emote, but just don't know how to flag the event of a boss miss.
  Reply With Quote
02-16-12, 06:32 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Code:
local bosses = {}

local playerGUID

local f = CreateFrame("Frame")
f:RegisterEvent("INSTANCE_ENCOUNTER_ENGAGE_UNIT")
f:SetScript("OnEvent", function(self, event, ...)
	if event == "COMBAT_LOG_EVENT_UNFILTERED" then
		local eventType, _, sourceGUID, sourceName, _, _, destGUID, destName, _, _, _, spellID, spellName, _, missType, _, missAmount = ...
		if missType ~= "MISS" or destGUID ~= playerGUID or not bosses[sourceGUID] or not eventType:match("_MISSED$") then
			-- This event is not a miss from a boss at the player. Quit.
			return
		end
		-- This event is a miss coming from a boss we care about.
		-- destName = boss name
		-- sourceName = your name
		-- spellID = ID of the spell/ability that missed
		--           (you can use this to get an icon or link if you want)
		-- spellName = name of the spell/ability that missed
		-- missAmount = amount that it would have hit for
		--
		-- Insert code here to do whatever.
		--
	else
		-- INSTANCE_ENCOUNTER_ENGAGE_UNIT
		-- Player GUID isn't available at runtime, so get it here.
		if not playerGUID then
			playerGUID = UnitGUID("player")
		end
		-- Check to see if there are any bosses around.
		if UnitExists("boss1") then
			-- At least one boss exists.
			-- Clear the list of boss GUIDs.
			wipe(bosses)
			-- Get a new list of boss GUIDs.
			for i = 1, 4 do
				local guid = UnitGuid("boss"..i)
				if guid then
					bosses[guid] = true
				end
			end
			-- Register for combat log events.
			self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
		else
			-- No bosses exist.
			-- Unregister for combat log events.
			self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
			-- Clear the list of boss GUIDs.
			wipe(bosses)
		end
	end
end)
  Reply With Quote
02-17-12, 12:48 PM   #3
Paolo242
An Aku'mai Servant
 
Paolo242's Avatar
Join Date: Jul 2010
Posts: 31
Thanks. You make it look so easy!
  Reply With Quote
02-17-12, 01:50 PM   #4
Paolo242
An Aku'mai Servant
 
Paolo242's Avatar
Join Date: Jul 2010
Posts: 31
if missType == "MISS" then
SendChatMessage("Avoided"..destName.. "'s " ..GetSpellLink(spellID).. ".", "Emote")
For some reason I'm still having trouble. I have put that code into the section that you labeled place code here, but it's still not doing anything. no errors though.
  Reply With Quote
02-17-12, 02:30 PM   #5
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
I'm not sure if you've completed that statement, or just cut it off. Regardless, you don't need to have that if there since Phanx's code checks to make sure the condition is already met.

In Phanx's code if it's anything but a boss miss it will just stop the code. Just put your SendChatMessage(...) where Phanx's yellow text is, no if then needed.
  Reply With Quote
02-17-12, 02:36 PM   #6
Paolo242
An Aku'mai Servant
 
Paolo242's Avatar
Join Date: Jul 2010
Posts: 31
hmm.. I tried that as well and no dice either.

Although to test it I did just run into the Stockades and get beat on my Hogger, does he not register as a boss?

Any other ideas?
  Reply With Quote
02-17-12, 02:39 PM   #7
Waky
A Cobalt Mageweaver
 
Waky's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2010
Posts: 200
Originally Posted by Paolo242 View Post
hmm.. I tried that as well and no dice either.

Although to test it I did just run into the Stockades and get beat on my Hogger, does he not register as a boss?

Any other ideas?
As long as he has a skull for his level then he should be considered a boss, but I'm not sure if he is. I haven't been in stocks since they changed it.
  Reply With Quote
02-17-12, 02:43 PM   #8
Paolo242
An Aku'mai Servant
 
Paolo242's Avatar
Join Date: Jul 2010
Posts: 31
I believe that's the problem. He's just a 25 Elite.
  Reply With Quote
02-17-12, 03:17 PM   #9
Paolo242
An Aku'mai Servant
 
Paolo242's Avatar
Join Date: Jul 2010
Posts: 31
I just tried it on a boss in Molten Core... Nothing.
  Reply With Quote
02-17-12, 09:02 PM   #10
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
That won't work for old bosses, only those encounters that spawn the new boss-frames (in default interface under the minimap)

If you want it to work for all bosses you'll need to use a library like LibBossIDs-1.0

In that case you won't be able to have as "smart" a solution as Phanx has proposed (only registering C_L_E_U when a boss encounter is engaged)

But you could have it check if you're in an instance or your target etc to similarly avoid doing combatlog parsing constantly.

Last edited by Dridzt : 02-17-12 at 09:14 PM.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Addon to announce when Boss Misses


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