From ac49540a5d7bf9d217179c36340f9384acc1e35e Mon Sep 17 00:00:00 2001 From: Wynd Date: Tue, 28 Oct 2025 01:57:19 +0200 Subject: [PATCH] First iteration on a pro codes page + data for codes and fights --- input/kh3/pro-codes/codes.toml | 51 ++++++++ input/kh3/pro-codes/fights.toml | 169 +++++++++++++++++++++++++ public/styles/kh3/pro-codes-sim.css | 18 +++ src/kh3.rs | 27 +++- src/kh3/pro_codes.rs | 30 +++++ templates/pages/index.html | 1 + templates/pages/kh3/pro-codes-sim.html | 31 +++++ 7 files changed, 324 insertions(+), 3 deletions(-) create mode 100644 input/kh3/pro-codes/codes.toml create mode 100644 input/kh3/pro-codes/fights.toml create mode 100644 public/styles/kh3/pro-codes-sim.css create mode 100644 src/kh3/pro_codes.rs create mode 100644 templates/pages/kh3/pro-codes-sim.html diff --git a/input/kh3/pro-codes/codes.toml b/input/kh3/pro-codes/codes.toml new file mode 100644 index 0000000..e87bcb3 --- /dev/null +++ b/input/kh3/pro-codes/codes.toml @@ -0,0 +1,51 @@ +[[codes]] +name = "Default Status" +stars = 5 + +[[codes]] +name = "Zero Defense" +stars = 4 + +[[codes]] +name = "HP Slip" +stars = 3 + +[[codes]] +name = "MP Slip" +stars = 4 + +[[codes]] +name = "No Shotlocks" +stars = 2 + +[[codes]] +name = "No Cure" +stars = 5 + +[[codes]] +name = "No Battle Items" +stars = 3 + +[[codes]] +name = "No Links" +stars = 2 + +[[codes]] +name = "No Formchanges/Grand Magic" +stars = 4 + +[[codes]] +name = "No Attractions" +stars = 1 + +[[codes]] +name = "No Team Attacks" +stars = 1 + +[[codes]] +name = "No Kupo Coin" +stars = 2 + +[[codes]] +name = "Ability Limit" +stars = 4 diff --git a/input/kh3/pro-codes/fights.toml b/input/kh3/pro-codes/fights.toml new file mode 100644 index 0000000..fb65f60 --- /dev/null +++ b/input/kh3/pro-codes/fights.toml @@ -0,0 +1,169 @@ +[[fights]] +world = "Olympus" +enemy = "Rock Titan" +merit = 100 + +[[fights]] +world = "Olympus" +enemy = "Ice Titan, Lava Titan and Tornado Titan" +merit = 200 + +[[fights]] +world = "Twilight Town" +enemy = "Demon Tide" +merit = 100 + +[[fights]] +world = "Toy Box" +enemy = "Angelic Amber" +merit = 100 + +[[fights]] +world = "Toy Box" +enemy = "King of Toys" +merit = 200 + +[[fights]] +world = "Kingdom of Corona" +enemy = "Chaos Carriage" +merit = 100 + +[[fights]] +world = "Kingdom of Corona" +enemy = "Grim Guarianess" +merit = 200 + +[[fights]] +world = "Monstropolis" +enemy = "Lump of Horror" +merit = 200 + +[[fights]] +world = "Arendelle" +enemy = "Marshmallow" +merit = 100 + +[[fights]] +world = "Arendelle" +enemy = "Skoll" +merit = 200 + +[[fights]] +world = "The Caribbean" +enemy = "Lightning Angler" +merit = 100 + +[[fights]] +world = "The Caribbean" +enemy = "Davy Jones" +merit = 200 + +[[fights]] +world = "San Fransokyo" +enemy = "Darkubes" +merit = 100 + +[[fights]] +world = "San Fransokyo" +enemy = "Dark Baymax" +merit = 200 + +[[fights]] +world = "Keyblade Graveyard" +enemy = "Demon Tide" +merit = 200 + +[[fights]] +world = "Keyblade Graveyard" +enemy = "Young Xehanort, Ansem, Xemnas" +merit = 200 + +[[fights]] +world = "Keyblade Graveyard" +enemy = "Dark Inferno" +merit = 400 + +[[fights]] +world = "Scala ad Caelum" +enemy = "Armored Xehanort" +merit = 200 + +[[fights]] +world = "Scala ad Caelum" +enemy = "Master Xehanort" +merit = 200 + +[[fights]] +world = "Re Mind" +enemy = "Armored Xehanort" +merit = 200 + +[[fights]] +world = "Limitcut" +enemy = "Ansem" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Xemnas" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Xigbar" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Luxord" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Larxene" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Marluxia" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Saix" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Terra-Xehanort" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Dark Riku" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Vanitas" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Young Xehanort" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Xion" +merit = 500 + +[[fights]] +world = "Limitcut" +enemy = "Master Xehanort" +merit = 500 + +[[fights]] +world = "Secret" +enemy = "Yozora" +merit = 600 diff --git a/public/styles/kh3/pro-codes-sim.css b/public/styles/kh3/pro-codes-sim.css new file mode 100644 index 0000000..7866364 --- /dev/null +++ b/public/styles/kh3/pro-codes-sim.css @@ -0,0 +1,18 @@ +#content { + display: flex; + margin: 4rem; +} + +#score, +#codes, +#fights { + display: flex; + flex-direction: column; + flex-grow: 1; +} + +#fights { + .slot { + margin-bottom: 0.5rem; + } +} diff --git a/src/kh3.rs b/src/kh3.rs index 954e9f8..3a5e1c0 100644 --- a/src/kh3.rs +++ b/src/kh3.rs @@ -1,6 +1,7 @@ use askama::Template; use food::Recipes; use ingredient::Ingredient; +use pro_codes::{ProCode, ProCodeFight, ProCodeFights, ProCodes}; use crate::{ RuntimeModule, @@ -10,10 +11,13 @@ use crate::{ mod food; mod ingredient; +mod pro_codes; const ENEMIES_PATH: &str = "./input/kh3/enemies"; const RECIPES_PATH: &str = "./input/kh3/recipes.toml"; const INGREDIENTS_PATH: &str = "./input/kh3/ingredients"; +const PRO_CODES_PATH: &str = "./input/kh3/pro-codes/codes.toml"; +const PRO_CODE_FIGHTS_PATH: &str = "./input/kh3/pro-codes/fights.toml"; #[derive(Template)] #[template(path = "pages/kh3/drops.html")] @@ -33,6 +37,13 @@ struct IngredientsTemplate { pub ingredients: Vec, } +#[derive(Template)] +#[template(path = "pages/kh3/pro-codes-sim.html")] +struct ProCodesTemplate { + pub pro_codes: Vec, + pub fights: Vec, +} + pub struct Module; impl RuntimeModule for Module { @@ -48,19 +59,29 @@ impl RuntimeModule for Module { let recipes_str = std::fs::read_to_string(RECIPES_PATH).unwrap(); let recipes = toml::from_str::(&recipes_str).unwrap(); + tracing::info!("Loading pro codes data from {}", PRO_CODES_PATH); + let pro_codes_str = std::fs::read_to_string(PRO_CODES_PATH).unwrap(); + let pro_codes = toml::from_str::(&pro_codes_str).unwrap(); + let pro_code_fights_str = std::fs::read_to_string(PRO_CODE_FIGHTS_PATH).unwrap(); + let pro_code_fights = toml::from_str::(&pro_code_fights_str).unwrap(); + tracing::info!("Generating the KH3 drops template"); let drops_template = DropsTemplate { data: drops }; - 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 }; - create_file("./out/kh3", "food-sim", food_template).unwrap(); + + tracing::info!("Generating the KH3 pro codes template"); + let pro_codes_template = ProCodesTemplate { + pro_codes: pro_codes.codes, + fights: pro_code_fights.fights, + }; + create_file("./out/kh3", "pro-codes-sim", pro_codes_template).unwrap(); } } diff --git a/src/kh3/pro_codes.rs b/src/kh3/pro_codes.rs new file mode 100644 index 0000000..1e3e700 --- /dev/null +++ b/src/kh3/pro_codes.rs @@ -0,0 +1,30 @@ +use serde::Deserialize; + +#[derive(Debug, Deserialize, PartialEq, Eq)] +pub struct ProCodes { + pub codes: Vec, +} + +#[derive(Debug, Deserialize, PartialEq, Eq)] +pub struct ProCode { + pub name: String, + pub stars: u8, +} + +impl ProCode { + pub fn id(&self) -> String { + self.name.replace(" ", "_").to_lowercase() + } +} + +#[derive(Debug, Deserialize, PartialEq, Eq)] +pub struct ProCodeFights { + pub fights: Vec, +} + +#[derive(Debug, Deserialize, PartialEq, Eq)] +pub struct ProCodeFight { + pub world: String, + pub enemy: String, + pub merit: u16, +} diff --git a/templates/pages/index.html b/templates/pages/index.html index 072f306..3b78dfc 100644 --- a/templates/pages/index.html +++ b/templates/pages/index.html @@ -26,6 +26,7 @@
  • Material Drops
  • Ingredients
  • Food Simulator
  • +
  • Pro Codes Simulator
  • {% endif %} diff --git a/templates/pages/kh3/pro-codes-sim.html b/templates/pages/kh3/pro-codes-sim.html new file mode 100644 index 0000000..e4408de --- /dev/null +++ b/templates/pages/kh3/pro-codes-sim.html @@ -0,0 +1,31 @@ +{% extends "layouts/base.html" %} + +{% block title %}KH3 - Pro Codes Simulator{% endblock %} + +{% block head %} + + +{% endblock %} + +{% block content %} +

    Merit: 365000

    +
    + {% for code in pro_codes %} +
    + + +
    + {% endfor %} +
    +
    + {% for fight in fights %} +
    + + {{fight.enemy}} +
    + {% endfor %} +
    +{% endblock %}