Commit a0863d1f authored by mercury233's avatar mercury233

fix room error

parent f9321212
...@@ -379,10 +379,25 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -379,10 +379,25 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
windbot = _.sample settings.modules.windbots windbot = _.sample settings.modules.windbots
room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000)) # 这个 AI# 没有特殊作用, 仅作为标记 room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000)) # 这个 AI# 没有特殊作用, 仅作为标记
room.windbot = windbot if !room
room.private = true ygopro.stoc_send_chat(client, "服务器已经爆满,请稍候再试", ygopro.constants.COLORS.RED)
client.room = room ygopro.stoc_send client, 'ERROR_MSG', {
client.room.connect(client) msg: 1
code: 2
}
client.end()
else if room.error
ygopro.stoc_send_chat(client, room.error, ygopro.constants.COLORS.RED)
ygopro.stoc_send client, 'ERROR_MSG', {
msg: 1
code: 2
}
client.end()
else
room.windbot = windbot
room.private = true
client.room = room
client.room.connect(client)
else if info.pass.length and settings.modules.mycard_auth else if info.pass.length and settings.modules.mycard_auth
ygopro.stoc_send_chat(client, '正在读取用户信息...', ygopro.constants.COLORS.RED) ygopro.stoc_send_chat(client, '正在读取用户信息...', ygopro.constants.COLORS.RED)
...@@ -480,8 +495,23 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)-> ...@@ -480,8 +495,23 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
} }
client.end() client.end()
return return
client.room = room if !room
client.room.connect(client) ygopro.stoc_send_chat(client, "服务器已经爆满,请稍候再试", ygopro.constants.COLORS.RED)
ygopro.stoc_send client, 'ERROR_MSG', {
msg: 1
code: 2
}
client.end()
else if room.error
ygopro.stoc_send_chat(client, room.error, ygopro.constants.COLORS.RED)
ygopro.stoc_send client, 'ERROR_MSG', {
msg: 1
code: 2
}
client.end()
else
client.room = room
client.room.connect(client)
if id = users_cache[client.name] if id = users_cache[client.name]
secret = id % 65535 + 1 secret = id % 65535 + 1
......
...@@ -432,10 +432,26 @@ ...@@ -432,10 +432,26 @@
windbot = _.sample(settings.modules.windbots); windbot = _.sample(settings.modules.windbots);
} }
room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000)); room = Room.find_or_create_by_name('AI#' + Math.floor(Math.random() * 100000));
room.windbot = windbot; if (!room) {
room["private"] = true; ygopro.stoc_send_chat(client, "服务器已经爆满,请稍候再试", ygopro.constants.COLORS.RED);
client.room = room; ygopro.stoc_send(client, 'ERROR_MSG', {
client.room.connect(client); msg: 1,
code: 2
});
client.end();
} else if (room.error) {
ygopro.stoc_send_chat(client, room.error, ygopro.constants.COLORS.RED);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
client.end();
} else {
room.windbot = windbot;
room["private"] = true;
client.room = room;
client.room.connect(client);
}
} else if (info.pass.length && settings.modules.mycard_auth) { } else if (info.pass.length && settings.modules.mycard_auth) {
ygopro.stoc_send_chat(client, '正在读取用户信息...', ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, '正在读取用户信息...', ygopro.constants.COLORS.RED);
if (info.pass.length <= 8) { if (info.pass.length <= 8) {
...@@ -538,8 +554,24 @@ ...@@ -538,8 +554,24 @@
client.end(); client.end();
return; return;
} }
client.room = room; if (!room) {
return client.room.connect(client); ygopro.stoc_send_chat(client, "服务器已经爆满,请稍候再试", ygopro.constants.COLORS.RED);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
return client.end();
} else if (room.error) {
ygopro.stoc_send_chat(client, room.error, ygopro.constants.COLORS.RED);
ygopro.stoc_send(client, 'ERROR_MSG', {
msg: 1,
code: 2
});
return client.end();
} else {
client.room = room;
return client.room.connect(client);
}
}; };
if (id = users_cache[client.name]) { if (id = users_cache[client.name]) {
secret = id % 65535 + 1; secret = id % 65535 + 1;
......
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