View Single Post
09-20-09, 09:29 AM   #1
Dainton
A Flamescale Wyrmkin
 
Dainton's Avatar
AddOn Author - Click to view addons
Join Date: Jun 2008
Posts: 115
Intoxication level filtering

So since Brewfest is upon us I've realized how annoying the tipsy/drunk spam is (its always kind of irked me, but this event really made me want to do something about it). I'm wanting to filter out the DRUNK_MESSAGE_OTHER and DRUNK_MESSAGE_ITEM_OTHER system messages, but I don't really have all of the know how to piece everything together.

I'm pretty sure that there needs to be a ChatFrame_AddMessageEventFilter in there along with a gsub or two, but like I said my knowledge of LUA is amateur at best.

The messages that I'd like to filter from the GlobalStrings.lua are:
DRUNK_MESSAGE_ITEM_OTHER1 = "%s is looking sober from the %s.";
DRUNK_MESSAGE_ITEM_OTHER2 = "%s seems a little tipsy from the %s.";
DRUNK_MESSAGE_ITEM_OTHER3 = "%s is getting drunk off of %s.";
DRUNK_MESSAGE_ITEM_OTHER4 = "%s is completely smashed from the %s.";
DRUNK_MESSAGE_OTHER1 = "%s seems to be sobering up.";
DRUNK_MESSAGE_OTHER2 = "%s looks tipsy.";
DRUNK_MESSAGE_OTHER3 = "%s looks drunk.";
DRUNK_MESSAGE_OTHER4 = "%s looks completely smashed.";

I tried to guess and throw a little something together after looking at a couple of mods that do much more than I want, but it completely destroys the CHAT_MSG_SYSTEM
lua Code:
  1. local function intox(frame, event, msg, ...)
  2.     for i=1,4 do
  3.         if msg:match("DRUNK_MESSAGE_ITEM_OTHER"..i) then
  4.             msg:gsub("%%s", ".*")
  5.         elseif msg:match("DRUNK_MESSAGE_OTHER"..i) then
  6.             msg:gsub("%%s", ".*")
  7.         end
  8.     end
  9. end
  10. ChatFrame_AddMessageEventFilter("CHAT_MSG_SYSTEM", intox)
(I'm not sure if this is the one that did nothing or broke everything.)

Any help with this is greatly appreciated.
  Reply With Quote