예제 #1
0
def _getList(port, listType=None):
    _dict, indexes = None, None
    if listType and listType in list(typeDict.keys()):
        lst = toList(fromPvfGetContent(port, typeDict[listType][0]))
        _dict = {}
        indexes = reCSort(lst[2:][::2])
        for index in indexes:
            _dict[index] = lst[lst.index(index) + 1]
    return _dict, indexes
예제 #2
0
def anaAni(aniPath, port=""):
    """
    ANI文件分析
    :param port: 读取模式,False为本地,其他应该为端口
    :param aniPath: ANI文件路径
    :return1: 返回ANI路径==文件读取有误/不存在IMG/不存在delay
    :return2: 返回IMG名称和其 包含帧序号的列表 对应延迟列表
    """
    nameFrameList = []
    delays = []

    if port == "":
        with open(aniPath, 'r', encoding='utf-8') as ani:
            aniCList = [line.strip() for line in ani.readlines() if line != '']

    else:
        aniC = fromPvfGetContent(port, aniPath)
        if not aniC:
            return aniPath
        else:
            aniCList = [
                line.strip() for line in fileText2List(aniC) if line != ''
            ]

    errorImgFlag = False
    for INDEX, line in enumerate(aniCList):
        if line == "[IMAGE]":
            imgName = aniCList[INDEX + 1]
            if imgName == '' or '.img' not in imgName:
                errorImgFlag = True
                continue
            imgName = 'sprite/' + imgName.replace('`', '').lower().replace(
                '%02d', '00').replace('%04d', '0000').replace('\\', '/')
            # print(imgName)
            pngIndex = int(aniCList[INDEX + 2])
            nameFrameList.append([imgName, pngIndex])
        elif line == '[DELAY]':
            if errorImgFlag:
                errorImgFlag = False
                continue
            delays.append(int(aniCList[INDEX + 1]) / 1000.0)

    if len(nameFrameList) == 0 or len(
            delays) == 0 or len(nameFrameList) != len(delays):
        return aniPath
    else:
        return nameFrameList, delays
예제 #3
0
def _getList_(port, listType=None):
    lst = toList(fromPvfGetContent(port, typeDict[listType][0]))
    indexes = reCSort(lst[2:][::2])
    return indexes
예제 #4
0
    getTypeList(["passiveobject", "monster", "worldmap", "town", "npc", "itemshop"], port)

