Added ingredients page for KH3 still WIP and needs more data
parent
020ce8fafe
commit
ead730305f
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "khguide"
|
name = "khguide"
|
||||||
version = "1.3.2"
|
version = "1.4.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
name = "Apple"
|
||||||
|
group = "fruit"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Any"
|
||||||
|
room = "Moogle Shop"
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
name = "Apricot"
|
||||||
|
group = "fruit"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Any"
|
||||||
|
room = "Moogle Shop"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Banana"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Monstropolis"
|
||||||
|
room = "Upper Level"
|
||||||
|
note = "Banana Flan"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Basil"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Bay Leaf"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Beef"
|
||||||
|
group = "meat"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Black Truffle"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Black Trumpet"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Blackberry"
|
||||||
|
group = "fruit"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Blood Orange"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Kingdom of Corona"
|
||||||
|
room = "Hills"
|
||||||
|
note = "Orange Flan"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Butter"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Carrot"
|
||||||
|
group = "vegetable"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Caviar"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Celery"
|
||||||
|
group = "vegetable"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Chanterelle"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Cheese"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Chocolate"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Cloves"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Cornichon"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Crab"
|
||||||
|
group = "seafood"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Dill"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Eel"
|
||||||
|
group = "seafood"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Eggplant"
|
||||||
|
group = "vegetable"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Filet Mignon"
|
||||||
|
group = "meat"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Garlic"
|
||||||
|
group = "vegetable"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Gooseberry"
|
||||||
|
group = "fruit"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Grapes"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Arendelle"
|
||||||
|
room = "Mountain Ridge"
|
||||||
|
note = "Grape Flan"
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
name = "Honey"
|
||||||
|
group = "other"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "100 Acre Wood"
|
||||||
|
room = "Pooh's Hunny Harvest"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "King Oyster Mushroom"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Lemon"
|
||||||
|
group = "fruit"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Lobster"
|
||||||
|
group = "seafood"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Melon"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "San Fransokyo"
|
||||||
|
room = "South District"
|
||||||
|
note = "Honeydew Flan"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Miller Mushroom"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Morel"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Olive Oil"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Onion"
|
||||||
|
group = "vegetable"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Orange"
|
||||||
|
group = "fruit"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Parsley"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Pear"
|
||||||
|
group = "fruit"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Porcini"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Portobello"
|
||||||
|
group = "mushroom"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Pumpkin"
|
||||||
|
group = "vegetable"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Kingdom of Corona"
|
||||||
|
room = "Thoroughfare"
|
||||||
|
note = "Stands on the main street"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Quail"
|
||||||
|
group = "meat"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Raspberry"
|
||||||
|
group = "fruit"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Rice"
|
||||||
|
group = "other"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Rosemary"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Saffron"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Sour Cherry"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Olympus"
|
||||||
|
room = "Overlook"
|
||||||
|
note = "Cherry Flan"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Strawberry"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Toy Box"
|
||||||
|
room = "Rest Area"
|
||||||
|
note = "Strawberry Flan"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Thyme"
|
||||||
|
group = "herb"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Tomato"
|
||||||
|
group = "vegetable"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "Kingdom of Corona"
|
||||||
|
room = "Thoroughfare"
|
||||||
|
note = "Stands on the main street"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Veal"
|
||||||
|
group = "meat"
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
name = "Watermelon"
|
||||||
|
group = "special"
|
||||||
|
|
||||||
|
[[locations]]
|
||||||
|
world = "The Caribbean"
|
||||||
|
room = "Fort"
|
||||||
|
note = "Watermelon Flan"
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
name = "Zucchini"
|
||||||
|
group = "vegetable"
|
||||||
18
src/kh3.rs
18
src/kh3.rs
|
|
@ -1,5 +1,6 @@
|
||||||
use askama::Template;
|
use askama::Template;
|
||||||
use food::Recipes;
|
use food::Recipes;
|
||||||
|
use ingredient::Ingredient;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
RuntimeModule,
|
RuntimeModule,
|
||||||
|
|
@ -8,9 +9,11 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
mod food;
|
mod food;
|
||||||
|
mod ingredient;
|
||||||
|
|
||||||
const ENEMIES_PATH: &str = "./input/kh3/enemies";
|
const ENEMIES_PATH: &str = "./input/kh3/enemies";
|
||||||
const RECIPES_PATH: &str = "./input/kh3/recipes.toml";
|
const RECIPES_PATH: &str = "./input/kh3/recipes.toml";
|
||||||
|
const INGREDIENTS_PATH: &str = "./input/kh3/ingredients";
|
||||||
|
|
||||||
#[derive(Template)]
|
#[derive(Template)]
|
||||||
#[template(path = "pages/kh3/drops.html")]
|
#[template(path = "pages/kh3/drops.html")]
|
||||||
|
|
@ -24,15 +27,23 @@ struct RecipesTemplate {
|
||||||
pub recipes: Recipes,
|
pub recipes: Recipes,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Template)]
|
||||||
|
#[template(path = "pages/kh3/ingredients.html")]
|
||||||
|
struct IngredientsTemplate {
|
||||||
|
pub ingredients: Vec<Ingredient>,
|
||||||
|
}
|
||||||
|
|
||||||
pub struct Module;
|
pub struct Module;
|
||||||
|
|
||||||
impl RuntimeModule for Module {
|
impl RuntimeModule for Module {
|
||||||
fn start_module() {
|
fn start_module() {
|
||||||
tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
|
tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
|
||||||
let enemies = Enemy::import(ENEMIES_PATH);
|
let enemies = Enemy::import(ENEMIES_PATH);
|
||||||
|
|
||||||
let drops = Drops::new(Game::Kh3, enemies);
|
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);
|
tracing::info!("Loading recipes data from {}", RECIPES_PATH);
|
||||||
let recipes_str = std::fs::read_to_string(RECIPES_PATH).unwrap();
|
let recipes_str = std::fs::read_to_string(RECIPES_PATH).unwrap();
|
||||||
let recipes = toml::from_str::<Recipes>(&recipes_str).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();
|
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");
|
tracing::info!("Generating the KH3 recipes template");
|
||||||
let food_template = RecipesTemplate { recipes };
|
let food_template = RecipesTemplate { recipes };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
{% for drop in data.drops %}
|
{% for drop in data.drops %}
|
||||||
{% call macros::drop("shard") %}
|
{% call drops_macros::drop("shard") %}
|
||||||
{% call macros::drop("stone") %}
|
{% call drops_macros::drop("stone") %}
|
||||||
{% call macros::drop("gem") %}
|
{% call drops_macros::drop("gem") %}
|
||||||
{% call macros::drop("crystal") %}
|
{% call drops_macros::drop("crystal") %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "layouts/base.html" %}
|
{% extends "layouts/base.html" %}
|
||||||
{% import "macros/common/macros.html" as macros %}
|
{% import "macros/common/drops.html" as drops_macros %}
|
||||||
|
|
||||||
{% block title %}KH1 - Drops{% endblock %}
|
{% block title %}KH1 - Drops{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
{% extends "layouts/base.html" %}
|
{% extends "layouts/base.html" %}
|
||||||
{% import "macros/common/macros.html" as macros %}
|
|
||||||
|
|
||||||
{% block title %}KH1 - Sythensis{% endblock %}
|
{% block title %}KH1 - Sythensis{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{% extends "layouts/base.html" %}
|
{% 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 %}KH2 - Drops{% endblock %}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "layouts/base.html" %}
|
{% 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 %}
|
{% block head %}
|
||||||
<link rel="stylesheet" href="{{ crate::find_hash("/public/styles/common/drops.css") }}"></link>
|
<link rel="stylesheet" href="{{ crate::find_hash("/public/styles/common/drops.css") }}"></link>
|
||||||
|
|
|
||||||
|
|
@ -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 %}
|
||||||
Loading…
Reference in New Issue