reqdata part 1
This commit is contained in:
parent
4a3ee91d9b
commit
02b5cabcb9
3 changed files with 41 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
||||||
use crate::jsonstruct::{CraftedTypesFr, Durability, FuncParams, Identificationer, ItemTypeDeser, Powder, Shinyjson, Shinystruct};
|
use crate::jsonstruct::{CraftedTypesFr, Durability, FuncParams, Identificationer, ItemTypeDeser, Powder, RequirementsDeser, Shinyjson, Shinystruct};
|
||||||
use idmangler_lib::types::{Element, ItemType, RollType, Stat};
|
use idmangler_lib::types::{Element, ItemType, RollType, Stat};
|
||||||
use idmangler_lib::{CustomGearTypeData, CustomConsumableTypeData, DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData, StartData, TypeData, DurabilityData};
|
use idmangler_lib::{CustomGearTypeData, CustomConsumableTypeData, DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData, StartData, TypeData, DurabilityData};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -76,6 +76,9 @@ pub fn encode_duradata(general_params: &mut FuncParams, real_dura: Durability) -
|
||||||
.encode(general_params.fr_ver, general_params.fr_out)
|
.encode(general_params.fr_ver, general_params.fr_out)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
Ok(())
|
Ok(())
|
||||||
|
}
|
||||||
|
pub fn encode_reqdata(general_params: &mut FuncParams, real_reqdata: RequirementsDeser) {
|
||||||
|
|
||||||
}
|
}
|
||||||
pub fn encode_namedata(general_params: &mut FuncParams, real_name: &str) {
|
pub fn encode_namedata(general_params: &mut FuncParams, real_name: &str) {
|
||||||
// ENCODE: NameData
|
// ENCODE: NameData
|
||||||
|
|
|
@ -2,7 +2,7 @@ use crate::errorfr::Errorfr;
|
||||||
use idmangler_lib::types::{ItemType, TransformVersion, ConsumableType, GearType};
|
use idmangler_lib::types::{ItemType, TransformVersion, ConsumableType, GearType};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use idmangler_lib::types::{ConsumableType::*,GearType::*};
|
use idmangler_lib::types::{ConsumableType::*,GearType::*, ClassType, SkillType};
|
||||||
use crate::jsonstruct::CraftedTypesFr::{Consu, Gear};
|
use crate::jsonstruct::CraftedTypesFr::{Consu, Gear};
|
||||||
|
|
||||||
// structs for the json parsing
|
// structs for the json parsing
|
||||||
|
@ -17,12 +17,40 @@ pub struct Jsonconfig {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
// durability data (Crafted Gear)
|
// durability data (Crafted Gear)
|
||||||
pub durability: Option<Durability>,
|
pub durability: Option<Durability>,
|
||||||
|
// requirements data (Crafted Gear, Crafted
|
||||||
|
pub requirements: Option<RequirementsDeser>,
|
||||||
// shiny data
|
// shiny data
|
||||||
pub shiny: Option<Shinyjson>,
|
pub shiny: Option<Shinyjson>,
|
||||||
|
// identifications
|
||||||
pub ids: Option<Vec<Identificationer>>,
|
pub ids: Option<Vec<Identificationer>>,
|
||||||
pub powders: Option<Vec<Powder>>,
|
pub powders: Option<Vec<Powder>>,
|
||||||
pub rerolls: Option<u8>,
|
pub rerolls: Option<u8>,
|
||||||
}
|
}
|
||||||
|
// reimplementing this because it doesnt have Deserialize.
|
||||||
|
// Also, changing the SkillPoint stuff into NOT a vec.
|
||||||
|
// This avoids confusing end user.
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct RequirementsDeser {
|
||||||
|
level: u8,
|
||||||
|
class: Option<ClassDeser>,
|
||||||
|
sp: SkillPointDeser
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub enum ClassDeser {
|
||||||
|
Archer,
|
||||||
|
Warrior,
|
||||||
|
Assassin,
|
||||||
|
Mage,
|
||||||
|
Shaman
|
||||||
|
}
|
||||||
|
#[derive(Deserialize)]
|
||||||
|
pub struct SkillPointDeser {
|
||||||
|
Earth: Option<i32>,
|
||||||
|
Thunder: Option<i32>,
|
||||||
|
Water: Option<i32>,
|
||||||
|
Fire: Option<i32>,
|
||||||
|
Air: Option<i32>
|
||||||
|
}
|
||||||
pub enum CraftedTypesFr {
|
pub enum CraftedTypesFr {
|
||||||
Gear(GearType),
|
Gear(GearType),
|
||||||
Consu(ConsumableType)
|
Consu(ConsumableType)
|
||||||
|
|
|
@ -173,6 +173,14 @@ fn cook(
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ENCODE: RequirementsData if ItemType is CraftedGear, CraftedConsu
|
||||||
|
match json_config.item_type {
|
||||||
|
ItemTypeDeser::CraftedGear | ItemTypeDeser::CraftedConsu => {
|
||||||
|
|
||||||
|
},
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
// ENCODE: PowderData if ItemType is Gear, CraftedGear
|
// ENCODE: PowderData if ItemType is Gear, CraftedGear
|
||||||
match json_config.item_type {
|
match json_config.item_type {
|
||||||
ItemTypeDeser::Gear | ItemTypeDeser::CraftedGear => {
|
ItemTypeDeser::Gear | ItemTypeDeser::CraftedGear => {
|
||||||
|
|
Loading…
Reference in a new issue