reqdata part 1

This commit is contained in:
endernon 2025-01-03 16:04:40 +00:00
parent 4a3ee91d9b
commit 02b5cabcb9
3 changed files with 41 additions and 2 deletions

View file

@ -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::{CustomGearTypeData, CustomConsumableTypeData, DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData, StartData, TypeData, DurabilityData};
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)
.unwrap();
Ok(())
}
pub fn encode_reqdata(general_params: &mut FuncParams, real_reqdata: RequirementsDeser) {
}
pub fn encode_namedata(general_params: &mut FuncParams, real_name: &str) {
// ENCODE: NameData

View file

@ -2,7 +2,7 @@ use crate::errorfr::Errorfr;
use idmangler_lib::types::{ItemType, TransformVersion, ConsumableType, GearType};
use serde::Deserialize;
use std::fs;
use idmangler_lib::types::{ConsumableType::*,GearType::*};
use idmangler_lib::types::{ConsumableType::*,GearType::*, ClassType, SkillType};
use crate::jsonstruct::CraftedTypesFr::{Consu, Gear};
// structs for the json parsing
@ -17,12 +17,40 @@ pub struct Jsonconfig {
pub name: Option<String>,
// durability data (Crafted Gear)
pub durability: Option<Durability>,
// requirements data (Crafted Gear, Crafted
pub requirements: Option<RequirementsDeser>,
// shiny data
pub shiny: Option<Shinyjson>,
// identifications
pub ids: Option<Vec<Identificationer>>,
pub powders: Option<Vec<Powder>>,
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 {
Gear(GearType),
Consu(ConsumableType)

View file

@ -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
match json_config.item_type {
ItemTypeDeser::Gear | ItemTypeDeser::CraftedGear => {