diff --git a/Cargo.toml b/Cargo.toml index 2e81be6..3b5cd8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blue_archive" -version = "0.3.94" +version = "0.3.95" edition = "2021" license-file = "LICENSE" description = "A Blue Archive api wrapper for Rust, based off of SchaleDB's data: https://github.com/lonqie/SchaleDB" @@ -25,8 +25,9 @@ rand = "0.8" anyhow = "1" thiserror = "1.0" -strum = "0.25" -strum_macros = "0.25" +strum = "0.26" +strum_macros = "0.26" +serde-aux = { version = "4.4.0", default-features = false } # futures = "0.3" # chrono = { version = "0.4", features = ["serde"] } diff --git a/src/types/mod.rs b/src/types/mod.rs index 3d10a21..82233fe 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -6,6 +6,7 @@ pub mod summons; pub use raids::RaidData; use serde::{Deserialize, Serialize}; +use serde_aux::prelude::*; pub use students::{Age, Released, Student}; pub use summons::Summon; @@ -137,10 +138,13 @@ pub enum Effect { ignore_def: Option>, }, DMGDot { - #[serde(alias = "Duration")] - duration: String, // todo: parse. - #[serde(alias = "Period")] - period: String, // todo: parse. + #[serde( + deserialize_with = "deserialize_number_from_string", + alias = "Duration" + )] + duration: u32, + #[serde(deserialize_with = "deserialize_number_from_string", alias = "Period")] + period: u32, #[serde(alias = "Icon")] icon: String, #[serde(alias = "Scale")] @@ -175,10 +179,13 @@ pub enum Effect { scale: ScaleValue, }, HealDot { - #[serde(alias = "Duration")] - duration: String, // todo: parse. - #[serde(alias = "Period")] - period: String, // todo: parse. + #[serde( + deserialize_with = "deserialize_number_from_string", + alias = "Duration" + )] + duration: u32, + #[serde(deserialize_with = "deserialize_number_from_string", alias = "Period")] + period: u32, #[serde(alias = "Scale")] scale: ScaleValue, }, @@ -193,8 +200,8 @@ pub enum Effect { scale: ScaleValue, }, CrowdControl { - #[serde(alias = "Chance")] - chance: String, // todo: parse. + #[serde(deserialize_with = "deserialize_number_from_string", alias = "Chance")] + chance: u32, #[serde(alias = "Icon")] icon: String, #[serde(alias = "Scale")]