Whatever happened to channelguardian?
Whatever happened to channelguardian?
I really liked this, at least I thought I did. I have noticed that there's many messages getting in the wrong channels these days, is there something in this code that doesn't work with current version of WoW?
I paste the LUA here since it seems to be a discontinued mod anyway;
-- Channel 24 is the LFG channel (no idea why, as it shows up as
-- 5, *shrug*). Channel 2 is the trade channel. Note that they'll
-- still display "[1. General]" at the beginning of the message.
-- So this mod is only useful if you seperate your channels into
-- different chat frames.
-- Really, everything you're looking for is in the function below.
-- We're just searching for patterns in the string and returning
-- a more appropriate channel.
-- Find the appropriate channel for the message
function CG_GetProperChannel(message)
local uMessage = string.upper(message);
if nil ~= string.find(uMessage, "LF%d?M") then return 24; end; -- "LF3M for Foobar"
if nil ~= string.find(uMessage, "LFG") then return 24; end; -- "Foobar LFG"
if nil ~= string.find(uMessage, "WTB") then return 2; end; -- "WTB Foobar PST"
if nil ~= string.find(uMessage, "WTS") then return 2; end; -- "WTS Foorbar
if nil ~= string.find(uMessage, "%dg") then return 2; end; -- "20xFoobar 10g"
if nil ~= string.find(uMessage, "LF HEALER") then return 24; end; -- "LF Healer for Foobar"
end
-- Register the new event
function ChannelGuardian_OnLoad()
ChatFrame_OnEvent_Original = ChatFrame_OnEvent;
ChatFrame_OnEvent = ChatFrame_OnEvent_CG;
end
-- Place the message into the proper channel
function ChatFrame_OnEvent_CG(event)
local newChannel;
if event == "CHAT_MSG_CHANNEL" then
newChannel= CG_GetProperChannel(arg1);
if newChannel ~= null then
arg7 = newChannel;
end;
end;
ChatFrame_OnEvent_Original(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9);
end
|