MCPcopy
hub / github.com/PokemonGoF/PokemonGo-Bot / AppliedItems

Class AppliedItems

pokemongo_bot/inventory.py:373–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371
372
373class AppliedItems(_BaseInventoryComponent):
374 TYPE='applied_items'
375 ID_FIELD = 'item_id'
376 STATIC_DATA_FILE = os.path.join(_base_dir, 'data', 'items.json')
377
378 def all(self):
379 """
380 Get EVERY Item from the cached inventory.
381 :return: List of evey item in the cached inventory
382 :rtype: list of Item
383 """
384 return list(self._data.values())
385
386 def get(self, item_id):
387 """
388 Get ONE Item from the cached inventory.
389 :param item_id: Item's ID to search for.
390 :return: Instance of the item from the cached inventory
391 :rtype: Item
392 """
393 return self._data.setdefault(item_id, Item(item_id, 0))
394
395 @classmethod
396 def name_for(cls, item_id):
397 """
398 Search the name for an item from its ID.
399 :param item_id: Item's ID to search for.
400 :return: Item's name.
401 :rtype: str
402 """
403 return cls.STATIC_DATA[str(item_id)]
404
405class Pokemons(_BaseInventoryComponent):
406 TYPE = 'pokemon_data'

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected