crafted recipe choice image updates upon recipe type input change
This commit is contained in:
parent
0fa7c2e4bd
commit
3a75db643d
2 changed files with 30 additions and 0 deletions
|
@ -48,6 +48,7 @@ function init_crafter() {
|
||||||
document.getElementById("level-choice").addEventListener("change", (event) => {
|
document.getElementById("level-choice").addEventListener("change", (event) => {
|
||||||
updateMaterials();
|
updateMaterials();
|
||||||
});
|
});
|
||||||
|
document.getElementById("recipe-choice").setAttribute("oninput", "updateCraftedImage()");
|
||||||
|
|
||||||
populateFields();
|
populateFields();
|
||||||
decodeCraft(ing_url_tag);
|
decodeCraft(ing_url_tag);
|
||||||
|
@ -188,6 +189,7 @@ function decodeCraft(ing_url_tag) {
|
||||||
//console.log(Base64.toInt(tag.substring(12,14)));
|
//console.log(Base64.toInt(tag.substring(12,14)));
|
||||||
recipesName = recipe.split("-");
|
recipesName = recipe.split("-");
|
||||||
setValue("recipe-choice",recipesName[0]);
|
setValue("recipe-choice",recipesName[0]);
|
||||||
|
updateCraftedImage();
|
||||||
setValue("level-choice",recipesName[1]+"-"+recipesName[2]);
|
setValue("level-choice",recipesName[1]+"-"+recipesName[2]);
|
||||||
tierNum = Base64.toInt(tag.substring(14,15));
|
tierNum = Base64.toInt(tag.substring(14,15));
|
||||||
mat_tiers = [];
|
mat_tiers = [];
|
||||||
|
@ -297,6 +299,16 @@ function toggleMaterial(buttonId) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Updates the crafted icon.
|
||||||
|
*/
|
||||||
|
function updateCraftedImage() {
|
||||||
|
let input = document.getElementById("recipe-choice");
|
||||||
|
if (item_types.includes(input.value)) {
|
||||||
|
document.getElementById("recipe-img").src = "../media/items/" + (newIcons ? "new/":"old/") + "generic-" + input.value.toLowerCase() + ".png";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/* Reset all fields
|
/* Reset all fields
|
||||||
*/
|
*/
|
||||||
function resetFields() {
|
function resetFields() {
|
||||||
|
|
|
@ -46,6 +46,24 @@ let elem_colors = [
|
||||||
"#FFFFFF"
|
"#FFFFFF"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
let item_types = [
|
||||||
|
"Helmet",
|
||||||
|
"Chestplate",
|
||||||
|
"Leggings",
|
||||||
|
"Boots",
|
||||||
|
"Ring",
|
||||||
|
"Bracelet",
|
||||||
|
"Necklace",
|
||||||
|
"Dagger",
|
||||||
|
"Spear",
|
||||||
|
"Wand",
|
||||||
|
"Relik",
|
||||||
|
"Bow",
|
||||||
|
"Potion",
|
||||||
|
"Scroll",
|
||||||
|
"Food"
|
||||||
|
]
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Display commands
|
* Display commands
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue