def calculate_distance_from_const_to_waypoint(): try: x = locate_constant_locator('constant_locator')[1] - detect('waypoints/1.png')[1] y = locate_constant_locator('constant_locator2')[0] - detect('waypoints/1.png')[0] return x, y except TypeError: print('Could not find loupe or waypoint on screen, are you sure you have Tibia client focused?')
def remove_junk_from_bp(self): # while True: print('Checking if anything to throw away...') if detect('images/medicinepouch.png') != (self.loot_x, self.loot_y): pyautogui.keyDown('escape') self.throw_away_junk() if detect('images/fish.png'): for _ in range(randint(2, 5)): sleep(0.3) pyautogui.keyDown('F1')
def __init__(self): coordinates = detect('images/mana.png') self.mana_x = coordinates[1] + 5 self.mana_y = coordinates[0] + 6 self.rgb = (101, 98, 240)
def check_if_attacking(self, monster_name): if detect('images/{}_attacking.png'.format(monster_name), threshold=0.98): return True return False
def __init__(self): self.loot_collected = True self.follow_coordinates = detect('images/follow.png') self.battle_coordinates = detect('images/battle.png') self.no_monster_on_screen_rgb = (70, 70, 70)
def locate_constant_locator(locator): return detect('images/{}.png'.format(locator))
def move_to_waypoint(waypoint_number): if not waypoint_number: raise ValueError('Waypoint number has not been provided') coordinates = detect('waypoints/{}.png'.format(waypoint_number)) pyautogui.click(coordinates[1], coordinates[0])
def waypoint_achieved(waypoint_number): x_locator = locator_x_position[1] - detect('waypoints/{}.png'.format(waypoint_number))[1] == locator_x_distance # noqa y_locator = locator_y_position[0] - detect('waypoints/{}.png'.format(waypoint_number))[0] == locator_y_distance # noqa if x_locator and y_locator: return True return False
def __init__(self): self.pos = detect('images/medicinepouch.png') self.x = settings.X_MIDDLE self.y = settings.Y_MIDDLE self.loot_x = self.pos[0] self.loot_y = self.pos[1]