Commit 1bf648a2 authored by nanahira's avatar nanahira

make recover replay available to non-tournament mode

parent 6a13b897
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
"replay_path": "./replays/", "replay_path": "./replays/",
"replay_archive_tool": "7z", "replay_archive_tool": "7z",
"block_replay_to_player": false, "block_replay_to_player": false,
"enable_recover": true, "enable_recover": false,
"show_ip": false, "show_ip": false,
"show_info": true, "show_info": true,
"log_save_path": "./config/", "log_save_path": "./config/",
......
...@@ -1026,7 +1026,7 @@ CLIENT_is_banned_by_mc = global.CLIENT_is_banned_by_mc = (client) -> ...@@ -1026,7 +1026,7 @@ CLIENT_is_banned_by_mc = global.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 = global.CLIENT_send_replays = (client, room) -> CLIENT_send_replays = global.CLIENT_send_replays = (client, room) ->
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 return false unless settings.modules.replay_delay and not (settings.modules.tournament_mode.enabled 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
...@@ -1195,7 +1195,7 @@ class Room ...@@ -1195,7 +1195,7 @@ class Room
if settings.modules.tournament_mode.enabled if settings.modules.tournament_mode.enabled
@hostinfo.replay_mode |= 0x1 @hostinfo.replay_mode |= 0x1
if (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.replay_safe) or (@hostinfo.mode == 1 and settings.modules.replay_delay) if (settings.modules.tournament_mode.enabled and settings.modules.tournament_mode.block_replay_to_player) or (@hostinfo.mode == 1 and settings.modules.replay_delay)
@hostinfo.replay_mode |= 0x2 @hostinfo.replay_mode |= 0x2
param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, @hostinfo.duel_rule, param = [0, @hostinfo.lflist, @hostinfo.rule, @hostinfo.mode, @hostinfo.duel_rule,
...@@ -3566,13 +3566,13 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server, datas)-> ...@@ -3566,13 +3566,13 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server, datas)->
ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)-> ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)->
room=ROOM_all[client.rid] room=ROOM_all[client.rid]
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.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 !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 or settings.modules.tournament_mode.enable_recover
if client.pos == 0 if client.pos == 0
dueltime=moment().format('YYYY-MM-DD HH-mm-ss') dueltime=moment().format('YYYY-MM-DD HH-mm-ss')
replay_filename=dueltime replay_filename=dueltime
......
...@@ -1375,7 +1375,7 @@ ...@@ -1375,7 +1375,7 @@
CLIENT_send_replays = global.CLIENT_send_replays = function(client, room) { CLIENT_send_replays = global.CLIENT_send_replays = function(client, room) {
var buffer, i, len2, m, ref2; var buffer, i, len2, m, ref2;
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)) { if (!(settings.modules.replay_delay && !(settings.modules.tournament_mode.enabled && 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;
...@@ -1579,7 +1579,7 @@ ...@@ -1579,7 +1579,7 @@
if (settings.modules.tournament_mode.enabled) { if (settings.modules.tournament_mode.enabled) {
this.hostinfo.replay_mode |= 0x1; this.hostinfo.replay_mode |= 0x1;
} }
if ((settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe) || (this.hostinfo.mode === 1 && settings.modules.replay_delay)) { if ((settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.block_replay_to_player) || (this.hostinfo.mode === 1 && settings.modules.replay_delay)) {
this.hostinfo.replay_mode |= 0x2; this.hostinfo.replay_mode |= 0x2;
} }
param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, this.hostinfo.duel_rule, (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit, this.hostinfo.replay_mode]; param = [0, this.hostinfo.lflist, this.hostinfo.rule, this.hostinfo.mode, this.hostinfo.duel_rule, (this.hostinfo.no_check_deck ? 'T' : 'F'), (this.hostinfo.no_shuffle_deck ? 'T' : 'F'), this.hostinfo.start_lp, this.hostinfo.start_hand, this.hostinfo.draw_count, this.hostinfo.time_limit, this.hostinfo.replay_mode];
...@@ -4764,7 +4764,7 @@ ...@@ -4764,7 +4764,7 @@
var duellog, dueltime, i, len2, len3, m, n, player, ref2, ref3, replay_filename, room; var duellog, dueltime, i, len2, len3, m, n, player, ref2, ref3, replay_filename, room;
room = ROOM_all[client.rid]; room = ROOM_all[client.rid];
if (!room) { if (!room) {
return settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe && settings.modules.tournament_mode.block_replay_to_player || settings.modules.replay_delay; return settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.block_replay_to_player || settings.modules.replay_delay;
} }
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);
...@@ -4773,7 +4773,7 @@ ...@@ -4773,7 +4773,7 @@
// 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 && settings.modules.tournament_mode.replay_safe) { if (settings.modules.tournament_mode.enabled && settings.modules.tournament_mode.replay_safe || settings.modules.tournament_mode.enable_recover) {
if (client.pos === 0) { if (client.pos === 0) {
dueltime = moment().format('YYYY-MM-DD HH-mm-ss'); dueltime = moment().format('YYYY-MM-DD HH-mm-ss');
replay_filename = dueltime; replay_filename = dueltime;
......
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