- tui.log_msg("");
- tui.log_msg("HELP");
- tui.log_msg("");
- tui.log_msg("chat mode commands:");
- tui.log_msg(":login USER - register as USER");
- tui.log_msg(":msg USER TEXT - send TEXT to USER");
- tui.log_msg(":help - show this help");
- tui.log_msg(":play or :p - switch to play mode");
- tui.log_msg(":study or :s - switch to study mode");
- tui.log_msg("");
- tui.log_msg("play mode commands:");
- tui.log_msg("w, a, s, d - move avatar");
- tui.log_msg("f - flatten surroundings");
- tui.log_msg("e - write following ASCII character");
- tui.log_msg("c - switch to chat mode");
- tui.log_msg("? - switch to study mode");
- tui.log_msg("");
- tui.log_msg("study mode commands:");
- tui.log_msg("w, a, s, d - move question mark");
- tui.log_msg("A - annotate terrain");
- tui.log_msg("c - switch to chat mode");
- tui.log_msg("p - switch to play mode");
- tui.log_msg("");
+ this.log_msg("HELP:");
+ this.log_msg("chat mode commands:");
+ this.log_msg(" " + command_char_selector.value + "nick NAME - re-name yourself to NAME");
+ this.log_msg(" " + command_char_selector.value + "msg USER TEXT - send TEXT to USER");
+ this.log_msg(" " + command_char_selector.value + "help - show this help");
+ this.log_msg(" " + command_char_selector.value + "P or " + command_char_selector.value + "play - switch to play mode");
+ this.log_msg(" " + command_char_selector.value + "? or " + command_char_selector.value + "study - switch to study mode");
+ this.log_msg("commands common to study and play mode:");
+ this.log_msg(" " + this.movement_keys_desc + " - move");
+ this.log_msg(" C - switch to chat mode");
+ this.log_msg("commands specific to play mode:");
+ this.log_msg(" E - write following ASCII character");
+ this.log_msg(" f - flatten surroundings");
+ this.log_msg(" ? - switch to study mode");
+ this.log_msg("commands specific to study mode:");
+ this.log_msg(" E - annotate terrain");
+ this.log_msg(" P - switch to play mode");
+ },
+ draw_map: function() {
+ let map_lines_split = [];
+ let line = [];
+ for (let i = 0, j = 0; i < game.map.length; i++, j++) {
+ if (j == game.map_size[1]) {
+ map_lines_split.push(line);
+ line = [];
+ j = 0;
+ };
+ line.push(game.map[i]);
+ };
+ map_lines_split.push(line);
+ for (const thing_id in game.things) {
+ let t = game.things[thing_id];
+ map_lines_split[t.position[0]][t.position[1]] = '@';
+ };
+ if (tui.mode.shows_info) {
+ map_lines_split[explorer.position[0]][explorer.position[1]] = '?';
+ }
+ let map_lines = []
+ if (game.map_geometry == 'Square') {
+ for (let line_split of map_lines_split) {
+ map_lines.push(line_split.join(''));
+ };
+ } else if (game.map_geometry == 'Hex') {
+ let indent = 0
+ for (let line_split of map_lines_split) {
+ map_lines.push(' '.repeat(indent) + line_split.join(' '));
+ if (indent == 0) {
+ indent = 1;
+ } else {
+ indent = 0;
+ };
+ };
+ }
+ let window_center = [terminal.rows / 2, this.window_width / 2];
+ let player = game.things[game.player_id];
+ let center_position = [player.position[0], player.position[1]];
+ if (tui.mode.shows_info) {
+ center_position = [explorer.position[0], explorer.position[1]];
+ }
+ if (game.map_geometry == 'Hex') {
+ center_position[1] = center_position[1] * 2;
+ };
+ let offset = [center_position[0] - window_center[0],
+ center_position[1] - window_center[1]]
+ if (game.map_geometry == 'Hex' && offset[0] % 2) {
+ offset[1] += 1;
+ };
+ let term_y = Math.max(0, -offset[0]);
+ let term_x = Math.max(0, -offset[1]);
+ let map_y = Math.max(0, offset[0]);
+ let map_x = Math.max(0, offset[1]);
+ for (; term_y < terminal.rows && map_y < game.map_size[0]; term_y++, map_y++) {
+ let to_draw = map_lines[map_y].slice(map_x, this.window_width + offset[1]);
+ terminal.write(term_y, term_x, to_draw);
+ }
+ },
+ draw_mode_line: function() {
+ terminal.write(0, this.window_width, 'MODE: ' + this.mode.name);
+ },
+ draw_turn_line: function(n) {
+ terminal.write(1, this.window_width, 'TURN: ' + game.turn);
+ },
+ draw_history: function() {
+ let log_display_lines = [];
+ for (let line of this.log) {
+ log_display_lines = log_display_lines.concat(this.msg_into_lines_of_width(line, this.window_width));
+ };
+ for (let y = terminal.rows - 1 - this.height_input,
+ i = log_display_lines.length - 1;
+ y >= this.height_header && i >= 0;
+ y--, i--) {
+ terminal.write(y, this.window_width, log_display_lines[i]);
+ }