WoWInterface SVN StopTradeSpam

[/] [trunk/] [StopTradeSpam/] [StopTradeSpam.lua] - Rev 52

Compare with Previous | Blame | View Log

local version = tonumber(strmatch(GetAddOnMetadata("StopTradeSpam","Version"),"^%d+.(%d+.%d+)"))
sts_session_all = 0
sts_session_filtered = 0
sts_last_action = 0
sts_last_msg = -1
sts_last_msgtext = ""
sts_lang = "enUS"
local f = CreateFrame("Frame", "STSFrame")
sts_notify = ""
sts_quiet = 0
tignlist = ""
sts_numignore = -1

local tign_events = {
        "CHAT_MSG_BATTLEGROUND",
        "CHAT_MSG_BATTLEGROUND_LEADER",
        "CHAT_MSG_GUILD", --TODO: Maybe unignore if this is seen.
        "CHAT_MSG_OFFICER", --TODO: Same as guild?
        "CHAT_MSG_PARTY",
        "CHAT_MSG_PARTY_LEADER",
        "CHAT_MSG_RAID",
        "CHAT_MSG_RAID_LEADER",
        "CHAT_MSG_RAID_WARNING",
        "CHAT_MSG_SAY",
        "CHAT_MSG_WHISPER",
        "CHAT_MSG_WHISPER_INFORM",
--      "CHAT_MSG_CHANNEL_JOIN", TODO: maybe add again
--      "CHAT_MSG_CHANNEL_LEAVE", TODO: maybe add again
        "CHAT_MSG_EMOTE",
        "CHAT_MSG_ACHIEVEMENT",
        "CHAT_MSG_GUILD_ACHIEVEMENT",
        "CHAT_MSG_TEXT_EMOTE",
        "CHAT_MSG_YELL",
}

function dcfa(...)
        if sts_quiet > 0 then
                sts_quiet = sts_quiet - 1
        else
                DEFAULT_CHAT_FRAME:AddMessage(...)
        end
        -- TODO: Maybe replace all "dcfa(" with "DEFAULT_CHAT_FRAME:AddMessage(" and remove this function
end

function STS_ResetSV(...) -- reset anything except ignorelist
        if not STS_SV then
                return false
        end
        if select(1,...) == "all" then
                STS_SV = nil
                dcfa("Error, sorry :-(")
        elseif select(1,...) == "ignore" then
                STS_SV["ignore"][tignlist] = nil
                STS_SV["ignore"][tignlist] = { }
                dcfa("Ignorelist cleared.")
        elseif not select(1,...) then
                for i,j in pairs(STS_SV) do
                        if i ~= "ignore" then
                                j = nil
                        end
                end
                dcfa("Returning settings to default.")
        else
                dcfa("Wrong parameters.")
                return false
        end
        return true
end

local function STS_GetLanguage(...)
        local getlang = STS_SV["language"][tignlist]
        if select(1,...) == "print" then
                dcfa(getlang)
        end
        return getlang
end

function STS_SetLanguage(setlang)
        if not STS_SV[setlang] then
                STS_SV[setlang] = {
                        ["list"] = {
                                ["Hitem:"] = -2,
                                ["Hspell:"] = -2,
                                ["Henchant:"] = -2,
                                ["Htrade:"] = -2,
                                ["Hquest:245%d%d:8"] = 1,
                        },
                }
                dcfa("New language \""..setlang.."\" created.")
        else
                dcfa("Language set to \""..setlang.."\".")
        end
        sts_lang = setlang
        STS_SV["language"][tignlist] = setlang
end

local function STS_DelLanguage(setlang)
        if not STS_SV[setlang] then
                dcfa("Language "..setlang.." not found.")
        else
                STS_SV[setlang] = nil
                for _,j in pairs(STS_SV["language"]) do
                        if j == setlang then
                                j = GetLocale()
                        end
                end
                dcfa("Language and filters of \""..setlang.."\" removed.")
        end
end

