Updated some ingredients locations + saving food simulator selection

master
Wynd 2025-10-24 22:16:11 +03:00
parent ead730305f
commit cf7edba39f
37 changed files with 273 additions and 15 deletions

View File

@ -4,15 +4,15 @@ version = "1.4.0"
edition = "2024" edition = "2024"
[dependencies] [dependencies]
askama = "0.14" askama = "0.14.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0.145"
toml = "0.8" toml = "0.9.8"
tracing = "0.1" tracing = "0.1.41"
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
itertools = "0.14" itertools = "0.14.0"
blake3 = "1.8" blake3 = "1.8.2"
ordered-float = { version = "5.0", features = ["serde"] } ordered-float = { version = "5.1.0", features = ["serde"] }
[features] [features]
default = ["bbs", "ddd", "kh3", "kh2", "kh1"] default = ["bbs", "ddd", "kh3", "kh2", "kh1"]

View File

@ -1,2 +1,12 @@
name = "Basil" name = "Basil"
group = "herb" group = "herb"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest around the trees"
[[locations]]
world = "Toy Box"
room = "Andy's House"
note = "Outside the house in the garden"

View File

@ -1,2 +1,16 @@
name = "Bay Leaf" name = "Bay Leaf"
group = "herb" group = "herb"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest around the trees"
[[locations]]
world = "Toy Box"
room = "Andy's House"
note = "Outside the house in the garden"

View File

@ -1,2 +1,11 @@
name = "Beef" name = "Beef"
group = "meat" group = "meat"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Galaxy Toys"
notes = "Rest Area"

View File

@ -1,2 +1,6 @@
name = "Black Truffle" name = "Black Truffle"
group = "mushroom" group = "mushroom"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Black Trumpet" name = "Black Trumpet"
group = "mushroom" group = "mushroom"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Butter" name = "Butter"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Caviar" name = "Caviar"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Celery" name = "Celery"
group = "vegetable" group = "vegetable"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,11 @@
name = "Chanterelle" name = "Chanterelle"
group = "mushroom" group = "mushroom"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest around the trees"

View File

@ -1,2 +1,11 @@
name = "Cheese" name = "Cheese"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Galaxy Toys"
notes = "1F on the right side stands"

View File

@ -1,2 +1,11 @@
name = "Chocolate" name = "Chocolate"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Galaxy Toys"
notes = "2F on the right side at the very end of the platform"

View File

@ -1,2 +1,6 @@
name = "Cloves" name = "Cloves"
group = "herb" group = "herb"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,21 @@
name = "Cornichon" name = "Cornichon"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Galaxy Toys"
note = "1F outside the store to the right"
[[locations]]
world = "Toy Box"
room = "Galaxy Toys"
note = "Rest Area"
[[locations]]
world = "Toy Box"
room = "Galaxy Toys"
note = "Action Figures, in the very back of the store"

View File

@ -1,2 +1,7 @@
name = "Dill" name = "Dill"
group = "herb" group = "herb"
[[locations]]
world = "Monstropolis"
room = "Lobby & Offices"
note = "Vending Machine at the Laugh Floor's entrance"

View File

@ -1,2 +1,11 @@
name = "Eel" name = "Eel"
group = "seafood" group = "seafood"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest near the water"

View File

@ -1,2 +1,12 @@
name = "Filet Mignon" name = "Filet Mignon"
group = "meat" group = "meat"
[[locations]]
world = "Monstropolis"
room = "Lobby & Offices"
note = "Laugh Floor on the desk in the very back"
[[locations]]
world = "The Carribean"
room = "Fort"
note = "In a box on the front terrace from the spawn"

View File

@ -1,2 +1,6 @@
name = "King Oyster Mushroom" name = "King Oyster Mushroom"
group = "mushroom" group = "mushroom"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Lemon" name = "Lemon"
group = "fruit" group = "fruit"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,7 @@
name = "Lobster" name = "Lobster"
group = "seafood" group = "seafood"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest near the water"

View File

@ -1,2 +1,6 @@
name = "Miller Mushroom" name = "Miller Mushroom"
group = "mushroom" group = "mushroom"
[[locations]]
world = "The Carribean"
room = "Hudded Isles"

View File

@ -1,2 +1,6 @@
name = "Morel" name = "Morel"
group = "mushroom" group = "mushroom"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Olive Oil" name = "Olive Oil"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Onion" name = "Onion"
group = "vegetable" group = "vegetable"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,11 @@
name = "Parsley" name = "Parsley"
group = "herb" group = "herb"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Andy's House"
note = "Outside the house in the garden"

View File

