Exemplo n.º 1
0
 def findImgAndclick(self, path):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(self.handle, path, 0.9)
     if len(xylist) > 0:
         x, y = xylist[0]
         self.leftClick(x, y)
         time.sleep(2)
Exemplo n.º 2
0
 def onBlueTacketAndBattle(self):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(
         self.handle, "map//blue_tacket_15_15_40_20.png", 0.9)
     if len(xylist) > 0:
         self.leftClickPer(75, 80)
         self.battleEvenCode = 2
Exemplo n.º 3
0
 def moveDown(self, num=1):
     print("moveDown")
     screen.setForegroundWindow(self.getHandle())
     self.leftClickPer(50, 50+num*15)
     self.leftClickPer(50, 50+num*15)
     time.sleep(num)
     self.resetCusor()
Exemplo n.º 4
0
 def moveLeft(self, num=1):
     print("moveLeft")
     screen.setForegroundWindow(self.getHandle())
     self.leftClickPer(50-num*10, 50)
     self.leftClickPer(50-num*10, 50)
     time.sleep(num)
     self.resetCusor()
Exemplo n.º 5
0
 def intoD3(self):
     screen.setForegroundWindow(self.getHandle())
     win32api.SetCursorPos((self.getPosX(70), self.getPosY(70)))
     win32api.mouse_event(
         win32con.MOUSEEVENTF_LEFTDOWN | win32con.MOUSEEVENTF_LEFTUP, 0, 0,
         0, 0)
     self.resetCusor()
Exemplo n.º 6
0
    def run(self):

        while self._isRun:
            screen.setForegroundWindow(self.handle)

            # print(screen.featResImgInWindow(self.handle,"map//unkown_46_46_54_50.png"))

            #底部菜单hash
            print("clickReplyBattle")
            if self.autoCompareResImgHash(
                    "reply//end_0_90_40_95.png") or self.autoCompareResImgHash(
                        "reply//end_0_90_100_95.png"):
                self.clickReplyBattle()
                time.sleep(5)

            print("clickOnGetItems")
            #获取物品执行
            if self.onGetItems():
                self.clickOnGetItems()
                time.sleep(2)

            self.clickMacthImg("reply/retbattle_28_91_48_94.png")

            #体力不足hash
            print("toUseHp")
            if self._isUseHp and self.isHpEmpty():
                self.toUseHp()
                time.sleep(2)
                self.closeEmptyHp()

            self.reTryNetErr()
            time.sleep(self.interval)
Exemplo n.º 7
0
    def run(self):

        while self._isRun:
            screen.setForegroundWindow(self.handle)

            #精彩页面hash
            print("toGuess")

            self.clickMacthImg("guess\\guess_top.png")
            self.clickMacthImg("guess\\guess_10_22_90_30.png")

            print("selecGuess")
            if self.autoCompareResImgHash("guess\\select_10_40_85_65.png"):
                self.selecGuessRight()
                time.sleep(5)

            xylist = self.getGuessLocation()
            if len(xylist) > 0:
                x, y = xylist[0]
                self.leftClick(x, y)

                time.sleep(10)

            if self.onGetMoney():
                self.clickOnMoney()
                time.sleep(2)
            else:
                pass

            if self.onGuessEnd():
                self._isRun = False
                return

            time.sleep(self.interval)
