frfr
This commit is contained in:
parent
2a3fcd5820
commit
fe7ec985f2
7 changed files with 46 additions and 48 deletions
|
@ -1,3 +1,3 @@
|
||||||
fn_params_layout = "Compressed"
|
fn_params_layout = "Compressed"
|
||||||
attr_fn_like_width = 140
|
attr_fn_like_width = 160
|
||||||
max_width = 160
|
max_width = 200
|
|
@ -1,12 +1,10 @@
|
||||||
use crate::errorfr::Errorfr;
|
use crate::errorfr::Errorfr;
|
||||||
use crate::jsonstruct::{
|
use crate::jsonstruct::{CraftedTypesFr, Durability, FuncParams, Identificationer, ItemTypeDeser, PowderFr, RequirementsDeser, Shinyjson, Shinystruct};
|
||||||
CraftedTypesFr, Durability, FuncParams, Identificationer, ItemTypeDeser, PowderFr, RequirementsDeser, Shinyjson, Shinystruct,
|
|
||||||
};
|
|
||||||
use idmangler_lib::encoding::DataEncoder;
|
use idmangler_lib::encoding::DataEncoder;
|
||||||
use idmangler_lib::{
|
use idmangler_lib::{
|
||||||
block::{
|
block::{
|
||||||
CraftedConsumableTypeData, CraftedGearTypeData, DurabilityData, EndData, IdentificationData, NameData, PowderData,
|
CraftedConsumableTypeData, CraftedGearTypeData, DurabilityData, EndData, IdentificationData, NameData, PowderData, RequirementsData, RerollData,
|
||||||
RequirementsData, RerollData, ShinyData, StartData, TypeData,
|
ShinyData, StartData, TypeData,
|
||||||
},
|
},
|
||||||
types::{ClassType, Element, ItemType, Powder, RollType, SkillType, Stat},
|
types::{ClassType, Element, ItemType, Powder, RollType, SkillType, Stat},
|
||||||
};
|
};
|
||||||
|
|
|
@ -28,11 +28,15 @@ pub enum Errorfr {
|
||||||
ShinyJsonCorrupt,
|
ShinyJsonCorrupt,
|
||||||
|
|
||||||
/// gear json is missing
|
/// gear json is missing
|
||||||
#[error("Error 2.3: gear.json is missing. It's only required for the \"perfect mode\" item gen. \nYou should run \"--download Gear\" or \"--download All\".")]
|
#[error(
|
||||||
|
"Error 2.3: gear.json is missing. It's only required for the \"perfect mode\" item gen. \nYou should run \"--download Gear\" or \"--download All\"."
|
||||||
|
)]
|
||||||
GearJsonMissing,
|
GearJsonMissing,
|
||||||
|
|
||||||
/// shiny data json is corrupt
|
/// shiny data json is corrupt
|
||||||
#[error("Error 2.4: gear.json is corrupt. It's only required for the \"perfect mode\" item gen. \nYou should run \"--download Gear\" or \"--download All\".")]
|
#[error(
|
||||||
|
"Error 2.4: gear.json is corrupt. It's only required for the \"perfect mode\" item gen. \nYou should run \"--download Gear\" or \"--download All\"."
|
||||||
|
)]
|
||||||
GearJsonCorrupt,
|
GearJsonCorrupt,
|
||||||
|
|
||||||
/// could not download the file
|
/// could not download the file
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use std::collections::HashMap;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
// the struct for each item in Hashmap<String, GearJson> gear.json. its a big ass pain
|
// the struct for each item in Hashmap<String, GearJson> gear.json. its a big ass pain
|
||||||
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
||||||
|
@ -20,31 +20,31 @@ pub struct GearJsonItem {
|
||||||
r#type: String,
|
r#type: String,
|
||||||
weaponType: Option<String>,
|
weaponType: Option<String>,
|
||||||
armourMaterial: Option<String>,
|
armourMaterial: Option<String>,
|
||||||
armourType: Option<String>
|
armourType: Option<String>,
|
||||||
}
|
}
|
||||||
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
||||||
pub struct ItemId {
|
pub struct ItemId {
|
||||||
max: i8,
|
max: i8,
|
||||||
min: i8,
|
min: i8,
|
||||||
raw: i8
|
raw: i8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
||||||
pub struct dropMeta {
|
pub struct dropMeta {
|
||||||
coordinates: [i64; 3],
|
coordinates: [i64; 3],
|
||||||
name: String,
|
name: String,
|
||||||
r#type: String
|
r#type: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
||||||
pub struct Icon {
|
pub struct Icon {
|
||||||
format: String,
|
format: String,
|
||||||
value: IconValue
|
value: IconValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
#[derive(Deserialize, PartialEq, Eq, Debug)]
|
||||||
pub struct IconValue {
|
pub struct IconValue {
|
||||||
customModelData: i16,
|
customModelData: i16,
|
||||||
id: String,
|
id: String,
|
||||||
name: String
|
name: String,
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
use crate::dl_json;
|
use crate::dl_json;
|
||||||
use crate::gearjson;
|
|
||||||
use crate::errorfr::Errorfr;
|
use crate::errorfr::Errorfr;
|
||||||
|
use crate::gearjson;
|
||||||
use crate::jsonstruct::Shinystruct;
|
use crate::jsonstruct::Shinystruct;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
@ -19,8 +19,9 @@ pub fn load_shinystats(executable_path: &str) -> Result<Vec<Shinystruct>, Errorf
|
||||||
|
|
||||||
pub fn load_gear(executable_path: &str) -> Result<HashMap<String, gearjson::GearJsonItem>, Errorfr> {
|
pub fn load_gear(executable_path: &str) -> Result<HashMap<String, gearjson::GearJsonItem>, Errorfr> {
|
||||||
// shiny_stats.json
|
// shiny_stats.json
|
||||||
let a: Result<HashMap<String, gearjson::GearJsonItem>, Errorfr> = serde_json5::from_reader(&mut fs::File::open(executable_path.to_owned() + "/data/gear.json").map_err(|_| Errorfr::GearJsonMissing)?)
|
let a: Result<HashMap<String, gearjson::GearJsonItem>, Errorfr> =
|
||||||
.map_err(|_| Errorfr::GearJsonCorrupt);
|
serde_json5::from_reader(&mut fs::File::open(executable_path.to_owned() + "/data/gear.json").map_err(|_| Errorfr::GearJsonMissing)?)
|
||||||
|
.map_err(|_| Errorfr::GearJsonCorrupt);
|
||||||
|
|
||||||
a
|
a
|
||||||
}
|
}
|
||||||
|
@ -35,7 +36,7 @@ pub fn dl_json_fr(dlvalue: &String, executable_path: &str) {
|
||||||
"https://raw.githubusercontent.com/Wynntils/Static-Storage/main/Data-Storage/shiny_stats.json"
|
"https://raw.githubusercontent.com/Wynntils/Static-Storage/main/Data-Storage/shiny_stats.json"
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
format!("{}{}", executable_path, "/data/shiny_stats.json")
|
format!("{}{}", executable_path, "/data/shiny_stats.json"),
|
||||||
) {
|
) {
|
||||||
// error handling below
|
// error handling below
|
||||||
println!("{} Filename: {}", e, dlvalue)
|
println!("{} Filename: {}", e, dlvalue)
|
||||||
|
@ -46,7 +47,7 @@ pub fn dl_json_fr(dlvalue: &String, executable_path: &str) {
|
||||||
"https://raw.githubusercontent.com/Wynntils/Static-Storage/main/Reference/id_keys.json"
|
"https://raw.githubusercontent.com/Wynntils/Static-Storage/main/Reference/id_keys.json"
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
format!("{}{}", executable_path, "/data/id_keys.json")
|
format!("{}{}", executable_path, "/data/id_keys.json"),
|
||||||
) {
|
) {
|
||||||
// error handling below
|
// error handling below
|
||||||
println!("{} Filename: {}", e, dlvalue)
|
println!("{} Filename: {}", e, dlvalue)
|
||||||
|
@ -57,7 +58,7 @@ pub fn dl_json_fr(dlvalue: &String, executable_path: &str) {
|
||||||
"https://raw.githubusercontent.com/Wynntils/Static-Storage/main/Reference/gear.json"
|
"https://raw.githubusercontent.com/Wynntils/Static-Storage/main/Reference/gear.json"
|
||||||
.parse()
|
.parse()
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
format!("{}{}", executable_path, "/data/gear.json")
|
format!("{}{}", executable_path, "/data/gear.json"),
|
||||||
) {
|
) {
|
||||||
// error handling below
|
// error handling below
|
||||||
println!("{} Filename: {}", e, dlvalue)
|
println!("{} Filename: {}", e, dlvalue)
|
||||||
|
@ -104,4 +105,3 @@ impl From<String> for DownloadJsons {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +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::types::{
|
||||||
types::{ClassType, ConsumableType, ConsumableType::*, CraftedGearType, CraftedGearType::*, EncodingVersion, ItemType, SkillType, AttackSpeed},
|
AttackSpeed, ClassType, ConsumableType, ConsumableType::*, CraftedGearType, CraftedGearType::*, EncodingVersion, ItemType, SkillType,
|
||||||
};
|
};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
@ -85,7 +85,7 @@ pub struct Jsonconfig {
|
||||||
)]
|
)]
|
||||||
pub crafted_ids: Option<Vec<IdentificationerCrafted>>,
|
pub crafted_ids: Option<Vec<IdentificationerCrafted>>,
|
||||||
|
|
||||||
pub crafted_damage: Option<DamageDeser>
|
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.
|
||||||
|
@ -231,7 +231,7 @@ pub struct FuncParams<'a> {
|
||||||
|
|
||||||
#[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone)]
|
#[derive(Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone)]
|
||||||
pub struct DamageDeser {
|
pub struct DamageDeser {
|
||||||
pub attack_speed: AttackSpeed
|
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)]
|
||||||
|
|
22
src/main.rs
22
src/main.rs
|
@ -1,20 +1,18 @@
|
||||||
#![allow(clippy::single_match)]
|
#![allow(clippy::single_match)]
|
||||||
#![allow(non_camel_case_types, non_snake_case)]
|
#![allow(non_camel_case_types, non_snake_case)]
|
||||||
|
|
||||||
|
|
||||||
mod encode;
|
mod encode;
|
||||||
mod errorfr;
|
mod errorfr;
|
||||||
|
mod gearjson;
|
||||||
mod jsondl;
|
mod jsondl;
|
||||||
mod jsonstruct;
|
mod jsonstruct;
|
||||||
mod gearjson;
|
|
||||||
use idmangler_lib::{encoding::string::encode_string, types::EncodingVersion};
|
|
||||||
use std::{collections::HashMap, env, fs, io, path::PathBuf};
|
|
||||||
use clap::Parser;
|
|
||||||
use reqwest::Url;
|
|
||||||
use crate::errorfr::Errorfr;
|
use crate::errorfr::Errorfr;
|
||||||
use crate::jsondl::*;
|
use crate::jsondl::*;
|
||||||
use crate::jsonstruct::*;
|
use crate::jsonstruct::*;
|
||||||
|
use clap::Parser;
|
||||||
|
use idmangler_lib::{encoding::string::encode_string, types::EncodingVersion};
|
||||||
|
use reqwest::Url;
|
||||||
|
use std::{collections::HashMap, env, fs, io, path::PathBuf};
|
||||||
|
|
||||||
#[derive(Parser, Debug, Clone)]
|
#[derive(Parser, Debug, Clone)]
|
||||||
#[command(version, about, long_about = None, arg_required_else_help(true))]
|
#[command(version, about, long_about = None, arg_required_else_help(true))]
|
||||||
|
@ -33,11 +31,11 @@ struct Args {
|
||||||
|
|
||||||
/// Function to generate perfect value items
|
/// Function to generate perfect value items
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
perfect: Option<String>
|
perfect: Option<String>,
|
||||||
}
|
}
|
||||||
pub enum PerfectStatus {
|
pub enum PerfectStatus {
|
||||||
None,
|
None,
|
||||||
Some(String)
|
Some(String),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn dl_json(url: Url, savename: String) -> Result<(), Errorfr> {
|
fn dl_json(url: Url, savename: String) -> Result<(), Errorfr> {
|
||||||
|
@ -115,8 +113,7 @@ fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cook(
|
fn cook(
|
||||||
out: &mut Vec<u8>, debug_mode: &bool, ver: EncodingVersion, json_config: &mut Jsonconfig, idsmap: HashMap<String, u8>,
|
out: &mut Vec<u8>, debug_mode: &bool, ver: EncodingVersion, json_config: &mut Jsonconfig, idsmap: HashMap<String, u8>, json_shiny: Vec<Shinystruct>,
|
||||||
json_shiny: Vec<Shinystruct>,
|
|
||||||
) -> Result<String, Errorfr> {
|
) -> Result<String, Errorfr> {
|
||||||
let mut fr_params = FuncParams {
|
let mut fr_params = FuncParams {
|
||||||
fr_out: out,
|
fr_out: out,
|
||||||
|
@ -238,8 +235,7 @@ fn cook(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cook_perfect(
|
fn cook_perfect(
|
||||||
out: &mut Vec<u8>, debug_mode: &bool, ver: EncodingVersion, json_config: &Jsonconfig, idsmap: HashMap<String, u8>,
|
out: &mut Vec<u8>, debug_mode: &bool, ver: EncodingVersion, json_config: &Jsonconfig, idsmap: HashMap<String, u8>, json_shiny: Vec<Shinystruct>,
|
||||||
json_shiny: Vec<Shinystruct>,
|
|
||||||
) -> Result<String, Errorfr> {
|
) -> Result<String, Errorfr> {
|
||||||
Ok("fr".parse().unwrap())
|
Ok("fr".parse().unwrap())
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue