calculateCraftSchedule added
This commit is contained in:
parent
0bed0dab91
commit
9ebc65ff90
1 changed files with 21 additions and 6 deletions
|
@ -44,23 +44,24 @@ function init_crafter() {
|
||||||
try {
|
try {
|
||||||
document.getElementById("recipe-choice").addEventListener("change", (event) => {
|
document.getElementById("recipe-choice").addEventListener("change", (event) => {
|
||||||
updateMaterials();
|
updateMaterials();
|
||||||
calculateCraft();
|
calculateCraftSchedule();
|
||||||
});
|
});
|
||||||
document.getElementById("level-choice").addEventListener("change", (event) => {
|
document.getElementById("level-choice").addEventListener("change", (event) => {
|
||||||
updateMaterials();
|
updateMaterials();
|
||||||
calculateCraft();
|
calculateCraftSchedule();
|
||||||
});
|
});
|
||||||
document.getElementById("recipe-choice").setAttribute("oninput", "updateCraftedImage()");
|
document.getElementById("recipe-choice").setAttribute("oninput", "updateCraftedImage()");
|
||||||
|
document.getElementById("recipe-choice").setAttribute("change", "updateCraftedImage()");
|
||||||
|
|
||||||
for (let i = 1; i < 4; ++i) {
|
for (let i = 1; i < 4; ++i) {
|
||||||
document.getElementById("mat-1-"+i).setAttribute("onclick", document.getElementById("mat-1-"+i).getAttribute("onclick") + "; calculateCraft();");
|
document.getElementById("mat-1-"+i).setAttribute("onclick", document.getElementById("mat-1-"+i).getAttribute("onclick") + "; calculateCraftSchedule();");
|
||||||
document.getElementById("mat-2-"+i).setAttribute("onclick", document.getElementById("mat-2-"+i).getAttribute("onclick") + "; calculateCraft();");
|
document.getElementById("mat-2-"+i).setAttribute("onclick", document.getElementById("mat-2-"+i).getAttribute("onclick") + "; calculateCraftSchedule();");
|
||||||
}
|
}
|
||||||
for (let i = 1; i < 7; ++i) {
|
for (let i = 1; i < 7; ++i) {
|
||||||
document.getElementById("ing-choice-" + i ).setAttribute("oninput", "calculateCraft();");
|
document.getElementById("ing-choice-" + i ).setAttribute("oninput", "calculateCraftSchedule();");
|
||||||
}
|
}
|
||||||
for (const str of ["slow", "normal", "fast"]) {
|
for (const str of ["slow", "normal", "fast"]) {
|
||||||
document.getElementById(str + "-atk-button").setAttribute("onclick", document.getElementById(str + "-atk-button").getAttribute("onclick") + "; calculateCraft();");
|
document.getElementById(str + "-atk-button").setAttribute("onclick", document.getElementById(str + "-atk-button").getAttribute("onclick") + "; calculateCraftSchedule();");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,6 +103,20 @@ function toggleAtkSpd(buttonId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let doCraftTask = null;
|
||||||
|
|
||||||
|
function calculateCraftSchedule(){
|
||||||
|
console.log("Craft Schedule called");
|
||||||
|
if (doCraftTask !== null) {
|
||||||
|
clearTimeout(doCraftTask);
|
||||||
|
}
|
||||||
|
doCraftTask = setTimeout(function(){
|
||||||
|
doCraftTask = null;
|
||||||
|
calculateCraft();
|
||||||
|
window.dispatchEvent(new Event('resize'));
|
||||||
|
}, 250);
|
||||||
|
}
|
||||||
|
|
||||||
function calculateCraft() {
|
function calculateCraft() {
|
||||||
//Make things display.
|
//Make things display.
|
||||||
for (let i of document.getElementsByClassName("hide-container-block")) {
|
for (let i of document.getElementsByClassName("hide-container-block")) {
|
||||||
|
|
Loading…
Reference in a new issue