From cf94fcb2374273130b988d3e74d6f45df3b3e972 Mon Sep 17 00:00:00 2001 From: Eidolon Date: Wed, 1 Nov 2023 18:13:27 -0500 Subject: [PATCH] Add d7 HospitalGachaData db --- databases-d7/examples/d7db-unpack.rs | 1 + databases-d7/src/hospitalgacha.rs | 61 ++++++++++++++++++++++++++++ databases-d7/src/lib.rs | 2 + modloader-d7/src/win.rs | 1 + 4 files changed, 65 insertions(+) create mode 100644 databases-d7/src/hospitalgacha.rs diff --git a/databases-d7/examples/d7db-unpack.rs b/databases-d7/examples/d7db-unpack.rs index e89eb7e..c41c275 100644 --- a/databases-d7/examples/d7db-unpack.rs +++ b/databases-d7/examples/d7db-unpack.rs @@ -98,6 +98,7 @@ fn main() -> Result<(), anyhow::Error> { unpack_db::<_, DrinkData>(&mut archive, "drink", &dest)?; unpack_db::<_, DungeonData>(&mut archive, "dungeon", &dest)?; unpack_db::<_, EvilityData>(&mut archive, "evility", &dest)?; + unpack_db::<_, HospitalGachaData>(&mut archive, "hospitalgacha", &dest)?; unpack_db::<_, InnocentAffinityData>(&mut archive, "innocentaffinity", &dest)?; unpack_db::<_, InnocentData>(&mut archive, "innocent", &dest)?; unpack_db::<_, ItemData>(&mut archive, "item", &dest)?; diff --git a/databases-d7/src/hospitalgacha.rs b/databases-d7/src/hospitalgacha.rs new file mode 100644 index 0000000..2e2ba6f --- /dev/null +++ b/databases-d7/src/hospitalgacha.rs @@ -0,0 +1,61 @@ +use crate::CmlString; +use makaikit_databases_serde::DatabaseRecord; +use serde::{Deserialize, Serialize}; + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Complete { + pub r#type: i32, + pub val1: i32, + pub val2: i32, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct Info { + pub r#type: i32, + pub val1: i32, + pub val2: i32, + + #[serde(rename = "identificationID")] + pub identification_id: i32, + + pub rate: i32, + pub is_complete: i32, +} + +#[derive(Clone, Debug, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct HospitalGachaData { + #[serde(rename = "ID")] + pub id: i32, + + pub enum_name: String, + pub comment: String, + pub name: CmlString, + pub help: CmlString, + pub consume_point: i32, + pub info: Vec, + pub info2: Vec, + pub complete: Complete, + pub complete2: Complete, + pub cond_on_flag: Vec, + pub cond_off_flag: Vec, + pub open_flag: i32, + pub on_flag_when_complete: i32, + + pub version: i32, + pub region: u32, + pub product: u32, + pub platform: u32, +} + +impl DatabaseRecord for HospitalGachaData { + fn database_id(&self) -> i32 { + self.id + } + + fn database_enum_name(&self) -> &str { + &self.enum_name + } +} diff --git a/databases-d7/src/lib.rs b/databases-d7/src/lib.rs index d0fd904..0273053 100644 --- a/databases-d7/src/lib.rs +++ b/databases-d7/src/lib.rs @@ -23,6 +23,7 @@ pub mod doping; pub mod drink; pub mod dungeon; pub mod evility; +pub mod hospitalgacha; pub mod innocent; pub mod innocentaffinity; pub mod item; @@ -59,6 +60,7 @@ pub use self::doping::DopingData; pub use self::drink::DrinkData; pub use self::dungeon::DungeonData; pub use self::evility::EvilityData; +pub use self::hospitalgacha::HospitalGachaData; pub use self::innocent::InnocentData; pub use self::innocentaffinity::InnocentAffinityData; pub use self::item::ItemData; diff --git a/modloader-d7/src/win.rs b/modloader-d7/src/win.rs index ca5472a..afa0303 100644 --- a/modloader-d7/src/win.rs +++ b/modloader-d7/src/win.rs @@ -492,6 +492,7 @@ fn repack_databases() { repack_database::<_, DrinkData>(&mut archive, "drink"); repack_database::<_, DungeonData>(&mut archive, "dungeon"); repack_database::<_, EvilityData>(&mut archive, "evility"); + repack_database::<_, HospitalGachaData>(&mut archive, "hospitalgacha"); repack_database::<_, InnocentAffinityData>(&mut archive, "innocentaffinity"); repack_database::<_, InnocentData>(&mut archive, "innocent"); repack_database::<_, ItemData>(&mut archive, "item");