local function STS_List(...)
        local list = "list"
        if select(1,...) then list = select(1,...) end
        if list == "white" or list == "black" or list == "list" then
                dcfa("List entrys:") --TODO: locale
                for le,lv in pairs(STS_SV[sts_lang]["list"]) do
                        if (list == "white" and lv < 0) or (list == "black" and lv > 0) or list == "list" then
                                dcfa("\""..le.."\" : "..lv)
                        end
                end
        elseif list == "ignore" then
                dcfa("STS-ignorelist entrys:")
                for i,le in pairs(STS_SV["ignore"][tignlist]) do
                        dcfa(le["reason"])
                end
        elseif list then
                dcfa("Wrong parameters: "..list..". Use /sts list white or /sts list black or /sts list ignore .")
        else
                dcfa("Wrong parameters. Use /sts list white or /sts list black or /sts list ignore .")
        end
end

function STS_Find(...)
        local key = select(1,...)
        local list = "list"
        if select(2,...) then list = select(2,...) end
        if list == "white" or list == "black" then
                dcfa("List entrys:") --TODO: locale
                for le,lv in pairs(STS_SV[sts_lang]["list"]) do
                        if key == le and ((list == "white" and lv < 0) or (list == "black" and lv > 0) or list == "list") then
                                dcfa("\""..le.."\" : "..lv)
                                return i
                        end
                end
                return false
        elseif list == "ignore" and (key == "raid" or key == "party") then
                local imax = 5
                local spammers = ""
                if key == "raid" then
                        imax = 40
                end
                dcfa("Following persons in this party/raid are T-ignored:") --TODO: locale
                for i=1,imax do
                        if STS_SV["ignore"][tignlist][UnitName(key..i)] then
                                spammers = spammers..STS_ColoredNameLink(nil,UnitName(key..i))..", "
                                if strlen(spammers) >= 254 then
                                        dcfa(substr(spammers,1,-4-strlen(STS_ColoredNameLink(nil,UnitName(key..i)))))
                                        spammers = STS_ColoredNameLink(nil,UnitName(key..i))..", "
                                end
                        end
                end
                if spammers ~= "" then
                        dcfa(strsub(spammers,1,-3))
                else
                        dcfa("No one in this party/raid is T-ignored.") --TODO: locale
                end
        elseif list == "ignore" then
                if STS_SV["ignore"][tignlist][key] then
                        dcfa(STS_SV["ignore"][tignlist][key]["time"])
                        dcfa(STS_SV["ignore"][tignlist][key]["reason"])
                        return true
                end
                dcfa("No exact match found. Note: Parameter name is case sensitive.")
                return false
        else
                dcfa("Wrong parameters: \""..list.."\". Use /sts find white [entry] or /sts find black [entry] or /sts find ignore [name].")
        end
        return false
end

local function STS_PostReason(ign_name)
        if not STS_SV["ignore"][tignlist][ign_name] then
                dcfa("\""..ign_name.."\" not found on T-ignorelist.")
        else
                local answer = STS_SV["ignore"][tignlist][ign_name]["time"].." "..STS_SV["ignore"][tignlist][ign_name]["reason"]
                answer = gsub(answer,"|Hplayer:.+|h|.+|r|h", ign_name)
                local answer1 = strsub(answer,1,254)
                local answer2 = strsub(answer,255)
                SendChatMessage(answer1, "WHISPER", nil, ign_name)
                if answer2 then
                        SendChatMessage(answer2, "WHISPER", nil, ign_name)
                end
        end
end

function STS_AddIgnore(ign_name, ign_reason)
        if not STS_SV["settings"]["enabletign"] then
                dcfa("Ignoring not possible! Ignorelist disabled in settings.")
                return false
        elseif not STS_SV["ignore"][tignlist][ign_name] then
                if not ign_reason then
                        ign_reason = ""
                end
                STS_SV["ignore"][tignlist][ign_name] = { ["reason"] = ign_reason, ["time"] = date("%Y-%m-%d %H:%M") }
                if strfind(ign_reason, ign_name) then
                        dcfa("New T-ignore: "..ign_reason)
                else
                        dcfa(ign_name.." is now T-ignored. Reason: "..ign_reason)
                end
                sts_numignore = sts_numignore + 1
                return true
        else
                dcfa("Character is already ignored. Use \"/sts unignore "..ign_name.."\" to remove him from T-ignorelist.")
        return false
        end
end

