예제 #1
0
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?')
예제 #2
0
파일: utils.py 프로젝트: bartkoz/TibiaBot
 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')
예제 #3
0
 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)
예제 #4
0
파일: attack.py 프로젝트: bartkoz/TibiaBot
 def check_if_attacking(self, monster_name):
     if detect('images/{}_attacking.png'.format(monster_name),
               threshold=0.98):
         return True
     return False
예제 #5
0
파일: attack.py 프로젝트: bartkoz/TibiaBot
 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)
예제 #6
0
def locate_constant_locator(locator):
    return detect('images/{}.png'.format(locator))
예제 #7
0
 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])
예제 #8
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
예제 #9
0
파일: utils.py 프로젝트: bartkoz/TibiaBot
 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]