def handle_cancelling_buy(runescape_window, ge_slot, list_of_items_in_use):
# click box 1
box_1_loc = pointfrombox.random_point((runescape_window.bottom_right_corner[0]-303, runescape_window.bottom_right_corner[1]-164), (runescape_window.bottom_right_corner[0]-273, runescape_window.bottom_right_corner[1]-139))
realmouse.move_mouse_to(box_1_loc[0], box_1_loc[1])
pyautogui.click()
# runescape_window.update_money(runescape_window.money+((ge_slot.item.quantity_to_buy-2)*ge_slot.item.price_instant_sold_at)) think this line is breaking it
# wait and check if we have jumped back to the main window, handle this
time.sleep(3)
if not len(list(pyautogui.locateAllOnScreen('Tools/screenshots/lent_item_box.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])))) > 0:
# we have to click box 2 still so click it and handle it
box_2_loc = pointfrombox.random_point((runescape_window.bottom_right_corner[0]-254, runescape_window.bottom_right_corner[1]-165), (runescape_window.bottom_right_corner[0]-224, runescape_window.bottom_right_corner[1]-139))
realmouse.move_mouse_to(box_2_loc[0], box_2_loc[1])
pyautogui.click()
# if not then click box 2 and proceed to sell the item
wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
if ge_slot.item.number_available_to_buy > 0:
find_up_to_date_sell_price(runescape_window, ge_slot)
ge_slot.item.set_price_instant_bought_at(ge_slot.item.price_instant_bought_at-1)
sell_items(runescape_window, ge_slot, record_number_selling=True)
runescape_window.add_to_items_on_cooldown(ge_slot.item)
ge_slot.item.update_number_available_to_buy(ge_slot.item.number_available_to_buy-ge_slot.item.quantity_to_buy)
return()
# item didnt buy any of so we can just mark this slot as open and start again
runescape_window.update_money(runescape_window.money+((ge_slot.item.quantity_to_buy-2)*ge_slot.item.price_instant_sold_at))
ge_slot.update_buy_or_sell_state(None)
list_of_items_in_use.remove(ge_slot.item.item_name)
ge_slot.item.set_price_instant_bought_at(None)
ge_slot.item.set_price_instant_sold_at(None)
ge_slot.set_item_in_ge_slot(None)
评论列表
文章目录