def start_action(self):
     """ This part can be run for both campaign and dungeons. """
     if self.is_active and self.timer.time_remaining() > 0:
         print(
             f"{self.name} is active with {self.timer.time_remaining():.0f} remaining"
         )
         return
     coordinates = self.get_cords()
     self.go_to_tab()
     pos = helpers.return_position_of_image_on_screen(
         IMAGE_DICTIONARY[self.name], coordinates)  # coordinates
     x = round(pos[0])
     y = round(pos[1]) - 25
     self.action_region = (x, y, x + 350, y + 50)
     self.action_region_relative = (x - coordinates.X_PAD,
                                    y - coordinates.Y_PAD,
                                    x + 350 - coordinates.X_PAD,
                                    y + 50 - coordinates.Y_PAD)
     pg.moveTo(coordinates.safe_spot)
     helpers.click_image_in_zone(IMAGE_DICTIONARY[self.START_BUTTON],
                                 zone=self.action_region)
     pg.moveTo(coordinates.safe_spot)
     duration = self.current_duration + 20
     if self.timer == -1:
         self.timer = TimerClass(self.name, duration)
     else:
         self.timer.set_end_time(duration)
         self.timer.reset_timer()
     TIMER_TRACKER[self.timer.name] = self.timer
     print(
         f"{self.name} has {self.timer.time_remaining()} seconds remaining")
def set_input_box_value(identity_image, input_box, input_value):
    coordinates = Dungeon.COORDINATES
    pos = helpers.return_position_of_image_on_screen(
        IMAGE_DICTIONARY[identity_image], coordinates)  # coordinates
    x = round(pos[0])
    y = round(pos[1]) - 25
    helpers.click_image_in_zone(IMAGE_DICTIONARY[input_box], x, y, x + 300,
                                y + 50)
    helpers.click_image_in_zone(IMAGE_DICTIONARY[input_box], x, y, x + 300,
                                y + 50)
    pg.write(input_value)
Esempio n. 3
0
 def create(self, image):
     """ Will start creating given element, regardless of next at setting """
     self.go_to_tab()
     coordinates = self.COORDINATES
     helpers.scroll_to_top()
     if self.IMAGES.index(image) >= self.IMAGES.index(self.NATION):
         pg.moveTo(coordinates.center_of_screen)
         pg.scroll(-2300)  # magic number for weather scroll positions
     elif self.IMAGES.index(image) > self.IMAGES.index(self.WEATHER):
         helpers.scroll_to_bottom()
     zone = helpers.get_active_zone(image, 500, 60, coordinates)
     helpers.click_image_in_zone(self.CREATE, zone=zone)
Esempio n. 4
0
 def fight_UB(self):
     """ Checks if the UBs are active and then fights them"""
     if Planet.POWER_SURGING:
         coordinates = Planet.COORDINATES
         pg.click(coordinates.tab)
         images = [Planet.PE, Planet.GT, Planet.LS, Planet.GAA, Planet.ITRTG]
         for image in images:
             zone = helpers.get_active_zone(image, 600, 70, coordinates)
             if zone == -1:
                 print("Ub not active")
                 continue
             helpers.click_image_in_zone(Planet.FIGHT, zone=zone)
         pg.click(Planet.CAP)
Esempio n. 5
0
 def add_or_remove_clones(self,
                          images,
                          zone_x_width=500,
                          zone_y_height=60,
                          click_image=None):
     coordinates = self.COORDINATES
     for image in images:
         zone = self.check_if_cached(image)
         if zone == -1:
             zone = helpers.get_active_zone(image, zone_x_width,
                                            zone_y_height, coordinates)
             if zone == -1:
                 return
             self.cache_image(image, zone)
         helpers.click_image_in_zone(click_image, zone=zone)
         pg.moveTo(coordinates.safe_spot)
Esempio n. 6
0
 def upgrade(self, image):
     self.go_to_tab()
     if self.IMAGES.index(image) > 3:
         helpers.scroll_to_bottom()
     else:
         helpers.scroll_to_top()
     time.sleep(0.1)
     zone = self.check_if_cached(image)
     if zone == -1:
         zone = helpers.get_active_zone(image, 500, 60, self.COORDINATES)
         if zone == -1:
             return
     y_value = zone[1] + 40
     y_2_value = zone[3] + 40
     upgrade_zone = (zone[0], y_value, zone[2], y_2_value)
     helpers.click_image_in_zone(self.PLUS, zone=upgrade_zone)
 def collect_reward(self):
     coordinates = self.get_cords()
     self.go_to_tab()
     pos = self.action_region_relative
     if pos[0] == -1:
         pos = (self.FALL_BACK_POS[0],
                self.FALL_BACK_POS[1] + 45 * self.camp_index)
     x = round(pos[0])
     y = round(pos[1]) - 15
     zone = (x + coordinates.X_PAD, y + coordinates.Y_PAD,
             x + 400 + coordinates.X_PAD, y + 65 + coordinates.Y_PAD)
     print(self.REWARD_BUTTON)
     helpers.click_image_in_zone(IMAGE_DICTIONARY[self.REWARD_BUTTON],
                                 zone=zone)
     pg.moveTo(coordinates.safe_spot)
     time.sleep(2)
     helpers.click_image_on_screen(IMAGE_DICTIONARY["close_button"])
     time.sleep(0.1)
     self.is_active = False
Esempio n. 8
0
 def change_clone_use_amount(self, amount, zone):
     helpers.click_image_in_zone(Divinity.CLONE_INPUT_IMAGE, clicks=2, zone=zone)
     pg.write(str(amount))
Esempio n. 9
0
 def create_clones_off(self):
     self.go_to_tab()
     zone = helpers.get_active_zone(self.CREATE_CLONES_MAX, 500, 60, self.COORDINATES)
     helpers.click_image_in_zone(self.CREATE_CLONES_ON, zone=zone)