Commit c8ce5471 authored by nanahira's avatar nanahira

Merge branch 'master' of ../srvpro into develop

parents 6a797c2d 3ebed4d9
Pipeline #40328 passed with stages
in 11 minutes and 15 seconds
...@@ -922,10 +922,6 @@ ROOM_find_or_create_ai = global.ROOM_find_or_create_ai = (name)-> ...@@ -922,10 +922,6 @@ ROOM_find_or_create_ai = global.ROOM_find_or_create_ai = (name)->
uname = name.toUpperCase() uname = name.toUpperCase()
if room = ROOM_find_by_name(name) if room = ROOM_find_by_name(name)
return room return room
else if uname == 'AI'
windbot = _.sample _.filter windbots, (w)->
!w.hidden
name = 'AI#' + Math.floor(Math.random() * 100000)
else if namea.length>1 else if namea.length>1
ainame = namea[namea.length-1] ainame = namea[namea.length-1]
windbot = _.sample _.filter windbots, (w)-> windbot = _.sample _.filter windbots, (w)->
...@@ -936,7 +932,7 @@ ROOM_find_or_create_ai = global.ROOM_find_or_create_ai = (name)-> ...@@ -936,7 +932,7 @@ ROOM_find_or_create_ai = global.ROOM_find_or_create_ai = (name)->
else else
windbot = _.sample _.filter windbots, (w)-> windbot = _.sample _.filter windbots, (w)->
!w.hidden !w.hidden
name = name + '#' + Math.floor(Math.random() * 10000) name = name + '#' + Math.floor(Math.random() * 100000)
if name.replace(/[^\x00-\xff]/g,"00").length>20 if name.replace(/[^\x00-\xff]/g,"00").length>20
log.info "long ai name", name log.info "long ai name", name
return { "error": "${windbot_name_too_long}" } return { "error": "${windbot_name_too_long}" }
...@@ -1420,7 +1416,7 @@ class Room ...@@ -1420,7 +1416,7 @@ class Room
else if name[0...2] == 'T#' else if name[0...2] == 'T#'
@hostinfo.mode = 2 @hostinfo.mode = 2
@hostinfo.start_lp = settings.hostinfo.start_lp * 2 @hostinfo.start_lp = settings.hostinfo.start_lp * 2
else if name[0...3] == 'AI#' else if name[0...3] == 'AI#' or name[0...4] == 'AIW#'
@hostinfo.rule = 5 @hostinfo.rule = 5
@hostinfo.lflist = -1 @hostinfo.lflist = -1
@hostinfo.time_limit = 0 @hostinfo.time_limit = 0
...@@ -1883,6 +1879,8 @@ class Room ...@@ -1883,6 +1879,8 @@ class Room
connect: (client)-> connect: (client)->
@players.push client @players.push client
if @windbot and @name[0...3] == 'AIW' and !client.is_local and !@determine_firstgo
@determine_firstgo = client
client.join_time = moment_now_string client.join_time = moment_now_string
if @random_type if @random_type
client.abuse_count = 0 client.abuse_count = 0
...@@ -2493,7 +2491,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)-> ...@@ -2493,7 +2491,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
log.warn("BANNED IP LOGIN", client.name, client.ip) log.warn("BANNED IP LOGIN", client.name, client.ip)
ygopro.stoc_die(client, "${banned_ip_login}") ygopro.stoc_die(client, "${banned_ip_login}")
return return
else if info.pass.length and settings.modules.mycard.enabled and info.pass[0...3] != 'AI#' else if info.pass.length and settings.modules.mycard.enabled and info.pass[0...3] != 'AI#' and info.pass[0...4] != 'AIW#'
ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE) ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE)
if info.pass.length <= 8 if info.pass.length <= 8
ygopro.stoc_die(client, '${invalid_password_length}') ygopro.stoc_die(client, '${invalid_password_length}')
......
...@@ -1186,11 +1186,6 @@ ...@@ -1186,11 +1186,6 @@
uname = name.toUpperCase(); uname = name.toUpperCase();
if (room = ROOM_find_by_name(name)) { if (room = ROOM_find_by_name(name)) {
return room; return room;
} else if (uname === 'AI') {
windbot = _.sample(_.filter(windbots, function(w) {
return !w.hidden;
}));
name = 'AI#' + Math.floor(Math.random() * 100000);
} else if (namea.length > 1) { } else if (namea.length > 1) {
ainame = namea[namea.length - 1]; ainame = namea[namea.length - 1];
windbot = _.sample(_.filter(windbots, function(w) { windbot = _.sample(_.filter(windbots, function(w) {
...@@ -1206,7 +1201,7 @@ ...@@ -1206,7 +1201,7 @@
windbot = _.sample(_.filter(windbots, function(w) { windbot = _.sample(_.filter(windbots, function(w) {
return !w.hidden; return !w.hidden;
})); }));
name = name + '#' + Math.floor(Math.random() * 10000); name = name + '#' + Math.floor(Math.random() * 100000);
} }
if (name.replace(/[^\x00-\xff]/g, "00").length > 20) { if (name.replace(/[^\x00-\xff]/g, "00").length > 20) {
log.info("long ai name", name); log.info("long ai name", name);
...@@ -1854,7 +1849,7 @@ ...@@ -1854,7 +1849,7 @@
} else if (name.slice(0, 2) === 'T#') { } else if (name.slice(0, 2) === 'T#') {
this.hostinfo.mode = 2; this.hostinfo.mode = 2;
this.hostinfo.start_lp = settings.hostinfo.start_lp * 2; this.hostinfo.start_lp = settings.hostinfo.start_lp * 2;
} else if (name.slice(0, 3) === 'AI#') { } else if (name.slice(0, 3) === 'AI#' || name.slice(0, 4) === 'AIW#') {
this.hostinfo.rule = 5; this.hostinfo.rule = 5;
this.hostinfo.lflist = -1; this.hostinfo.lflist = -1;
this.hostinfo.time_limit = 0; this.hostinfo.time_limit = 0;
...@@ -2454,6 +2449,9 @@ ...@@ -2454,6 +2449,9 @@
connect(client) { connect(client) {
var host_player; var host_player;
this.players.push(client); this.players.push(client);
if (this.windbot && this.name.slice(0, 3) === 'AIW' && !client.is_local && !this.determine_firstgo) {
this.determine_firstgo = client;
}
client.join_time = moment_now_string; client.join_time = moment_now_string;
if (this.random_type) { if (this.random_type) {
client.abuse_count = 0; client.abuse_count = 0;
...@@ -3275,7 +3273,7 @@ ...@@ -3275,7 +3273,7 @@
log.warn("BANNED IP LOGIN", client.name, client.ip); log.warn("BANNED IP LOGIN", client.name, client.ip);
ygopro.stoc_die(client, "${banned_ip_login}"); ygopro.stoc_die(client, "${banned_ip_login}");
return; return;
} else if (info.pass.length && settings.modules.mycard.enabled && info.pass.slice(0, 3) !== 'AI#') { } else if (info.pass.length && settings.modules.mycard.enabled && info.pass.slice(0, 3) !== 'AI#' && info.pass.slice(0, 4) !== 'AIW#') {
ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, '${loading_user_info}', ygopro.constants.COLORS.BABYBLUE);
if (info.pass.length <= 8) { if (info.pass.length <= 8) {
ygopro.stoc_die(client, '${invalid_password_length}'); ygopro.stoc_die(client, '${invalid_password_length}');
......
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