function STS_DelIgnore(ign_name)
        if STS_SV["ignore"][tignlist][ign_name] then
                STS_SV["ignore"][tignlist][ign_name] = nil
                dcfa(ign_name.." is no longer T-ignored.")
                sts_numignore = sts_numignore - 1
                return true
        else
                dcfa("Character "..ign_name.." not found on T-ignorelist.")
        end
        return false
end

function STS_Add(...)
        local key = select(1,...)
        local list = select(2,...)
        local val = 0
        if tonumber(select(2,...)) then
                val = select(2,...)
                list = "list"
        else
                if list == "white" then val = -2
                elseif list == "black" then val = 1
                end
        end
        if not key then
                dcfa("Wrong parameters. Use /sts add <valueOrList> <entry> .")
        elseif list == "white" or list == "black" or list == "list" then
                STS_SV[sts_lang]["list"][key] = val
                dcfa("Filter added: \""..key.."\" with value "..val) --TODO: locale
                return true
        else
                dcfa("Wrong parameters. Use /sts add <valueOrList> <entry> .")--TODO: locale
        end
        return false
end

function STS_Remove(...)
        local key = select(1,...)
        local list = "list"
        if select(2,...) then list = select(2,...) end
        if not key then
                dcfa("Wrong parameters. Use /sts remove [list] <entry> .")--TODO: change function and locale
                return false
        end
--[[ has to be rewritten TODO!!!
        local entry = tonumber(key)
        if type(entry) ~= "number" then
                local entry = STS_Find(key, list)
        end
        if not entry then
                dcfa("Entry not found.")
                return false
        end
        ]]--
        if STS_SV[sts_lang]["list"][key] then
                dcfa("Entry \""..key.."\" removed.")
                STS_SV[sts_lang]["list"][key] = nil
                return true
        else
                dcfa("Entry not found.")
                return false
        end
end

function STS_ColoredNameLink(...)
        if not select(2,...) or select(2,...) == "" then
                return ""
        elseif select(12,...) and select(12,...) ~= "" then
                local _, englishClass = GetPlayerInfoByGUID(select(12,...))
                local classColorTable = RAID_CLASS_COLORS[englishClass]
                return "[\124Hplayer:"..select(2,...).."\124h"..string.format("\124cff%.2x%.2x%.2x", classColorTable.r*255, classColorTable.g*255, classColorTable.b*255)..select(2,...).."\124r\124h]"
        else
                return "[\124Hplayer:"..select(2,...).."\124h"..select(2,...).."\124h]"
        end
end

function STS_Statistic(...)
        if select(1,...) == true then
                dcfa("Trade messages filtered this session: "..sts_session_filtered.." of "..sts_session_all..". There are "..sts_numignore.." characters on your T-ignorelist.")
        end
        return sts_session_filtered,sts_session_all
end

function STS_Options(...)
        local opento = "StopTradeSpam"
        if select(1,...) then opento = opento.."_"..select(1,...) end
        InterfaceOptionsFrame_OpenToCategory(opento);
end

function STS_Settings(...)
        if select(1,...) == "GET" then
                if select('#',...) == 2 then
                        if STS_SV["settings"][select(2,...)] then
                                return STS_SV["settings"][select(2,...)]
                        else
                                return nil
                        end
                elseif select('#',...) == 3 then --deeper in Table!
                        if STS_SV["settings"][select(2,...)][select(3,...)] then
                                return STS_SV["settings"][select(2,...)][select(3,...)]
                        else
                                return nil
                        end
                end
        elseif select(1,...) == "SET" then
                if select('#',...) <= 3 then
                        STS_SV["settings"][select(2,...)] = select(3,...)
                elseif select('#',...) == 4 then --deeper in Table!
                        STS_SV["settings"][select(2,...)][select(3,...)] = select(4,...)
                end
        end
        return false,1
end

local function STS_Slash(argument)
        local STScommand = { strsplit(" ", argument) }
        if STScommand[1] == "help" or argument == "" then
                dcfa("\124cffff0000S\124cff00ff00top \124cffff0000T\124cff00ff00rade \124cffff0000S\124cff00ff00pam")
                dcfa("StopTradeSpam will, based on your whitelist and blacklist automatically try to ignore players, who are looking for groups/raids/... in trade channel.")
