示例#1
0
def readMapScript(hwnd, proc):
    '''
    读图
    '''

    
    serName = '圖書館人員B'
    hwndList = window.getPlayerHwndList()
    
    myid = dolScript.getPCID(proc)
    party = dolScript.getParty(proc)
    

    
    
    myname = dolScript.getRoleName(proc)
    if(myname == serName):
        return
    
    if(party != [] and myid != party[0]):
        return
    
    
    fellowList = []
    serHwnd = -1
    for hwnd in hwndList:
        procGuard = ProcGuard(hwnd)
        if (dolScript.getRoleName(procGuard.proc) == serName):
            serHwnd = hwnd
        else:
            fid = dolScript.getPCID(procGuard.proc)
            
            if(party != [] and fid in party and fid != dolScript.getPCID(proc)):
                fellowList.append(hwnd)
    
    if(serHwnd == -1):
        print 'No servant!!!'
        return
    print myname
    print fellowList
    
    
    cRead = readMapDta.london()
    cSec = readMapDta.duofo()
    
    cl = readMap.readMapClass(proc, cRead, cSec, serHwnd, '得到了教會祭器的地圖', fellowList)
    cl.main()
    
    
    
示例#2
0
def allTalk(hwnd, proc):
    '''
    集体谈话
    '''
    hwndList = window.getPlayerHwndList()
    party = dolScript.getParty(proc)
    
    leadHwnd = None
    
    myid = dolScript.getPCID(proc)
    myname = dolScript.getRoleName(proc)
    if(party != [] and myid != party[0]):
        for hwnd in hwndList:
            if(__findLead(hwnd)):
                leadHwnd = hwnd
        
        if(leadHwnd == None):
            print "找不到队长,退出"
            return
        
        leadProc = WindowHelper.getProcByHwnd(leadHwnd)
                
        tabid = dolScript.getTabId(leadProc)
        #print 'party member'
        #print tabid
        if(tabid != 0):
            dolCall.talk(proc, tabid)
        win32api.CloseHandle(leadProc)
    else:
        tabid = dolScript.getTabId(proc)
        #print 'party leader'
        #print tabid
        if(tabid != 0):
            dolCall.talk(proc, tabid)
示例#3
0
def wiseMin(hwndList):
    for hwnd in hwndList:
        proc = WindowHelper.getProcByHwnd(hwnd)
        myid = dolScript.getPCID(proc)
        party = dolScript.getParty(proc)
        if(not (len(party) != 0 and myid == party[0])):
            win32gui.ShowWindow(hwnd, win32con.SW_MINIMIZE)
        
        win32api.CloseHandle(proc)
            
            
示例#4
0
def __findLead(hwnd):
    proc = WindowHelper.getProcByHwnd(hwnd)
    myid = dolScript.getPCID(proc)
    party = dolScript.getParty(proc)
    
    flag = False
    
    if(party != [] and myid == party[0]):
        flag = True
    
    win32api.CloseHandle(proc)
    return flag
示例#5
0
def getDolList():
    '''获取机器内所有大航海OL的信息
    return (name, hwnd, id)
    '''
    nameList = []
    winHelper = helper.WindowHelper()
    hwndList = dolScript.getDolHwndList()
    for hwnd in hwndList:
        proc = WindowHelper.getProcByHwnd(hwnd)
        name = dolScript.getRoleName(proc)
        id = dolScript.getPCID(proc)
        
        threadID, processID = win32process.GetWindowThreadProcessId(hwnd)
        pidstr = "%d / %xh" % (processID, processID) 
        
        win32gui.SetWindowText(hwnd, name + ' ' + pidstr)
        nameList.append((name, hwnd, id))
    
    return nameList
