crafted support (1/?) (unfinished)
This commit is contained in:
parent
a2b82ccf22
commit
5cdfcfeca2
6 changed files with 47 additions and 10 deletions
16
Cargo.lock
generated
16
Cargo.lock
generated
|
@ -227,7 +227,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -594,6 +594,7 @@ dependencies = [
|
|||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"tribool",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -912,7 +913,7 @@ dependencies = [
|
|||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1153,7 +1154,7 @@ dependencies = [
|
|||
"fastrand",
|
||||
"once_cell",
|
||||
"rustix",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.59.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1259,6 +1260,15 @@ dependencies = [
|
|||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tribool"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e8660361502033a51e119386b47fbb811e5706722f2e91ccf867aa6b2b09f90"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "try-lock"
|
||||
version = "0.2.5"
|
||||
|
|
|
@ -15,3 +15,4 @@ reqwest = "0.12.9"
|
|||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0.68"
|
||||
tribool = { version = "0.3.0", features = ["serde"] }
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
"There are also some values you cannot increase beyond a limit."
|
||||
],
|
||||
"name":"Singularity",
|
||||
"item_type": "Gear",
|
||||
"shiny": {
|
||||
"key": "playersKilled",
|
||||
"value": 9223372036854775807
|
||||
|
|
|
@ -25,5 +25,9 @@ pub enum Errorfr {
|
|||
|
||||
/// shiny data json is corrupt
|
||||
#[error("Error 6: shiny_stats.json is corrupt.")]
|
||||
ShinyJsonCorrupt
|
||||
ShinyJsonCorrupt,
|
||||
|
||||
///
|
||||
#[error("Error 7: Item Type is missing from json (add an \"item_type\" field")]
|
||||
ItemTypeMissing
|
||||
}
|
|
@ -83,15 +83,16 @@ fn cook() -> Result<(), Errorfr> {
|
|||
.unwrap();
|
||||
|
||||
// ENCODE: TypeData
|
||||
TypeData(ItemType::Gear)
|
||||
TypeData(ItemType::from(json_config.item_type))
|
||||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
.map_err(|_| Errorfr::ItemTypeMissing)?;
|
||||
|
||||
// ENCODE: NameData
|
||||
NameData(String::from(format!("{}", json_config.name.trim())))
|
||||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
|
||||
|
||||
// json identification data handling
|
||||
let mut idvec = Vec::new();
|
||||
for eachid in json_config.ids {
|
||||
|
@ -162,9 +163,6 @@ fn cook() -> Result<(), Errorfr> {
|
|||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
if debug_mode {
|
||||
dbg!(&powdervec);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use idmangler_lib::types::ItemType;
|
||||
use serde::Deserialize;
|
||||
// structs
|
||||
#[derive(Deserialize)]
|
||||
|
@ -16,7 +17,7 @@ pub struct Identificationer {
|
|||
pub struct Jsonconfig {
|
||||
pub debug: Option<bool>,
|
||||
pub name: String,
|
||||
pub crafted: bool,
|
||||
pub item_type: ItemTypeDeser,
|
||||
pub shiny: Option<Shinyjson>,
|
||||
pub ids: Vec<Identificationer>,
|
||||
pub powder_limit: u8,
|
||||
|
@ -34,3 +35,25 @@ pub struct Shinyjson {
|
|||
pub key: String,
|
||||
pub value: i64,
|
||||
}
|
||||
|
||||
// I had to clone this and add Deserialize because the original idmangler_lib::types::ItemType does not
|
||||
#[repr(u8)]
|
||||
#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Hash, Debug, Deserialize)]
|
||||
pub enum ItemTypeDeser {
|
||||
Gear = 0,
|
||||
Tome = 1,
|
||||
Charm = 2,
|
||||
CraftedGear = 3,
|
||||
CraftedConsu = 4,
|
||||
}
|
||||
impl From<ItemTypeDeser> for ItemType {
|
||||
fn from(value: ItemTypeDeser) -> ItemType {
|
||||
match value {
|
||||
ItemTypeDeser::Gear => ItemType::Gear,
|
||||
ItemTypeDeser::Tome => ItemType::Tome,
|
||||
ItemTypeDeser::Charm => ItemType::Charm,
|
||||
ItemTypeDeser::CraftedConsu => ItemType::CraftedConsu,
|
||||
ItemTypeDeser::CraftedGear => ItemType::CraftedGear
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue