AxesOfEvil / NGU-save-parser

0 stars 2 forks source link

No special divisor found for .. #4

Closed tex0l closed 2 years ago

tex0l commented 2 years ago

When I try to optimize with the following command:

python optimize.py --infile ./saves/NGUSave-Build-1260-avril-03-15-20.txt --stat ngu

I get the following error log:

CRITICAL:root:No special divisor found for Res3Power (Item: 392 - Bread Bowl Helmet @ head/1
head/1: Res3Power
CRITICAL:root:No special divisor found for Res3Cap (Item: 392 - Bread Bowl Helmet @ head/2
head/2: Res3Cap
CRITICAL:root:No special divisor found for WishSpeed (Item: 417 - Broken Drum @ chest/1
chest/1: WishSpeed
....

Do you have any idea why?

AxesOfEvil commented 2 years ago

You are farther into the game then I, and have item types I couldn't validate. Look at spectypes.py You'll see that Res3Power, Res3Cap, WishSpeed have the divisor set as 0. You need to figure out what the correct divisor is for these properties. The divisor is applied at optimize.py:33 and should be whatever the value you see in the json for this item's property / the value shown in game. Since these resources are unique, you could also just set the divisor in spectypes.py to 1 to let the code proceed, but if you want to submit a pull request, I'd like to have the correct values in there.

tex0l commented 2 years ago

Let me understand more precisely, is it the divisor between the boost level and the actual bonus the items provides? For example, if I take this item: https://ngu-idle.fandom.com/wiki/A_Bed_Rock it has at max level 1 998 000 000 points maximum for wishes, it provides at this level a 199.8% bonus, so the divisor would be 10 000 000 for wishes, is that right?

AxesOfEvil commented 2 years ago

Yes. This is not really important for properties that do not have multiple scalars, but it is needed to be able to compare items for instance: https://ngu-idle.fandom.com/wiki/Beam_Laser_Sword to https://ngu-idle.fandom.com/wiki/The_Fists_of_Flubber The 1st takes 10 points to make the magic bars go up by 1%, whereas the 2nd takes 1000 points to make the magic bars go up by 1%

So WishSpeed and Res3Cap both appear to need a divisor of 10_000_000 and Res3Pow appears to be 1_000_000

tex0l commented 2 years ago

Ok understood, thanks, if I'm right these are the correct params:

    SpecObj("DaycareSpeed", 100000),
    SpecObj("QuestDrop", 1000000),
    SpecObj("Blood", 0),
    SpecObj("Res3Power", 1000000),
    SpecObj("Res3Bar", 1000000),
    SpecObj("Res3Cap", 1000000),
    # 50
    SpecObj("HackSpeed", 10000000),
    SpecObj("WishSpeed", 10000000),

However now I'm getting :

 CRITICAL:root:Can't handle item type Res3Power

Any idea why?

tex0l commented 2 years ago

Ok got it, it's the stats.py:

            # DaycareSpeed
            # Blood
            # Res3Power
            # Res3Cap
            # Res3Bars
            # HackSpeed
            # WishSpeed
            # GoldRNG
AxesOfEvil commented 2 years ago

Would you mind filing a pull-request for this change?

tex0l commented 2 years ago

Sure, I've done the PR.

BTW, I wanted to reimplement your parsing & stuff into gear-optimizer: https://github.com/tex0l/gear-optimizer

AxesOfEvil commented 2 years ago

Thanks. Fix merged

AxesOfEvil commented 2 years ago

BTW: If you haven't seen it, there is a hack at parse_saves.py line 57 where the offset is hardcoded. The serialized data is embedded in a wrapper that does some validation and whatnot. We never spent the time to fully parse this, and just coded the relevant offset to the serialized data. In theory this could change in the future, though it has worked fine for the past year

tex0l commented 2 years ago

Yeah, I've seen that, the only thing prepended to the base64 data is a checksum, which is probably of fixed length. I'm not sure however what kind of checksum is used 🤷, maybe an md5 or something, I'd need to compare multiple save files to be sure.., but I actually don't want to find out, otherwise I could probably forge a save file 🙄