Commit 492e22b8 authored by nanahira's avatar nanahira

fix record in ready

parent 6264a952
...@@ -1772,8 +1772,8 @@ class Room ...@@ -1772,8 +1772,8 @@ class Room
else else
@last_active_time = moment_now_string @last_active_time = moment_now_string
addRecorderBuffer: (buffer) -> addRecorderBuffer: (buffer, isChat) ->
if settings.modules.cloud_replay.enabled if settings.modules.cloud_replay.enabled and (!isChat or @arena or settings.modules.tournament_mode.enabled)
@recorder_buffers.push buffer @recorder_buffers.push buffer
return return
......
...@@ -2397,8 +2397,8 @@ ...@@ -2397,8 +2397,8 @@
} }
} }
addRecorderBuffer(buffer) { addRecorderBuffer(buffer, isChat) {
if (settings.modules.cloud_replay.enabled) { if (settings.modules.cloud_replay.enabled && (!isChat || this.arena || settings.modules.tournament_mode.enabled)) {
this.recorder_buffers.push(buffer); this.recorder_buffers.push(buffer);
} }
} }
...@@ -4280,8 +4280,19 @@ ...@@ -4280,8 +4280,19 @@
return cancel; return cancel;
}); });
ygopro.ctos_follow('HS_READY', true, function(buffer, info, client, server, datas) {
log.info("HS_READY", client.name);
return false;
});
ygopro.stoc_follow('ERROR_MSG', true, function(buffer, info, client, server, datas) {
log.info("ERROR_MSG", client.name, JSON.stringify(info));
return false;
});
ygopro.ctos_follow('UPDATE_DECK', true, async function(buffer, info, client, server, datas) { ygopro.ctos_follow('UPDATE_DECK', true, async function(buffer, info, client, server, datas) {
var athleticCheckResult, buff_main, buff_side, card, current_deck, deck, deck_array, deck_main, deck_side, deck_text, deckbuf, decks, found_deck, i, j, l, len, len1, line, oppo_pos, recover_player_data, recoveredDeck, room, struct, win_pos; var athleticCheckResult, buff_main, buff_side, card, current_deck, deck, deck_array, deck_main, deck_side, deck_text, deckbuf, decks, found_deck, i, j, l, len, len1, line, oppo_pos, recover_player_data, recoveredDeck, room, struct, win_pos;
log.info("UPDATE_DECK", client.name, info.mainc, info.sidec);
if (settings.modules.reconnect.enabled && client.pre_reconnecting) { if (settings.modules.reconnect.enabled && client.pre_reconnecting) {
if (!CLIENT_is_able_to_reconnect(client) && !CLIENT_is_able_to_kick_reconnect(client)) { if (!CLIENT_is_able_to_reconnect(client) && !CLIENT_is_able_to_kick_reconnect(client)) {
ygopro.stoc_send_chat(client, "${reconnect_failed}", ygopro.constants.COLORS.RED); ygopro.stoc_send_chat(client, "${reconnect_failed}", ygopro.constants.COLORS.RED);
......
...@@ -78,10 +78,17 @@ translateHandler = (handler) -> ...@@ -78,10 +78,17 @@ translateHandler = (handler) ->
if !room if !room
console.log "err stoc_send_chat_to_room" console.log "err stoc_send_chat_to_room"
return return
for client in room.players for line in _.lines(msg)
@stoc_send_chat(client, msg, player) if client chat_buffer = @helper.prepareMessage("STOC_CHAT", {
for client in room.watchers player: player
@stoc_send_chat(client, msg, player) if client msg: line
})
for client in room.players
@helper.send(client, chat_buffer) if client
for client in room.watchers
@helper.send(client, chat_buffer) if client
if room.duel_stage != @constants.DUEL_STAGE.BEGIN
room.addRecorderBuffer(chat_buffer, true)
return return
@stoc_send_hint_card_to_room = (room, card)-> @stoc_send_hint_card_to_room = (room, card)->
......
...@@ -120,23 +120,34 @@ ...@@ -120,23 +120,34 @@
}; };
this.stoc_send_chat_to_room = function(room, msg, player = 8) { this.stoc_send_chat_to_room = function(room, msg, player = 8) {
var client, i, j, len, len1, ref, ref1; var chat_buffer, client, i, j, k, len, len1, len2, line, ref, ref1, ref2;
if (!room) { if (!room) {
console.log("err stoc_send_chat_to_room"); console.log("err stoc_send_chat_to_room");
return; return;
} }
ref = room.players; ref = _.lines(msg);
for (i = 0, len = ref.length; i < len; i++) { for (i = 0, len = ref.length; i < len; i++) {
client = ref[i]; line = ref[i];
if (client) { chat_buffer = this.helper.prepareMessage("STOC_CHAT", {
this.stoc_send_chat(client, msg, player); player: player,
msg: line
});
ref1 = room.players;
for (j = 0, len1 = ref1.length; j < len1; j++) {
client = ref1[j];
if (client) {
this.helper.send(client, chat_buffer);
}
} }
} ref2 = room.watchers;
ref1 = room.watchers; for (k = 0, len2 = ref2.length; k < len2; k++) {
for (j = 0, len1 = ref1.length; j < len1; j++) { client = ref2[k];
client = ref1[j]; if (client) {
if (client) { this.helper.send(client, chat_buffer);
this.stoc_send_chat(client, msg, player); }
}
if (room.duel_stage !== this.constants.DUEL_STAGE.BEGIN) {
room.addRecorderBuffer(chat_buffer, true);
} }
} }
}; };
......
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