@ -1,2 +1,6 @@
name = "Porcini" name = "Porcini"
group = "mushroom" group = "mushroom"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,6 @@
name = "Rice" name = "Rice"
group = "other" group = "other"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,2 +1,11 @@
name = "Rosemary" name = "Rosemary"
group = "herb" group = "herb"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Andy's House"
note = "Outside the house in the garden"

View File

@ -1,2 +1,6 @@
name = "Saffron" name = "Saffron"
group = "herb" group = "herb"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -5,3 +5,8 @@ group = "seafood"
world = "Kingdom of Corona" world = "Kingdom of Corona"
room = "Thoroughfare" room = "Thoroughfare"
note = "At the wharf to the left from save point" note = "At the wharf to the left from save point"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest near the water"

View File

@ -5,3 +5,8 @@ group = "seafood"
world = "Kingdom of Corona" world = "Kingdom of Corona"
room = "Thoroughfare" room = "Thoroughfare"
note = "At the wharf to the left from save point" note = "At the wharf to the left from save point"
[[locations]]
world = "Kingdom of Corona"
room = "The Forest"
note = "Spawn in Thoroughfare and go back to The Forest near the water"

View File

@ -1,6 +1,10 @@
name = "Sole" name = "Sole"
group = "seafood" group = "seafood"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]] [[locations]]
world = "Kingdom of Corona" world = "Kingdom of Corona"
room = "Thoroughfare" room = "Thoroughfare"

View File

@ -1,2 +1,11 @@
name = "Thyme" name = "Thyme"
group = "herb" group = "herb"
[[locations]]
world = "Any"
room = "Moogle Shop"
[[locations]]
world = "Toy Box"
room = "Andy's House"
note = "Outside the house in the garden"

View File

@ -1,2 +1,6 @@
name = "Veal" name = "Veal"
group = "meat" group = "meat"
[[locations]]
world = "Any"
room = "Moogle Shop"

View File

