+document.getElementById("terminal").onclick = function() {
+ tui.inputEl.focus();
+};
+document.getElementById("help").onclick = function() {
+ tui.show_help = true;
+ tui.full_refresh();
+};
+document.getElementById("switch_to_play").onclick = function() {
+ tui.switch_mode('play');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_study").onclick = function() {
+ tui.switch_mode('study');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_chat").onclick = function() {
+ tui.switch_mode('chat');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_password").onclick = function() {
+ tui.switch_mode('password');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_edit").onclick = function() {
+ tui.switch_mode('edit');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_annotate").onclick = function() {
+ tui.switch_mode('annotate');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_portal").onclick = function() {
+ tui.switch_mode('portal');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_admin").onclick = function() {
+ tui.switch_mode('admin');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_control_pw_type").onclick = function() {
+ tui.switch_mode('control_pw_type');
+ tui.full_refresh();
+};
+document.getElementById("switch_to_control_tile_type").onclick = function() {
+ tui.switch_mode('control_tile_type');
+ tui.full_refresh();
+};
+document.getElementById("toggle_map_mode").onclick = function() {
+ if (tui.map_mode == 'terrain') {
+ tui.map_mode = 'annotations';
+ } else if (tui.map_mode == 'annotations') {
+ tui.map_mode = 'control';
+ } else {
+ tui.map_mode = 'terrain';
+ }
+ tui.full_refresh();
+};
+document.getElementById("take_thing").onclick = function() {
+ server.send(['TASK:PICK_UP']);
+};
+document.getElementById("drop_thing").onclick = function() {
+ server.send(['TASK:DROP']);
+};
+document.getElementById("flatten").onclick = function() {
+ server.send(['TASK:FLATTEN_SURROUNDINGS', tui.password]);
+};
+document.getElementById("teleport").onclick = function() {
+ game.teleport();
+};
+document.getElementById("move_upleft").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'UPLEFT']);
+ } else {
+ explorer.move('UPLEFT');
+ };
+};
+document.getElementById("move_left").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'LEFT']);
+ } else {
+ explorer.move('LEFT');
+ };
+};
+document.getElementById("move_downleft").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'DOWNLEFT']);
+ } else {
+ explorer.move('DOWNLEFT');
+ };
+};
+document.getElementById("move_down").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'DOWN']);
+ } else {
+ explorer.move('DOWN');
+ };
+};
+document.getElementById("move_up").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'UP']);
+ } else {
+ explorer.move('UP');
+ };
+};
+document.getElementById("move_upright").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'UPRIGHT']);
+ } else {
+ explorer.move('UPRIGHT');
+ };
+};
+document.getElementById("move_right").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'RIGHT']);
+ } else {
+ explorer.move('RIGHT');
+ };
+};
+document.getElementById("move_downright").onclick = function() {
+ if (tui.mode.name == 'play') {
+ server.send(['TASK:MOVE', 'DOWNRIGHT']);
+ } else {
+ explorer.move('DOWNRIGHT');
+ };
+};