Skip to content
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

Core: add correct flags to precollected items #2059

Closed
wants to merge 11 commits into from
2 changes: 1 addition & 1 deletion Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def write_multidata():
games[slot] = multiworld.game[slot]
slot_info[slot] = NetUtils.NetworkSlot(group["name"], multiworld.game[slot], multiworld.player_types[slot],
group_members=sorted(group["players"]))
precollected_items = {player: [item.code for item in world_precollected if type(item.code) == int]
precollected_items = {player: [(item.code, item.flags) for item in world_precollected if type(item.code) == int]
for player, world_precollected in multiworld.precollected_items.items()}
precollected_hints = {player: set() for player in range(1, multiworld.players + 1 + len(multiworld.groups))}

Expand Down
9 changes: 6 additions & 3 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,12 @@ def _load(self, decoded_obj: dict, game_data_packages: typing.Dict[str, typing.A
for player, loc_data in decoded_obj["er_hint_data"].items()}

# load start inventory:
for slot, item_codes in decoded_obj["precollected_items"].items():
self.start_inventory[slot] = [NetworkItem(item_code, -2, 0) for item_code in item_codes]

for slot, items in decoded_obj["precollected_items"].items():
# TODO: remove conditionals after version 0.4.5 and reject loading old multidata
if items and isinstance(items[0], tuple):
self.start_inventory[slot] = [NetworkItem(item_code, -2, 0, flags) for item_code, flags in items]
else:
self.start_inventory[slot] = [NetworkItem(item_code, -2, 0) for item_code in items]
for slot, hints in decoded_obj["precollected_hints"].items():
self.hints[0, slot].update(hints)

Expand Down
Loading