bit of cleaning up
This commit is contained in:
parent
3220d21e73
commit
a2b82ccf22
5 changed files with 1302 additions and 16 deletions
1281
Cargo.lock
generated
1281
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -11,6 +11,7 @@ description = "A cli tool to generate fake wynntils items"
|
|||
base64 = "0.22.1"
|
||||
clap = { version = "4.5.20", features = ["derive"] }
|
||||
idmangler-lib = "0.4.0"
|
||||
reqwest = "0.12.9"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
thiserror = "1.0.68"
|
||||
|
|
|
@ -9,9 +9,10 @@ Any bugs? DM endernon on discord.
|
|||
Go to the [releases tab](https://git.frfrnocap.men/endernon/idmangler-cli/releases)
|
||||
### Option 2: compile yourself
|
||||
requirements: rust, cargo
|
||||
use cargo run --release to build and run.
|
||||
use `cargo run --release` to build and run.
|
||||
### Option 3: get from crates.io
|
||||
Requirements: rust-lang
|
||||
Requirements: rust-lang
|
||||
run `cargo install idmangler-cli`.
|
||||
|
||||
## Usage
|
||||
- Move the program to some folder along with config.json . Download these three files and place them next to the program:
|
||||
|
|
10
config.md
10
config.md
|
@ -25,14 +25,14 @@ Each value in the array must have a comma at the end except the last.
|
|||
The use of spaces is optional, as well as letter case for the $TYPE value.
|
||||
The keys ("type" "tier" "amount") must all be lowercase.
|
||||
If type is invalid, it will default back to being Thunder powder.
|
||||
#### Powders Example
|
||||
```js
|
||||
#### Powders Example (yes, this looks wacky to show that this is allowed)
|
||||
```json
|
||||
"powders": [
|
||||
{ "type":"T", "tier":6, "amount":5 },
|
||||
{"type":"e","tier":1,"amount":5},
|
||||
{"type":"F", "tier":3,"amount":1},
|
||||
{"type" :"e","tier":1,"amount":5},
|
||||
{"type": "F", "tier": 3,"amount":1},
|
||||
{ "type" : "w" , "tier":6 }
|
||||
],
|
||||
]
|
||||
```
|
||||
Note that the last powder block in array has no comma at the end.
|
||||
### Which items can have powders?
|
||||
|
|
21
src/main.rs
21
src/main.rs
|
@ -76,14 +76,18 @@ fn cook() -> Result<(), Errorfr> {
|
|||
let mut out = Vec::new();
|
||||
let ver = TransformVersion::Version1;
|
||||
|
||||
|
||||
// ENCODE: StartData
|
||||
StartData(ver)
|
||||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
|
||||
// ENCODE: TypeData
|
||||
TypeData(ItemType::Gear)
|
||||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
|
||||
// ENCODE: NameData
|
||||
NameData(String::from(format!("{}", json_config.name.trim())))
|
||||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
|
@ -112,6 +116,7 @@ fn cook() -> Result<(), Errorfr> {
|
|||
// println!("{:?} {:?} {:?}",id_id,id_base,id_roll)
|
||||
}
|
||||
|
||||
// ENCODE: IdentificationsData
|
||||
IdentificationData {
|
||||
identifications: idvec,
|
||||
extended_encoding: true,
|
||||
|
@ -119,6 +124,8 @@ fn cook() -> Result<(), Errorfr> {
|
|||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
|
||||
|
||||
|
||||
// json powder data handling
|
||||
let mut powdervec = Vec::new();
|
||||
for eachpowder in json_config.powders {
|
||||
|
@ -128,9 +135,6 @@ fn cook() -> Result<(), Errorfr> {
|
|||
for _ in 0..powderamount {
|
||||
let eletype = match eachpowder.r#type.to_ascii_lowercase() {
|
||||
'e' => {
|
||||
if debug_mode {
|
||||
|
||||
}
|
||||
Element::Earth
|
||||
}
|
||||
't' => {
|
||||
|
@ -166,7 +170,7 @@ fn cook() -> Result<(), Errorfr> {
|
|||
dbg!(&powdervec);
|
||||
}
|
||||
|
||||
// old powder data encode kinda, takes data from new encode
|
||||
// ENCODE: PowderData
|
||||
PowderData {
|
||||
powder_slots: json_config.powder_limit,
|
||||
powders: powdervec,
|
||||
|
@ -174,9 +178,12 @@ fn cook() -> Result<(), Errorfr> {
|
|||
.encode(ver, &mut out)
|
||||
.unwrap();
|
||||
|
||||
|
||||
|
||||
match json_config.rerolls {
|
||||
Some(rerollcount) => {
|
||||
if rerollcount != 0 {
|
||||
// ENCODE: RerollData if applicable
|
||||
RerollData(rerollcount).encode(ver, &mut out).unwrap();
|
||||
if debug_mode {
|
||||
dbg!(rerollcount);
|
||||
|
@ -186,11 +193,12 @@ fn cook() -> Result<(), Errorfr> {
|
|||
None => pass(),
|
||||
};
|
||||
|
||||
|
||||
|
||||
let mut realshinykey: u8;
|
||||
if let Some(shiny) = json_config.shiny {
|
||||
if let ref _shinykey = shiny.key {
|
||||
if let shinyvalue = shiny.value {
|
||||
|
||||
realshinykey = 1;
|
||||
for i in json_shiny {
|
||||
if i.key == shiny.key {
|
||||
|
@ -204,7 +212,7 @@ fn cook() -> Result<(), Errorfr> {
|
|||
dbg!(&realshinykey);
|
||||
dbg!(&shinyvalue);
|
||||
}
|
||||
|
||||
// ENCODE: ShinyData (if applicable)
|
||||
ShinyData {
|
||||
id: realshinykey,
|
||||
val: shinyvalue as i64, //- 0b0100_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000_0000,
|
||||
|
@ -220,6 +228,7 @@ fn cook() -> Result<(), Errorfr> {
|
|||
// prints (Water,6) 255 times
|
||||
// println!("{:?}",vec![(Powders::WATER, 6); 255]);
|
||||
|
||||
// ENCODE: EndData
|
||||
EndData.encode(ver, &mut out).unwrap();
|
||||
|
||||
// final string print
|
||||
|
|
Loading…
Reference in a new issue