Skip to content

Bug: Stardew Valley slot data breaks the WebHost #5825

@OriginalTomPouce

Description

@OriginalTomPouce

What happened?

Hello !

I'm building a silly tracker that displays game inventories from a multiworld (a normal AP multiworld tracker). I'm using the WebHost API to fetch the multiworld data, including the slot data in order to get some goal info.

I'm using this API call :
/slot_data_tracker/<suuid:tracker>

However, some multiworlds send me back a 500 error when I try to get the slot_data. After some investigation (a good number of local gens and local hosts), Stardew Valley appaears to always break that API call.

The reason why is because of the generated slot data. Stardew Valley uses an hybrid structure to store their bundles. That structure, once set on the database, always breaks the Webhost when it tries to retrieve it.

File that cause the issue : /worlds/stardew_valley/init.py , line 363

        for room in self.modified_bundles:
            bundles[room.name] = dict()
            for bundle in room.bundles:
                bundles[room.name][bundle.name] = {"number_required": bundle.number_required}
                for i, item in enumerate(bundle.items):
                    bundles[room.name][bundle.name][i] = f"{item.get_item()}|{item.amount}|{item.quality}"

I've checked the Stardew Valley mod to see if the slot_data is used. It is, and we have to keep the number_required key on the same level as their associated items.

Github of the mod : https://github.com/agilbert1412/StardewArchipelago
An example of a class that parse the bundle structure : https://github.com/agilbert1412/StardewArchipelago/blob/main/StardewArchipelago/Bundles/ItemBundle.cs

The safest way to solve this would be to add the bundle items as a key, by casting the index into a str :

                    bundles[room.name][bundle.name][str(i)] = f"{item.get_item()}|{item.amount}|{item.quality}"

I set this as an issue because I don't have a copy of Stardew Valley. I cannot do an end to end test.

What were the expected results?

The /slot_data_tracker/<suuid:tracker> should send me the slot_data as usual. Or maybe not take into account any invalid data.

I'm aware that slot_data can be too versatile.

Software

Website

Metadata

Metadata

Assignees

No one assigned

    Labels

    is: bug/fixIssues that are reporting bugs or pull requests that are fixing bugs.waiting-on: otherIssue/PR is waiting for something else, like another PR.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions