khguide/src/kh1.rs

47 lines
1.1 KiB
Rust

use askama::Template;
use crate::{
RuntimeModule,
common::{Game, drops::Drops, enemy::Enemy, synthesis::Synthesis},
create_file,
};
const ENEMIES_PATH: &str = "./input/kh1/enemies";
const SYNTHESIS_PATH: &str = "./input/kh1/synthesis.toml";
#[derive(Template)]
#[template(path = "pages/kh1/drops.html")]
struct DropsTemplate {
pub data: Drops,
}
#[derive(Template)]
#[template(path = "pages/kh1/synth.html")]
struct SynthTemplate {
pub data: Synthesis,
}
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::Kh1, enemies);
tracing::info!("Loading synthesis data from {}", SYNTHESIS_PATH);
let synth = Synthesis::new(SYNTHESIS_PATH);
tracing::info!("Generating the KH1 drops template");
let drops_template = DropsTemplate { data: drops };
create_file("./out/kh1", "drops", drops_template).unwrap();
tracing::info!("Generating the KH1 synth template");
let synth_template = SynthTemplate { data: synth };
create_file("./out/kh1", "synth", synth_template).unwrap();
}
}