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