--              dcfa("Maybe in a future version it will Report Spam to gamemasters, but thats a bad idea with unreliable filtering.")
                dcfa("\124cff00ff00List of usable commands:")
                dcfa("\124cffff0000/sts list <white/black/ignore> \124cff00ff00Lists all entrys of the specified list.")
                dcfa("\124cffff0000/sts find <white/black/ignore> <entry> \124cff00ff00Looks for an entry which is exactly <entry> in the specified list. If no list is specified it will search the T-ignorelist.")
                dcfa("\124cffff0000/sts ignore <name> [<reason>] \124cff00ff00T-ignores someone, with reason, if given.")
                dcfa("\124cffff0000/sts unignore <name> \124cff00ff00Removes someone from your T-ignore list.")
                dcfa("\124cffff0000/sts add <white/black> <pattern> \124cff00ff00Used to add a new filter pattern to the specifeid list.")
                dcfa("\124cffff0000/sts del <white/black> <pattern> \124cff00ff00Used to delete a filter pattern from a specified list.") --TODO: Use \"/sts list <white/black>\" to find the number of a specific pattern.")
                dcfa("\124cffff0000/sts language set/del <lang> \124cff00ff00possible options are \"enUS\" (english), \"deDE\" (german) or any other (a few default filters will be set)")
                dcfa("\124cffff0000/sts statistic \124cff00ff00Prints a short session statistic")
                dcfa("\124cffff0000/sts post <name> \124cff00ff00Whispers the reason and the time of his T-ignore to the character <name>.")
                dcfa("\124cffff0000/sts party \124cff00ff00Lists all party members who are on your T-ignorelist.")
                dcfa("\124cffff0000/sts raid \124cff00ff00Lists all raid members who are on your T-ignorelist.")
                dcfa("\124cffff0000/sts version \124cff00ff00Shows the current version number.")
                dcfa("\124cffff0000/sts options \124cff00ff00Not yet working.")
                dcfa("\124cffff0000/sts reset \124cff00ff00Reset language setting, language filters to default, T-ignorelist is not resetted")
        elseif STScommand[1] == "reset" then
                if STScommand[2] then
                        STS_ResetSV(STScommand[2])
                else
                        STS_ResetSV()
                end
                STS_InitSV()
        elseif STScommand[1] == "list" then
                STS_List(STScommand[2])
        elseif STScommand[1] == "find" then
                                if STScommand[3] then
                        STS_Find(STScommand[3], STScommand[2])
                elseif STScommand[2] then
                        STS_Find(STScommand[2], "ignore")
                else
                        STS_Find(select(1,UnitName("target")), "ignore")
                end
        elseif STScommand[1] == "add" then
                STS_Add(strsub(argument, 2 + select(2, strfind(argument, STScommand[2], 1))), STScommand[2])
        elseif STScommand[1] == "del" or STScommand[1] == "remove" then
                if STScommand[3] then
                        STS_Remove(strsub(argument, 2 + select(2, strfind(argument, STScommand[2], 1))), STScommand[2])
                else
                        STS_Remove(strsub(argument, 2 + select(2, strfind(argument, STScommand[1], 1))))
                end
        elseif STScommand[1] == "ignore" then
                if STScommand[3] then
                        STS_AddIgnore(STScommand[2], strsub(argument, 9 + strlen(STScommand[2])))
                else
                        STS_AddIgnore(STScommand[2], nil)
                end
        elseif STScommand[1] == "unignore" or STScommand[1] == "delignore" then
                STS_DelIgnore(STScommand[2])
        elseif (STScommand[1] == "lang" or STScommand[1] == "language") then
                if STScommand[2] == "set" then
                        STS_SetLanguage(STScommand[3])
                elseif STScommand[2] == "del" or STScommand[2] == "remove" then
                        STS_DelLanguage(STScommand[3])
                else
                        STS_GetLanguage("print")
                end
        elseif STScommand[1] == "stat" or STScommand[1] == "statistic" then
                STS_Statistic(true)
        elseif STScommand[1] == "post" then
                if STScommand[2] then
                        STS_PostReason(STScommand[2])
                else
                        STS_PostReason(select(1,UnitName("target")))
                end
        elseif STScommand[1] == "party" then
                STS_Find("party","ignore")
        elseif STScommand[1] == "raid" then
                STS_Find("raid","ignore")
        elseif STScommand[1] == "version" then
                if STScommand[2] then
                        SendAddonMessage("STS_?Version",GetAddOnMetadata("StopTradeSpam","Version"),"WHISPER",STScommand[2])
                end
                dcfa(GetAddOnMetadata("StopTradeSpam","Version"))
        elseif STScommand[1] == "options" or STScommand[1] == "o" then
                STS_Options()
        elseif STScommand[1] == "debug" then
                if STScommand[2] then
                        STS_SV["debug"] = true
                        dcfa("debug flag set")
                else
                        STS_SV["debug"] = nil
                        dcfa("debug flag unset")
                end
        else
                dcfa("Wrong parameters.")
        end