@ -1,5 +1,8 @@
import "../common/prototypes.js"; import "../common/prototypes.js";
const RECIPE_STORAGE_NAME = "kh1/synth/recipe.";
const LIST_STORAGE_NAME = "kh1/synth/needed-maths";
let markedNeededMaterials = []; let markedNeededMaterials = [];
document.addEventListener("DOMContentLoaded", (event) => { document.addEventListener("DOMContentLoaded", (event) => {
@ -7,12 +10,13 @@ document.addEventListener("DOMContentLoaded", (event) => {
for (const recipe of recipes) { for (const recipe of recipes) {
recipe.checked = recipe.checked =
localStorage.getItem("kh1-synth-" + recipe.id) === "true" ?? false; localStorage.getItem(RECIPE_STORAGE_NAME + recipe.id) === "true" ??
false;
updateSynthRecipeState(recipe); updateSynthRecipeState(recipe);
recipe.addEventListener("input", function () { recipe.addEventListener("input", function () {
// Change the recipe's state and update and needed materials list based on the remaining recipes // Change the recipe's state and update and needed materials list based on the remaining recipes
localStorage.setItem("kh1-synth-" + this.id, this.checked); localStorage.setItem(RECIPE_STORAGE_NAME + this.id, this.checked);
updateSynthRecipeState(this); updateSynthRecipeState(this);
calcNeededMats(); calcNeededMats();
}); });
@ -26,8 +30,8 @@ document.addEventListener("DOMContentLoaded", (event) => {
} }
// Turn the single saved string into an array with each material // Turn the single saved string into an array with each material
if (localStorage.getItem("kh1-synth-needed-mats") != null) { if (localStorage.getItem(LIST_STORAGE_NAME) != null) {
let saved = localStorage.getItem("kh1-synth-needed-mats"); let saved = localStorage.getItem(LIST_STORAGE_NAME);
saved = saved.split(","); saved = saved.split(",");
markedNeededMaterials = saved; markedNeededMaterials = saved;
markedNeededMaterials = markedNeededMaterials.filter( markedNeededMaterials = markedNeededMaterials.filter(
@ -128,7 +132,7 @@ function updateMarkedNeededMats(ingredient) {
markedNeededMaterials.push(ingredient); markedNeededMaterials.push(ingredient);
} }
markedNeededMaterials = markedNeededMaterials.filter((n) => n && n !== ""); markedNeededMaterials = markedNeededMaterials.filter((n) => n && n !== "");
localStorage.setItem("kh1-synth-needed-mats", markedNeededMaterials); localStorage.setItem(LIST_STORAGE_NAME, markedNeededMaterials);
} }
function markNeededMat(mat) { function markNeededMat(mat) {

View File

@ -1,17 +1,27 @@
let globalStats = { str: 0, mag: 0, def: 0, hp: 0, mp: 0 }; const STORAGE_NAME = "kh3/food-sim/recipe.";
const types = ["starters", "soups", "fish", "meat", "deserts"]; const types = ["starters", "soups", "fish", "meat", "deserts"];
let globalStats = { str: 0, mag: 0, def: 0, hp: 0, mp: 0 };
let typeItem = []; let typeItem = [];
let hasSelection = [false, false, false, false, false]; let hasSelection = [false, false, false, false, false];
let ingredientsList = [];
document.addEventListener("DOMContentLoaded", (event) => { document.addEventListener("DOMContentLoaded", (event) => {
updateStats(); updateStats();
types.forEach(function (type, typeIdx) { types.forEach(function (type, typeIdx) {
let savedRecipe = localStorage.getItem(STORAGE_NAME + typeIdx);
const recipes = document.querySelectorAll( const recipes = document.querySelectorAll(
"div.recipes." + type + " .recipe", "div.recipes." + type + " .recipe",
); );
recipes.forEach(function (item, index) { recipes.forEach(function (item, index) {
let recipeName = item.querySelector(".title").innerText;
if (savedRecipe != undefined && recipeName == savedRecipe) {
selectRecipe(item, typeIdx);
}
item.addEventListener("click", function () { item.addEventListener("click", function () {
if (!hasSelection[typeIdx]) { if (!hasSelection[typeIdx]) {
hasSelection[typeIdx] = true; hasSelection[typeIdx] = true;
@ -71,6 +81,16 @@ document.addEventListener("DOMContentLoaded", (event) => {
}); });
function unselectRecipe(index) { function unselectRecipe(index) {
// Remove all ingredients of this recipe
let ingredients = typeItem[index].querySelectorAll(".ingredients ul li");
for (let ingredient of ingredients) {
ingredientsList = ingredientsList.filter(
(ing) => ing != ingredient["innerText"],
);
}
localStorage.removeItem(STORAGE_NAME + index);
typeItem[index].style["box-shadow"] = "0px 0px 10px rgba(0, 0, 0, 0.4)"; typeItem[index].style["box-shadow"] = "0px 0px 10px rgba(0, 0, 0, 0.4)";
let stats = JSON.parse(typeItem[index].dataset["stats"]); let stats = JSON.parse(typeItem[index].dataset["stats"]);
removeStats(stats); removeStats(stats);
@ -80,6 +100,17 @@ function selectRecipe(item, index) {
typeItem[index] = item; typeItem[index] = item;
item.style["box-shadow"] = "0px 0px 10px rgba(0, 255, 0, 0.8)"; item.style["box-shadow"] = "0px 0px 10px rgba(0, 255, 0, 0.8)";
// Add all ingredients of this recipe to a global list
let ingredients = item.querySelectorAll(".ingredients ul li");
for (let ingredient of ingredients) {
ingredientsList.push(ingredient["innerText"]);
}
let recipeName = item.querySelector(".title").innerText;
console.log(item);
console.log(item.querySelectorAll(".title"));
localStorage.setItem(STORAGE_NAME + index, recipeName);
let stats = JSON.parse(item.dataset["stats"]); let stats = JSON.parse(item.dataset["stats"]);
addStats(stats); addStats(stats);
} }
@ -149,6 +180,14 @@ function updateStats() {
); );
updatePoint(poly, 2, HP_MAX_POINT, hpProgress, globalStats.hp, "stat-hp"); updatePoint(poly, 2, HP_MAX_POINT, hpProgress, globalStats.hp, "stat-hp");
updatePoint(poly, 3, MP_MAX_POINT, mpProgress, globalStats.mp, "stat-mp"); updatePoint(poly, 3, MP_MAX_POINT, mpProgress, globalStats.mp, "stat-mp");
// let list = document.getElementById("ingredients-list");
// list.innerHTML = "";
// for (let ingredient of ingredientsList) {
// let ingredientElem = document.createElement("li");
// ingredientElem.innerText = ingredient;
// list.appendChild(ingredientElem);
// }
} }
function updatePoint(poly, statId, max, progress, value, statElem) { function updatePoint(poly, statId, max, progress, value, statElem) {

View File

@ -57,6 +57,8 @@
<input type="checkbox" id="hearty-meal" name="hearty-meal" /> <input type="checkbox" id="hearty-meal" name="hearty-meal" />
<label for="hearty-meal">Hearty Meal</label> <label for="hearty-meal">Hearty Meal</label>
</div> </div>
<ul id="ingredients-list"></ul>
</div> </div>
<h1>Starters</h1> <h1>Starters</h1>