Skip to content

Commit

Permalink
adds a manual collect list that gets collected on update
Browse files Browse the repository at this point in the history
  • Loading branch information
qwint committed May 30, 2024
1 parent 05d2ba4 commit d05f74c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions worlds/tracker/TrackerClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def _cmd_event_inventory(self):
for event in sorted(events):
logger.info(event)

def _cmd_manually_collect(self, item_name: str):
"""Manually adds an item name to the CollectionState to test """
self.ctx.manual_items.append(item_name)
updateTracker(self.ctx)
logger.info("Added {item_name} to manually collect")


class TrackerGameContext(CommonContext):
from kvui import GameManager
Expand All @@ -78,6 +84,7 @@ def __init__(self, server_address, password):
self.datapackage = []
self.multiworld: MultiWorld = None
self.player_id = None
self.manual_items = []

def clear_page(self):
if self.tracker_page is not None:
Expand Down Expand Up @@ -424,17 +431,17 @@ def updateTracker(ctx: TrackerGameContext):

callback_list = []

for item in ctx.items_received:
for item_name in [item[0] for item in ctx.items_received] + ctx.manual_items:
try:
world_item = ctx.multiworld.create_item(ctx.multiworld.worlds[ctx.player_id].item_id_to_name[item[0]],
world_item = ctx.multiworld.create_item(ctx.multiworld.worlds[ctx.player_id].item_id_to_name[item_name],
ctx.player_id)
state.collect(world_item, True)
if world_item.classification == ItemClassification.progression or world_item.classification == ItemClassification.progression_skip_balancing:
prog_items[world_item.name] += 1
if world_item.code is not None:
all_items[world_item.name] += 1
except:
ctx.log_to_tab("Item id " + str(item[0]) + " not able to be created", False)
ctx.log_to_tab("Item id " + str(item_name) + " not able to be created", False)
state.sweep_for_events(
locations=(location for location in ctx.multiworld.get_locations() if (not location.address)))

Expand Down

0 comments on commit d05f74c

Please sign in to comment.