def get_inventories_component(
    model: language_model.LanguageModel,
    memory: associative_memory.AssociativeMemory,
    players: Sequence[entity_agent.EntityAgent],
    main_players: Sequence[entity_agent.EntityAgent],
    player_configs: Sequence[formative_memories.AgentConfig],
    clock_now: Callable[[], datetime.datetime] = datetime.datetime.now,
) -> tuple[component.Component, gm_components.inventory_based_score.Score]:
  """Get the inventory tracking component for the game master."""
  alchemy_texts = (
      'tabula smaragdina',
      'secreta secretorum',
  )
  money_config = ItemTypeConfig(name='coin')
  laudanum_config = ItemTypeConfig(
      name='laudanum bottle', minimum=0, maximum=np.inf
  )
  tabula_smaragdina_config = ItemTypeConfig(
      name=alchemy_texts[0], minimum=0, maximum=1, force_integer=True
  )
  secreta_secretorum_config = ItemTypeConfig(
      name=alchemy_texts[1], minimum=0, maximum=1, force_integer=True
  )
  player_initial_endowments = {
      config.name: config.extras['initial_endowment']
      for config in player_configs
  }
  inventories = gm_contrib.restricted_inventory.RestrictedInventory(
      model=model,
      memory=memory,
      item_type_configs=[
          money_config,
          laudanum_config,
          tabula_smaragdina_config,
          secreta_secretorum_config,
      ],
      players=players,
      player_initial_endowments=player_initial_endowments,
      clock_now=clock_now,
      financial=True,
      name='possessions',
      verbose=True,
  )

  score = gm_components.inventory_based_score.Score(
      inventory=inventories,
      players=main_players,  # Only main players get a score.
      targets={
          'Doctor Cornelius Ashmole': alchemy_texts,
          'Madame Esmeralda Dee': alchemy_texts,
      },
      verbose=True,
  )
  return inventories, score
Get the inventory tracking component for the game master.
examples/deprecated/modular/environment/london_esoteric_market_1870.py