Exemplo n.º 8
0
    def run(self):
        battleCount = 0
        toBattleType = 0
        while self._isRun:
            screen.setForegroundWindow(self.handle)

            # 底部菜单hash
            self.resetCusor()

            if self.isAtHome():

                if self.missionType == 0:

                    self.leftClickPer(20*(toBattleType+1), 50)

                    if battleCount >= 8:
                        break
                    #     battleCount = 0
                    # pass
                else:
                    toBattleType = self.missionType-1
                    self.leftClickPer(20*(toBattleType+1), 50)

                time.sleep(2)

            if self.inLevel():
                print("battleCount", battleCount)
               

                level = int(self.missionlevel[toBattleType])

                self.leftClickPer(35, 10+level*16)
                time.sleep(1)

            if self.onSelectTeam():
                if self.missionType == 0:
                    curToBattleType = toBattleType

                    toBattleType = int(battleCount/2)

                    if toBattleType != curToBattleType:
                        self.leftClickPer(5, 5)  # 返回每日界面
                        time.sleep(1)
                        self.leftClickPer(5, 5)  # 返回每日界面
                        time.sleep(2)
                        continue

                teamCode = int(self.teamNum[toBattleType])

                self.toSelectTeam(teamCode)
                battleCount = battleCount+1
                self.clickBattle()
                time.sleep(2)

            if self.onBattleEnd():
                self.battleContinue()
                time.sleep(2)

            time.sleep(self.interval)
Exemplo n.º 9
0
 def switchTeam(self):
     print("switchTeam")
     screen.setForegroundWindow(self.getHandle())
     # self.leftClickPer(99, 99)#防止任务弹出
     time.sleep(0.5)
     self.leftClickPer(82, 96)
     time.sleep(3)
     self.resetCusor()
Exemplo n.º 10
0
 def onYellowPvpAndBattle(self):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(
         self.handle, "map//yellow_pvp_60_76_80_82.png", 0.9)
     if len(xylist) > 0:
         x, y = xylist[0]
         self.leftClick(x+2, y+2)
         self.battleEvenCode = 3
Exemplo n.º 11
0
 def onDlgAccept(self):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(
         self.handle, "map//accept_60_58_80_62.png", 0.9)
     if len(xylist) > 0:
         x, y = xylist[0]
         self.leftClick(x+2, y+2)
         self.battleEvenCode = 0
Exemplo n.º 12
0
 def onDlgBuyRoadAndClick(self):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(
         self.handle, "map//buy_road_20_58_40_62.png", 0.9)
     if len(xylist) > 0:
         x, y = xylist[0]
         self.leftClick(x+2, y+2)
         self.battleEvenCode = 3
Exemplo n.º 13
0
 def clickMacthImg(self, imgPath, threshold=0.9):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(self.handle, imgPath, threshold)
     if len(xylist) > 0:
         x, y = xylist[0]
         self.leftClick(x, y)
         time.sleep(2)
         return True
     return False
Exemplo n.º 14
0
 def onDlgOkAndClick(self):
     screen.setForegroundWindow(self.handle)
     xylist = screen.matchResImgInWindow(self.handle,
                                         "on_dlg_ok_60_62_80_66.png", 0.9)
     if len(xylist) > 0:
         x, y = xylist[0]
         self.leftClick(x + 2, y + 2)
         time.sleep(2)
         return True
     return False
Exemplo n.º 15
0
 def resetTeamLocation(self, t=3):
     print("resetTeamLocation")
     screen.setForegroundWindow(self.getHandle())
     # self.leftClickPer(99, 99)#防止任务弹出
     # time.sleep(0.5)
     self.leftClickPer(82, 96)
     time.sleep(t)
     self.leftClickPer(82, 96)
     # time.sleep(t)
     self.resetCusor()
Exemplo n.º 16
0
    def run(self):    
        self._mapBattleCount=0
        self._mapBattlePoint=0
        while self._isRun:
            screen.setForegroundWindow(self.handle)

            if self.onMap():
                x,y=self._mapPointLocation[self._mapBattlePoint]
                self.leftClickPer(x,y)
                self._mapBattlePoint+=1
                if self._mapBattlePoint>8 :
                    return
                time.sleep(5)    


            self.battleStory()

            if self.onSelectTeam():
               self.toSelectTeam(self.mapTeamNo)
               time.sleep(2)
            

            self.onDlgOkAndClick()
            self.findImgAndclick("aixi/mapread_40_50_60_70.png")
            #底部菜单hash 
            print("clickReplyBattle")
            if self.autoCompareResImgHash("reply/end_0_90_40_95.png") or self.autoCompareResImgHash("reply//end_0_90_100_95.png"):
               
                self._isInBattle=True
                self.clickReplyBattle()
                self._mapBattleCount+=1
                time.sleep(5)
                if self._mapBattleCount>6 :
                   self.clickContinue()


           
            print("clickOnGetItems")
            #获取物品执行
            if self.onGetItems() :
                self.clickOnGetItems()
                time.sleep(2)
            
           

            #体力不足hash 
            print("toUseHp")
            if self._isUseHp and self.isHpEmpty():
                self.toUseHp()
                time.sleep(2)
                self.closeEmptyHp()

           

            time.sleep(self.interval)
