Fix fatal typo causing default ings to show as undefined in crafter

This commit is contained in:
hppeng 2022-08-02 23:42:59 -07:00
parent d999b29125
commit d81bdd8e93
2 changed files with 7 additions and 20 deletions

View file

@ -31,16 +31,6 @@ let player_craft;
function init_crafter() { function init_crafter() {
//no ing
console.log("all ingredients");
console.log(ingMap);
console.log("all recipes");
console.log(recipeMap);
/*console.log(ingList);
console.log(recipeList);
console.log(ingIDMap);
console.log(recipeIDMap);*/
try { try {
document.getElementById("recipe-choice").addEventListener("change", (event) => { document.getElementById("recipe-choice").addEventListener("change", (event) => {
updateMaterials(); updateMaterials();
@ -56,17 +46,16 @@ function init_crafter() {
}); });
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") + "; calculateCraftSchedule();"); document.getElementById("mat-1-"+i).addEventListener("click", (e) => calculateCraftSchedule());
document.getElementById("mat-2-"+i).setAttribute("onclick", document.getElementById("mat-2-"+i).getAttribute("onclick") + "; calculateCraftSchedule();"); document.getElementById("mat-2-"+i).addEventListener("click", (e) => calculateCraftSchedule());
} }
for (let i = 1; i < 7; ++i) { for (let i = 1; i < 7; ++i) {
document.getElementById("ing-choice-" + i ).setAttribute("oninput", "calculateCraftSchedule();"); document.getElementById("ing-choice-" + i ).addEventListener("oninput", (e) => 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") + "; calculateCraftSchedule();"); document.getElementById(str + "-atk-button").addEventListener("onclick", (e) => calculateCraftSchedule());
} }
populateFields(); populateFields();
decodeCraft(ing_url_tag); decodeCraft(ing_url_tag);
} catch (error) { } catch (error) {
@ -259,12 +248,10 @@ function populateFields() {
ing_list.appendChild(el); ing_list.appendChild(el);
} }
} }
} }
/* /*
Copies the CR Hash (CR-blahblahblah) * Copies the CR Hash (CR-blahblahblah)
*/ */
function copyRecipeHash() { function copyRecipeHash() {
if (player_craft) { if (player_craft) {
copyTextToClipboard("CR-"+location.hash.slice(1)); copyTextToClipboard("CR-"+location.hash.slice(1));

View file

@ -197,7 +197,7 @@ function init_ing_maps() {
posMods: {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0} posMods: {"left": 0, "right": 0, "above": 0, "under": 0, "touching": 0, "notTouching": 0}
}; };
ing.id = 4001 + ing.pid; ing.id = 4001 + ing.pid;
ing.diplayName = ing.name; ing.displayName = ing.name;
switch(i) { switch(i) {
case 0: case 0:
ing.itemIDs["strReq"] = powderIng["skpReq"]; ing.itemIDs["strReq"] = powderIng["skpReq"];