/trunk
local version = 6.8 |
local version = 7.0 |
sts_session_all = 0 |
sts_session_filtered = 0 |
sts_last_action = 0 |
function STS_SetLanguage(setlang) |
if not STS_SV[setlang] then |
STS_SV[setlang] = { |
whitelist = { "Hitem:","Hspell:","Henchant:","Htrade:", }, |
blacklist = { "Hquest:245%d%d:8" }, |
["list"] = { |
["Hitem:"] = -2, |
["Hspell:"] = -2, |
["Henchant:"] = -2, |
["Htrade:"] = -2, |
["Hquest:245%d%d:8"] = 1, |
}, |
} |
dcfa("New language \""..setlang.."\" created.") |
else |
local list = select(1,...) |
if list == "white" or list == "black" then |
dcfa(gsub(list,"^%a",strupper).."list entrys:") |
for i,le in pairs(STS_SV[sts_lang][list.."list"]) do |
dcfa(i.." : \""..le.."\"") |
for le,lv in pairs(STS_SV[sts_lang]["list"]) do |
if (list == "white" and lv < 0) or (list == "black" and lv > 0) then |
dcfa("\""..le.."\" : "..lv) |
end |
end |
elseif list == "ignore" then |
dcfa("STS-ignorelist entrys:") |
function STS_Find(key, list) |
if list == "white" or list == "black" then |
dcfa(gsub(list,"^%a",strupper).."list entrys:") |
for i,le in pairs(STS_SV[sts_lang][list.."list"]) do |
if key == le then |
dcfa(i.." : \""..le.."\"") |
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)) then |
dcfa("\""..le.."\" : "..lv) |
return i |
end |
end |
return false |
end |
function STS_Add(key, list) |
function STS_Add(...) |
local key = select(1,...) |
local list = select(2,...) |
local val = 0 |
if select(3,...) then |
select(3,...) |
else |
if list == "white" then val = -2 |
elseif list == "black" then val = 1 |
end |
end |
if not key then |
dcfa("Error, couldn't add new filter.") |
elseif list == "white" or list == "black" then |
tinsert(STS_SV[sts_lang][list.."list"],key) |
STS_SV[sts_lang]["list"][key] = val |
dcfa("Filter added to "..list.."list: "..key) |
return true |
else |
dcfa("Wrong parameters: "..list..". Use /sts add white or /sts add black .") |
dcfa("Wrong parameters: "..list..". Use /sts add white or /sts add black .")--TODO: explain new |
end |
return false |
end |
dcfa("Wrong parameters: "..list..". Use /sts remove white [entry] or /sts remove black [entry] .") |
return false |
end |
--[[ has to be rewritten |
local entry = tonumber(key) |
if type(entry) ~= "number" then |
local entry = STS_Find(key, list) |
dcfa("Entry not found.") |
return false |
end |
dcfa("Entry \""..STS_SV[sts_lang][list.."list"][entry].."\" removed.") |
STS_SV[sts_lang][list.."list"][entry] = nil |
return true |
]]-- |
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(...) |
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/numberOfPattern> \124cff00ff00Used to delete a filter pattern from a specified list. Use \"/sts list <white/black>\" to find the number of a specific pattern.") |
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>.") |
--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 |
--[[ rewritten |
for _,wle in pairs(STS_SV[sts_lang]["whitelist"]) do |
if strfind(msg, wle) then |
spamfound = spamfound - 2 --TODO: evaluate numbers |
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 |
sts_lang = STS_SV["language"][tignlist] |
if not STS_SV["version"] then |
STS_SV["version"] = version |
elseif STS_SV["version"] ~= version then |
elseif STS_SV["version"] < version then |
STS_SV["version"] = STS_Update(STS_SV["version"]) |
end |
if not STS_SV["ignore"] then |
local version = 6.8 |
local version = 7.0 |
function STS_InitSV() |
if not STS_SV then |
STS_SV = { } |
end |
if not STS_SV["version"] then |
STS_SV["version"] = version |
end |
if not STS_SV["language"] then |
STS_SV["language"] = { |
[tignlist] = GetLocale() |
STS_SV["language"][tignlist] = GetLocale() |
end |
STS_SV["deDE"] = { |
["whitelist"] = {"%d+% ?[Gg] ","%d+% ?[Gg]$","[Zz]ahle","[Pp]reis","[Rr]ezept","[Pp]l[äa]ne?"," AH","ingi","[Vv][Kk] "," [Tt]g","[Ss]tack","[Mm]ats","Hitem:","Henchant:","Htrade:","[Ww][Tt][Bb]","[Ss]chenk"}, |
["blacklist"] = {"www%..+%.de","%.com$","%.cn$","[Aa]rena","[235]% ?[vo][sn]?% ?[235]","priest","[Aa][Kk]% ?[12][05]","[Pp][Dd][Oo]?[Kk]","Onyx?i?a? ","[Oo]nyx?i?a?% ?[12][05]","[Uu]lduar"," 10/25"," 10er"," 25er","youtube","farmrun","[Gg]ilde","Hquest:245%d%d:8","[Ii][Cc][Cc]","[Aa]rcha","[Hh]eroic"," [Hh]eros? ","[Hh]eros?$","[Ww]eekly","[Dd]aily","[Gg]earcheck","[Nn]axx","DD[ s]"," dd","dds ","[Hh]eiler","[Hh]eal ","[Tt]ank ","[Dd][Pp][Ss]","[Gg][Rr][Pp] ","such.+gru?p?pe?","[Ss]tammgru?p?pe?","[Bb][Gg] ?[Ss]tamm"," [Rr]aid","[Gg]earscore","[Cc]huck "," [Nn]orris"}, |
["list"] = { |
["%d+% ?[Gg] "] = -2, |
["%d+% ?[Gg]$"] = -2, |
["[Zz]ahle"] = -2, |
["[Pp]reis"] = -2, |
["[Rr]ezept"] = -2, |
["[Pp]l[äa]ne?"] = -2, |
[" AH"] = -2, |
["ingi"] = -2, |
["[Vv][Kk] "] = -2, |
[" [Tt]g"] = -2, |
["[Ss]tack"] = -2, |
["[Mm]ats"] = -2, |
["Hitem:"] = -2, |
["Henchant:"] = -2, |
["Htrade:"] = -2, |
["[Ww][Tt][Bb]"] = -2, |
["[Ss]chenk"] = -2, |
["www%..+%.de"] = 10, |
["%.com$"] = 5, |
["%.cn$"] = 10, |
["[Aa]rena"] = 1, |
["[235]% ?[vo][sn]?% ?[235]"] = 1, |
["priest"] = 1, |
["[Aa][Kk]% ?[12][05]"] = 1, |
["[Pp][Dd][Oo]?[Kk]"] = 1, |
["Onyx?i?a? "] = 1, |
["[Oo]nyx?i?a?% ?[12][05]"] = 1, |
["[Uu]lduar"] = 1, |
[" 10/25"] = 1, |
[" 10er"] = 1, |
[" 25er"] = 1, |
["youtube"] = 1, |
["farmrun"] = 1, |
["[Gg]ilde"] = 1, |
["Hquest:245%d%d:8"] = 1, |
["[Ii][Cc][Cc]"] = 1, |
["[Aa]rcha"] = 1, |
["[Hh]eroic"] = 1, |
[" [Hh]eros? "] = 1, |
["[Hh]eros?$"] = 1, |
["[Ww]eekly"] = 1, |
["[Dd]aily"] = 1, |
["[Gg]earcheck"] = 1, |
["[Nn]axx"] = 1, |
["DD[ s]"] = 1, |
[" dd"] = 1, |
["dds "] = 1, |
["[Hh]eiler"] = 1, |
["[Hh]eal "] = 1, |
["[Tt]ank "] = 1, |
["[Dd][Pp][Ss]"] = 1, |
["[Gg][Rr][Pp] "] = 1, |
["such.+gru?p?pe?"] = 1, |
["[Ss]tammgru?p?pe?"] = 1, |
["[Bb][Gg] ?[Ss]tamm"] = 1, |
[" [Rr]aid"] = 1, |
["[Gg]earscore"] = 1, |
["[Cc]huck "] = 1, |
[" [Nn]orris"] = 1, |
["%d+%.%d%d?%s?[Ee][Uu][Rr][Oo]?"] = 15, |
["[Pp]aypal"] = 10, |
[".berweisung"] = 10, |
["mmo%w+%.com"] = 10, |
}, |
} |
STS_SV["enUS"] = { |
["whitelist"] = {"[Pp]ay","[Pp]rice","^[Ww][Tt][SsBb]","[Oo]ffer","[Rr]ecipe","%d+% ?[Gg] ","%d+% ?[Gg]$","[Ss]tack","[Ss]ell","[Ll][Ff][Ww]","[Mm]ats","[Ff]ee","Hitem:","Henchant:","Htrade:", }, |
["blacklist"] = {"[Aa]rena","[Ii][Cc][Cc]","Hquest:245%d%d:8","^[Ll][Ff]%d?[RrGgMm]","[Tt]ank","[Hh]ealer","10/25","guild","recruit"," [Rr]aid","^[Ll][Ff][GgMm% ].+quest","rep% ?farm","[Gg]ear% ?[Ii]nspect","[Gg]ear% ?[Ss]core","[Ww]eekly","[Dd]aily","[Ll][Ff]%d?[GgRrMm] .+[12][05]","[Dd][Pp][Ss] ","http://","%.cn$","[Vv][Oo][Aa]% ?[12][05]","[Tt][Oo]?[Gg]?[Cc]% ?[12][05]", }, |
["list"] = { |
["[Pp]ay"] = -2, |
["[Pp]rice"] = -2, |
["^[Ww][Tt][SsBb]"] = -2, |
["[Oo]ffer"] = -2, |
["[Rr]ecipe"] = -2, |
["%d+% ?[Gg] "] = -2, |
["%d+% ?[Gg]$"] = -2, |
["[Ss]tack"] = -2, |
["[Ss]ell"] = -2, |
["[Ll][Ff][Ww]"] = -2, |
["[Mm]ats"] = -2, |
["[Ff]ee"] = -2, |
["Hitem:"] = -2, |
["Henchant:"] = -2, |
["Htrade:"] = -2, |
["[Aa]rena"] = 1, |
["[Ii][Cc][Cc]"] = 1, |
["Hquest:245%d%d:8"] = 1, |
["^[Ll][Ff]%d?[RrGgMm]"] = 1, |
["[Tt]ank"] = 1, |
["[Hh]ealer"] = 1, |
["10/25"] = 1, |
["guild"] = 1, |
["recruit"] = 1, |
[" [Rr]aid"] = 1, |
["^[Ll][Ff][GgMm% ].+quest"] = 1, |
["rep% ?farm"] = 1, |
["[Gg]ear% ?[Ii]nspect"] = 1, |
["[Gg]ear% ?[Ss]core"] = 1, |
["[Ww]eekly"] = 1, |
["[Dd]aily"] = 1, |
["[Ll][Ff]%d?[GgRrMm] .+[12][05]"] = 1, |
["[Dd][Pp][Ss] "] = 1, |
["http://"] = 5, |
["%.cn$"] = 10, |
["[Vv][Oo][Aa]% ?[12][05]"] = 1, |
["[Tt][Oo]?[Gg]?[Cc]% ?[12][05]"] = 1, |
["%d+%.%d%d?%s?[Ee][Uu][Rr][Oo]?"] = 15, |
["[Pp]aypal"] = 10, |
["mmo%w+%.com"] = 10, |
}, |
} |
STS_SV["settings"] = { |
["showblack"] = true, |
if oldv <= 6.8 then |
STS_SV["settings"]["complainchat"] = true |
end |
if oldv <= 7.0 then |
for key,t in pairs(STS_SV) do |
if type(t) == "table" and t["whitelist"] and t["blacklist"] then |
t["list"] = { } |
for _,le in pairs(t["whitelist"]) do |
t["list"][le] = -2 |
end |
for _,le in pairs(t["blacklist"]) do |
t["list"][le] = 1 |
end |
t["whitelist"] = nil |
t["blacklist"] = nil |
end |
end |
STS_SV["settings"]["blockgold"] = true |
STS_SV["enUS"]["list"]["%.cn$"] = 10 |
STS_SV["enUS"]["list"]["http://"] = 5 |
STS_SV["deDE"]["list"]["www%..+%.de"] = 10 |
STS_SV["deDE"]["list"]["%.com$"] = 5 |
STS_SV["deDE"]["list"]["mmo%w+%.com"] = 10 |
STS_SV["enUS"]["list"]["mmo%w+%.com"] = 10 |
STS_SV["deDE"]["list"]["%.cn$"] = 10 |
STS_SV["deDE"]["list"]["[Pp]aypal"] = 10 |
STS_SV["enUS"]["list"]["[Pp]aypal"] = 10 |
STS_SV["deDE"]["list"][".berweisung"] = 10 |
STS_SV["deDE"]["list"]["%d+%.%d%d?%s?[Ee][Uu][Rr][Oo]?"] = 15 |
STS_SV["enUS"]["list"]["%d+%.%d%d?%s?[Ee][Uu][Rr][Oo]?"] = 15 |
STS_SV["deDE"]["list"]["[Vv]erkauf"] = -2 |
end |
sts_quiet = 0 |
return version |
end |