fix powders changing in idmangler-lib 4.0

This commit is contained in:
endernon 2024-11-05 21:47:15 +00:00
parent 32740e8318
commit 6010d1be0d
3 changed files with 50 additions and 55 deletions

4
Cargo.lock generated
View file

@ -123,9 +123,9 @@ dependencies = [
[[package]] [[package]]
name = "idmangler-lib" name = "idmangler-lib"
version = "0.3.0" version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "01a4ccddf0b9d54668e06b249f940e4c376cc4393ef5d149c87759a774b385d5" checksum = "0395df40b27e5b44d89befbf479c06df7554c0af28674fa663aebd8e0d8f400c"
dependencies = [ dependencies = [
"thiserror", "thiserror",
] ]

View file

@ -6,7 +6,7 @@ edition = "2021"
[dependencies] [dependencies]
base64 = "0.22.1" base64 = "0.22.1"
clap = { version = "4.5.20", features = ["derive"] } clap = { version = "4.5.20", features = ["derive"] }
idmangler-lib = "0.3.0" idmangler-lib = "0.4.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0" serde_json = "1.0"
thiserror = "1.0.68" thiserror = "1.0.68"

View file

@ -1,7 +1,7 @@
use idmangler_lib::{ use idmangler_lib::{
encoding::encode_string, encoding::encode_string,
types::{ types::{
ItemType, Powders, TransformVersion, {RollType, Stat}, ItemType, TransformVersion, {RollType, Stat}, Element
}, },
DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData, DataEncoder, EndData, IdentificationData, NameData, PowderData, RerollData, ShinyData,
StartData, TypeData, StartData, TypeData,
@ -117,62 +117,57 @@ fn cook() -> Result<(), Errorfr> {
let powdertier = eachpowder.tier; // get the powder tier let powdertier = eachpowder.tier; // get the powder tier
let powderamount: u8 = eachpowder.amount.unwrap_or_else(|| 1); let powderamount: u8 = eachpowder.amount.unwrap_or_else(|| 1);
// match for the powder type // match for the powder type
// no need to return to variable or i'll need to rematch AGAIN for _ in 0..powderamount {
match eachpowder.r#type.to_ascii_lowercase() { let eletype = match eachpowder.r#type.to_ascii_lowercase() {
'e' => { 'e' => {
for _i in 0..powderamount {
powdervec.push((Powders::EARTH, powdertier))
}
if debug_mode { if debug_mode {
println!("Powder type: Earth"); println!("Powder type: Earth");
} }
Element::Earth
} }
't' => { 't' => {
for _i in 0..powderamount {
powdervec.push((Powders::THUNDER, powdertier))
}
if debug_mode { if debug_mode {
println!("Powder type: Thunder"); println!("Powder type: Thunder");
} }
Element::Thunder
} }
'w' => { 'w' => {
for _i in 0..powderamount {
powdervec.push((Powders::WATER, powdertier))
}
if debug_mode { if debug_mode {
println!("Powder type: Water"); println!("Powder type: Water");
} }
Element::Water
} }
'f' => { 'f' => {
for _i in 0..powderamount {
powdervec.push((Powders::FIRE, powdertier))
}
if debug_mode { if debug_mode {
println!("Powder type: Fire"); println!("Powder type: Fire");
} }
Element::Fire
} }
'a' => { 'a' => {
for _i in 0..powderamount {
powdervec.push((Powders::AIR, powdertier))
}
if debug_mode { if debug_mode {
println!("Powder type: Air"); println!("Powder type: Air");
} }
Element::Air
} }
_ => { _ => {
for _i in 0..powderamount {
powdervec.push((Powders::THUNDER, powdertier))
}
if debug_mode { if debug_mode {
println!("Powder type: Broken, fallback Thunder"); println!("Powder type: Broken, fallback Thunder");
} }
Element::Thunder
} }
}; };
powdervec.push(Some((eletype,powdertier)));
if debug_mode { if debug_mode {
println!("Powder tier: {}", powdertier); println!("Powder tier: {}", powdertier);
println!("Powder amount: {}", powderamount); println!("Powder amount: {}", powderamount);
} }
};
} }
if debug_mode { if debug_mode {
println!("Powders Vec: {:?}", powdervec); println!("Powders Vec: {:?}", powdervec);