2025-06-25 02:15:27 +03:00
|
|
|
use askama::Template;
|
|
|
|
|
|
2025-06-26 01:08:13 +03:00
|
|
|
use crate::{
|
|
|
|
|
RuntimeModule,
|
2025-07-13 23:56:34 +03:00
|
|
|
common::{Game, drops::Drops, enemy::Enemy, synthesis::Synthesis},
|
2025-06-29 15:18:43 +03:00
|
|
|
create_file,
|
2025-06-26 01:08:13 +03:00
|
|
|
};
|
2025-06-25 02:15:27 +03:00
|
|
|
|
2025-06-26 01:08:13 +03:00
|
|
|
const ENEMIES_PATH: &str = "./input/kh1/enemies";
|
2025-06-28 23:57:29 +03:00
|
|
|
const SYNTHESIS_PATH: &str = "./input/kh1/synthesis.toml";
|
2025-06-25 02:15:27 +03:00
|
|
|
|
|
|
|
|
#[derive(Template)]
|
|
|
|
|
#[template(path = "pages/kh1/drops.html")]
|
|
|
|
|
struct DropsTemplate {
|
2025-07-13 23:56:34 +03:00
|
|
|
pub data: Drops,
|
2025-06-25 02:15:27 +03:00
|
|
|
}
|
|
|
|
|
|
2025-06-29 14:03:58 +03:00
|
|
|
#[derive(Template)]
|
|
|
|
|
#[template(path = "pages/kh1/synth.html")]
|
|
|
|
|
struct SynthTemplate {
|
2025-07-13 23:56:34 +03:00
|
|
|
pub data: Synthesis,
|
2025-06-29 14:03:58 +03:00
|
|
|
}
|
|
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
pub struct Module;
|
2025-06-25 02:15:27 +03:00
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
impl RuntimeModule for Module {
|
|
|
|
|
fn start_module() {
|
2025-06-26 01:08:13 +03:00
|
|
|
tracing::info!("Loading enemy data from {}", ENEMIES_PATH);
|
|
|
|
|
let enemies = Enemy::import(ENEMIES_PATH);
|
|
|
|
|
|
2025-07-13 23:56:34 +03:00
|
|
|
let drops = Drops::new(Game::Kh1, enemies);
|
2025-06-25 02:15:27 +03:00
|
|
|
|
2025-06-28 23:57:29 +03:00
|
|
|
tracing::info!("Loading synthesis data from {}", SYNTHESIS_PATH);
|
2025-07-13 23:56:34 +03:00
|
|
|
let synth = Synthesis::new(SYNTHESIS_PATH);
|
2025-06-28 23:57:29 +03:00
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
tracing::info!("Generating the KH1 drops template");
|
2025-07-13 23:56:34 +03:00
|
|
|
let drops_template = DropsTemplate { data: drops };
|
2025-06-25 13:44:08 +03:00
|
|
|
|
2025-06-29 14:03:58 +03:00
|
|
|
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();
|
2025-06-25 13:44:08 +03:00
|
|
|
}
|
2025-06-25 02:15:27 +03:00
|
|
|
}
|