2025-06-25 13:44:08 +03:00
|
|
|
use std::sync::OnceLock;
|
2025-02-08 13:35:55 +02:00
|
|
|
|
2025-06-24 19:56:47 +03:00
|
|
|
use askama::Template;
|
2025-06-25 13:44:08 +03:00
|
|
|
use blake3::Hash;
|
2025-02-08 13:35:55 +02:00
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
use crate::{RuntimeModule, common::materials::MaterialDrops, create_file, create_hashes};
|
2025-02-08 13:35:55 +02:00
|
|
|
|
2025-06-24 19:56:47 +03:00
|
|
|
const MATERIAL_KINDS: &[&str] = &[
|
2025-02-09 13:51:00 +02:00
|
|
|
"blazing",
|
|
|
|
|
"bright",
|
|
|
|
|
"dark",
|
|
|
|
|
"dense",
|
|
|
|
|
"energy",
|
|
|
|
|
"frost",
|
|
|
|
|
"lightning",
|
|
|
|
|
"lucid",
|
|
|
|
|
"power",
|
|
|
|
|
"remembrance",
|
|
|
|
|
"serenity",
|
|
|
|
|
"twilight",
|
|
|
|
|
];
|
2025-06-24 19:56:47 +03:00
|
|
|
const DROPS_PATH: &str = "./input/kh2/drops";
|
2025-06-25 13:44:08 +03:00
|
|
|
static JS_HASH: OnceLock<Hash> = OnceLock::new();
|
2025-02-08 19:09:16 +02:00
|
|
|
|
2025-02-08 13:35:55 +02:00
|
|
|
#[derive(Template)]
|
|
|
|
|
#[template(path = "pages/kh2/drops.html")]
|
|
|
|
|
struct DropsTemplate {
|
|
|
|
|
pub drops: Vec<MaterialDrops>,
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
pub struct Module;
|
2025-02-08 13:35:55 +02:00
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
impl RuntimeModule for Module {
|
|
|
|
|
fn start_module() {
|
|
|
|
|
tracing::info!("Loading enemy drops data from {}", DROPS_PATH);
|
2025-06-26 01:08:13 +03:00
|
|
|
// let drops = MaterialDrops::import(DROPS_PATH);
|
2025-02-08 13:35:55 +02:00
|
|
|
|
2025-06-25 13:44:08 +03:00
|
|
|
tracing::info!("Generating the KH2 drops template");
|
2025-06-26 01:08:13 +03:00
|
|
|
// let drops_template = DropsTemplate { drops };
|
2025-06-25 13:44:08 +03:00
|
|
|
|
2025-06-26 01:08:13 +03:00
|
|
|
// create_file("./out/kh2", "drops", drops_template.render().unwrap()).unwrap();
|
2025-06-25 13:44:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn get_js_hash() -> String {
|
|
|
|
|
JS_HASH.get_or_init(|| create_hashes("kh2")).to_string()
|
|
|
|
|
}
|
2025-02-08 13:35:55 +02:00
|
|
|
}
|