Commit f19e7d6d authored by nanahira's avatar nanahira

unfinished: i18n problem

parent 492e22b8
......@@ -1825,13 +1825,13 @@ netRequestHandler = (client) ->
if client.isWs
client.on 'close', (code, reason) ->
closeHandler()
else
client.on 'close', (had_error) ->
closeHandler(had_error ? 'unknown' : undefined)
client.on 'timeout', ()->
unless settings.modules.reconnect.enabled and (disconnect_list[CLIENT_get_authorize_key(client)] or client.had_new_reconnection)
client.destroy()
return
else
client.on 'close', (had_error) ->
closeHandler(had_error ? 'unknown' : undefined)
client.on 'error', closeHandler
......
......@@ -4280,19 +4280,8 @@
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,17 +78,10 @@ translateHandler = (handler) ->
if !room
console.log "err stoc_send_chat_to_room"
return
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)
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
return
@stoc_send_hint_card_to_room = (room, card)->
......
......@@ -94,13 +94,9 @@
return this.helper.sendMessage(socket, `CTOS_${proto}`, info);
};
//util
this.stoc_send_chat = async function(client, msg, player = 8) {
var i, len, line, o, r, ref, ref1;
if (!client) {
console.log("err stoc_send_chat");
return;
}
this.splitLines = function(msg, player) {
var i, len, line, lines, o, r, ref, ref1;
lines = [];
ref = _.lines(msg);
for (i = 0, len = ref.length; i < len; i++) {
line = ref[i];
......@@ -112,6 +108,21 @@
r = ref1[o];
line = line.replace(r.regex, r.text);
}
lines.push(line);
}
return lines;
};
//util
this.stoc_send_chat = async function(client, msg, player = 8) {
var i, len, line, ref;
if (!client) {
console.log("err stoc_send_chat");
return;
}
ref = this.splitLines(msg, player);
for (i = 0, len = ref.length; i < len; i++) {
line = ref[i];
await this.stoc_send(client, 'CHAT', {
player: player,
msg: line
......@@ -125,7 +136,7 @@
console.log("err stoc_send_chat_to_room");
return;
}
ref = _.lines(msg);
ref = this.splitLines(msg, player);
for (i = 0, len = ref.length; i < len; i++) {
line = ref[i];
chat_buffer = this.helper.prepareMessage("STOC_CHAT", {
......
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