From 6010d1be0daae5730939fe2abf2f0a9426126a8f Mon Sep 17 00:00:00 2001 From: endernon Date: Tue, 5 Nov 2024 21:47:15 +0000 Subject: [PATCH] fix powders changing in idmangler-lib 4.0 --- Cargo.lock | 4 +-- Cargo.toml | 2 +- src/main.rs | 99 +++++++++++++++++++++++++---------------------------- 3 files changed, 50 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6911915..7387d36 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,9 +123,9 @@ dependencies = [ [[package]] name = "idmangler-lib" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a4ccddf0b9d54668e06b249f940e4c376cc4393ef5d149c87759a774b385d5" +checksum = "0395df40b27e5b44d89befbf479c06df7554c0af28674fa663aebd8e0d8f400c" dependencies = [ "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index 5423b26..41d0f77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" [dependencies] base64 = "0.22.1" clap = { version = "4.5.20", features = ["derive"] } -idmangler-lib = "0.3.0" +idmangler-lib = "0.4.0" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "1.0.68" diff --git a/src/main.rs b/src/main.rs index 558d68f..a448b4d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,7 @@ use idmangler_lib::{ encoding::encode_string, types::{ - ItemType, Powders, TransformVersion, {RollType, Stat}, + ItemType, TransformVersion, {RollType, Stat}, Element }, DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData, StartData, TypeData, @@ -117,62 +117,57 @@ fn cook() -> Result<(), Errorfr> { let powdertier = eachpowder.tier; // get the powder tier let powderamount: u8 = eachpowder.amount.unwrap_or_else(|| 1); // match for the powder type - // no need to return to variable or i'll need to rematch AGAIN - match eachpowder.r#type.to_ascii_lowercase() { - 'e' => { - for _i in 0..powderamount { - powdervec.push((Powders::EARTH, powdertier)) + for _ in 0..powderamount { + let eletype = match eachpowder.r#type.to_ascii_lowercase() { + 'e' => { + if debug_mode { + println!("Powder type: Earth"); + } + Element::Earth } - if debug_mode { - println!("Powder type: Earth"); - } - } - 't' => { - for _i in 0..powderamount { - powdervec.push((Powders::THUNDER, powdertier)) - } - if debug_mode { - println!("Powder type: Thunder"); - } - } - 'w' => { - for _i in 0..powderamount { - powdervec.push((Powders::WATER, powdertier)) - } - if debug_mode { - println!("Powder type: Water"); - } - } - 'f' => { - for _i in 0..powderamount { - powdervec.push((Powders::FIRE, powdertier)) - } - if debug_mode { - println!("Powder type: Fire"); - } - } - 'a' => { - for _i in 0..powderamount { - powdervec.push((Powders::AIR, powdertier)) - } - if debug_mode { - println!("Powder type: Air"); - } - } - _ => { - for _i in 0..powderamount { - powdervec.push((Powders::THUNDER, powdertier)) - } - if debug_mode { - println!("Powder type: Broken, fallback Thunder"); + 't' => { + + if debug_mode { + println!("Powder type: Thunder"); + } + Element::Thunder } + 'w' => { + if debug_mode { + println!("Powder type: Water"); + } + Element::Water + } + 'f' => { + if debug_mode { + println!("Powder type: Fire"); + } + Element::Fire + } + 'a' => { + if debug_mode { + println!("Powder type: Air"); + } + Element::Air + } + _ => { + if debug_mode { + println!("Powder type: Broken, fallback Thunder"); + } + Element::Thunder + } + }; + powdervec.push(Some((eletype,powdertier))); + if debug_mode { + println!("Powder tier: {}", powdertier); + println!("Powder amount: {}", powderamount); } + }; - if debug_mode { - println!("Powder tier: {}", powdertier); - println!("Powder amount: {}", powderamount); - } + + + } if debug_mode { println!("Powders Vec: {:?}", powdervec);