Skip to content

Commit

Permalink
fixed manual collect to actually add the item to inventory correctly,…
Browse files Browse the repository at this point in the history
… work with spaces, and respond better (ArchipelagoMW#7)
  • Loading branch information
qwint authored Jun 12, 2024
1 parent 7b5a10c commit affd65e
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions worlds/tracker/TrackerClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from worlds import AutoWorld
from worlds.tracker import TrackerWorld
from collections import Counter
from MultiServer import mark_raw

from Generate import main as GMain, mystery_argparse

Expand Down Expand Up @@ -53,17 +54,18 @@ def _cmd_event_inventory(self):
for event in sorted(events):
logger.info(event)

def _cmd_manually_collect(self, item_name: str):
@mark_raw
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")
logger.info(f"Added {item_name} to manually collect.")

def _cmd_reset_manually_collect(self):
"""Resets the list of items manually collected by /manually_collect"""
self.ctx.manual_items = []
updateTracker(self.ctx)
logger.info("Reset manually collect")
logger.info("Reset manually collect.")


class TrackerGameContext(CommonContext):
Expand Down Expand Up @@ -437,10 +439,10 @@ def updateTracker(ctx: TrackerGameContext):

callback_list = []

for item_name in [item[0] for item in ctx.items_received] + ctx.manual_items:
item_id_to_name = ctx.multiworld.worlds[ctx.player_id].item_id_to_name
for item_name in [item_id_to_name[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_name],
ctx.player_id)
world_item = ctx.multiworld.create_item(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
Expand Down

0 comments on commit affd65e

Please sign in to comment.