Sebaestschjin / gloomhaven-campaign-manager

Simplify the management of your Gloomhaven campaign progress in Tabletop Simulator.
MIT License
7 stars 5 forks source link

Base64 encode/decode broken for player notes #77

Closed CombatZAK closed 3 years ago

CombatZAK commented 3 years ago

Campaign manager Version: 2.2.0 Campaign file: https://pastebin.com/4S1v96hc

Repro Steps:

Above file saved successfully per instructions. Attempting to load file in new campaign generates the following error message:

Error in Script (Gloomhaven campaign manager - 535305) function : chunk_3:(5159,8-77): attempt to perform arithmetic on a nil value

The referenced script line is: local v = map[a] * 0x40000 + map[b] * 0x1000 + map[c] * 0x40 + map[d] in function Base64.decode(b64, map)

Scanning the savefile, the only Base64 encoded data is player notes; removing this data allows the file to be loaded successfully. This implies that either there is a problem with the decoding function, or the encoding function is silently corrupting the data for this file. The unencoded values for this save file are as follows

Red

Gloomhaven - 1 Dagger Forest - 1 Lingering Swamp - Watcher Mountains - Copperneck Mountains - Misty Sea -

Angel of Death - Darkness - 300 Prepare for the Kill - +1 55 +1 130

White

14 Exhausts

This is not a blocker for our campaign since I was able to load successfully by removing the notes from the savefile. But this may impact other users.

Sebaestschjin commented 3 years ago

Huh, interesting find! The error seems to be in the Base64 library I use and fails for all cases for the decoded Base64 value contains an uppercase A. Funny, that all the test cases I use don't include an uppercase A. I opened an issue on the library, so I guess it will be fixed soon. :-)

Sebaestschjin commented 3 years ago

The library got fixed, so it's also fixed now in the latest version.