Added ingredients page for KH3 still WIP and needs more data

master
Wynd 2025-10-23 01:12:32 +03:00
parent 020ce8fafe
commit ead730305f
69 changed files with 298 additions and 11 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "khguide"
version = "1.3.2"
version = "1.4.0"
edition = "2024"
[dependencies]

View File

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

View File

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

View File

@ -0,0 +1,7 @@
name = "Banana"
group = "special"
[[locations]]
world = "Monstropolis"
room = "Upper Level"
note = "Banana Flan"

View File

@ -0,0 +1,2 @@
name = "Basil"
group = "herb"

View File

@ -0,0 +1,2 @@
name = "Bay Leaf"
group = "herb"

View File

@ -0,0 +1,2 @@
name = "Beef"
group = "meat"

View File

@ -0,0 +1,2 @@
name = "Black Truffle"
group = "mushroom"

View File

@ -0,0 +1,2 @@
name = "Black Trumpet"
group = "mushroom"

View File

@ -0,0 +1,2 @@
name = "Blackberry"
group = "fruit"

View File

@ -0,0 +1,7 @@
name = "Blood Orange"
group = "special"
[[locations]]
world = "Kingdom of Corona"
room = "Hills"
note = "Orange Flan"

View File

@ -0,0 +1,2 @@
name = "Butter"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Carrot"
group = "vegetable"

View File

@ -0,0 +1,2 @@
name = "Caviar"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Celery"
group = "vegetable"

View File

@ -0,0 +1,2 @@
name = "Chanterelle"
group = "mushroom"

View File

@ -0,0 +1,2 @@
name = "Cheese"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Chocolate"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Cloves"
group = "herb"

View File

@ -0,0 +1,7 @@
name = "Cod"
group = "seafood"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "At the wharf to the left from save point"

View File

@ -0,0 +1,2 @@
name = "Cornichon"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Crab"
group = "seafood"

View File

@ -0,0 +1,2 @@
name = "Dill"
group = "herb"

View File

@ -0,0 +1,2 @@
name = "Eel"
group = "seafood"

View File

@ -0,0 +1,2 @@
name = "Eggplant"
group = "vegetable"

View File

@ -0,0 +1,2 @@
name = "Filet Mignon"
group = "meat"

View File

@ -0,0 +1,2 @@
name = "Garlic"
group = "vegetable"

View File

@ -0,0 +1,2 @@
name = "Gooseberry"
group = "fruit"

View File

@ -0,0 +1,7 @@
name = "Grapes"
group = "special"
[[locations]]
world = "Arendelle"
room = "Mountain Ridge"
note = "Grape Flan"

View File

@ -0,0 +1,6 @@
name = "Honey"
group = "other"
[[locations]]
world = "100 Acre Wood"
room = "Pooh's Hunny Harvest"

View File

@ -0,0 +1,2 @@
name = "King Oyster Mushroom"
group = "mushroom"

View File

@ -0,0 +1,2 @@
name = "Lemon"
group = "fruit"

View File

@ -0,0 +1,2 @@
name = "Lobster"
group = "seafood"

View File

@ -0,0 +1,7 @@
name = "Melon"
group = "special"
[[locations]]
world = "San Fransokyo"
room = "South District"
note = "Honeydew Flan"

View File

@ -0,0 +1,2 @@
name = "Miller Mushroom"
group = "mushroom"

View File

@ -0,0 +1,2 @@
name = "Morel"
group = "mushroom"

View File

@ -0,0 +1,7 @@
name = "Mussle"
group = "seafood"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "At the wharf to the left from save point"

View File

@ -0,0 +1,2 @@
name = "Olive Oil"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Onion"
group = "vegetable"

View File

@ -0,0 +1,2 @@
name = "Orange"
group = "fruit"

View File

@ -0,0 +1,2 @@
name = "Parsley"
group = "herb"

View File

@ -0,0 +1,2 @@
name = "Pear"
group = "fruit"

View File

@ -0,0 +1,2 @@
name = "Porcini"
group = "mushroom"

View File

@ -0,0 +1,2 @@
name = "Portobello"
group = "mushroom"

View File

@ -0,0 +1,7 @@
name = "Pumpkin"
group = "vegetable"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "Stands on the main street"

View File

@ -0,0 +1,2 @@
name = "Quail"
group = "meat"

View File

@ -0,0 +1,2 @@
name = "Raspberry"
group = "fruit"

View File

@ -0,0 +1,2 @@
name = "Rice"
group = "other"

View File

@ -0,0 +1,2 @@
name = "Rosemary"
group = "herb"

View File

@ -0,0 +1,2 @@
name = "Saffron"
group = "herb"

View File

@ -0,0 +1,7 @@
name = "Scallop"
group = "seafood"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "At the wharf to the left from save point"

View File

@ -0,0 +1,7 @@
name = "Sea Bass"
group = "seafood"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "At the wharf to the left from save point"

View File

@ -0,0 +1,7 @@
name = "Sole"
group = "seafood"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "At the wharf to the left from save point"

View File

@ -0,0 +1,7 @@
name = "Sour Cherry"
group = "special"
[[locations]]
world = "Olympus"
room = "Overlook"
note = "Cherry Flan"

View File

@ -0,0 +1,7 @@
name = "Strawberry"
group = "special"
[[locations]]
world = "Toy Box"
room = "Rest Area"
note = "Strawberry Flan"

View File

@ -0,0 +1,2 @@
name = "Thyme"
group = "herb"

