|
@@ -21,6 +21,7 @@ function displaySelectedIngredients(game, stageData) {
|
|
|
selectedIngredient.style.display = "flex"
|
|
|
|
|
|
selectedIngredient.getElementsByClassName("selected-ingredient-image")[0].getElementsByTagName('img')[0].src = ingredientData.image
|
|
|
+
|
|
|
selectedIngredient.getElementsByClassName("selected-ingredient-description")[0].getElementsByTagName('h2')[0].innerText = ingredientData.title
|
|
|
selectedIngredient.getElementsByClassName("selected-ingredient-description")[0].getElementsByTagName('p')[0].innerText = ingredientData.description
|
|
|
}
|
|
@@ -40,6 +41,24 @@ function displayBrewPotion(game, stageData) {
|
|
|
potionIcon.src = potionToBrew.image
|
|
|
document.getElementById('potion-icon').appendChild(potionIcon)
|
|
|
|
|
|
+ const groupedPotionInventory = {}
|
|
|
+ stageData.potionInventory.forEach(potionName => {
|
|
|
+ if (!groupedPotionInventory[potionName]) {
|
|
|
+ groupedPotionInventory[potionName] = 1
|
|
|
+ } else {
|
|
|
+ groupedPotionInventory[potionName]++
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ const potionCount = groupedPotionInventory[potionToBrew.name] ?? 0
|
|
|
+
|
|
|
+ const potionCountElement = document.getElementById('potion-icon-container').getElementsByClassName("potion-inventory-count")[0]
|
|
|
+ if(potionCount == 0) {
|
|
|
+ potionCountElement.style.display = "none"
|
|
|
+ } else {
|
|
|
+ potionCountElement.style.display = "block"
|
|
|
+ potionCountElement.innerHTML = potionCount
|
|
|
+ }
|
|
|
document.getElementById('potion-name').innerText = potionToBrew.title
|
|
|
document.getElementById('potion-properties-list').innerHTML = ''
|
|
|
potionToBrew.properties.forEach(property => {
|