X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=rogue_chat.html;h=84d481c806218a35570d937cd49e485aacbff054;hb=ce80e43db5939580763b1f66bff4f87f1cccc383;hp=c685581b91969031a0f217feca967bc9c4464aac;hpb=1c16b715953524a6d9e84993963cf4f7adcc5bbe;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index c685581..84d481c 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -16,7 +16,7 @@ terminal rows:

-
+
 

button controls for hard-to-remember keybindings

@@ -485,11 +485,13 @@ let server = { let tokens = parser.tokenize(event.data); if (tokens[0] === 'TURN') { game.turn_complete = false; - game.turn = parseInt(tokens[1]); } else if (tokens[0] === 'OTHER_WIPE') { game.portals_new = {}; explorer.annotations_new = {}; game.things_new = []; + } else if (tokens[0] === 'STATS') { + game.bladder_pressure_new = parseInt(tokens[1]) + game.weariness_new = parseInt(tokens[2]) } else if (tokens[0] === 'THING') { let t = game.get_thing_temp(tokens[4], true); t.position = parser.parse_yx(tokens[1]); @@ -546,6 +548,8 @@ let server = { game.things = game.things_new; game.player = game.things[game.player_id]; game.players_hat_chars = game.players_hat_chars_new; + game.bladder_pressure = game.bladder_pressure_new + game.weariness = game.weariness_new game.turn_complete = true; if (tui.mode.name == 'post_login_wait') { tui.switch_mode('play'); @@ -986,10 +990,11 @@ let tui = { }; inner_links[y].push([url_start_x, end_x, url]); }; - const matches = msg.matchAll(/https?:\/\/[^\s]+/g) let link_data = {}; let url_ends = []; - for (const match of matches) { + const regexp = RegExp('https?://[^\\s]+', 'g'); + let match; + while ((match = regexp.exec(msg)) !== null) { const url = match[0]; const url_start = match.index; const url_end = match.index + match[0].length; @@ -1209,10 +1214,10 @@ let tui = { } terminal.write(0, this.window_width, 'MODE: ' + this.mode.short_desc + ' – ' + help); }, - draw_turn_line: function(n) { - if (game.turn_complete) { - terminal.write(1, this.window_width, 'TURN: ' + game.turn); - } + draw_stats_line: function(n) { + terminal.write(1, this.window_width, + 'WEARINESS: ' + game.weariness + + ' BLADDER: ' + game.bladder_pressure); }, draw_history: function() { let log_display_lines = []; @@ -1327,7 +1332,7 @@ let tui = { this.draw_input(); } else { this.draw_map(); - this.draw_turn_line(); + this.draw_stats_line(); this.draw_mode_line(); if (this.mode.shows_info) { this.draw_info(); @@ -1367,6 +1372,8 @@ let game = { this.portals = {}; this.portals_new = {}; this.players_hat_chars = ""; + this.bladder_pressure = 0; + this.bladder_pressure_new = 0; }, get_thing_temp: function(id_, create_if_not_found=false) { if (id_ in game.things_new) {