Commit b65f471f authored by nanahira's avatar nanahira

improve

parent 94601b6a
...@@ -372,6 +372,7 @@ ban_user = (name) -> ...@@ -372,6 +372,7 @@ ban_user = (name) ->
ROOM_bad_ip[bad_ip]=99 ROOM_bad_ip[bad_ip]=99
settings.ban.banned_ip.push(player.ip) settings.ban.banned_ip.push(player.ip)
ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED) ygopro.stoc_send_chat_to_room(room, "#{player.name} ${kicked_by_system}", ygopro.constants.COLORS.RED)
CLIENT_send_replays(player, room)
CLIENT_kick(player) CLIENT_kick(player)
continue continue
return return
...@@ -1026,6 +1027,7 @@ class Room ...@@ -1026,6 +1027,7 @@ class Room
@has_ygopro_error = true @has_ygopro_error = true
@ygopro_error_length = if @ygopro_error_length then @ygopro_error_length + data.length else data.length @ygopro_error_length = if @ygopro_error_length then @ygopro_error_length + data.length else data.length
if @ygopro_error_length > 10000 if @ygopro_error_length > 10000
@send_replays()
@process.kill() @process.kill()
return return
catch catch
...@@ -1194,6 +1196,14 @@ class Room ...@@ -1194,6 +1196,14 @@ class Room
challonge_duel_log.scoresCsv = "0-0" challonge_duel_log.scoresCsv = "0-0"
return challonge_duel_log return challonge_duel_log
send_replays: () ->
return false unless settings.modules.replay_delay and @replays.length and @hostinfo.mode == 1
for player in @players
CLIENT_send_replays(player, this)
for player in @watchers
CLIENT_send_replays(player, this)
return true
add_windbot: (botdata)-> add_windbot: (botdata)->
@windbot = botdata @windbot = botdata
request request
...@@ -1260,6 +1270,7 @@ class Room ...@@ -1260,6 +1270,7 @@ class Room
roomlist.update(this) if !@windbot and !@started and settings.modules.http.websocket_roomlist roomlist.update(this) if !@windbot and !@started and settings.modules.http.websocket_roomlist
#client.room = null #client.room = null
else else
@send_replays()
@process.kill() @process.kill()
#client.room = null #client.room = null
this.delete() this.delete()
...@@ -3314,6 +3325,7 @@ if settings.modules.http ...@@ -3314,6 +3325,7 @@ if settings.modules.http
room.scores[room.dueling_players[0].name_vpass] = 0 room.scores[room.dueling_players[0].name_vpass] = 0
room.scores[room.dueling_players[1].name_vpass] = 0 room.scores[room.dueling_players[1].name_vpass] = 0
room.kicked = true room.kicked = true
@send_replays()
room.process.kill() room.process.kill()
room.delete() room.delete()
response.writeHead(200) response.writeHead(200)
......
...@@ -430,6 +430,7 @@ ...@@ -430,6 +430,7 @@
ROOM_bad_ip[bad_ip] = 99; ROOM_bad_ip[bad_ip] = 99;
settings.ban.banned_ip.push(player.ip); settings.ban.banned_ip.push(player.ip);
ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat_to_room(room, player.name + " ${kicked_by_system}", ygopro.constants.COLORS.RED);
CLIENT_send_replays(player, room);
CLIENT_kick(player); CLIENT_kick(player);
continue; continue;
} }
...@@ -1309,6 +1310,7 @@ ...@@ -1309,6 +1310,7 @@
_this.has_ygopro_error = true; _this.has_ygopro_error = true;
_this.ygopro_error_length = _this.ygopro_error_length ? _this.ygopro_error_length + data.length : data.length; _this.ygopro_error_length = _this.ygopro_error_length ? _this.ygopro_error_length + data.length : data.length;
if (_this.ygopro_error_length > 10000) { if (_this.ygopro_error_length > 10000) {
_this.send_replays();
_this.process.kill(); _this.process.kill();
} }
}; };
...@@ -1544,6 +1546,24 @@ ...@@ -1544,6 +1546,24 @@
return challonge_duel_log; return challonge_duel_log;
}; };
Room.prototype.send_replays = function() {
var len2, len3, m, n, player, ref2, ref3;
if (!(settings.modules.replay_delay && this.replays.length && this.hostinfo.mode === 1)) {
return false;
}
ref2 = this.players;
for (m = 0, len2 = ref2.length; m < len2; m++) {
player = ref2[m];
CLIENT_send_replays(player, this);
}
ref3 = this.watchers;
for (n = 0, len3 = ref3.length; n < len3; n++) {
player = ref3[n];
CLIENT_send_replays(player, this);
}
return true;
};
Room.prototype.add_windbot = function(botdata) { Room.prototype.add_windbot = function(botdata) {
this.windbot = botdata; this.windbot = botdata;
request({ request({
...@@ -1635,6 +1655,7 @@ ...@@ -1635,6 +1655,7 @@
roomlist.update(this); roomlist.update(this);
} }
} else { } else {
this.send_replays();
this.process.kill(); this.process.kill();
this["delete"](); this["delete"]();
} }
...@@ -4231,6 +4252,7 @@ ...@@ -4231,6 +4252,7 @@
room.scores[room.dueling_players[1].name_vpass] = 0; room.scores[room.dueling_players[1].name_vpass] = 0;
} }
room.kicked = true; room.kicked = true;
this.send_replays();
room.process.kill(); room.process.kill();
room["delete"](); room["delete"]();
} }
......
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