Created
May 26, 2020 07:05
-
-
Save DarkFenX/f0a0779368ac12a874b286d487c6a03b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[derive(Debug, serde::Deserialize)] | |
pub(super) struct ItemFighterAbilData { | |
#[serde(rename = "abilityID")] | |
pub(super) abil_id: ReeInt, | |
#[serde(rename = "cooldownSeconds")] | |
pub(super) cooldown: Option<ReeFloat>, | |
pub(super) charges: Option<ItemFighterAbilChargeData>, | |
} | |
#[derive(Debug, serde::Deserialize)] | |
pub(super) struct ItemFighterAbilChargeData { | |
#[serde(rename = "chargeCount")] | |
pub(super) count: ReeInt, | |
#[serde(rename = "rearmTimeSeconds")] | |
pub(super) rearm_time: ReeFloat, | |
} | |
... | |
fn fsd_merge(self, id: ReeInt) -> Vec<dh::ItemFighterAbilRel> { | |
let mut vec = Vec::new(); | |
for abil_data in vec![self.abil0, self.abil1, self.abil2].into_iter() { | |
if let Some(abil_data) = abil_data { | |
vec.push(dh::ItemFighterAbilRel::new( | |
id, | |
abil_data.abil_id, | |
abil_data.cooldown, | |
abil_data.charges.and_then(|v| Some(v.count)), | |
abil_data.charges.and_then(|v| Some(v.rearm_time)), | |
)) | |
} | |
} | |
vec | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment