Esempio n. 1
0
	def enclos_is_empty(self):
		location = self.get_box_location('Enclos First Place')
		screen = tools.screen_game(location)
		empty_percentage = tools.get_color_percentage(screen, data.Colors['Empty Enclos'])
		selected_percentage = tools.get_color_percentage(screen, data.Colors['Selected Row'])
		is_empty = empty_percentage >= 99 or selected_percentage >= 99
		debug_level = DebugLevel.Normal if is_empty else DebugLevel.High
		self.debug('Enclos is empty: {}, empty percentage: {}%, selected percentage: {}%'.format(is_empty, empty_percentage, selected_percentage), debug_level)
		return is_empty
Esempio n. 2
0
	def get_dragodinde_spec(self, name, dragodinde_image):
		# crop dragodinde image
		box = data.Boxes[name]
		x, y, w, h = (box['x'], box['y'], box['width'], box['height'])
		image = dragodinde_image.crop((x, y, w+x, h+y))
		# get specification percentage & state
		state = data.DragodindeStats.Full
		percentage = tools.get_color_percentage(image, data.Colors['Full'])
		if percentage == 0:
			state = data.DragodindeStats.InProgress
			percentage = tools.get_color_percentage(image, data.Colors['In Progress'])
			if percentage == 0:
				state = data.DragodindeStats.Empty

		return [percentage, state]
Esempio n. 3
0
 def wait_for_box_appear(self, box_name, box_color=None, timeout=30):
     # set box color
     if box_color is None:
         if box_name in data.Colors:
             box_color = data.Colors[box_name]
         else:
             return False
     # wait for box to appear
     elapsed_time = 0
     while elapsed_time < timeout:
         # wait 1 second
         self.sleep(1)
         # check for pause or suspend
         self.pause_event.wait()
         if self.suspend: return False
         # check box color
         location = self.get_box_location(box_name)
         screen = tools.screen_game(location)
         percentage = tools.get_color_percentage(screen, box_color)
         has_appeared = percentage >= 99
         debug_level = DebugLevel.Normal if has_appeared else DebugLevel.High
         self.debug(
             '{} has appeared: {}, percentage: {}%, timeout: {}'.format(
                 box_name, has_appeared, percentage, timeout), debug_level)
         if has_appeared:
             return True
         elapsed_time += 1
     # if box did not appear before timeout
     return False
Esempio n. 4
0
	def inventory_is_empty(self):
		location = self.get_box_location('Inventory First Place')
		screen = tools.screen_game(location)
		percentage = tools.get_color_percentage(screen, data.Colors['Empty Inventory'])
		is_empty = percentage >= 99
		debug_level = DebugLevel.Normal if is_empty else DebugLevel.High
		self.debug('Inventory is empty: {}, percentage: {}%'.format(is_empty, percentage), debug_level)
		return is_empty
Esempio n. 5
0
 def has_box_appeared(self, box_name, box_color=None):
     # set box color
     if box_color is None:
         if box_name in data.Colors:
             box_color = data.Colors[box_name]
         else:
             return False
     location = self.get_box_location(box_name)
     screen = tools.screen_game(location)
     percentage = tools.get_color_percentage(screen, box_color)
     has_appeared = percentage >= 70
     debug_level = DebugLevel.Normal if has_appeared else DebugLevel.High
     self.debug(
         f"{box_name} has appeared: {has_appeared}, percentage: {percentage}",
         debug_level)
     return has_appeared