end

local function STS_ChatFilter(self, event, ...)
        if sts_last_msg == select(11,...) then
                if sts_last_action >= 1 then -- filtered based on last scan of same message
                        return true
                elseif sts_last_action == 0 then
                        return false,...
                elseif sts_last_action <= -1 then
                        return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...)
                end
        else
                sts_last_msg = select(11,...)
                sts_last_msgtext = select(1,...)
        end
        if (select(2,...) == UnitName("player")) or (select(2,...) == "") or (select(6,...) == "GM") then
                sts_last_action = 0
                return false,...
        elseif event == "CHAT_MSG_CHANNEL" then
                if select(7,...) == 2 then sts_session_all = sts_session_all + 1 end
                if STS_SV["ignore"][tignlist][select(2,...)] then
                        if STS_SV["settings"][event][select(8,...)] then        -- if channel is activated for ignorelist in settings (default)
                                if select(7,...) == 2 then sts_session_filtered = sts_session_filtered + 1 end
                                sts_last_action = 1
                                return true
                        else --just notify
                                sts_last_msgtext = sts_notify..STS_SV["settings"]["notify_tign"].."\124r "..select(1,...)
                                sts_last_action = -1
--                              return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...)
                        end
                end
                if select(7,...) == 2 then -- Trade Channel: Filter this!
                        --local sp = " # " --debug
                        local msg = select(1,...)
                        local spamfound = 0
                        
                        for le,lv in pairs(STS_SV[sts_lang]["list"]) do
                                if strfind(msg, le) then
                                        spamfound = spamfound + lv
                                end
                        end
                        --sp = sp.."# #" --debug
                        if STS_SV["settings"]["blockgold"] and spamfound > 7 then
                                ComplainChat(select(11,...))
                                sts_last_action = 1
                                return true
                        end
                        if spamfound > 0 then
                                -- Ignore author of spam message here
                                sts_quiet = 1
                                local new_ign = STS_AddIgnore(select(2,...), "STS: ["..select(4,...).."] "..STS_ColoredNameLink(...)..": "..msg)
                                sts_session_filtered = sts_session_filtered + 1
                                if STS_SV["settings"]["complainchat"] and spamfound > 2 then
                                        ComplainChat(select(11,...))
                                --dcfa(select(2,...).." reported")
                                end
                                if STS_SV["settings"]["showblack"] and new_ign then
                                        sts_last_action = -1
                                --debug w/: sts_last_msgtext = strsub("<"..spamfound.."> "..sp.." "..sts_notify..STS_SV["settings"]["notify_new"].." \124r"..select(1,...),1,255)
                                        sts_last_msgtext = strsub(sts_notify..STS_SV["settings"]["notify_new"].." \124r"..select(1,...),1,255)
                                        return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...)
                                else
                                        sts_last_action = 1
                                        return true
                                end
                        else
                        --debug w/:     sts_last_msgtext = strsub("<"..spamfound.."> "..sp.." "..select(1,...),1,255)
                                if not strfind(sts_last_msgtext,"^"..sts_notify) then
                                        sts_last_action = 0
                                end
                                return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...)
                        --debug w/:     return false,sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...)
                        end
                end
        elseif not STS_SV["settings"][event] and STS_SV["ignore"][tignlist][select(2,...)] then
                sts_last_action = -1
                sts_last_msgtext = strsub(sts_notify..STS_SV["settings"]["notify_tign"].."\124r "..select(1,...),1,255)
                return false, sts_last_msgtext,select(2,...),select(3,...),select(4,...),select(5,...),select(6,...),select(7,...),select(8,...),select(9,...),select(10,...),select(11,...),select(12,...)
        elseif STS_SV["ignore"][tignlist][select(2,...)] then --and STS_SV["settings"][event] (not needed)
                sts_last_action = 1
                return true
        else
                sts_last_action = 0
                return false,...
        end