View File

@ -0,0 +1,7 @@
name = "Tomato"
group = "vegetable"
[[locations]]
world = "Kingdom of Corona"
room = "Thoroughfare"
note = "Stands on the main street"

View File

@ -0,0 +1,2 @@
name = "Veal"
group = "meat"

View File

@ -0,0 +1,7 @@
name = "Watermelon"
group = "special"
[[locations]]
world = "The Caribbean"
room = "Fort"
note = "Watermelon Flan"

View File

@ -0,0 +1,2 @@
name = "Zucchini"
group = "vegetable"

View File

@ -1,5 +1,6 @@
use askama::Template;
use food::Recipes;
use ingredient::Ingredient;
use crate::{
RuntimeModule,
@ -8,9 +9,11 @@ use crate::{
};
mod food;
mod ingredient;
const ENEMIES_PATH: &str = "./input/kh3/enemies";
const RECIPES_PATH: &str = "./input/kh3/recipes.toml";
const INGREDIENTS_PATH: &str = "./input/kh3/ingredients";
#[derive(Template)]
#[template(path = "pages/kh3/drops.html")]
@ -24,15 +27,23 @@ struct RecipesTemplate {
pub recipes: Recipes,
}
#[derive(Template)]
#[template(path = "pages/kh3/ingredients.html")]
struct IngredientsTemplate {
pub ingredients: Vec<Ingredient>,
}
pub struct Module;
impl RuntimeModule for Module {
fn start_module() {
tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
let enemies = Enemy::import(ENEMIES_PATH);
let drops = Drops::new(Game::Kh3, enemies);
tracing::info!("Loading ingredients data from {}", ENEMIES_PATH);
let ingredients = Ingredient::import(INGREDIENTS_PATH);
tracing::info!("Loading recipes data from {}", RECIPES_PATH);
let recipes_str = std::fs::read_to_string(RECIPES_PATH).unwrap();
let recipes = toml::from_str::<Recipes>(&recipes_str).unwrap();
@ -42,6 +53,11 @@ impl RuntimeModule for Module {
create_file("./out/kh3", "drops", drops_template).unwrap();
tracing::info!("Generating the KH3 ingredients template");
let ingredients_template = IngredientsTemplate { ingredients };
create_file("./out/kh3", "ingredients", ingredients_template).unwrap();
tracing::info!("Generating the KH3 recipes template");
let food_template = RecipesTemplate { recipes };

View File

@ -0,0 +1,58 @@
use std::path::PathBuf;
use serde::Deserialize;
#[derive(Debug, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum IngredientGroup {
Meat,
Seafood,
Vegetable,
Mushroom,
Herb,
Fruit,
Other,
Special,
}
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Ingredient {
pub name: String,
pub group: IngredientGroup,
pub locations: Vec<Location>,
}
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct Location {
pub world: String,
pub room: String,
pub note: Option<String>,
}
impl Ingredient {
pub fn import(path: &str) -> Vec<Ingredient> {
let mut ingredients: Vec<Ingredient> = vec![];
// Loading multiple files into one vector due to the size of each board
let paths = std::fs::read_dir(path)
.unwrap()
.filter_map(|f| f.ok())
.map(|f| f.path())
.filter_map(|p| match p.extension().is_some_and(|e| e == "toml") {
true => Some(p),
false => None,
})
.collect::<Vec<PathBuf>>();
for path in paths {
let str = std::fs::read_to_string(path).unwrap();
let ingredient = toml::from_str::<Ingredient>(&str);
if let Ok(ingredient) = ingredient {
ingredients.push(ingredient);
}
}
ingredients
}
}

View File

@ -26,8 +26,8 @@
<br />
{% for drop in data.drops %}
{% call macros::drop("shard") %}
{% call macros::drop("stone") %}
{% call macros::drop("gem") %}
{% call macros::drop("crystal") %}
{% call drops_macros::drop("shard") %}
{% call drops_macros::drop("stone") %}
{% call drops_macros::drop("gem") %}
{% call drops_macros::drop("crystal") %}
{% endfor %}

View File

@ -1,5 +1,5 @@
{% extends "layouts/base.html" %}
{% import "macros/common/macros.html" as macros %}
{% import "macros/common/drops.html" as drops_macros %}
{% block title %}KH1 - Drops{% endblock %}

View File

@ -1,5 +1,4 @@
{% extends "layouts/base.html" %}
{% import "macros/common/macros.html" as macros %}
{% block title %}KH1 - Sythensis{% endblock %}

View File

@ -1,5 +1,5 @@
{% extends "layouts/base.html" %}
{% import "macros/common/macros.html" as macros %}
{% import "macros/common/drops.html" as drops_macros %}
{% block title %}KH2 - Drops{% endblock %}

View File

@ -1,7 +1,7 @@
{% extends "layouts/base.html" %}
{% import "macros/common/macros.html" as macros %}
{% import "macros/common/drops.html" as drops_macros %}
{% block title %}KH2 - Drops{% endblock %}
{% block title %}KH3 - Drops{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ crate::find_hash("/public/styles/common/drops.css") }}"></link>

View File

@ -0,0 +1,14 @@
{% extends "layouts/base.html" %}
{% block title %}KH3 - Ingredients{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ crate::find_hash("/public/styles/common/ingredients.css") }}"></link>
<script
type="module"
src="{{ crate::find_hash("/public/scripts/common/ingredients.js") }}"
></script>
{% endblock %}
{% block content %}
{% endblock %}