48 lines
1.0 KiB
Rust
48 lines
1.0 KiB
Rust
use std::sync::OnceLock;
|
|
|
|
use askama::Template;
|
|
use blake3::Hash;
|
|
|
|
use crate::{RuntimeModule, common::materials::MaterialDrops, create_file, create_hashes};
|
|
|
|
const MATERIAL_KINDS: &[&str] = &[
|
|
"blazing",
|
|
"bright",
|
|
"dark",
|
|
"dense",
|
|
"energy",
|
|
"frost",
|
|
"lightning",
|
|
"lucid",
|
|
"power",
|
|
"remembrance",
|
|
"serenity",
|
|
"twilight",
|
|
];
|
|
const DROPS_PATH: &str = "./input/kh2/drops";
|
|
static JS_HASH: OnceLock<Hash> = OnceLock::new();
|
|
|
|
#[derive(Template)]
|
|
#[template(path = "pages/kh2/drops.html")]
|
|
struct DropsTemplate {
|
|
pub drops: Vec<MaterialDrops>,
|
|
}
|
|
|
|
pub struct Module;
|
|
|
|
impl RuntimeModule for Module {
|
|
fn start_module() {
|
|
tracing::info!("Loading enemy drops data from {}", DROPS_PATH);
|
|
// let drops = MaterialDrops::import(DROPS_PATH);
|
|
|
|
tracing::info!("Generating the KH2 drops template");
|
|
// let drops_template = DropsTemplate { drops };
|
|
|
|
// create_file("./out/kh2", "drops", drops_template.render().unwrap()).unwrap();
|
|
}
|
|
|
|
fn get_js_hash() -> String {
|
|
JS_HASH.get_or_init(|| create_hashes("kh2")).to_string()
|
|
}
|
|
}
|