Commit aa4be601 authored by nanahira's avatar nanahira

js

parent 518b4e6a
...@@ -2196,6 +2196,19 @@ ...@@ -2196,6 +2196,19 @@
//else //else
//log.info "windbot added" //log.info "windbot added"
kill_bots_with_name(name) {
var j, len, player, results, stand_bots;
stand_bots = room.get_playing_player().filter(function(player) {
return player.is_local && player.name_vpass === name;
});
results = [];
for (j = 0, len = stand_bots.length; j < len; j++) {
player = stand_bots[j];
results.push(CLIENT_kick(player));
}
return results;
}
add_windbot_stand(name, deckContent) { add_windbot_stand(name, deckContent) {
request({ request({
url: `http://${settings.modules.windbot.server_ip}:${settings.modules.windbot.port}/?name=${encodeURIComponent(name)}&deck=Test&host=${settings.modules.windbot.my_ip}&port=${settings.port}&version=${settings.version}&password=${encodeURIComponent(this.name)}&chat=false&deckcode=${encodeURIComponent(deckContent.toString('base64'))}` url: `http://${settings.modules.windbot.server_ip}:${settings.modules.windbot.port}/?name=${encodeURIComponent(name)}&deck=Test&host=${settings.modules.windbot.my_ip}&port=${settings.port}&version=${settings.version}&password=${encodeURIComponent(this.name)}&chat=false&deckcode=${encodeURIComponent(deckContent.toString('base64'))}`
...@@ -2297,6 +2310,9 @@ ...@@ -2297,6 +2310,9 @@
} }
} }
} }
if (this.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && !client.is_local && client.bot_bound) {
this.kill_bots_with_name(client.name_vpass);
}
if (this.players.length && !(this.windbot && client.is_host) && !(this.arena && this.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && client.pos <= 3)) { if (this.players.length && !(this.windbot && client.is_host) && !(this.arena && this.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && client.pos <= 3)) {
left_name = (settings.modules.hide_name && this.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN ? "********" : client.name); left_name = (settings.modules.hide_name && this.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN ? "********" : client.name);
ygopro.stoc_send_chat_to_room(this, `${left_name} \${left_game}` + (error ? `: ${error}` : '')); ygopro.stoc_send_chat_to_room(this, `${left_name} \${left_game}` + (error ? `: ${error}` : ''));
...@@ -3892,7 +3908,7 @@ ...@@ -3892,7 +3908,7 @@
}); });
ygopro.ctos_follow('HS_TODUELIST', true, async function(buffer, info, client, server, datas) { ygopro.ctos_follow('HS_TODUELIST', true, async function(buffer, info, client, server, datas) {
var j, len, player, room, stand_bots; var room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return; return;
...@@ -3900,13 +3916,7 @@ ...@@ -3900,13 +3916,7 @@
if (room.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && !client.is_local && client.bot_bound) { if (room.duel_stage === ygopro.constants.DUEL_STAGE.BEGIN && !client.is_local && client.bot_bound) {
ygopro.stoc_send_chat(client, "${stand_bot_removed}", ygopro.constants.COLORS.BABYBLUE); ygopro.stoc_send_chat(client, "${stand_bot_removed}", ygopro.constants.COLORS.BABYBLUE);
client.bot_bound = false; client.bot_bound = false;
stand_bots = room.get_playing_player().filter(function(player) { room.kill_bots_with_name(client.name_vpass);
return player.is_local && player.name_vpass === client.name_vpass;
});
for (j = 0, len = stand_bots.length; j < len; j++) {
player = stand_bots[j];
CLIENT_kick(player);
}
} }
return false; return false;
}); });
......
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