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)->
uname = name.toUpperCase()
if room = ROOM_find_by_name(name)
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
ainame = namea[namea.length-1]
windbot = _.sample _.filter windbots, (w)->
......@@ -936,7 +932,7 @@ ROOM_find_or_create_ai = global.ROOM_find_or_create_ai = (name)->
else
windbot = _.sample _.filter windbots, (w)->
!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
log.info "long ai name", name
return { "error": "${windbot_name_too_long}" }
......@@ -1420,7 +1416,7 @@ class Room
else if name[0...2] == 'T#'
@hostinfo.mode = 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.lflist = -1
@hostinfo.time_limit = 0
......@@ -1883,6 +1879,8 @@ class Room
connect: (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
if @random_type
client.abuse_count = 0
......@@ -2493,7 +2491,7 @@ ygopro.ctos_follow 'JOIN_GAME', true, (buffer, info, client, server, datas)->
log.warn("BANNED IP LOGIN", client.name, client.ip)
ygopro.stoc_die(client, "${banned_ip_login}")
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)
if info.pass.length <= 8
ygopro.stoc_die(client, '${invalid_password_length}')
......
......@@ -1186,11 +1186,6 @@
uname = name.toUpperCase();
if (room = ROOM_find_by_name(name)) {
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) {
ainame = namea[namea.length - 1];
windbot = _.sample(_.filter(windbots, function(w) {
......@@ -1206,7 +1201,7 @@
windbot = _.sample(_.filter(windbots, function(w) {
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) {
log.info("long ai name", name);
......@@ -1854,7 +1849,7 @@
} else if (name.slice(0, 2) === 'T#') {
this.hostinfo.mode = 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.lflist = -1;
this.hostinfo.time_limit = 0;
......@@ -2454,6 +2449,9 @@
connect(client) {
var host_player;
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;
if (this.random_type) {
client.abuse_count = 0;
......@@ -3275,7 +3273,7 @@
log.warn("BANNED IP LOGIN", client.name, client.ip);
ygopro.stoc_die(client, "${banned_ip_login}");
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);
if (info.pass.length <= 8) {
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