|
|
|
@@ -6,8 +6,6 @@ let currentDialog = null; |
|
|
|
let currentFoe = null; |
|
|
|
|
|
|
|
let dirButtons = []; |
|
|
|
let actionButtons = []; |
|
|
|
|
|
|
|
let mode = "explore"; |
|
|
|
let actions = []; |
|
|
|
let time = 9*60*60; |
|
|
|
@@ -117,19 +115,17 @@ function updateExploreCompass() { |
|
|
|
function updateExploreActions() { |
|
|
|
updateActions(); |
|
|
|
|
|
|
|
for (let i = 0; i < actionButtons.length; i++) { |
|
|
|
if (i < actions.length) { |
|
|
|
actionButtons[i].disabled = false; |
|
|
|
actionButtons[i].innerHTML = actions[i].name; |
|
|
|
actionButtons[i].classList.remove("inactive-button"); |
|
|
|
actionButtons[i].classList.add("active-button"); |
|
|
|
} |
|
|
|
else { |
|
|
|
actionButtons[i].disabled = true; |
|
|
|
actionButtons[i].innerHTML = ""; |
|
|
|
actionButtons[i].classList.remove("active-button"); |
|
|
|
actionButtons[i].classList.add("inactive-button"); |
|
|
|
} |
|
|
|
let actionButtons = document.querySelector("#actions"); |
|
|
|
|
|
|
|
actionButtons.innerHTML = ""; |
|
|
|
|
|
|
|
for (let i = 0; i < actions.length; i++) { |
|
|
|
let button = document.createElement("button"); |
|
|
|
button.innerHTML = actions[i].name; |
|
|
|
button.classList.add("active-button"); |
|
|
|
button.classList.add("action-button"); |
|
|
|
button.addEventListener("click", function() { actions[i].action(); }); |
|
|
|
actionButtons.appendChild(button); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@@ -365,7 +361,6 @@ function start() { |
|
|
|
document.getElementById("game").style.display = "block"; |
|
|
|
document.getElementById("stat-button-status").addEventListener("click", status, false); |
|
|
|
document.getElementById("log-button").addEventListener("click", toggleLog, false); |
|
|
|
loadActions(); |
|
|
|
loadCompass(); |
|
|
|
loadDialog(); |
|
|
|
world = createWorld(); |
|
|
|
@@ -680,17 +675,6 @@ function loadDialog() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function actionClicked(index) { |
|
|
|
actions[index].action(); |
|
|
|
} |
|
|
|
|
|
|
|
function loadActions() { |
|
|
|
actionButtons = Array.from( document.querySelectorAll(".action-button")); |
|
|
|
for (let i = 0; i < actionButtons.length; i++) { |
|
|
|
actionButtons[i].addEventListener("click", function() { actionClicked(i); }); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function loadCompass() { |
|
|
|
dirButtons[NORTH_WEST] = document.getElementById("compass-north-west"); |
|
|
|
dirButtons[NORTH_WEST].addEventListener("click", function() { |
|
|
|
|