WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Search/Requests (https://www.wowinterface.com/forums/forumdisplay.php?f=6)
-   -   [Request] Guild Alert AddOn (https://www.wowinterface.com/forums/showthread.php?t=54447)

joshmiller83 09-09-16 06:02 PM

[Request] Guild Alert AddOn
 
I am looking to see if its possible first of all and then see if there is an Author willing to tackle a hopefully smallish project/addon.

I along with several others have Chat Filtered in Tabs to make it easier to read and not have all chat in one place.

I have System Chats going to another tab and since Blizz DID NOT split Guild Logon/Logoff Alerts as well as Guild Join/Leave Messages differently than System Alerts, I miss them all.

I would like to have an Addon Filter those Specific Messages either back into a certain chat tab OR (if easier) have them appear in the Blizz Error Frame / MSBT Frames OR both! :).

I would be forever grateful and happy! :)

Phanx 09-11-16 01:22 AM

This should work:

Code:

local DESTINATION = UIErrorsFrame

local ONLINE = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.+)"):gsub("[%[%]]", "%%%1")
local OFFLINE = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.+)")

local f = CreateFrame("Frame")
f:RegisterEvent("CHAT_MSG_SYSTEM")
f:SetScript("OnEvent", function(self, event, text)
        if text:match(ONLINE) then
                DESTINATION:AddMessage(text:gsub("%[(.-)%]", "%1"), 0.3, 1, 0.3)
        elseif text:match(OFFLINE) then
                DESTINATION:AddMessage(text, .6, .6, .6)
        end
end)

Change the first line if you want to send the messages to some other chat frame, eg. ChatFrame3

Use Vlad's addon creator tool to turn the code into an addon.

joshmiller83 09-11-16 02:33 AM

This is awesome!

Is it possible to also see Guild Join and Guild Quit messages? :)

Thanks!

Phanx 09-11-16 09:52 AM

Made some changes for joined/left guild messages, and to more easily support adding more message types:

Code:

local DESTINATION = UIErrorsFrame

local messageTypes = {
        {
                -- X has come online
                pattern = ERR_FRIEND_ONLINE_SS:gsub("%%s", "(.+)"):gsub("[%[%]]", "%%%1"),
                r = 0.3, g = 1, b = 0.3,
        },
        {
                -- X has gone online
                pattern = ERR_FRIEND_OFFLINE_S:gsub("%%s", "(.+)"),
                r = 0.6, g = 0.6, b = 0.6,
        },
        {
                -- X has joined the guild
                pattern = ERR_GUILD_JOIN_S:gsub("%%s", "(.+)"),
                r = 0.3, g = 1, b = 0.3,
        },
        {
                -- X has left the guild
                pattern = ERR_GUILD_LEAVE_S:gsub("%%s", "(.+)"),
                r = 0.6, g = 0.6, b = 0.6,
        },
}

local f = CreateFrame("Frame")
f:RegisterEvent("CHAT_MSG_SYSTEM")
f:SetScript("OnEvent", function(self, event, text)
        for i = 1, #messageTypes do
                local messageType = messageTypes[i]
                if text:match(messageType.pattern) then
                        if not DESTINATION:IsMouseEnabled() then
                                -- Remove link brackets if the destination frame doesn't support clicking
                                text = text:gsub("%[(.-)%]", "%1")
                        end
                        return DESTINATION:AddMessage(text, messageType.r, messageType.g, messageType.b)
                end
        end
end)


joshmiller83 09-11-16 01:18 PM

Wow! Thank you! You ROCK! :) :banana:


All times are GMT -6. The time now is 06:57 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI