Commit 5bc0a3d0 authored by nanahira's avatar nanahira

send replays to arena api

parent 227f0842
...@@ -939,7 +939,7 @@ CLIENT_is_banned_by_mc = (client) -> ...@@ -939,7 +939,7 @@ CLIENT_is_banned_by_mc = (client) ->
return client.ban_mc and client.ban_mc.banned and moment().isBefore(client.ban_mc.until) return client.ban_mc and client.ban_mc.banned and moment().isBefore(client.ban_mc.until)
CLIENT_send_replays = (client, room) -> CLIENT_send_replays = (client, room) ->
return false unless settings.modules.replay_delay and room.replays.length and room.hostinfo.mode == 1 and !client.replays_sent and !client.closed return false unless settings.modules.replay_delay and not (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe and settings.modules.tournament_mode.block_replay_to_player) and room.replays.length and room.hostinfo.mode == 1 and !client.replays_sent and !client.closed
client.replays_sent = true client.replays_sent = true
i = 0 i = 0
for buffer in room.replays for buffer in room.replays
...@@ -978,8 +978,7 @@ class Room ...@@ -978,8 +978,7 @@ class Room
@death = 0 @death = 0
@turn = 0 @turn = 0
@duel_stage = ygopro.constants.DUEL_STAGE.BEGIN @duel_stage = ygopro.constants.DUEL_STAGE.BEGIN
if settings.modules.replay_delay @replays = []
@replays = []
ROOM_all.push this ROOM_all.push this
@hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo)) @hostinfo ||= JSON.parse(JSON.stringify(settings.hostinfo))
...@@ -1179,6 +1178,7 @@ class Room ...@@ -1179,6 +1178,7 @@ class Room
userscoreB: score_array[1].score, userscoreB: score_array[1].score,
userdeckA: score_array[0].deck, userdeckA: score_array[0].deck,
userdeckB: score_array[1].deck, userdeckB: score_array[1].deck,
replays: @replays,
start: @start_time, start: @start_time,
end: end_time, end: end_time,
arena: @arena arena: @arena
...@@ -3261,7 +3261,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)-> ...@@ -3261,7 +3261,7 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)->
return settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe and settings.modules.tournament_mode.block_replay_to_player or settings.modules.replay_delay unless room return settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe and settings.modules.tournament_mode.block_replay_to_player or settings.modules.replay_delay unless room
if settings.modules.cloud_replay.enabled and room.random_type if settings.modules.cloud_replay.enabled and room.random_type
Cloud_replay_ids.push room.cloud_replay_id Cloud_replay_ids.push room.cloud_replay_id
if settings.modules.replay_delay and room.hostinfo.mode == 1 and not (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe and settings.modules.tournament_mode.block_replay_to_player) and !room.replays[room.duel_count - 1] if !room.replays[room.duel_count - 1]
# console.log("Replay saved: ", room.duel_count - 1, client.pos) # console.log("Replay saved: ", room.duel_count - 1, client.pos)
room.replays[room.duel_count - 1] = buffer room.replays[room.duel_count - 1] = buffer
if settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe if settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe
......
...@@ -1201,7 +1201,7 @@ ...@@ -1201,7 +1201,7 @@
CLIENT_send_replays = function(client, room) { CLIENT_send_replays = function(client, room) {
var buffer, i, len2, m, ref2; var buffer, i, len2, m, ref2;
if (!(settings.modules.replay_delay && room.replays.length && room.hostinfo.mode === 1 && !client.replays_sent && !client.closed)) { if (!(settings.modules.replay_delay && !(settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe && settings.modules.tournament_mode.block_replay_to_player) && room.replays.length && room.hostinfo.mode === 1 && !client.replays_sent && !client.closed)) {
return false; return false;
} }
client.replays_sent = true; client.replays_sent = true;
...@@ -1252,9 +1252,7 @@ ...@@ -1252,9 +1252,7 @@
this.death = 0; this.death = 0;
this.turn = 0; this.turn = 0;
this.duel_stage = ygopro.constants.DUEL_STAGE.BEGIN; this.duel_stage = ygopro.constants.DUEL_STAGE.BEGIN;
if (settings.modules.replay_delay) { this.replays = [];
this.replays = [];
}
ROOM_all.push(this); ROOM_all.push(this);
this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo))); this.hostinfo || (this.hostinfo = JSON.parse(JSON.stringify(settings.hostinfo)));
delete this.hostinfo.comment; delete this.hostinfo.comment;
...@@ -1523,6 +1521,7 @@ ...@@ -1523,6 +1521,7 @@
userscoreB: score_array[1].score, userscoreB: score_array[1].score,
userdeckA: score_array[0].deck, userdeckA: score_array[0].deck,
userdeckB: score_array[1].deck, userdeckB: score_array[1].deck,
replays: this.replays,
start: this.start_time, start: this.start_time,
end: end_time, end: end_time,
arena: this.arena arena: this.arena
...@@ -4175,7 +4174,7 @@ ...@@ -4175,7 +4174,7 @@
if (settings.modules.cloud_replay.enabled && room.random_type) { if (settings.modules.cloud_replay.enabled && room.random_type) {
Cloud_replay_ids.push(room.cloud_replay_id); Cloud_replay_ids.push(room.cloud_replay_id);
} }
if (settings.modules.replay_delay && room.hostinfo.mode === 1 && !(settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe && settings.modules.tournament_mode.block_replay_to_player) && !room.replays[room.duel_count - 1]) { if (!room.replays[room.duel_count - 1]) {
room.replays[room.duel_count - 1] = buffer; room.replays[room.duel_count - 1] = buffer;
} }
if (settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) { if (settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) {
......
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