diff --git a/index.html b/index.html index 694f8f9..296c90f 100644 --- a/index.html +++ b/index.html @@ -42,6 +42,12 @@

+ + +

v1.1.1

+

v1.1: Enhanced Edition


diff --git a/js/game.js b/js/game.js index 40e8ecd..e170ac4 100644 --- a/js/game.js +++ b/js/game.js @@ -5,7 +5,7 @@ var NaNalert = false; var gameEnded = false; let VERSION = { - num: 1.1, + num: "1.1.1", name: "Enhanced Edition" } @@ -694,28 +694,35 @@ function switchTheme() { resizeCanvas() } +function updateHotkeys() +{ + hotkeys = {}; + for (layer in layers){ + hk = layers[layer].hotkeys + if (hk){ + for (id in hk){ + hotkeys[hk[id].key] = hk[id] + hotkeys[hk[id].key].layer = layer + } + } + } +} +updateHotkeys() + document.onkeydown = function(e) { if (player===undefined) return; if (gameEnded&&!player.keepGoing) return; let shiftDown = e.shiftKey let ctrlDown = e.ctrlKey let key = e.key + if (ctrlDown) key = "ctrl+" + key if (onFocused) return if (ctrlDown && key != "-" && key != "_" && key != "+" && key != "=" && key != "r" && key != "R" && key != "F5") e.preventDefault() - if (false && key >= 0 && key <= 9) { - //if (key == 0) activateSpell(10) - //else activateSpell(key) - return - } else if ((!LAYERS.includes(key)) || ctrlDown || shiftDown) { - switch(key) { - case "???": - if (player.c.unl) doReset("c") - return - case "bbbbb": - if (ctrlDown && player.c.unl) doReset("c") - return - } - } else if (player[key].unl) doReset(key) + console.log(key) + if(hotkeys[key]){ + if (player[hotkeys[key].layer].unl) + hotkeys[key].onPress() + } } var onFocused = false diff --git a/js/layers.js b/js/layers.js index 6825bb4..916e509 100644 --- a/js/layers.js +++ b/js/layers.js @@ -139,8 +139,12 @@ var layers = { updateTemp() { }, // Do any necessary temp updating resetsNothing() {return false}, + hotkeys: [ + {key: "c", desc: "C: reset for lollipops or whatever", onPress(){if (player.c.unl) doReset("c")}}, + {key: "ctrl+c", desc: "Ctrl+c: respec things", onPress(){if (player.c.unl) respecBuyables("c")}}, + ], incr_order: [], // Array of layer names to have their order increased when this one is first unlocked - + // Optional, lets you format the tab yourself by listing components. You can create your own components in v.js. tabFormat: ["main-display", ["prestige-button", function(){return "Melt your points into "}], @@ -188,6 +192,10 @@ function layerShown(layer){ var LAYERS = Object.keys(layers); +var hotkeys = {}; + + + var ROW_LAYERS = {} for (layer in layers){ row = layers[layer].row @@ -206,4 +214,5 @@ function addLayer(layerName, layerData){ // Call this to add layers from a diffe ROW_LAYERS[row][layer]=layer; } + updateHotkeys() } \ No newline at end of file diff --git a/js/v.js b/js/v.js index 36e3b61..489a039 100644 --- a/js/v.js +++ b/js/v.js @@ -179,7 +179,8 @@ function loadVue() { keepGoing, VERSION, ENDGAME, - LAYERS + LAYERS, + hotkeys }, }) } \ No newline at end of file