let quoted = ['"'];
for (let i = 0; i < str.length; i++) {
let c = str[i];
- if (c in ['"', '\\']) {
+ if (['"', '\\'].includes(c)) {
quoted.push('\\');
};
quoted.push(c);
tui.log_msg('# ' + tokens[1], 1);
} else if (tokens[0] === 'PLAYER_ID') {
game.player_id = parseInt(tokens[1]);
- } else if (tokens[0] === 'META') {
- tui.log_msg('@ ' + tokens[1]);
} else if (tokens[0] === 'LOGIN_OK') {
server.send(['GET_GAMESTATE']);
- tui.log_msg('@ ' + tokens[1]);
tui.log_help();
- tui.switch_mode(mode_chat);
+ tui.switch_mode(mode_play);
} else if (tokens[0] === 'ANNOTATION') {
let position = parser.parse_yx(tokens[1]);
explorer.update_info_db(position, tokens[2]);
} else {
tui.log_msg('? unknown command');
}
- } else {
- server.send(['ALL', tui.input]);
+ } else {
+ server.send(['ALL', tui.input]);
}
+ } else if (tui.input.length > 0) {
+ server.send(['ALL', tui.input]);
}
tui.empty_input();
tui.full_refresh();