Exemplo n.º 1
0
    def advance_support(self, spt: str = None, tms: int = 3):
        """ Advance Support Selection

        Parameters
        ----------
            spt: str, optional
        Override the initially set support.

            tms: int, optional
        Max support list update times. (Default: 3)

        Raises
        ------
            Exception("Desired support not found!")
        Raises when reached maxium update times.
        """
        time.sleep(0.3)
        if spt is None:
            spt = self.support
        x = util.get_crd(util.get_sh(self.shifts), spt)
        counter = False
        times = tms
        while len(x) == 0:
            if not counter:
                self.swipe((1000, 800), (1000, 300),
                           0.5 + 0.1 * random.randrange(1, 10))
                counter = True
            else:
                update = self.update_support()
                if update:
                    counter = False
                    times -= 1
                    if times < 0:
                        raise Exception("Desired support not found!")
                else:
                    time.sleep(3)
            time.sleep(0.5)
            x = util.get_crd(util.get_sh(self.shifts), spt)
        self.tap(x[0])
        print("[INFO] Support selected.")
Exemplo n.º 2
0
    def finish_battle(self, cont=True):
        """ Finish Battle
        In `Free Quest`, there will be a continue battle option

        Parameters
        ----------
            cont: bool
        Defalut: `True` this will tap `閉じる` or `关闭` (close). when set to `False`, no action will be taken.
        """
        while not util.standby(util.get_sh(self.shifts), crds.IMAGE["item"]):
            xs = util.get_crd(util.get_sh(self.shifts), crds.IMAGE["close"])
            if len(xs) != 0:
                self.tap(xs[0])
            self.tap((960, 540), 400, 200)
            time.sleep(0.2)
        time.sleep(0.2)
        x = util.get_crd(util.get_sh(self.shifts), crds.IMAGE["item"])
        self.tap(x[0])
        if cont:
            time.sleep(0.5)
            self.tap((650, 850))
        print("[INFO] Battle Finished.")
Exemplo n.º 3
0
    def update_support(self) -> bool:
        """ Update Support List

        Returns
        -------
            bool
        `True` if successfully updated, otherwise is `False`.
        """
        btn = util.get_crd(util.get_sh(self.shifts),
                           crds.IMAGE["update_support"])
        # something strange...
        while len(btn) == 0:
            time.sleep(1)
            btn = util.get_crd(util.get_sh(self.shifts),
                               crds.IMAGE["update_support"])
        self.tap(btn[0], 1, 1)
        time.sleep(0.1)
        if util.standby(util.get_sh(self.shifts), crds.IMAGE["confirm_update"]):
            self.tap((1240, 840), 10, 5)
            return True
        else:
            self.tap((950, 840))
            return False
Exemplo n.º 4
0
 def select_support(self, spt: str = None):
     """ Select Support
     Parameters
     ----------
         spt: str, optional
     Override the initially set support.
     """
     time.sleep(0.3)
     if spt is None:
         spt = self.support
     x = util.get_crd(util.get_sh(self.shifts), spt)
     if len(x) == 0:
         self.tap((860, 430), 300, 100)
     else:
         self.tap(x[0])
Exemplo n.º 5
0
 def select_checkpoint(self, ckp: str = None):
     self.wait(self.checkpoint)
     if ckp is None:
         ckp = self.checkpoint
     crds = util.get_crd(util.get_sh(self.shifts), self.checkpoint)
     self.tap(crds[0], 100)
     time.sleep(0.2)
     # check whether out of AP
     # Not tested
     if util.standby(util.get_sh(self.shifts),
                     "assets/noap.png"):  # in progress
         if self.counts > 0:
             self.eat_apple()
         else:
             raise Exception("Out of AP!")
Exemplo n.º 6
0
 def update_support(self) -> bool:
     """ Update Support List
     Returns
     -------
         bool
     `True` if successfully updated, otherwise is `False`.
     """
     btn = util.get_crd(util.get_sh(self.shifts), "assets/update.png")
     self.tap(btn[0], 1, 1)
     time.sleep(0.1)
     if util.standby(util.get_sh(self.shifts), "assets/uplist.png"):
         self.tap((1240, 840), 10, 5)
         return True
     else:
         self.tap((950, 840))
         return False
Exemplo n.º 7
0
 def start_battle(self):
     while not util.standby(util.get_sh(self.shifts), crds.IMAGE["start"]):
         time.sleep(0.2)
     x = util.get_crd(util.get_sh(self.shifts), crds.IMAGE["start"])
     self.tap(x[0])
     print("[INFO] Battle started.")
Exemplo n.º 8
0
 def start_battle(self):
     while not util.standby(util.get_sh(self.shifts), "assets/start.png"):
         time.sleep(0.2)
     x = util.get_crd(util.get_sh(self.shifts), "assets/start.png")
     self.tap(x[0])