trigger-rs/crates/trigger-fileconfig/src/lib.rs
traffic95 23fcde33f5 Properties calc port for 1.7beta ()
Reviewed-on: 
Co-authored-by: traffic95 <traffic95@xeondev.com>
Co-committed-by: traffic95 <traffic95@xeondev.com>
2025-03-19 08:52:04 +00:00

67 lines
1.9 KiB
Rust

#[allow(dead_code, unused_imports, unsafe_op_in_unsafe_fn)]
#[path = "../gen_flatbuffers/tables_generated.rs"]
mod data;
pub mod main_city_script;
pub use data::*;
use flatbuffers_owned::*;
macro_rules! file_cfg {
($($name:ident;)*) => {
$(flatbuffers_owned!($name);)*
::paste::paste!{
pub struct NapFileCfg {
$([<$name:snake>]: [<Owned $name>],)*
}}
impl NapFileCfg {
::paste::paste!{
pub fn new() -> Self {
Self {
$(
[<$name:snake>]: {
let filename = ::const_format::formatcp!("Filecfg/{}", ::xxhash_rust::const_xxh64::xxh64(stringify!([<$name:lower>]).as_bytes(), 0));
let data = std::fs::read(&filename).unwrap();
[<Owned $name>]::new(data.into()).unwrap()
},
)*
}
}
$(
pub fn [<$name:snake>](&self) -> $name {
self.[<$name:snake>].as_actual()
}
)*
}
}
};
}
file_cfg! {
ConditionConfigTemplateTb;
AvatarBaseTemplateTb;
WeaponTemplateTb;
EquipmentTemplateTb;
EquipmentSuitTemplateTb;
UnlockConfigTemplateTb;
PostGirlConfigTemplateTb;
ArchiveFileQuestTemplateTb;
ArchiveBattleQuestTemplateTb;
SectionConfigTemplateTb;
MainCityBGMConfigTemplateTb;
HollowBuffTemplateTb;
CafeConfigTemplateTb;
HollowConfigTemplateTb;
HollowQuestTemplateTb;
BattleGroupConfigTemplateTb;
MusicPlayerConfigTemplateTb;
TeleportConfigTemplateTb;
AvatarBattleTemplateTb;
AvatarLevelAdvanceTemplateTb;
WeaponLevelTemplateTb;
WeaponStarTemplateTb;
AvatarPassiveSkillTemplateTb;
EquipmentLevelTemplateTb;
}