GeMercher.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:RunescapeBots 作者: lukegarbutt 项目源码 文件源码
def cancel_offer(top_left_corner, bottom_right_corner, runescape_window):
    loc_of_ge_point = pointfrombox.random_point(top_left_corner, bottom_right_corner)
    realmouse.move_mouse_to(loc_of_ge_point[0], loc_of_ge_point[1])
    pyautogui.click()
    # print('now waiting and then trying to locate x button')
    # wait_for('Tools/screenshots/abort_x_button.png', runescape_window)
    time.sleep(3+random.random())
    fail_count = 0
    # print('We are about to cancel an offer that we believe to be in the window with coords {}, we are at line 497'.format(runescape_window.bottom_right_corner))
    while True:
        cancel_loc = pyautogui.locateOnScreen('Tools/screenshots/abort_x_button.png', region=(runescape_window.top_left_corner[0], runescape_window.top_left_corner[1], runescape_window.bottom_right_corner[0]-runescape_window.top_left_corner[0], runescape_window.bottom_right_corner[1]-runescape_window.top_left_corner[1]))
        if fail_count > 3:
            print('failed 3 times so trying to locate the abort button from the inventory collect button')
            to_inv_loc = pyautogui.locateOnScreen('Tools/screenshots/to_inv_button.png', region=(runescape_window.top_left_corner[0], runescape_window.top_left_corner[1], runescape_window.bottom_right_corner[0]-runescape_window.top_left_corner[0], runescape_window.bottom_right_corner[1]-runescape_window.top_left_corner[1]))
            cancel_loc = tuple(numpy.subtract(to_inv_loc, (163, 107, 163, 8)))
        if cancel_loc == None:
            print('Failed to locate the abort button {} times, trying again in 5 seconds'.format(fail_count))
            time.sleep(5)
            fail_count += 1
        else:
            break
    # print('we have saved the location of the x button ready to click')
    # print(cancel_loc)
    point_of_cancel_button = pointfrombox.random_point((cancel_loc[0], cancel_loc[1]), (cancel_loc[0]+cancel_loc[2], cancel_loc[1]+cancel_loc[3]))
    realmouse.move_mouse_to(point_of_cancel_button[0], point_of_cancel_button[1])
    pyautogui.click()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号