Thread Tools Display Modes
08-01-15, 01:35 PM   #1
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Who used the Legendary Ring?

I'm looking for a simple AddOn (NO Weak Aura) to post in chat who used the Legendary Ring. It shoud be possible to post in raid chat and alternative post only to myself so noone else sees it.

I found this weakaura script, if it helps:
Code:
function(event, timestamp, message, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags, ...)  
    if message == "SPELL_CAST_SUCCESS" then
        local spellId, spellName, spellSchool = ...
        if spellId == 187615 or spellId == 187611 or spellId == 187614  then  
            name = sourceName
            return true
        end
    end
end
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
08-02-15, 11:45 PM   #2
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
This should probably work:
Code:
local ringSpells = { [187611] = true, [187614] = true, [187615] = true }

local f = CreateFrame("Frame")
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
f:SetScript("OnEvent", function(f, event, _, combatEvent, _, sourceGUID, sourceName, sourceFlags, _, _, _, _, _, spellID, spellName)
	if combatEvent == "SPELL_CAST_SUCCESS" and ringSpells[spellID] and bit.band(sourceFlags, COMBATLOG_OBJECT_AFFILIATION_RAID) > 0 then
		local message = sourceName .. " used a legendary ring!"

		-- Post to own chat frame:
		DEFAULT_CHAT_FRAME:AddMessage(message)

		-- Post to own raid warning frame:
		RaidNotice_AddMessage(RaidWarningFrame, message, ChatTypeInfo["SYSTEM"])

		-- Send to instance/raid/party chat:
		-- SendChatMessage(message, IsInGroup(LE_PARTY_CATEGORY_INSTANCE) and "INSTANCE_CHAT" or IsInRaid() and "RAID" or IsInGroup() and "PARTY")
	end
end)
Comment or uncomment the lines for different message outputs as desired.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
08-03-15, 02:05 PM   #3
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Welcome back Phanx! Your "probably working" code works fine as always, thank you very much!
I called it the Legendary Ring Tracker !
Just wish it had a slash command to change the chat output so I don't have to reload for it
Like "/lrt raid" to toggle the raid output on and off with a chat confirmation that it is on/off.
If the raid output is on it coud also disable the personal DEFAULT_CHAT_FRAME output.

I guess it woud be complicated to change the text based on what ring has been used?
187614, 187615, = NAME used the Meele DPS legendary ring!
187611, = NAME used the Caster DPS legendary ring!
187612, = NAME used the Healer legendary ring!
187613, = NAME used the Tank legendary ring!
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________

Last edited by Tonyleila : 08-03-15 at 02:20 PM.
  Reply With Quote
08-03-15, 05:12 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
http://wow.gamepedia.com/Creating_a_slash_command
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
08-04-15, 04:15 PM   #5
Tonyleila
A Molten Giant
 
Tonyleila's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 758
Nevermind. I'm using Exorsus Raid Tools and it was just added as a modul. Thanks for your help!
__________________
Author of: LeilaUI and Aurora: Missing Textures
__________________
  Reply With Quote
08-12-15, 03:08 AM   #6
Beelsebub
A Defias Bandit
Join Date: Aug 2015
Posts: 2
Hi Phanx.
I used your code to create an addon for it.
Problem is I wanted to test it, so I created a raid in my Garrison and used my ring, but I didnt get any message in chat saying I used it.
Will it only say in raid-frames if other people uses it or have I done something wrong ?
Best regards.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Search/Requests » Who used the Legendary Ring?


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