home · contact · privacy
Nother fix.
[plomrogue2] / rogue_chat_nocanvas_monochrome.html
index 60418718fb57b9fb8a2535b85f6a46ce70c1cf8b..085c8a298646b4c9fbfc4cdee330b6c170896c86 100644 (file)
@@ -298,13 +298,13 @@ let mode_waiting_for_server = new Mode('waiting_for_server', 'Waiting for a serv
 let mode_login = new Mode('login', 'Pick your player name.', true, false, true);
 let mode_post_login_wait = new Mode('waiting for game world', 'Waiting for a server response.', false, false, true);
 let mode_chat = new Mode('chat', 'This mode allows you to engage in chit-chat with other users.  Any line you enter into the input prompt that does not start with a "/" will be sent to all users.  Lines that start with a "/" are used for commands like:', true, false);
-let mode_annotate = new Mode('annotate', 'This mode allows you to add/edit a comment on the tile you are currently standing on.  Hit Return to leave.', true, true);
+  let mode_annotate = new Mode('annotate', 'This mode allows you to add/edit a comment on the tile you are currently standing on (provided your map editing password authorizes you so).  Hit Return to leave.', true, true);
 let mode_play = new Mode('play', 'This mode allows you to interact with the map.', false, false);
-let mode_study = new Mode('study', 'This mode allows you to study the map and its tiles in detail.  Move the question mark over a tile, and the right half of the screen will show detailed information on it (unless obscured by this help screen here, which you can disappear with any key).', false, true);
-let mode_edit = new Mode('edit', 'This mode allows you to change the map tile you currently stand on (if your terrain editing password authorizes you so).  Just enter any printable ASCII character to imprint it on the ground below you.', false, false);
+let mode_study = new Mode('study', 'This mode allows you to study the map and its tiles in detail.  Move the question mark over a tile, and the right half of the screen will show detailed information on it.', false, true);
+let mode_edit = new Mode('edit', 'This mode allows you to change the map tile you currently stand on (if your map editing password authorizes you so).  Just enter any printable ASCII character to imprint it on the ground below you.', false, false);
 let mode_teleport = new Mode('teleport', 'Follow the instructions to re-connect and log-in to another server, or enter anything else to abort.', true);
-let mode_portal = new Mode('portal', 'This mode imprints/edits/removes a teleportation target on the ground you are currently standing on.  Enter or edit a URL to imprint a teleportation target; enter emptiness to remove a pre-existing teleportation target.  Hit Return to leave.', true, true);
-let mode_password = new Mode('password', 'This mode allows you to change the password that you send to authorize yourself for editing password-protected tiles.  Hit return to confirm and leave.', true, false, false);
+let mode_portal = new Mode('portal', 'This mode allows you to imprint/edit/remove a teleportation target on the ground you are currently standing on (provided your map editing password authorizes you so).  Enter or edit a URL to imprint a teleportation target; enter emptiness to remove a pre-existing teleportation target.  Hit Return to leave.', true, true);
+let mode_password = new Mode('password', 'This mode allows you to change the password that you send to authorize yourself for editing password-protected map tiles.  Hit return to confirm and leave.', true, false, false);
 
 let tui = {
   mode: mode_waiting_for_server,
@@ -355,13 +355,8 @@ let tui = {
     }
     this.mode = mode;
     this.empty_input();
-    if (mode == mode_annotate && explorer.position in explorer.info_db) {
-        let info = explorer.info_db[explorer.position];
-        if (info != "(none)") {
-           this.inputEl.value = info;
-           this.recalc_input_lines();
-        }
-    } else if (mode == mode_login) {
+    this.restore_input_values();
+    if (mode == mode_login) {
         if (this.login_name) {
             server.send(['LOGIN', this.login_name]);
         } else {
@@ -369,19 +364,28 @@ let tui = {
         }
     } else if (mode == mode_edit) {
         this.show_help = true;
-    } else if (mode == mode_portal && explorer.position in game.portals) {
-        let portal = game.portals[explorer.position]
-        this.inputEl.value = portal;
-        this.recalc_input_lines();
-    } else if (mode == mode_password) {
-        this.inputEl.value = this.password;
-        this.recalc_input_lines();
     } else if (mode == mode_teleport) {
         tui.log_msg("@ May teleport to: " + tui.teleport_target);
         tui.log_msg("@ Enter 'YES!' to entusiastically affirm.");
     }
     this.full_refresh();
   },
+  restore_input_values: function() {
+      if (this.mode == mode_annotate && explorer.position in explorer.info_db) {
+          let info = explorer.info_db[explorer.position];
+          if (info != "(none)") {
+              this.inputEl.value = info;
+              this.recalc_input_lines();
+          }
+      } else if (this.mode == mode_portal && explorer.position in game.portals) {
+          let portal = game.portals[explorer.position]
+          this.inputEl.value = portal;
+          this.recalc_input_lines();
+      } else if (this.mode == mode_password) {
+          this.inputEl.value = this.password;
+          this.recalc_input_lines();
+      }
+  },
   empty_input: function(str) {
       this.inputEl.value = "";
       if (this.mode.has_input_prompt) {
@@ -534,7 +538,7 @@ let tui = {
           content += "Available actions:\n";
           content += '[' + movement_keys_desc + '] – move question mark\n';
           content += '[' + this.keys.toggle_map_mode + '] – toggle view between terrain, and password protection areas\n';
-          content += '\nOther modes available from here:';
+          content += '\nOther modes available from here:\n';
           content += '[' + this.keys.switch_to_chat + '] – chat mode\n';
           content += '[' + this.keys.switch_to_play + '] – play mode\n';
           content += '[' + this.keys.switch_to_portal + '] – portal mode\n';
@@ -705,13 +709,13 @@ let explorer = {
         if (msg.length == 0) {
             msg = " ";  // triggers annotation deletion
         }
-        server.send(["ANNOTATE", unparser.to_yx(explorer.position), msg]);
+        server.send(["ANNOTATE", unparser.to_yx(explorer.position), msg, tui.password]);
     },
     set_portal: function(msg) {
         if (msg.length == 0) {
             msg = " ";  // triggers portal deletion
         }
-        server.send(["PORTAL", unparser.to_yx(explorer.position), msg]);
+        server.send(["PORTAL", unparser.to_yx(explorer.position), msg, tui.password]);
     }
 }
 
@@ -743,6 +747,7 @@ tui.inputEl.addEventListener('keydown', (event) => {
     if (tui.mode.has_input_prompt && event.key == 'Enter' && tui.inputEl.value == '/help') {
         tui.show_help = true;
         tui.empty_input();
+        tui.restore_input_values();
         tui.full_refresh();
     } else if (!tui.mode.has_input_prompt && event.key == tui.keys.help) {
         tui.show_help = true;