Add optional mode for debug prints

This commit is contained in:
endernon 2024-09-14 20:52:06 +01:00
parent 9e2d94c625
commit fd7bc7acc8
3 changed files with 62 additions and 21 deletions

View file

@ -1,6 +1,9 @@
# idmangler-cli
Basically this generates fake items by loading from a json. Effectively a wrapper for [zatzou's idmangler-lib](https://github.com/Zatzou/idmangler-lib).
Any bugs? DM endernon on discord.
## How to get the program
### Option 1: prebuilt
Go to the [releases tab](https://git.frfrnocap.men/endernon/idmangler-cli/releases)

View file

@ -3,10 +3,10 @@
"Refer to config.md to understand how to apply the data shown here.",
"There are also some values you cannot increase beyond a limit."
],
"debug":true,
"debug":false,
"name":"Singularity",
"shiny": {
"key": "raidsWon",
"key": "lootrunsCompleted",
"value": 69
},
"ids": [
@ -16,7 +16,7 @@
{"id": "walkSpeed", "base":-40 , "roll":69},
{"id": "mainAttackDamage", "base":15, "roll":130 },
{"id": "rawMainAttackDamage", "base":444 , "roll":130 },
{"id": "rawSpellDamage", "base":222 , "roll":30 },
{"id": "rawSpellDamage", "base":222 , "roll":130 },
{"id": "spellDamage", "base":10 , "roll":130 }
],
"powder_limit": 255,

View file

@ -60,6 +60,8 @@ fn main() {
// enable fancypanic when building for release
// fancypanic();
// newest json reading code
let json_config: jsonconfig = serde_json::from_reader(
fs::File::open("config.json").expect(ERROR[1]))
@ -72,7 +74,13 @@ fn main() {
.expect(ERROR[6]);
// println!("{:?}",idsmap.get("airDamage"));
let mut debugMode = false;
if let Some(debuggering) = json_config.debug {
if debuggering == true {
debugMode = true;
println!("Debug mode enabled");
}
};
let mut out = Vec::new();
let ver = TransformVersion::Version1;
@ -140,38 +148,60 @@ fn main() {
for _i in 0..powderamount {
powdervec.push((Powders::EARTH,powdertier))
}
if debugMode {
println!("Powder type: Earth");
}
},
'T' | 't' => {
for _i in 0..powderamount {
powdervec.push((Powders::THUNDER,powdertier))
}
if debugMode {
println!("Powder type: Thunder");
}
},
'W' | 'w' => {
for _i in 0..powderamount {
powdervec.push((Powders::WATER,powdertier))
}
if debugMode {
println!("Powder type: Water");
}
},
'F' | 'f' => {
for _i in 0..powderamount {
powdervec.push((Powders::FIRE,powdertier))
}
if debugMode {
println!("Powder type: Fire");
}
},
'A' | 'a' => {
for _i in 0..powderamount {
powdervec.push((Powders::AIR,powdertier))
}
if debugMode {
println!("Powder type: Air");
}
},
_ => {
for _i in 0..powderamount {
powdervec.push((Powders::THUNDER,powdertier))
}
if debugMode {
println!("Powder type: Broken, fallback Thunder");
}
}
};
// println!("tier {}",powdertier);
// println!("amount {}",powderamount);
if debugMode {
println!("Powder tier: {}",powdertier);
println!("Powder amount: {}",powderamount);
}
}
if debugMode {
println!("Powders Vec: {:?}",powdervec);
}
// println!("{:?}",powdervec);
// old powder data encode kinda, takes data from new encode
PowderData {
@ -186,6 +216,9 @@ fn main() {
Some(i) => {
if i != 0 {
RerollData(i).encode(ver, &mut out).unwrap();
if debugMode {
println!("Rerolls: {}",i)
}
}
},
None => pass()
@ -199,11 +232,16 @@ fn main() {
for i in json_shiny {
if i.key == shiny.key {
realshinykey = i.id;
// println!("shiny key {}",shiny.key);
if debugMode {
println!("shiny key {}", shiny.key);
}
}
// println!("realshinykey: {}",realshinykey);
// println!("shinyvalue: {}",shinyvalue);
}
if debugMode {
println!("realshinykey: {}", realshinykey);
println!("shinyvalue: {}", shinyvalue);
}
ShinyData {
id: realshinykey,
val: shinyvalue as i64, //- 0b0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000,