Пример #1
0
def sell_items(runescape_window, ge_slot):
	# click correct sell bag
	move_mouse_to_image_within_region('Tools/screenshots/sell_bag.png', ge_slot)
	pyautogui.click()
	wait_for('Tools/screenshots/quantity_box.png', runescape_window)
	# click item in inv
	coords_of_item = pointfrombox.random_point((runescape_window.bottom_right_corner[0]-180, runescape_window.bottom_right_corner[1]-372),
		(runescape_window.bottom_right_corner[0]-166, runescape_window.bottom_right_corner[1]-349))
	realmouse.move_mouse_to(coords_of_item[0], coords_of_item[1])
	pyautogui.click()
	# click all button incase
	move_mouse_to_image_within_region("Tools/screenshots/all_button.png", runescape_window)
	pyautogui.click()
	# click price button
	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())
	# type price in and hit enter
	random_typer(str(ge_slot.item.price_instant_bought_at))
	pyautogui.press('enter')
	# click confirm
	move_mouse_to_image_within_region("Tools/screenshots/confirm_offer_button.png", runescape_window)
	pyautogui.click()
	# update state of ge slot
	ge_slot.update_buy_or_sell_state('sell')
	wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
	runescape_window.set_time_of_last_action()
	print('Placed a sell order for {} {} at {} each'.format(ge_slot.item.quantity_to_buy, ge_slot.item.item_name, ge_slot.item.price_instant_bought_at))
Пример #2
0
def examine_money(position):
	# this whole block just examines the amount of money
	point = pointfrombox.random_point((138, 94), (189, 109))
	# that the account has just for auto log out purposes
	money_pouch = (position[0] - point[0], position[1] - point[1])
	# so that it has a recording of the last time an action
	realmouse.move_mouse_to(money_pouch[0], money_pouch[1])
	# was taken and can keep track of this value in future to stop logouts
	# occuring
	pyautogui.click(button='right')
	point = pointfrombox.random_point((-75, -35), (74, -24))
	examine = (money_pouch[0] - point[0], money_pouch[1] - point[1])
	realmouse.move_mouse_to(examine[0], examine[1])
	pyautogui.click()
Пример #3
0
def collect_items_from_ge_slot(ge_slot, runescape_window):
	point_to_click = pointfrombox.random_point(ge_slot.top_left_corner, ge_slot.bottom_right_corner)
	realmouse.move_mouse_to(point_to_click[0], point_to_click[1])
	pyautogui.click()
	wait_for('Tools/screenshots/completed_offer_page.png', runescape_window)
	point_of_item_collection_box_1 = pointfrombox.random_point((runescape_window.bottom_right_corner[0] - 303, runescape_window.bottom_right_corner[
															   1] - 166), (runescape_window.bottom_right_corner[0] - 273, runescape_window.bottom_right_corner[1] - 138))
	point_of_item_collection_box_2 = pointfrombox.random_point((runescape_window.bottom_right_corner[0] - 254, runescape_window.bottom_right_corner[
															   1] - 166), (runescape_window.bottom_right_corner[0] - 222, runescape_window.bottom_right_corner[1] - 138))
	realmouse.move_mouse_to(point_of_item_collection_box_2[0], point_of_item_collection_box_2[1])
	pyautogui.click()
	realmouse.move_mouse_to(point_of_item_collection_box_1[0], point_of_item_collection_box_1[1])
	pyautogui.click()
	wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
