Commit b6fc504a authored by 神楽坂玲奈's avatar 神楽坂玲奈

ai filter

parent bfd5f993
......@@ -321,15 +321,29 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
client.end()
else if settings.modules.windbot and info.pass[0...2] == 'AI'
room = Room.find_or_create_by_name('M#AI' + Math.random().toString())
room.windbot = _.sample settings.modules.windbot
if info.pass.length > 3 and info.pass[0...3] == 'AI#'
name = info.pass.slice(3)
windbot = _.sample _.filter settings.modules.windbot, (w)->
w.name == name or w.deck == name
if !windbot
ygopro.stoc_send_chat(client,'主机密码不正确 (Invalid Windbot Name)', 11)
ygopro.stoc_send client, 'ERROR_MSG',{
msg: 1
code: 2
}
client.end()
return
else
windbot = _.sample settings.modules.windbot
room = Room.find_or_create_by_name('AI#' + Math.random().toString()) # 这个 AI# 没有特殊作用, 仅作为标记
room.windbot = windbot
room.private = true
client.room = room
client.room.connect(client)
else if info.pass.length and settings.modules.mycard_auth
console.log settings.modules.windbot
ygopro.stoc_send_chat(client,'正在读取用户信息...', 11)
if info.pass.length <= 8
ygopro.stoc_send_chat(client,'主机密码不正确 (Invalid Length)', 11)
......
......@@ -293,7 +293,7 @@
});
ygopro.ctos_follow('JOIN_GAME', false, function(buffer, info, client, server) {
var check, decrypted_buffer, finish, i, id, k, l, len, len1, ref, ref1, room, secret;
var check, decrypted_buffer, finish, i, id, k, l, len, len1, name, ref, ref1, room, secret, windbot;
if (settings.modules.stop) {
ygopro.stoc_send_chat(client, settings.modules.stop, 11);
ygopro.stoc_send(client, 'ERROR_MSG', {
......@@ -351,13 +351,29 @@
});
client.end();
} else if (settings.modules.windbot && info.pass.slice(0, 2) === 'AI') {
room = Room.find_or_create_by_name('M#AI' + Math.random().toString());
room.windbot = _.sample(settings.modules.windbot);
if (info.pass.length > 3 && info.pass.slice(0, 3) === 'AI#') {
name = info.pass.slice(3);
windbot = _.sample(_.filter(settings.modules.windbot, function(w) {
return w.name === name || w.deck === name;
}));
if (!windbot) {
ygopro.stoc_send_chat(client, '主机密码不正确 (Invalid Windbot Name)', 11);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
client.end();
return;
}
} else {
windbot = _.sample(settings.modules.windbot);
}
room = Room.find_or_create_by_name('AI#' + Math.random().toString());
room.windbot = windbot;
room["private"] = true;
client.room = room;
client.room.connect(client);
} else if (info.pass.length && settings.modules.mycard_auth) {
console.log(settings.modules.windbot);
ygopro.stoc_send_chat(client, '正在读取用户信息...', 11);
if (info.pass.length <= 8) {
ygopro.stoc_send_chat(client, '主机密码不正确 (Invalid Length)', 11);
......@@ -387,7 +403,7 @@
return (checksum & 0xFF) === 0;
};
finish = function(buffer) {
var action, name, opt1, opt2, opt3, options;
var action, opt1, opt2, opt3, options;
action = buffer.readUInt8(1) >> 4;
if (buffer !== decrypted_buffer && (action === 1 || action === 2 || action === 4)) {
ygopro.stoc_send_chat(client, '主机密码不正确 (Unauthorized)', 11);
......
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