Exemplo n.º 17
0
 def toPvp(self):
     screen.setForegroundWindow(self.handle)
     # win32api.SetCursorPos((self.getPosX(80), self.getPosY(28)))#点击pvp
     # win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN |
     # win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
     if self._upPonit:
         self.leftClickPer(80, 28)
     else:
         for i in range(3):
             self.dragPer(50, 70, 50, 30)
             time.sleep(2)
         self.leftClickPer(80, 82)
Exemplo n.º 18
0
    def onDlgChallengeAndClick(self):
        screen.setForegroundWindow(self.handle)

        tarImgs = [
            "map//challenge_60_58_80_62.png",
            "map//challenge2_60_58_80_62.png",
             "map//touxi_60_58_80_62.png",
        ]
        for img in tarImgs:
            xylist = screen.matchResImgInWindow(
                self.handle, img, 0.9)
            if len(xylist) > 0:
                x, y = xylist[0]
                self.leftClick(x+2, y+2)
                self.battleEvenCode = 0
    def run(self):
        self._team1BattleCount = 0
        self._team2BattleCount = 0
        self._team1MoveCount = 0
        self._team2MoveCount = 0
        self._teamNum = 1

        while self._isRun:
            screen.setForegroundWindow(self.getHandle())

            # 底部菜单hash
            self.resetCusor()
            print("isAtHome")
            if self.isAtHome():
                self._team1BattleCount = 0
                self._team2BattleCount = 0
                self._team1MoveCount = 0
                self._team2MoveCount = 0
                self._teamNum = 1
                self.clickMap()
                time.sleep(2)

            print("isAtInMapReady")
            if self.isAtInMapReady():
                self._team1BattleCount = 0
                self._team2BattleCount = 0
                self._team1MoveCount = 0
                self._team2MoveCount = 0
                self._teamNum = 1
                self.intoMap()
                time.sleep(2)

            print("onSelectTeam")
            if self.onSelectTeam():
                self.clickNeedLeaderCat()
                time.sleep(2)
                self.atTeamIntoMap()
                time.sleep(2)

            self.commonAction()

            print("isInMap")
            if self.isInMap():
                self.findAndBattle()

            time.sleep(self.interval)
Exemplo n.º 20
0
    def onBusinessAndClose(self):
        screen.setForegroundWindow(self.handle)
        print("onBusinessAndClose")
        xylist = screen.matchResImgInWindow(
            self.handle, "map//on_business_65_73_85_76.png", 0.8)

        if len(xylist) > 0:
            # if self.canChangeRedAir():
            #      self.leftClickPer(75, 34)
            #      time.sleep(3)
            #      self.onDlgOkAndClick()
            #      self.leftClickPer(75, 46)
            #      time.sleep(3)
            #      self.onDlgOkAndClick()
            #      self.leftClickPer(75, 59)
            #      time.sleep(3)
            #      self.onDlgOkAndClick()

            x, y = xylist[0]
            self.leftClick(x, y)