# -----------主程序
while True:
    result = getExtractIndex("twn", twnLst)
    if len(result) == 1:
        errorLog = result
        break
    allTwnID, errorLog = result
    directExtractFile = []
    uiPath = []
    mapFilePath = []
    allWdmID, allItemID = [], []
    for twnId in allTwnID:
        twnPath = getLstPath('town', twnId, twnLst)
        twnC = fromPvfGetContent(port, twnPath)
        if twnC is False:
            errorLog.append(twnPath + '\t读取错误')
            continue
        twnCList = fileText2List(twnC)
        directExtractFile.append(twnPath)
        for index, line in enumerate(twnCList):
            if "`[dungeon gate]`" in line:
                allWdmID.append(line.split('\t')[-1])
            elif line == "[entering title]":
                directExtractFile.append("town/" +
                                         twnCList[index +
                                                  1].replace('`', '').lower())
            elif line[-5:].lower() == '.map`':
                # print(line)
                mapPath = 'map/' + line.replace('`', '').lower().replace(
예제 #5
0
from data import replaceChar
import re

from extractFuncs.toolFunc import toList, fromPvfGetContent, ife, GetDesktopPath, iep

port = '27000'

equLst = toList(fromPvfGetContent(port, "equipment/equipment.lst"))

cnP = re.compile(
    r'\[animation job\]\n`\[at swordman\].*equipment/character/atswordman\.lay`',
    flags=re.S)
twP = re.compile("\[animation job\].*\.lay`", flags=re.S)
twCharP = re.compile(r'\[usable job\].*\[/usable job\]', flags=re.S)

# priestWeaponPath = []
for line in equLst:
    if 'character/swordman/weapon' in line:
        pvfPath = 'equipment/' + line.replace('`', '').lower().replace(
            '\\', '/')
        weaponC = fromPvfGetContent(port, pvfPath)
        filePath = "G:\\" + pvfPath.replace('/', '\\')
        if weaponC and ife(filePath):
            with open(filePath, 'r', encoding='utf-8') as cnF:
                cnWeaponC = cnF.read()
            twS = re.search(twP, weaponC)
            cnS = re.search(cnP, cnWeaponC)
            twCS = re.search(twCharP, weaponC)

            if twS and cnS and twCS:
                weaponC = re.sub(twCharP, replaceChar, weaponC)
예제 #6
0
def equExtract(allEquID, equLst, port, errorLog, imgDir):
    creLst = toList(fromPvfGetContent(port, "creature/creature.lst"))
    for equId in allEquID:
        if equId not in equLst:
            errorLog.append(equId + "\t不在列表中,已跳过获取。")
            allEquID.remove(equId)
    if len(allEquID) == 0:
        return False

    # ------------创建套装词典
    partSetIndexDict = getPartSetIndexDict(imgDir, equLst, port)
    partSetEtcDict = getPartSetEtc(port)
    # ------------初步获取输入装备index信息
    [
        directExtractFiles, repeatEqu, allMobID, allObjID, allApdID, allApcID,
        iconImgFiles, trueVars, allCreID, allPartSetFileIndex, repeatFileList,
        inputItems
    ] = getEmptyList(12)

    contentList = [
        iconImgFiles, trueVars, repeatEqu, allMobID, allObjID, allApdID,
        allApcID, allCreID, allPartSetFileIndex, repeatFileList,
        directExtractFiles, errorLog, inputItems
    ]
    contentList = equIdFunc(allEquID, equLst, port, contentList)

    # ------------获取套装信息
    setPartContent = ''
    getPartSetInfo = [
        directExtractFiles, repeatEqu, allMobID, allObjID, allApcID, allApdID,
        repeatFileList
    ]
    allPartSetFileIndex = list(set(allPartSetFileIndex))

    # ------------去除对高级和稀有时装的获取
    if "2" in allPartSetFileIndex:
        allPartSetFileIndex.remove("2")
    if "3" in allPartSetFileIndex:
        allPartSetFileIndex.remove("3")
    if len(allPartSetFileIndex) > 0:
        [directExtractFiles, repeatEqu, allMobID,
         allObjID, allApcID, allApdID, repeatFileList], \
        setPartContent, errorLog = getPartSet(allPartSetFileIndex, partSetIndexDict,
                                              partSetEtcDict, getPartSetInfo, errorLog, port)

    contentList = [
        iconImgFiles, trueVars, repeatEqu, allMobID, allObjID, allApdID,
        allApcID, allCreID, allPartSetFileIndex, repeatFileList,
        directExtractFiles, errorLog, inputItems
    ]

    # ------------重复获取
    allEquID, contentList = equRepeat(repeatEqu, allEquID, contentList, port,
                                      equLst)
    [
        iconImgs, trueVars, repeatEqu, allMobID, allObjID, allApdID, allApcID,
        allCreID, allPartSetFileIndex, repeatFileList, directExtractFiles,
        errorLog, inputItems
    ] = contentList

    # ------------宠物提取
    allCreID = list(set(allCreID).intersection(set(creLst)))
    if len(allCreID) > 0:
        creDirectFile, creRepeatFile, creObj, errorLog = creFunc(
            allCreID, creLst, port, errorLog)
        directExtractFiles += creDirectFile
        repeatFileList += creRepeatFile
        allObjID += creObj

    return directExtractFiles, repeatFileList, \
           allEquID, allMobID, allObjID, allApdID, allCreID, allApcID, \
           iconImgs, trueVars, setPartContent