示例#6
0
def sailing(hwnd, proc, hwndList = None):
    '''
    航行异常处理
    '''
    global sailingLock
    stormWeather = 0x48
    if(hwndList == None):
        hwndList = [hwnd]
    
    myid = dolScript.getPCID(proc)
    party = dolScript.getParty(proc)
    
    leadHwnd = None
    
    
    myname = dolScript.getRoleName(proc)
    if(party != [] and myid != party[0]):
        for hwnd in hwndList:
            if(__findLead(hwnd)):
                leadHwnd = hwnd
        
        if(leadHwnd == None):
            print "找不到队长,退出"
            return
        
        
        log( "[%s] 开始队员异常处理" % (myname))
        count = 0
        while(True):
            #if(count % 20 == 0):
                #log( "[%s] 报到!" % (myname))
            
            if(dolScript.getLocationType(proc) != dolCallEnum.LocType.Sea):
                log( "[%s] Not in sea, exit" %(myname))
                break
        
            if(not dolScript.isOnline(proc)):
                log( "[%s] 断线了, 退出脚本" % (myname))
                beep(unicode("警告"), unicode("[%s] 断线了!!!" % (myname)))
                break
            
            if(dolScript.isBadWeather(proc)):
                log("遇到暴风")
                while(dolScript.getSailState(proc) != 0):
                    dolCall.sail(proc, 0)
                    time.sleep(0.2)
                
                beep(unicode("警告"), unicode("遇到暴风!!!"))
                log('遇到暴风, 已停船, 停止脚本')
                break
            
            statetxt = dolScript.getShipState(proc)
            if(statetxt == "鼠患"):
                leadProc = WindowHelper.getProcByHwnd(leadHwnd)
                
                log("[%s]发现<%s>,请求队长发动驱除技能" % (myname, statetxt)) 
                dountil(dolScript.isNormal, [leadProc])
                dolCall.custom(leadProc, 4)#f4 驱除
                time.sleep(2)
                win32api.CloseHandle(leadProc)
            count += 1
            time.sleep(0.5)
        log( "[%s] 退出脚本sailing" % (myname))
        return
    
    
    
    print "sailing()"
    a = MutexGuard(sailingLock)
    print "Lock acquired"
    count = 0
    while(True):
        
        if(not dolScript.isOnline(proc)):
            log( "断线了, 退出脚本")
            beep(unicode("警告"), unicode("[%s] 断线了!!!" % (myname)))
            break
        
        if(dolScript.getLocationType(proc) != dolCallEnum.LocType.Sea):
            log( "Not in sea, exit")
            break
        
        
        
        #if(count % 10 == 0):
        #    log("Sailing() running...")
            
        if(dolScript.getCombat(proc) == 2): #被攻击
            log("停战")
            dountil(dolScript.isNormal, [proc])
            dolCall.custom(proc, 6) #f6 要设置为停战
            time.sleep(2)
            
        
                    
        if(dolScript.isBadWeather(proc)):
            log("遇到暴风")
            while(dolScript.getSailState(proc) != 0):
                dolCall.sail(proc, 0)
                time.sleep(0.2)
            
            beep(unicode("警告"), unicode("遇到暴风!!!"))
            log('遇到暴风, 已停船, 停止脚本')
            break
        
        
        while(dolScript.getHPRatio(proc) < 0.4):
            if(not dolScript.isOnline(proc)):
                break
                
            hp1 = dolScript.getHP(proc)
            log("要补行动力, 行动力 = %d" % (hp1))
            dountil(dolScript.isNormal, [proc])
            
            dolCall.custom(proc, 7) #f7 要设置为料理
            time.sleep(2)
            hp2 = dolScript.getHP(proc)
            log("吃了一个料理, 行动力 = %d" % (hp2))
            if(hp1 == hp2):
                time.sleep(5)
            time.sleep(0.2)
        
        
            
        
        if(not dolScript.isAutoSail(proc) and dolScript.getSailState(proc) != 0 and dolScript.getWeather(proc) != stormWeather):
            log("操帆")
            dountil(dolScript.isNormal, [proc])
            dolCall.custom(proc, 1) #f1 要设置为操帆
            time.sleep(3)
            
        statetxt = dolScript.getShipState(proc)
        if(statetxt == "鼠患" or statetxt == "海藻"):
            log("发现<%s>,发动驱除技能" % (statetxt)) 
            dountil(dolScript.isNormal, [proc])
            dolCall.custom(proc, 4)#f4 驱除
            time.sleep(3) 
        
        
        sCount, sList = dolScript.getSkill(proc) 
        
        if(sCount != 3 and 75 not in sList): #75 == 警戒
            log("发动警戒技能") 
            dountil(dolScript.isNormal, [proc])
            dolCall.custom(proc, 3)#f3 警戒
            time.sleep(2)
            
            
        #=======================================================================
        # if(sCount != 3 and 12 not in sList): #12 == 钓鱼
        #    log("发动钓鱼技能")
        #    dountil(dolScript.isNormal, [proc])
        #    dolCall.custom(proc, 2) #f2 钓鱼
        #    time.sleep(2)
        #=======================================================================
        
        preFatigue = dolScript.getFatigue(proc)
        if(preFatigue > 40):
            while(preFatigue > 40):
                if(not dolScript.isOnline(proc)):
                    break
                
                
                log("要消除疲劳, 疲劳 = %f" % (preFatigue))
                dountil(dolScript.isNormal, [proc])
                dolCall.custom(proc, 7) #f7 要设置为料理
                fatigue = dolScript.getFatigue(proc)
                time.sleep(2)
                log("吃了一个料理, 疲劳 = %f" % (fatigue))
                
                if(fatigue == preFatigue):
                    log("料理并不能降低疲劳")
                    break
                else:
                    preFatigue = fatigue
        
            
        count += 1
        time.sleep(0.3)