diff --git a/src/jsonstruct.rs b/src/jsonstruct.rs index a6eeab1..3d80f6e 100644 --- a/src/jsonstruct.rs +++ b/src/jsonstruct.rs @@ -1,8 +1,7 @@ use crate::errorfr::Errorfr; use crate::jsonstruct::CraftedTypesFr::{Consu, Gear}; use idmangler_lib::{ - block, - types::{ClassType, ConsumableType, ConsumableType::*, CraftedGearType, CraftedGearType::*, EncodingVersion, ItemType, SkillType}, + types::{ClassType, ConsumableType, ConsumableType::*, CraftedGearType, CraftedGearType::*, EncodingVersion, ItemType, SkillType, AttackSpeed}, }; use serde::Deserialize; use std::fs; @@ -42,14 +41,6 @@ pub struct Jsonconfig { #[serde(alias = "Name", alias = "NAME")] pub name: Option, - // durability data (Crafted Gear) - #[serde(alias = "Durability", alias = "DURABILITY", alias = "Dura", alias = "DURA")] - pub durability: Option, - - // requirements data (Crafted) - #[serde(alias = "Requirements", alias = "REQUIREMENTS")] - pub requirements: Option, - // shiny data #[serde(alias = "Shiny", alias = "SHINY")] pub shiny: Option, @@ -65,6 +56,36 @@ pub struct Jsonconfig { // rerolls #[serde(alias = "Rerolls", alias = "REROLLS", alias = "reroll", alias = "Reroll", alias = "REROLL")] pub rerolls: Option, + + // durability data (Crafted Gear) + #[serde(alias = "durability", alias = "Durability", alias = "DURABILITY", alias = "dura", alias = "Dura", alias = "DURA")] + pub crafted_durability: Option, + + // requirements data (Crafted) + #[serde(alias = "requirement", alias = "Requirement", alias = "REQUIREMENT", alias = "requirements", alias = "Requirements", alias = "REQUIREMENTS")] + pub crafted_requirements: Option, + + // identifications (Crafted) + // to be honest i wish there was a better way instead of too many aliases + #[serde( + alias = "craftedids", + alias = "CRAFTED_IDS", + alias = "CRAFTEDIDS", + alias = "Crafted_Ids", + alias = "Crafted_ids", + alias = "CraftedIds", + alias = "Craftedids", + alias = "craftedidentifications", + alias = "CRAFTED_IDENTIFICATIONS", + alias = "CRAFTEDIDENTIFICATIONS", + alias = "Crafted_Identifications", + alias = "Crafted_identifications", + alias = "CraftedIdentifications", + alias = "Craftedidentifications" + )] + pub crafted_ids: Option>, + + pub crafted_damage: Option } // reimplementing this because it doesnt have Deserialize. // Also, changing the SkillPoint stuff into NOT a vec. @@ -184,6 +205,11 @@ pub struct Identificationer { pub roll: Option, } #[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +pub struct IdentificationerCrafted { + pub name: String, + pub max_roll: i32, +} +#[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] pub struct PowderFr { pub r#type: char, pub amount: Option, @@ -203,6 +229,10 @@ pub struct FuncParams<'a> { pub fr_ver: EncodingVersion, } +#[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] +pub struct DamageDeser { + pub attack_speed: AttackSpeed +} // I had to clone this and add Deserialize because the original idmangler_lib::types::ItemType does not #[repr(u8)] #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug, Deserialize)] diff --git a/src/main.rs b/src/main.rs index 2913f8d..28cc830 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,8 +11,6 @@ mod jsonstruct; use crate::errorfr::Errorfr; use crate::jsondl::*; use crate::jsonstruct::*; - -use crate::errorfr::Errorfr::JsonNotFoundCraftedType; use clap::Parser; use reqwest::Url; @@ -122,7 +120,7 @@ fn cook( if let Some(real_crafted_type) = &json_config.crafted_type { fr_params.encode_typedata_custom(real_crafted_type)?; } else { - return Err(JsonNotFoundCraftedType); + return Err(Errorfr::JsonNotFoundCraftedType); } } _ => {} @@ -153,7 +151,7 @@ fn cook( // ENCODE: DurabilityData (REQUIRED for CraftedGear) match json_config.item_type { ItemTypeDeser::CraftedGear => { - if let Some(real_dura) = &json_config.durability { + if let Some(real_dura) = &json_config.crafted_durability { fr_params.encode_duradata(real_dura)?; } else { return Err(Errorfr::JsonNotFoundDura); @@ -165,7 +163,7 @@ fn cook( // ENCODE: RequirementsData if ItemType is CraftedGear, CraftedConsu match json_config.item_type { ItemTypeDeser::CraftedGear | ItemTypeDeser::CraftedConsu => { - if let Some(real_reqs) = json_config.requirements { + if let Some(real_reqs) = json_config.crafted_requirements { fr_params.encode_reqdata(real_reqs)? } else { return Err(Errorfr::JsonNotFoundReqs);