test change
This commit is contained in:
parent
1034ab46f4
commit
a3533aa7e9
2 changed files with 43 additions and 15 deletions
|
@ -1,8 +1,7 @@
|
||||||
use crate::errorfr::Errorfr;
|
use crate::errorfr::Errorfr;
|
||||||
use crate::jsonstruct::CraftedTypesFr::{Consu, Gear};
|
use crate::jsonstruct::CraftedTypesFr::{Consu, Gear};
|
||||||
use idmangler_lib::{
|
use idmangler_lib::{
|
||||||
block,
|
types::{ClassType, ConsumableType, ConsumableType::*, CraftedGearType, CraftedGearType::*, EncodingVersion, ItemType, SkillType, AttackSpeed},
|
||||||
types::{ClassType, ConsumableType, ConsumableType::*, CraftedGearType, CraftedGearType::*, EncodingVersion, ItemType, SkillType},
|
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -42,14 +41,6 @@ pub struct Jsonconfig {
|
||||||
#[serde(alias = "Name", alias = "NAME")]
|
#[serde(alias = "Name", alias = "NAME")]
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
|
|
||||||
// durability data (Crafted Gear)
|
|
||||||
#[serde(alias = "Durability", alias = "DURABILITY", alias = "Dura", alias = "DURA")]
|
|
||||||
pub durability: Option<Durability>,
|
|
||||||
|
|
||||||
// requirements data (Crafted)
|
|
||||||
#[serde(alias = "Requirements", alias = "REQUIREMENTS")]
|
|
||||||
pub requirements: Option<RequirementsDeser>,
|
|
||||||
|
|
||||||
// shiny data
|
// shiny data
|
||||||
#[serde(alias = "Shiny", alias = "SHINY")]
|
#[serde(alias = "Shiny", alias = "SHINY")]
|
||||||
pub shiny: Option<Shinyjson>,
|
pub shiny: Option<Shinyjson>,
|
||||||
|
@ -65,6 +56,36 @@ pub struct Jsonconfig {
|
||||||
// rerolls
|
// rerolls
|
||||||
#[serde(alias = "Rerolls", alias = "REROLLS", alias = "reroll", alias = "Reroll", alias = "REROLL")]
|
#[serde(alias = "Rerolls", alias = "REROLLS", alias = "reroll", alias = "Reroll", alias = "REROLL")]
|
||||||
pub rerolls: Option<u8>,
|
pub rerolls: Option<u8>,
|
||||||
|
|
||||||
|
// durability data (Crafted Gear)
|
||||||
|
#[serde(alias = "durability", alias = "Durability", alias = "DURABILITY", alias = "dura", alias = "Dura", alias = "DURA")]
|
||||||
|
pub crafted_durability: Option<Durability>,
|
||||||
|
|
||||||
|
// requirements data (Crafted)
|
||||||
|
#[serde(alias = "requirement", alias = "Requirement", alias = "REQUIREMENT", alias = "requirements", alias = "Requirements", alias = "REQUIREMENTS")]
|
||||||
|
pub crafted_requirements: Option<RequirementsDeser>,
|
||||||
|
|
||||||
|
// 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<Vec<IdentificationerCrafted>>,
|
||||||
|
|
||||||
|
pub crafted_damage: Option<DamageDeser>
|
||||||
}
|
}
|
||||||
// reimplementing this because it doesnt have Deserialize.
|
// reimplementing this because it doesnt have Deserialize.
|
||||||
// Also, changing the SkillPoint stuff into NOT a vec.
|
// Also, changing the SkillPoint stuff into NOT a vec.
|
||||||
|
@ -184,6 +205,11 @@ pub struct Identificationer {
|
||||||
pub roll: Option<u8>,
|
pub roll: Option<u8>,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
|
#[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 struct PowderFr {
|
||||||
pub r#type: char,
|
pub r#type: char,
|
||||||
pub amount: Option<u8>,
|
pub amount: Option<u8>,
|
||||||
|
@ -203,6 +229,10 @@ pub struct FuncParams<'a> {
|
||||||
pub fr_ver: EncodingVersion,
|
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
|
// I had to clone this and add Deserialize because the original idmangler_lib::types::ItemType does not
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug, Deserialize)]
|
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug, Deserialize)]
|
||||||
|
|
|
@ -11,8 +11,6 @@ mod jsonstruct;
|
||||||
use crate::errorfr::Errorfr;
|
use crate::errorfr::Errorfr;
|
||||||
use crate::jsondl::*;
|
use crate::jsondl::*;
|
||||||
use crate::jsonstruct::*;
|
use crate::jsonstruct::*;
|
||||||
|
|
||||||
use crate::errorfr::Errorfr::JsonNotFoundCraftedType;
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use reqwest::Url;
|
use reqwest::Url;
|
||||||
|
|
||||||
|
@ -122,7 +120,7 @@ fn cook(
|
||||||
if let Some(real_crafted_type) = &json_config.crafted_type {
|
if let Some(real_crafted_type) = &json_config.crafted_type {
|
||||||
fr_params.encode_typedata_custom(real_crafted_type)?;
|
fr_params.encode_typedata_custom(real_crafted_type)?;
|
||||||
} else {
|
} else {
|
||||||
return Err(JsonNotFoundCraftedType);
|
return Err(Errorfr::JsonNotFoundCraftedType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
@ -153,7 +151,7 @@ fn cook(
|
||||||
// ENCODE: DurabilityData (REQUIRED for CraftedGear)
|
// ENCODE: DurabilityData (REQUIRED for CraftedGear)
|
||||||
match json_config.item_type {
|
match json_config.item_type {
|
||||||
ItemTypeDeser::CraftedGear => {
|
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)?;
|
fr_params.encode_duradata(real_dura)?;
|
||||||
} else {
|
} else {
|
||||||
return Err(Errorfr::JsonNotFoundDura);
|
return Err(Errorfr::JsonNotFoundDura);
|
||||||
|
@ -165,7 +163,7 @@ fn cook(
|
||||||
// ENCODE: RequirementsData if ItemType is CraftedGear, CraftedConsu
|
// ENCODE: RequirementsData if ItemType is CraftedGear, CraftedConsu
|
||||||
match json_config.item_type {
|
match json_config.item_type {
|
||||||
ItemTypeDeser::CraftedGear | ItemTypeDeser::CraftedConsu => {
|
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)?
|
fr_params.encode_reqdata(real_reqs)?
|
||||||
} else {
|
} else {
|
||||||
return Err(Errorfr::JsonNotFoundReqs);
|
return Err(Errorfr::JsonNotFoundReqs);
|
||||||
|
|
Loading…
Add table
Reference in a new issue