Commit 70c97420 authored by mercury233's avatar mercury233

give spammers rag

parent 91c6c3ed
......@@ -115,7 +115,8 @@
"badword_level1": ["傻逼", "鸡巴"],
"badword_level2": ["死妈", "草你妈"],
"badword_level3": ["迷奸", "仿真枪"],
"illegal_id": ["^Lv.\\d+", "^VIP.\\d+"]
"illegal_id": ["^Lv\\.-*\\d+\\s*(.*)", "^VIP\\.\\d+\\s*(.*)"],
"spam_word": ["——"]
},
"tip": [
"欢迎来到本服务器",
......
......@@ -825,6 +825,15 @@ ygopro.ctos_follow 'PLAYER_INFO', true, (buffer, info, client, server)->
# checkmate use username$password, but here don't
# so remove the password
name = info.name.split("$")[0]
if (_.any(settings.ban.illegal_id, (badid) ->
regexp = new RegExp(badid, 'i')
matchs = name.match(regexp)
if matchs
name = matchs[1]
return true
return false
, name))
client.rag = true
struct = ygopro.structs["CTOS_PlayerInfo"]
struct._setBuff(buffer)
struct.set("name", name)
......@@ -1418,6 +1427,23 @@ ygopro.ctos_follow 'CHAT', true, (buffer, info, client, server)->
else
client.abuse_count=client.abuse_count+4
ygopro.stoc_send_chat(client, "您的发言存在不适当的内容,发送失败!", ygopro.constants.COLORS.RED)
else if (client.rag and room.started)
client.rag = false
#ygopro.stoc_send_chat(client, "发言失败", ygopro.constants.COLORS.RED)
cancel = true
else if (msg.length>100)
log.warn "SPAM WORD", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+2
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED)
cancel = true
else if (_.any(settings.ban.spam_word, (badword) ->
regexp = new RegExp(badword, 'i')
return msg.match(regexp)
, msg))
#log.warn "SPAM WORD", client.name, client.ip, oldmsg
client.abuse_count=client.abuse_count+2
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED)
cancel = true
else if (_.any(settings.ban.badword_level2, (badword) ->
regexp = new RegExp(badword, 'i')
return msg.match(regexp)
......
......@@ -1040,6 +1040,18 @@
ygopro.ctos_follow('PLAYER_INFO', true, function(buffer, info, client, server) {
var name, struct;
name = info.name.split("$")[0];
if (_.any(settings.ban.illegal_id, function(badid) {
var matchs, regexp;
regexp = new RegExp(badid, 'i');
matchs = name.match(regexp);
if (matchs) {
name = matchs[1];
return true;
}
return false;
}, name)) {
client.rag = true;
}
struct = ygopro.structs["CTOS_PlayerInfo"];
struct._setBuff(buffer);
struct.set("name", name);
......@@ -1753,6 +1765,22 @@
client.abuse_count = client.abuse_count + 4;
ygopro.stoc_send_chat(client, "您的发言存在不适当的内容,发送失败!", ygopro.constants.COLORS.RED);
}
} else if (client.rag && room.started) {
client.rag = false;
cancel = true;
} else if (msg.length > 100) {
log.warn("SPAM WORD", client.name, client.ip, oldmsg);
client.abuse_count = client.abuse_count + 2;
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED);
cancel = true;
} else if (_.any(settings.ban.spam_word, function(badword) {
var regexp;
regexp = new RegExp(badword, 'i');
return msg.match(regexp);
}, msg)) {
client.abuse_count = client.abuse_count + 2;
ygopro.stoc_send_chat(client, "请不要发送垃圾信息!", ygopro.constants.COLORS.RED);
cancel = true;
} else if (_.any(settings.ban.badword_level2, function(badword) {
var regexp;
regexp = new RegExp(badword, 'i');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment