Commit 492e22b8 authored by nanahira's avatar nanahira

fix record in ready

parent 6264a952
......@@ -1772,8 +1772,8 @@ class Room
else
@last_active_time = moment_now_string
addRecorderBuffer: (buffer) ->
if settings.modules.cloud_replay.enabled
addRecorderBuffer: (buffer, isChat) ->
if settings.modules.cloud_replay.enabled and (!isChat or @arena or settings.modules.tournament_mode.enabled)
@recorder_buffers.push buffer
return
......
......@@ -2397,8 +2397,8 @@
}
}
addRecorderBuffer(buffer) {
if (settings.modules.cloud_replay.enabled) {
addRecorderBuffer(buffer, isChat) {
if (settings.modules.cloud_replay.enabled && (!isChat || this.arena || settings.modules.tournament_mode.enabled)) {
this.recorder_buffers.push(buffer);
}
}
......@@ -4280,8 +4280,19 @@
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) {
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 (!CLIENT_is_able_to_reconnect(client) && !CLIENT_is_able_to_kick_reconnect(client)) {
ygopro.stoc_send_chat(client, "${reconnect_failed}", ygopro.constants.COLORS.RED);
......
......@@ -78,10 +78,17 @@ translateHandler = (handler) ->
if !room
console.log "err stoc_send_chat_to_room"
return
for client in room.players
@stoc_send_chat(client, msg, player) if client
for client in room.watchers
@stoc_send_chat(client, msg, player) if client
for line in _.lines(msg)
chat_buffer = @helper.prepareMessage("STOC_CHAT", {
player: player
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
@stoc_send_hint_card_to_room = (room, card)->
......
......@@ -120,23 +120,34 @@
};
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) {
console.log("err stoc_send_chat_to_room");
return;
}
ref = room.players;
ref = _.lines(msg);
for (i = 0, len = ref.length; i < len; i++) {
client = ref[i];
if (client) {
this.stoc_send_chat(client, msg, player);
line = ref[i];
chat_buffer = this.helper.prepareMessage("STOC_CHAT", {
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);
}
}
}
ref1 = room.watchers;
for (j = 0, len1 = ref1.length; j < len1; j++) {
client = ref1[j];
if (client) {
this.stoc_send_chat(client, msg, player);
ref2 = room.watchers;
for (k = 0, len2 = ref2.length; k < len2; k++) {
client = ref2[k];
if (client) {
this.helper.send(client, chat_buffer);
}
}
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