X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=rogue_chat.html;h=4285ded541ea1912fd83f36ba37337761407f074;hb=aab94ffb12aa0dedc240d7b29001699b95c49249;hp=883afc9322ad994c260c3a422921f477c58fb2e7;hpb=1ae4633dc3322876c494f710de67dfdbb0a2a5ba;p=plomrogue2 diff --git a/rogue_chat.html b/rogue_chat.html index 883afc9..4285ded 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -69,6 +69,7 @@ terminal rows: + @@ -104,6 +105,7 @@ terminal rows:
  • (un-)wear:
  • +
  • @@ -173,6 +175,11 @@ let mode_helps = { 'intro': '@ enter face line (enter nothing to abort):', 'long': 'Draw your face as ASCII art. The string you enter must be 18 characters long, and will be divided on display into 3 lines of 6 characters each, from top to bottom..' }, + 'enter_hat': { + 'short': 'enter your hat', + 'intro': '@ enter hat line (enter nothing to abort):', + 'long': 'Draw your hat as ASCII art. The string you enter must be 18 characters long, and will be divided on display into 3 lines of 6 characters each, from top to bottom..' + }, 'write': { 'short': 'change terrain', 'intro': '', @@ -536,6 +543,7 @@ let server = { explorer.info_cached = false; game.things = game.things_new; game.player = game.things[game.player_id]; + game.players_hat_chars = game.players_hat_chars_new; game.turn_complete = true; if (tui.mode.name == 'post_login_wait') { tui.switch_mode('play'); @@ -551,6 +559,8 @@ let server = { tui.log_msg('#MUSICPLAYER: ' + tokens[1], 1); } else if (tokens[0] === 'PLAYER_ID') { game.player_id = parseInt(tokens[1]); + } else if (tokens[0] === 'PLAYERS_HAT_CHARS') { + game.players_hat_chars_new = tokens[1]; } else if (tokens[0] === 'LOGIN_OK') { this.send(['GET_GAMESTATE']); tui.switch_mode('post_login_wait'); @@ -688,6 +698,7 @@ let tui = { mode_take_thing: new Mode('take_thing', true), mode_drop_thing: new Mode('drop_thing', true), mode_enter_face: new Mode('enter_face', true), + mode_enter_hat: new Mode('enter_hat', true), mode_admin_enter: new Mode('admin_enter', true), mode_admin: new Mode('admin'), mode_control_pw_pw: new Mode('control_pw_pw', true), @@ -724,7 +735,7 @@ let tui = { this.mode_control_tile_draw.available_actions = ["toggle_tile_draw"]; this.mode_edit.available_modes = ["write", "annotate", "portal", "name_thing", "password", "chat", "study", "play", - "admin_enter", "enter_face"] + "admin_enter", "enter_face", "enter_hat"] this.mode_edit.available_actions = ["move", "flatten", "install", "toggle_map_mode"] this.inputEl = document.getElementById("input"); @@ -1322,6 +1333,7 @@ let game = { this.map_size_new = [0,0]; this.portals = {}; this.portals_new = {}; + this.players_hat_chars = ""; }, get_thing_temp: function(id_, create_if_not_found=false) { if (id_ in game.things_new) { @@ -1543,6 +1555,14 @@ tui.inputEl.addEventListener('keydown', (event) => { } tui.inputEl.value = ""; tui.switch_mode('edit'); + } else if (tui.mode.name == 'enter_hat' && event.key == 'Enter') { + if (tui.inputEl.value.length != 18) { + tui.log_msg('? wrong input length, aborting'); + } else { + server.send(['PLAYER_HAT', tui.inputEl.value]); + } + tui.inputEl.value = ""; + tui.switch_mode('edit'); } else if (tui.mode.name == 'command_thing' && event.key == 'Enter') { server.send(['TASK:COMMAND', tui.inputEl.value]); tui.inputEl.value = "";