Пример #4
0
def find_up_to_date_buy_price(runescape_window, ge_slot):
	# click correct sell bag
	move_mouse_to_image_within_region('Tools/screenshots/sell_bag.png', ge_slot)
	pyautogui.click()
	wait_for('Tools/screenshots/quantity_box.png', runescape_window)
	# sell item for cheap
	coords_of_item = pointfrombox.random_point((runescape_window.bottom_right_corner[0]-180, runescape_window.bottom_right_corner[1]-372),
		(runescape_window.bottom_right_corner[0]-166, runescape_window.bottom_right_corner[1]-349))
	realmouse.move_mouse_to(coords_of_item[0], coords_of_item[1])
	pyautogui.click()
	move_mouse_to_image_within_region('Tools/screenshots/-5perc_button.png', runescape_window)
	for i in range(random.randint(20,35)):
		pyautogui.click()
		time.sleep(random.random()/7)
	time.sleep(random.random()+1)
	move_mouse_to_image_within_region('Tools/screenshots/confirm_offer_button.png', runescape_window)
	pyautogui.click()
	wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
	# collect money
	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
	sell_price = check_price(runescape_window)
	# update price
	ge_slot.item.set_price_instant_sold_at(sell_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()
	print('{} instantly sold for a price of {}'.format(ge_slot.item.item_name, ge_slot.item.price_instant_sold_at))
Пример #5
0
def buy_item(runescape_window, ge_slot):
	# click the 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)
	# click search box
	move_mouse_to_image_within_region('Tools/screenshots/search_box.png', runescape_window)
	pyautogui.click()
	# type in item
	random_typer(str(ge_slot.item.item_name))
	wait_for(ge_slot.item.image_in_ge_search, runescape_window)
	# click item
	move_mouse_to_image_within_region(ge_slot.item.image_in_ge_search, runescape_window)
	pyautogui.click()
	# click price box
	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(random.random()+1)
	# type in correct price and hit enter
	random_typer(str(ge_slot.item.price_instant_sold_at))
	pyautogui.press('enter')
	# click quantity box
	move_mouse_to_image_within_region("Tools/screenshots/quantity_box.png", runescape_window)
	pyautogui.click()
	time.sleep(random.random()+2)
	# type in correct quantity and hit enter
	ge_slot.item.set_quantity_to_buy(int(min(ge_slot.item.number_available_to_buy, (runescape_window.money/ge_slot.item.price_instant_sold_at)/runescape_window.number_of_empty_ge_slots)))
	runescape_window.update_money(runescape_window.money - (ge_slot.item.quantity_to_buy*ge_slot.item.price_instant_sold_at))
	random_typer(str(ge_slot.item.quantity_to_buy))
	time.sleep(random.random())
	pyautogui.press('enter')
	# click confirm off
	move_mouse_to_image_within_region("Tools/screenshots/confirm_offer_button.png", runescape_window)
	pyautogui.click()
	ge_slot.item.set_time_item_buy_was_placed()
	wait_for('Tools/screenshots/lent_item_box.png', runescape_window)
	# update states accordingly
	runescape_window.set_time_of_last_action()
	ge_slot.update_buy_or_sell_state('buy')
	runescape_window.check_for_empty_ge_slots()
	print('Placed a buy order for {} {} at {} each'.format(ge_slot.item.quantity_to_buy, ge_slot.item.item_name, ge_slot.item.price_instant_sold_at))
Пример #6
0
 def location(self):
     location = pointfrombox.random_point(self.top_left_corner,
                                          self.bottom_right_corner)
     return location
Пример #7
0
 def select_inventory_item(self):
     item_location = pointfrombox.random_point(*self.loc_inventory_item)
     move_mouse_to(item_location[0], item_location[1])
     pyautogui.click()
Пример #8
0
 def collect_2(self):
     top_left, bottom_right = pointfrombox.random_point(
         *self.loc_collection_box_item)
     move_mouse_to(top_left, bottom_right)
     pyautogui.click()
Пример #9
0
def move_mouse_to_image_within_region(image, region): # region takes in an object
	image_loc = pyautogui.locateOnScreen(image, region=(region.top_left_corner[0], region.top_left_corner[1], region.bottom_right_corner[0]-region.top_left_corner[0], region.bottom_right_corner[1]-region.top_left_corner[1]))
	while(image_loc == None):
		image_loc = pyautogui.locateOnScreen(image, region=(region.top_left_corner[0], region.top_left_corner[1], region.bottom_right_corner[0]-region.top_left_corner[0], region.bottom_right_corner[1]-region.top_left_corner[1]))
	point_to_click = pointfrombox.random_point((image_loc[0], image_loc[1]), (image_loc[0]+image_loc[2], image_loc[1]+image_loc[3]))
	realmouse.move_mouse_to(point_to_click[0], point_to_click[1])