Example #1
0
 def __markOK(_hwnd):
     procGuard = helper.ProcGuard(_hwnd)
     dolCall.writeMem(procGuard.proc, statusAddr, dolCall.c_uint(0))
Example #2
0
 def read(self, hwnd, proc, isFellow = False):
     print 'read'
     myname = dolScript.getRoleName(proc)
     print '[%s](%d) start to read. (isFellow = %s)' % (myname, hwnd, isFellow)
     statusAddr = 0xAFD700
     
     def __markOK(_hwnd):
         procGuard = helper.ProcGuard(_hwnd)
         dolCall.writeMem(procGuard.proc, statusAddr, dolCall.c_uint(0))
     
     def __whenRead():
         log('讀到圖')
         bossid = dolScript.getPCID(proc)
         dolCall.openDialog(proc, bossid, 0x20)
         myname = dolScript.getRoleName(proc)
         dountil(dolScript.isDialogOpen, [proc])
         
         l = MutexGuard(msgBoxMutex)
         msgBox(myname, '读到图。准备弹出窗口……')
         
         win32gui.ShowWindow(hwnd, win32con.SW_RESTORE)
         win32gui.SetActiveWindow(hwnd)
         
         win32gui.SetForegroundWindow(hwnd)
         msgBox(myname, '请在摆好露天后点击确定。(将会有购买窗口弹出……)')
         dowhile(dolScript.isDialogOpen, [proc])
         win32gui.ShowWindow(hwnd, win32con.SW_MINIMIZE)
         
         
         tarhwnd = self.serHwnd
         
         self.makeBuy(tarhwnd, hwnd)
         print 'one read loop end'
     
     x, y = self.cityRead.toReadPos
     if(dolScript.getLandFollow(proc) == 0):
         dolCall.walk(proc, x, y)
     
     if(not isFellow):
         for _hwnd in self.fellowList:
             __markOK(_hwnd)
         self.makeAllDo(self.read, [True], hwndPos = 0, procPos = 1)
         self.nextDoFunc = self.lib2Dock
         
         self.nextDoPara = []
     
     
     
     
     while(True):
         while(not dolScript.isDialogOpen(proc)):
             dolCall.openDialog(proc, self.cityRead.manID, 0x83)
             time.sleep(0.5)
         dountil(dolScript.isDialogOpen, [proc])
         
         while(dolScript.getToRead(proc) != 5): #5是美术
             print '[%s](%d) press left arrow' % (myname, hwnd)
             dll.Key('KeyClick', hwnd, win32con.VK_LEFT)
             time.sleep(1)
         
         print 'Click begin'
         print "-------%s %s-------" % (dolScript.getInt(proc, dolCall.CALLADDR.DIALOG) != 0, not dolScript.isReading(proc))
         while(dolScript.getInt(proc, dolCall.CALLADDR.DIALOG) != 0 and not dolScript.isReading(proc)):
             print "%s %s" % (dolScript.getInt(proc, dolCall.CALLADDR.DIALOG) != 0, not dolScript.isReading(proc))
             
             dll.Mouse('LClick', hwnd, 547, 240)
             time.sleep(2)
         print 'Click end'
             
         #547, 240
         
         while(True):
             print '[' + myname + ('] reading... (Money = %d)' % (dolScript.getMoney(proc)))
             if(dolScript.inLog(proc, '頭腦疲勞', 3)):
                 log('疲勞了...')
                 startTime = time.time()
                 if(isFellow):
                     procGuard = helper.ProcGuard(hwnd)
                     print '[%s] 疲劳了, 写内存' % (myname)
                     dolCall.writeMem(procGuard.proc, statusAddr, dolCall.c_uint(1))
                 else:
                     okFellowDict = {}
                     if(len(self.fellowList) > 0):
                         while(True):
                             if(len(okFellowDict) == len(self.fellowList)):
                                 #timeout一分钟也走人
                                 log('全部疲倦了,走人')
                                 return
                             
                             for _hwnd in self.fellowList:
                                 if(okFellowDict.has_key(_hwnd)):
                                     continue
                                 procGuard = helper.ProcGuard(_hwnd)
                                 if(not dolScript.isOnline(procGuard.proc)):
                                     okFellowDict[_hwnd] = -1
                                 
                                 
                                 if(dolScript.getInt(procGuard.proc, statusAddr) != 0):
                                     okFellowDict[_hwnd] = 1
                             time.sleep(0.5) 
                 
                 return
             
             
             if(dolScript.inLog(proc, self.readMsg, 3)):
                 __whenRead()
                 break
                 
             time.sleep(0.2)