end

SlashCmdList["StopTradeSpam_SlashCommand"] = STS_Slash
SLASH_StopTradeSpam_SlashCommand1 = "/sts"
f:RegisterEvent("ADDON_LOADED")
f:SetScript("OnEvent", function(self, event, ...)
        if event == "PARTY_INVITE_REQUEST" and STS_SV["ignore"][tignlist][select(1,...)] then
                dcfa("You are T-ignoring \""..select(1,...).."\".")
        elseif (event == "ADDON_LOADED") and (select(1,...) == "StopTradeSpam") then
                tignlist = GetRealmName() .. "-" .. UnitFactionGroup("player")
                if not STS_SV then
                        STS_InitSV()
                end
                sts_lang = STS_SV["language"][tignlist]
                if not STS_SV["version"] then
                        STS_SV["version"] = version
                elseif STS_SV["version"] < version then
                        STS_SV["version"] = STS_Update(STS_SV["version"])
                end
                if not STS_SV["ignore"] then
                        STS_SV["ignore"] = {[GetRealmName().."-"..UnitFactionGroup("player")] = { },}
                end
                if not STS_SV["ignore"][GetRealmName().."-"..UnitFactionGroup("player")] then
                        STS_SV["ignore"][GetRealmName().."-"..UnitFactionGroup("player")] = { }
                end
                if not STS_SV["language"] then
                        STS_SV["language"][GetRealmName().."-"..UnitFactionGroup("player")] = GetLocale()
                end
                if not STS_SV["language"][GetRealmName().."-"..UnitFactionGroup("player")] then
                        STS_SV["language"][GetRealmName().."-"..UnitFactionGroup("player")] = GetLocale()
                end
                if sts_numignore < 0 then
                        sts_numignore = 0
                        for _,_ in pairs(STS_SV["ignore"][tignlist]) do
                                sts_numignore = sts_numignore + 1
                        end
                end
                sts_notify = "\124cff"..("%.2x%.2x%.2x"):format(STS_SV["settings"]["r"]*255,STS_SV["settings"]["g"]*255,STS_SV["settings"]["b"]*255)
                f:UnregisterEvent("ADDON_LOADED")
                f:RegisterEvent("PARTY_INVITE_REQUEST")
                f:RegisterEvent("CHAT_MSG_ADDON")
                if STS_SV["debug"] then f:RegisterEvent("WHO_LIST_UPDATE") end
                ChatFrame_AddMessageEventFilter("CHAT_MSG_CHANNEL", STS_ChatFilter)
                for _,event in pairs(tign_events) do
                        ChatFrame_AddMessageEventFilter(event, STS_ChatFilter)
                end
                STSO_Build()
        elseif event == "CHAT_MSG_ADDON" and strsub(select(1,...),1,3) == "STS" then
                if strsub(select(1,...),4,12) == "_?Version" then
                        SendAddonMessage("STS_!Version",GetAddOnMetadata("StopTradeSpam","Version"),"WHISPER",select(4,...))
                end
        elseif event == "WHO_LIST_UPDATE" then
                for i=1,GetNumWhoResults() do
                        local charname, guildname, level, race, class, zone, classFileName = GetWhoInfo(i)
                        if STS_SV["ignore"][tignlist][charname] and level < 80 then
                                print("["..level.."] "..STS_SV["ignore"][tignlist][charname]["reason"])
                        end
                end
        end
end)

-- DEBUG: LDB testing
LibStub:GetLibrary("LibDataBroker-1.1"):NewDataObject("StopTradeSpam", {
        type = "launcher",
        icon = "Interface\\Icons\\Spell_Nature_StormReach",
        OnClick = function(clickedframe, button)
                if button == "LeftButton" then STS_Options() end
                --elseif TODO other buttons
        end,
})

Compare with Previous | Blame