codeshaunted / monke

Command line packing/unpacking tool for Bloons TD 6 save files
Apache License 2.0
22 stars 6 forks source link

[Documentation] - BTD6 Insta Monkeys #16

Closed MGJerry closed 1 year ago

MGJerry commented 1 year ago

Disclaimer:

(to codeshaunted) This is not an issue, more like a guide to whoever want to do something similar in the future. Doing this since there's not "wiki" section to this repo. (to everyone else) This is a somewhat illegal of a guide on how to add, edit or remove your insta monkeys. So like what codeshaunted stated with using this repo's code and release program, use at your own risk.

Reading the list

After unpacking your save file (aka Profile.Save), your list of insta monkeys is saved as something similar to this "instaTowers":{"'insert tower name here'":[1024,2176,7184,...],...}

The "tower name" part is basically... the tower's name. That's it, it is pretty simple and self-explanatory. If you don't have a insta monkey of any tower you want before, just check the "towerXp" part at the beginning of the unpacked save file for its name.

The array of number after the tower's name is the list of insta monkeys of that specific tower. The crosspath and the number of insta monkeys with that exact crosspath? All saved as integers in that array.

Adding / Editing

So, after hours and hours of testing*, the integers follow one simple binary pattern:

Number of Insta(s) Bottom Path Upgrade(s) Middle Path Upgrade(s) Top Path Upgrade(s) isNew?
Bit(s) 22** 3 3 3 1
Values More than 0 000 - 101
0 - 5 upgrades
000 - 101
0 - 5 upgrades
000 - 101
0 - 5 upgrades
0 - false
1 - true

For non-programmers and less tech-savvy people, just put this formula in your calculator: number of insta x 1024 + bottom path upgrade x 128 + middle path upgrade x 16 + top path upgrade x 2 = result (isNew usually doesn't matter, so add 1 to your result if you want a big red exclamation on the top corner of your shiny new insta, more power to you I guess)

Example (top-middle-bottom crosspath):

Notes:

*Actually just 30 minutes of trials and errors in reality lmao **I only test up to 6 bits or 63 instas (with the bits behind it, in total 16 bits or 2 bytes) but theoretically, it should be able to goes up to 4+ million (unsigned int) or 2+ million (signed int)

codeshaunted commented 1 year ago

Hacking in microtransaction items is best left as an exercise for the reader. Closing.

MGJerry commented 1 year ago

Yup, agreed. I mostly use this because I was too lazy to grind for instas on my modded profile to use for coop matches with friends :)