Exemplo n.º 21
0
    def toSelectTeamBack(self, teamNo):
        screen.setForegroundWindow(self.handle)
        if teamNo == 1:
            win32api.SetCursorPos((self.getPosX(30), self.getPosY(50)))  # 点击1队
        elif teamNo == 2:
            win32api.SetCursorPos((self.getPosX(55), self.getPosY(50)))  # 点击2队
        elif teamNo == 3:
            win32api.SetCursorPos((self.getPosX(80), self.getPosY(50)))  # 点击3队
        elif teamNo == 4:
            win32api.SetCursorPos((self.getPosX(30), self.getPosY(55)))  # 点击4队
        elif teamNo == 5:
            win32api.SetCursorPos((self.getPosX(55), self.getPosY(55)))  # 点击5队
        elif teamNo == 6:
            win32api.SetCursorPos((self.getPosX(80), self.getPosY(55)))  # 点击6队
        else:
            pass

        win32api.mouse_event(
            win32con.MOUSEEVENTF_LEFTDOWN | win32con.MOUSEEVENTF_LEFTUP, 0, 0,
            0, 0)
Exemplo n.º 22
0
    def run(self):

        while self._isRun:
            screen.setForegroundWindow(self.handle)

            #PVP列表hash

            if self.onPvpList():
                self.toPvp()
                time.sleep(3)
            else:
                pass

            if self.onSelectTeam():
                self.toSelectTeam(self._teamNo)
                time.sleep(20)
            else:
                pass

            if self.onPvpLost():
                self.toPvpContinue()
                time.sleep(7)
                continue
            else:
                pass

            if self.onPvpWin():  #输赢难以判断
                self.toSelecItemOnWin()
                time.sleep(3)
                self.toPvpContinue()
                time.sleep(5)  #容易截图延迟
            else:
                pass

            self.reTryNetErr()

            if self.onPvpEnd():
                self._isRun = False
                return

            time.sleep(self.interval)
Exemplo n.º 23
0
    def run(self):
        self._count = 0
        while self._isRun and self._count < self.maxCount:
            screen.setForegroundWindow(self.handle)

            if self.matchResImgInWindow("momo/momo_5_50_15_56.png"):
                self.leftClickPer(8, 50)
                time.sleep(3)
                self.onDlgOkAndClick()
                time.sleep(4)
                self._count = self._count + 1
                time.sleep(4)

            # self.clickMacthImg("momo/next_88_70_98_88.png")
            self.leftClickPer(95, 80)
            time.sleep(2)

            self.onDlgOkAndClick()
            time.sleep(2)

            self.reTryNetErr()

            time.sleep(self.interval)
Exemplo n.º 24
0
 def clickReplyBattle(self):
     screen.setForegroundWindow(self.handle)
     win32api.SetCursorPos((self.getPosX(35), self.getPosY(93)))  #点击重复战斗
     win32api.mouse_event(
         win32con.MOUSEEVENTF_LEFTDOWN | win32con.MOUSEEVENTF_LEFTUP, 0, 0,
         0, 0)
Exemplo n.º 25
0
    def run(self):

        while self._isRun:
            screen.setForegroundWindow(self.handle)
 def intoMap(self):
     screen.setForegroundWindow(self.getHandle())
     self.leftClickPer(70, 68)
     self.resetCusor()
Exemplo n.º 27
0
 def atTeamIntoMap(self):
     screen.setForegroundWindow(self.handle)
     win32api.SetCursorPos((self.getPosX(80), self.getPosY(85)))
     win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN |
     win32con.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)      
     self.resetCusor()      
Exemplo n.º 28
0
 def intoMap(self):
     screen.setForegroundWindow(self.handle)
     self.leftClick(self.getPosX(80), self.getPosY(85))   
Exemplo n.º 29
0
 def battleContinue(self):
     screen.setForegroundWindow(self.handle)
     self.leftClick(self.getPosX(99), self.getPosY(99))
     self.resetCusor()
Exemplo n.º 30
0
 def clickOnGetItems(self):
     screen.setForegroundWindow(self.handle)
     self.leftClick(self.getPosX(50), self.getPosY(65))