GeMercher.py 文件源码

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

项目:RunescapeBots 作者: lukegarbutt 项目源码 文件源码
def find_up_to_date_sell_price(runescape_window, ge_slot):
    # click correct buy bag
    move_mouse_to_image_within_region('Tools/screenshots/buy_bag.png', ge_slot)
    pyautogui.click()
    wait_for('Tools/screenshots/quantity_box.png', runescape_window)
    # buy item for lots of money
    move_mouse_to_image_within_region('Tools/screenshots/search_box.png', runescape_window)
    pyautogui.click()
    time.sleep(1+random.random())
    random_typer(str(ge_slot.item.item_name))
    wait_for(ge_slot.item.image_in_ge_search, runescape_window)
    move_mouse_to_image_within_region(ge_slot.item.image_in_ge_search, runescape_window)
    pyautogui.click()
    move_mouse_to_image_within_region('Tools/screenshots/+1_button.png', runescape_window)
    pyautogui.click()

    '''move_mouse_to_image_within_region('Tools/screenshots/+5perc_button.png', runescape_window)
    for i in range(random.randint(25,35)):
        pyautogui.click()
        time.sleep(random.random()/7)'''

    coords_of_price_box = pointfrombox.random_point((runescape_window.bottom_right_corner[0]-384, runescape_window.bottom_right_corner[1]-272), (runescape_window.bottom_right_corner[0]-291, runescape_window.bottom_right_corner[1]-259))##########################
    realmouse.move_mouse_to(coords_of_price_box[0], coords_of_price_box[1])
    pyautogui.click()
    time.sleep(2+random.random())
    random_typer('1m')
    pyautogui.press('enter')#########################################################################################################

    time.sleep(random.random()+1)
    move_mouse_to_image_within_region('Tools/screenshots/confirm_offer_button.png', runescape_window)
    pyautogui.click()
    # need to add a way of putting this 1 item bought on cooldown
    runescape_window.add_single_item_to_cooldown(ge_slot.item)
    ge_slot.item.update_number_available_to_buy(ge_slot.item.number_available_to_buy-1)
    wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
    # collect item
    collect_items_from_ge_slot(ge_slot, runescape_window)
    # click sale history
    move_mouse_to_image_within_region('Tools/screenshots/sale_history_button.png', runescape_window)
    pyautogui.click()
    wait_for('Tools/screenshots/sale_history_check.png', runescape_window)
    # check price
    buy_price = check_price(runescape_window)
    # update price
    ge_slot.item.set_price_instant_bought_at(buy_price)
    # updating the amount of money in the window
    runescape_window.update_money(runescape_window.money-buy_price)
    # click grand exchange window
    move_mouse_to_box('Tools/screenshots/grand_exchange_button.png',
                        runescape_window.top_left_corner, runescape_window.bottom_right_corner)
    pyautogui.click()
    wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
    runescape_window.set_time_of_last_action()
    ge_slot.item.set_time_of_last_pc()
    print('{} instantly bought for a price of {}'.format(ge_slot.item.item_name, ge_slot.item.price_instant_bought_at))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号