Building ATMA for Torchlight 2 (FNIStash)

Back in my old Diablo 2 days, there was an incredible third-party application called ATMA.  ATMA was a muling application for single player.  In Diablo 2, your characters have limited space in your inventory, so you frequently needed to either toss valuable items away or put them on a separate character (called a mule).  ATMA (short for A Tenshi Muling Application) essentially gave you a limitless inventory for your characters.  By modifying the actual Diablo 2 save files, it could “pull” items out of your character’s inventory, store them in a separate and searchable database, and then insert them back into your inventory when you wanted them.

Well, I’ve been playing a little Torchlight 2 recently and found that no similar utility currently exists.  Searching the Torchlight 2 forums reveals a few posts related to the topic, including the scrambling/descrambling algorithm used to obscure the save files, as well as the item format.  Cthon (of clockworkcore.org, I believe) is the furthest along.  He wrote a TL2 character editor that’s quite nice, so I imagine it’s only a matter of time before a nice muling app comes out as well.  The CC website says that the full file specification will be out “hopefully before the end of October.”

Well, I got tired of waiting so I started working on it myself.  Here’s an excerpt of my shared stash data dump after running my code on it:

Full name:  Labarinto Boots
Num Enchants: 1
Item level: 70
Used Sockets: 0/2
Dmg/Armor: 4294967295/51
Num elements: 0
Num mods: 4
Mods: Right [Right

Type: 32833
Name: “OFTHETURTLE ARMOR BONUS”

,Right

Type: 32833
Name: “OFTHEBEAR DAMAGE BONUS”

,Right

Type: 32833
Name: “”

,Right

Type: 33857
Name: “TRINKET_ELECTRICDEFENSE ELECTRICAL DEFENSE”

]
Footer: 0x 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

The “Right” labels are a Haskell thing indicating something was achieved successfully.  In this case, it’s parsing the mods out of the file correctly.

What I eventually hope to build is a small utility similar to ATMA, which I have tentatively named FNIStash. I want to include basic searchability, and maybe at some point in the future an optimization tool that will automatically select a good set of gear based on certain criteria.  GUI maybe someday, although I’m primarily using this project as a way to learn more Haskell.

I wouldn’t count out clockworkcore.org yet.  I suspect they have something pretty well developed already but are keeping it under wraps until it’s done.