def calc_food(): global stop while stop != 'y': with shoot_lock: # grabs food bar hsv_img = shoot(172, 503, 271, 504, 'hsv') low = np.array([0, 100, 100]) high = np.array([179, 255, 255]) mask = cv2.inRange(hsv_img, low, high) #(conts, _) = cv2.findContours(mask.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) #print(contours) mask = np.array(mask) percentage = 0 for color in mask: for element in color: if element == 0: break percentage += 1 # Decide what to do with the amount percentage if percentage <= 20: # withdraws food from very top of list itmlst(330, 125, 1) sleep(1) # cliks use button action_btn(4) # clicks the food slot move(770, 75) break
def heal(): """Used in calc_health function""" # withdraws HE & Spirit Restoration itmlst(330, 196, 2) sleep(.8) # eats spirit potion move(771, 76) # casts restoration move(741, 80)
def go_harvest(self): x, y = self.har_loc # opens map (button 13) action_btn(13) sleep(.5) # clicks on location to harvest on map move(x, y) sleep(.5) # closes map action_btn(13)
def to_storage(self): x, y = self.sto_loc # opens map, cliks on storage, closes map action_btn(13) move(x, y) action_btn(13) # waits till getting to storage in VotD sleep(18) #opens inventory action_btn(8) sleep(1) #stores all materials move(290, 68) sleep(1) # checks health #calc_health() # Checks food calc_food() # closes storage action_btn(8) # walk button to be able to harvest action_btn(1)
def tely(): # click on teleport spell grids.move(738,111) time.sleep(5)