cargo fmt
This commit is contained in:
parent
bc063bae6e
commit
9459b6adb9
5 changed files with 36 additions and 31 deletions
|
@ -1,7 +1,12 @@
|
|||
use std::collections::HashMap;
|
||||
use idmangler_lib::{DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData, StartData, TypeData};
|
||||
use crate::jsonstruct::{
|
||||
FuncParams, Identificationer, ItemTypeDeser, Powder, Shinyjson, Shinystruct,
|
||||
};
|
||||
use idmangler_lib::types::{Element, ItemType, RollType, Stat};
|
||||
use crate::jsonstruct::{FuncParams, Identificationer, ItemTypeDeser, Powder, Shinyjson, Shinystruct};
|
||||
use idmangler_lib::{
|
||||
DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData,
|
||||
StartData, TypeData,
|
||||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub fn encode_startdata(general_params: &mut FuncParams) {
|
||||
// ENCODE: StartData
|
||||
|
@ -53,8 +58,8 @@ pub fn encode_ids(
|
|||
identifications: idvec,
|
||||
extended_encoding: true,
|
||||
}
|
||||
.encode(general_params.fr_ver, general_params.fr_out)
|
||||
.unwrap();
|
||||
.encode(general_params.fr_ver, general_params.fr_out)
|
||||
.unwrap();
|
||||
}
|
||||
pub fn encode_powder(general_params: &mut FuncParams, real_powders: Vec<Powder>) {
|
||||
let mut powdervec = Vec::new();
|
||||
|
@ -89,8 +94,8 @@ pub fn encode_powder(general_params: &mut FuncParams, real_powders: Vec<Powder>)
|
|||
powder_slots: powderlimitfr,
|
||||
powders: powdervec,
|
||||
}
|
||||
.encode(general_params.fr_ver, general_params.fr_out)
|
||||
.unwrap();
|
||||
.encode(general_params.fr_ver, general_params.fr_out)
|
||||
.unwrap();
|
||||
}
|
||||
pub fn encode_reroll(general_params: &mut FuncParams, rerollcount: u8) {
|
||||
if rerollcount != 0 {
|
||||
|
@ -103,7 +108,11 @@ pub fn encode_reroll(general_params: &mut FuncParams, rerollcount: u8) {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub fn encode_shiny(general_params: &mut FuncParams, shiny: Shinyjson, json_shiny: Vec<Shinystruct>) {
|
||||
pub fn encode_shiny(
|
||||
general_params: &mut FuncParams,
|
||||
shiny: Shinyjson,
|
||||
json_shiny: Vec<Shinystruct>,
|
||||
) {
|
||||
let mut realshinykey: u8;
|
||||
let _shinykey = &shiny.key;
|
||||
let shinyvalue = shiny.value;
|
||||
|
@ -125,8 +134,8 @@ pub fn encode_shiny(general_params: &mut FuncParams, shiny: Shinyjson, json_shin
|
|||
id: realshinykey,
|
||||
val: shinyvalue,
|
||||
}
|
||||
.encode(general_params.fr_ver, general_params.fr_out)
|
||||
.unwrap();
|
||||
.encode(general_params.fr_ver, general_params.fr_out)
|
||||
.unwrap();
|
||||
}
|
||||
pub fn encode_enddata(general_params: &mut FuncParams) {
|
||||
// ENCODE: EndData
|
||||
|
|
|
@ -44,6 +44,8 @@ pub enum Errorfr {
|
|||
JsonDlReqFileWriteFail,
|
||||
|
||||
/// Name value was not found in json
|
||||
#[error("Error 3.4: \"name\" field was not found in the json (required for Gear, Tome, Charm).")]
|
||||
#[error(
|
||||
"Error 3.4: \"name\" field was not found in the json (required for Gear, Tome, Charm)."
|
||||
)]
|
||||
JsonNotFoundName,
|
||||
}
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use serde::Deserialize;
|
||||
use crate::dl_json;
|
||||
use crate::errorfr::Errorfr;
|
||||
use crate::jsonstruct::{Shinystruct};
|
||||
|
||||
use crate::jsonstruct::Shinystruct;
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
||||
pub fn load_idkeys(executable_path: &str) -> Result<HashMap<String, u8>, Errorfr> {
|
||||
// id_keys.json
|
||||
|
@ -12,7 +11,7 @@ pub fn load_idkeys(executable_path: &str) -> Result<HashMap<String, u8>, Errorfr
|
|||
&mut fs::File::open(executable_path.to_owned() + "/id_keys.json")
|
||||
.map_err(|_| Errorfr::IDMapJsonMissing)?,
|
||||
)
|
||||
.map_err(|_| Errorfr::IDMapJsonCorrupt)
|
||||
.map_err(|_| Errorfr::IDMapJsonCorrupt)
|
||||
}
|
||||
pub fn load_shinystats(executable_path: &str) -> Result<Vec<Shinystruct>, Errorfr> {
|
||||
// shiny_stats.json
|
||||
|
@ -20,7 +19,7 @@ pub fn load_shinystats(executable_path: &str) -> Result<Vec<Shinystruct>, Errorf
|
|||
&mut fs::File::open(executable_path.to_owned() + "/shiny_stats.json")
|
||||
.map_err(|_| Errorfr::ShinyJsonMissing)?,
|
||||
)
|
||||
.map_err(|_| Errorfr::ShinyJsonCorrupt)
|
||||
.map_err(|_| Errorfr::ShinyJsonCorrupt)
|
||||
}
|
||||
pub fn dl_json_fr(dlvalue: &String, executable_path: &str) {
|
||||
let jsons = DownloadJsons::from(dlvalue.clone());
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::fs;
|
||||
use crate::errorfr::Errorfr;
|
||||
use idmangler_lib::types::{ItemType, TransformVersion};
|
||||
use serde::Deserialize;
|
||||
use crate::errorfr::Errorfr;
|
||||
use std::fs;
|
||||
|
||||
// structs for the json parsing
|
||||
#[derive(Deserialize)]
|
||||
|
@ -69,4 +69,4 @@ impl From<ItemTypeDeser> for ItemType {
|
|||
pub fn load_jsonconfig(path: &String) -> Result<Jsonconfig, Errorfr> {
|
||||
serde_json5::from_reader(&mut fs::File::open(path).map_err(|_| Errorfr::ItemJsonMissing)?)
|
||||
.map_err(Errorfr::ItemJsonCorrupt)
|
||||
}
|
||||
}
|
||||
|
|
15
src/main.rs
15
src/main.rs
|
@ -1,20 +1,17 @@
|
|||
#![allow(clippy::single_match)]
|
||||
|
||||
use idmangler_lib::{
|
||||
encoding::encode_string,
|
||||
types::TransformVersion,
|
||||
};
|
||||
use idmangler_lib::{encoding::encode_string, types::TransformVersion};
|
||||
|
||||
use std::{collections::HashMap, env, fs, io, path::PathBuf};
|
||||
|
||||
mod jsonstruct;
|
||||
mod errorfr;
|
||||
mod encode;
|
||||
mod errorfr;
|
||||
mod jsondl;
|
||||
use crate::jsonstruct::*;
|
||||
use crate::errorfr::Errorfr;
|
||||
mod jsonstruct;
|
||||
use crate::encode::*;
|
||||
use crate::errorfr::Errorfr;
|
||||
use crate::jsondl::*;
|
||||
use crate::jsonstruct::*;
|
||||
|
||||
use clap::Parser;
|
||||
use reqwest::Url;
|
||||
|
@ -185,5 +182,3 @@ fn cook(
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue