Thread Tools Display Modes
03-24-10, 09:41 PM   #1
Kuchinashi
A Defias Bandit
Join Date: Dec 2009
Posts: 3
Chat Alert replacement

I use ArpUI, but the latest round of revisions he's switched to gChat for his chat frames. I can live without almost everything Prat does, but I've gotten very fond of the automatic raid warning every time someone types your name. Is there a minimal addon that only handles this function, or should I just stick to Prat?
  Reply With Quote
03-25-10, 02:30 AM   #2
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Code:
local color = "FF0000"
local names = {
	UnitName("player"),
	"customname1", -- add any custom filters this same way
}

local orig = {}

local function AddMessage(frame, text, ...)
	for _, name in ipairs(names) do
		local _, _, message = strfind(text, "|Hplayer.-|h.-|h.-%p?%s(.*)")
		if message then
			local first, last = strfind(strlower(message), strlower(name).."%w*%s*")
			if first then
				text = gsub(text, format("(.*)(%s)(.*)", strsub(message, first, last)), "%1|cff"..color.."%2|r%3")
				RaidNotice_AddMessage(RaidWarningFrame, text, ChatTypeInfo["RAID_WARNING"])
				PlaySoundFile("Sound\\Interface\\RaidWarning.wav") -- comment out for no sound
			end
		end
	end
	return orig[frame](frame, text, ...)
end

local f
for i = 1, NUM_CHAT_WINDOWS do
	if ( i ~= 2 ) then
		f = _G['ChatFrame'..i]

		orig[f] = f.AddMessage
		f.AddMessage = AddMessage
	end
end
If you know how to throw together an addon then this is something quick and dirty that should do the trick. I'm no pro, so anyone else that knows their stuff can feel free to fix any mistakes.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » Chat Alert replacement


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