コード例 #1
0
 async def run(self):
     await game.equip_item_by_name(constants.WATERING_CAN)
     async for crop in game.navigate_tiles(self.get_unwatered_crops,
                                           game.generic_next_item_key,
                                           allow_action_on_same_tile=False):
         await game.equip_item_by_name(constants.WATERING_CAN)
         await game.swing_tool()
コード例 #2
0
 async def run(self):
     await game.equip_item_by_name(constants.AXE)
     async for tree in game.navigate_tiles(
             game.get_fully_grown_trees_and_stumps,
             game.generic_next_item_key):
         await game.equip_item_by_name(constants.AXE)
         await game.chop_tree_and_gather_resources(tree)
コード例 #3
0
 async def run(self):
     await game.equip_item_by_name(constants.SCYTHE)
     async for debris in game.navigate_tiles(
             game.get_grass,
             game.next_debris_key,
             items_ok=lambda prev, items: True):
         await game.equip_item_by_name(constants.SCYTHE)
         await game.swing_tool()
コード例 #4
0
 async def run(self):
     async with server.player_status_stream() as stream:
         await game.equip_item_by_name(constants.HOE)
         player_status = await stream.next()
     player_tile = player_status["tileX"], player_status["tileY"]
     facing_direction = player_status['facingDirection']
     start_tile = game.next_tile(player_tile, facing_direction)
     plot_tiles = set()
     x_increment = -1 if game.last_faced_east_west == constants.WEST else 1
     y_increment = -1 if game.last_faced_north_south == constants.NORTH else 1
     for i in range(self.n1):
         x = start_tile[0] + i * x_increment
         for j in range(self.n2):
             y = start_tile[1] + j * y_increment
             plot_tiles.add((x, y))
     get_next_diggable = functools.partial(game.get_diggable_tiles,
                                           plot_tiles)
     async for hdt in game.navigate_tiles(
             get_next_diggable,
             game.generic_next_item_key,
             allow_action_on_same_tile=False,
             items_ok=game.disallow_previous_item):
         await game.equip_item_by_name(constants.HOE)
         await game.swing_tool()
コード例 #5
0
 async def run(self):
     async for hdt in game.navigate_tiles(
             self.get_hoe_dirt,
             game.generic_next_item_key,
             items_ok=game.disallow_previous_item):
         await game.do_action()
コード例 #6
0
 async def run(self):
     async for debris in game.navigate_tiles(self.get_debris,
                                             game.next_debris_key):
         await self.at_tile(debris)
コード例 #7
0
 async def run(self):
     async for crop in game.navigate_tiles(
             self.get_harvestable_crops,
             game.generic_next_item_key,
             items_ok=game.disallow_previous_item):
         await game.do_action()