First iteration on a pro codes page + data for codes and fights

master
Wynd 2025-10-28 01:57:19 +02:00
parent e6cf0e3067
commit ac49540a5d
7 changed files with 324 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}
}

View File

@ -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<Ingredient>,
}
#[derive(Template)]
#[template(path = "pages/kh3/pro-codes-sim.html")]
struct ProCodesTemplate {
pub pro_codes: Vec<ProCode>,
pub fights: Vec<ProCodeFight>,
}
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>(&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::<ProCodes>(&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::<ProCodeFights>(&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();
}
}

View File

@ -0,0 +1,30 @@
use serde::Deserialize;
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct ProCodes {
pub codes: Vec<ProCode>,
}
#[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<ProCodeFight>,
}
#[derive(Debug, Deserialize, PartialEq, Eq)]
pub struct ProCodeFight {
pub world: String,
pub enemy: String,
pub merit: u16,
}

View File

@ -26,6 +26,7 @@
<li><a href="./kh3/drops.html">Material Drops</a></li>
<li><a href="./kh3/ingredients.html">Ingredients</a></li>
<li><a href="./kh3/food-sim.html">Food Simulator</a></li>
<li><a href="./kh3/pro-codes-sim.html">Pro Codes Simulator</a></li>
</ul>
{% endif %}

View File

@ -0,0 +1,31 @@
{% extends "layouts/base.html" %}
{% block title %}KH3 - Pro Codes Simulator{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ crate::find_hash("/public/styles/kh3/pro-codes-sim.css") }}"></link>
<script
type="module"
src="{{ crate::find_hash("/public/scripts/kh3/pro-codes-sim.js") }}"
></script>
{% endblock %}
{% block content %}
<div id="score"><h1>Merit: 365000</h1></div>
<div id="codes">
{% for code in pro_codes %}
<div class="slot">
<input type="checkbox" id="{{code.id()}}" autocomplete="off">
<label for="{{code.id()}}">{{code.name}}</label>
</div>
{% endfor %}
</div>
<div id="fights">
{% for fight in fights %}
<div class="slot">
<button onclick="" data-base-merit="{{fight.merit}}">Track</button>
<span>{{fight.enemy}}</span>
</div>
{% endfor %}
</div>
{% endblock %}