Commit 3ebed4d9 authored by nanahira's avatar nanahira

add AIW

parent 1a600d3a
......@@ -807,10 +807,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)->
......@@ -821,7 +817,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}" }
......@@ -1305,7 +1301,7 @@ class Room
else if name[0...2] == 'T#'
@hostinfo.mode = 2
@hostinfo.start_lp = 16000
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 = 999
......@@ -1693,6 +1689,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
......@@ -2272,7 +2270,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}')
......
......@@ -1040,11 +1040,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) {
......@@ -1060,7 +1055,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);
......@@ -1708,7 +1703,7 @@
} else if (name.slice(0, 2) === 'T#') {
this.hostinfo.mode = 2;
this.hostinfo.start_lp = 16000;
} 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 = 999;
......@@ -2229,6 +2224,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;
......@@ -3002,7 +3000,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