-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incompatible with Alpha v0.21 Saves #5
Comments
Hi, since I really enjoy using your tool, I had a quick look at it. I could get it working for my savefile with some very minimalistic changes, although them being not clean. The saved data is stored as arrays now:
By reassigning them to the original saveJSON['itemStats'] = (saveJSON['ns'] && saveJSON['ns'][3] && saveJSON['ns'][3][0]) ?? [];
saveJSON['monsterStats'] = (saveJSON['s'] && saveJSON['s'][21]) ?? [];
saveJSON['petUnlocked'] = (saveJSON['s'] && saveJSON['s'][22]) ?? []; The data for pets is the same, but the array for items and monsters contain more data. So I updated the functions to check the right column. For items this is the first column of 3. For monsters, it's the third column of 10. function getMissingItemIDs(itemStats) {
var missingIDs = []
itemStats.forEach(function(item, index) {
if (item == 0 && index%3 == 0) {
missingIDs.push((index/3).toString())
}
});
return missingIDs;
}
function getMissingMonsterIDs(monsterStats) {
var missingIDs = Object.keys(melvorData['monsters']);
var missingIDs = []
monsterStats.forEach(function(monster, index) {
if (index%10 == 2 && monster == 0) {
missingIDs.push(((index - index%10)/10).toString())
}
});
return missingIDs;
} With these minimal changes, it worked for me. But it's very fragile. The column order is found in https://melvoridle.com/assets/js/game/serializeSave.js?989. This might change in the future as it's decided by the game version (currently 3) which decides the order of fields: I did not check where it's decided how many subtables there are. Since it's potentially dynamic, it could break quite easily, even with patch updates. For items, the second and third column are respectively quantity sold and GP gained. |
@cdd1 I cannot overstate how awesome this feedback is. I've updated the site with your fix (53a506d). You're right this is likely is fragile, but I wanted to get it up and running immediately. I am going to leave this open for some improvements. I believe I can use the "tooling" side of the repo to bring in the serialVars to make it more reliable. |
There was a SIGNIFICANT re-write in how saving works in Melvor Idle with Alpha v0.21. Old saves were just gzipped JSON files. New saves are smaller serialized objects which require significant portions of the game code to read.
I will work on this "soon" but after playing with it for a few hours this looks to be a bigger task.
If anyone knows of an open source project that is working with these saves outside of the Melvor game code please post here.
Pull requests also welcome!
The text was updated successfully, but these errors were encountered: