Exemplo n.º 1
0
def extractDgn(dgnNameList, nameRepeatFlag, dgnIndex, port, allLst):
    dgnLst, objLst, mobLst, mapLst = allLst[0], allLst[7], allLst[2], allLst[
        -1]
    errorLog = []
    # -----------获取Dgn内信息
    # if dgnIndex in map2DgnDict.keys():
    #     dgnMapIndex = map2DgnDict[dgnIndex]
    # else:
    dgnMapIndex = []
    directExtractFile, dgnObjID, allMapIndex, dgnMobID, dgnName, dgnPathName = dgnFunc(
        dgnIndex, dgnLst, port, dgnMapIndex)
    dgnName = correctDirName(dgnName)
    if dgnName not in dgnNameList:
        dgnNameList.append(dgnName)
    else:
        dgnName += str(nameRepeatFlag)
        nameRepeatFlag += 1
        dgnNameList.append(dgnName)
    couldRepeatGetFileList, allObjID, allMobID, wrongObjID, wrongMobID = ObjMobIDToPath(
        dgnObjID, dgnMobID, objLst, mobLst)
    # changeMapID
    changeMapID, npcList = [], []
    contentList = [
        directExtractFile, couldRepeatGetFileList, allObjID, allMobID,
        changeMapID, npcList
    ]
    # 对在词典里的地图进行获取
    [directExtractFile, couldRepeatGetFileList, allObjID, allMobID, changeMapID, npcList], \
    dgnMapIndex, errorLog = getInDictMapInfo(contentList, allMapIndex, mapLst,
                                             errorLog, dgnMapIndex, port)
    # -----------循环获取
    allApcID = []
    directExtractList, allObjID, allMobID, errorLog = repeatGet(
        allObjID, objLst, allMobID, mobLst, couldRepeatGetFileList,
        directExtractFile, allApcID, port, errorLog)
    allMapIndex = reCSort(allMapIndex)
    allObjID = reCSort(allObjID)
    allMobID = reCSort(allMobID)
    directExtractFile = list(set(directExtractFile + directExtractList))
    lstDict = {
        "dungeon": [[dgnIndex], dgnLst],
        "map": [allMapIndex, mapLst],
        "passiveObject": [allObjID, objLst],
        "monster": [allMobID, mobLst]
    }

    return [
        "\\副本\\" + dgnName, nameRepeatFlag, dgnNameList, directExtractFile,
        lstDict, errorLog
    ]
Exemplo n.º 2
0
def extractObj(objIndex, port, allLst, errorLog):
    mobLst, objLst = allLst[2], allLst[7]
    directExtractFile, couldRepeatGetFileList, allMobID, allApcID = getEmptyList(
        4)
    directExtractFile, allObjID, allMobID, errorLog = repeatGet(
        objIndex, objLst, allMobID, mobLst, couldRepeatGetFileList,
        directExtractFile, allApcID, port, errorLog)
    # 去重排序
    allObjID = reCSort(allObjID)
    allMobID = reCSort(allMobID)
    directExtractFile = list(set(directExtractFile))
    # 导出文件
    objName = '\\特效-被动对象\\' + "_".join(allObjID)
    lstDict = {
        "passiveObject": [allObjID, objLst],
        "monster": [allMobID, mobLst]
    }

    return objName, directExtractFile, lstDict, errorLog
Exemplo n.º 3
0
def extractAPC(saveDir, allApcID, port, allLst, errorLog):
    start_id = int(datetime.now().strftime('%Y%m%d') + '00')
    shpID = 100301

    apcLst, equLst, objLst, mobLst, = allLst[3], allLst[1], allLst[7], allLst[
        2]

    allDirectFile, allRepeatFile, allItems, newAllApc, allObjID, allMobID, stkList, newcashshopList = getEmptyList(
        8)

    apcNameList = getApcNameDict(allApcID, apcLst, equLst, port, errorLog)

    apcDirName = "\\APC\\" + "_".join(allApcID)
    apcSaveDir = saveDir + apcDirName
    iep(apcSaveDir)

    for apcC in apcNameList:

        [apcID, apcName, equItem, apcJob, directFile, repeatFile] = apcC
        allItems += equItem
        allDirectFile += directFile
        allRepeatFile += repeatFile
        newAllApc.append(apcID)
        newSummon = summonStk.format(name=apcName, ID=apcID)

        # 写入STK文件
        packageContent = ''
        for equID in equItem:
            if 'avatar' in equLst[equLst.index(equID) + 1]:
                packageContent += '''\n[avatar]\n1\t{equID}\t1000\t1\t0\t0\n[/avatar]\n'''.format(
                    equID=equID)
            else:
                packageContent += '''\n[equipment]\n1\t{equID}\t1000\t1\n[/equipment]\n'''.format(
                    equID=equID)

        packageContent += '''\n[stackable]\n1\t{card}\t1000\t1\n[/stackable]\n'''.format(
            card=str(start_id))
        newPackage = packageStk.format(name=apcName,
                                       job=apcJob,
                                       package=packageContent)

        start_id, stkList = saveFileApc(start_id, newSummon, stkList,
                                        apcSaveDir)
        start_id, stkList = saveFileApc(start_id, newPackage, stkList,
                                        apcSaveDir)

        newcashshopList.append(
            """{a}	{b}	0	0	1200	`{name} COS 礼包`	1	0	-1	-1	\n""".format(
                a=str(shpID), b=str(start_id - 1), name=apcName))

        shpID += 1

    allDirectFile, allObjID, allMobID, errorLog = repeatGet(
        allObjID, objLst, allMobID, mobLst, allRepeatFile, allDirectFile,
        allApcID, port, errorLog)

    allDirectFile = [
        file.replace('key/key/', 'key/') for file in allDirectFile
    ]
    # 写出物品TXT
    with open(apcSaveDir + '\\apcEqu.lst', 'w', encoding='utf-8') as f:
        f.write('**所有APC物品代码**\n')
        items = ','.join(allItems)
        f.write('-' * (len(items) + 4) + '\n')
        f.write('+ ' + items + ' +\n')
        f.write('-' * (len(items) + 4) + '\n\n')
        f.write('\n\n**对应APC物品代码**\n')
        for apc in apcNameList:
            f.write('apcName:' + apc[1] + '\n' + 'apcID:\t' + apc[0] + '\n')
            items = ','.join(apc[2])
            f.write('-' * (len(items) + 4) + '\n')
            f.write('+ ' + items + ' +\n')
            f.write('-' * (len(items) + 4) + '\n\n')

    lstSavePath = apcSaveDir + '\\APC提取列表.txt'
    # 写出列表
    with open(lstSavePath, 'w', encoding='utf-8') as lst:
        lst.write("----------stackable.lst----------\n")
    with open(lstSavePath, 'a', encoding="utf-8") as lst:
        for stk in stkList:
            lst.write(stk)
    with open(lstSavePath, 'a', encoding='utf-8') as lst:
        lst.write("\n\n----------etc/newcashshop.etc----------\n")
    with open(lstSavePath, 'a', encoding="utf-8") as lst:
        for shp in newcashshopList:
            lst.write(shp)

    lstDict = {
        "aicharacter": [allApcID, apcLst],
        "monster": [allMobID, mobLst],
        "passiveObject": [allObjID, objLst]
    }

    return apcDirName, allDirectFile, lstDict, errorLog
Exemplo n.º 4
0
def extractTwn(twnId, port, allLst, errorLog, savePath):
    directExtractFile, uiPath, mapFilePath, allWdmID, allItemID = getEmptyList(
        5)

    twnLst, wdmLst, objLst, mobLst = allLst[9], allLst[10], allLst[7], allLst[
        2]

    twnPath = getLstPath('town', twnId, twnLst)
    twnC = fromPvfGetContent(port, twnPath)

    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('\\', '/')
            frMap = [
                mapPath.replace(
                    mapPath.split('/')[-1], '(r)' + mapPath.split('/')[-1]),
                mapPath.replace(
                    mapPath.split('/')[-1], '(f)' + mapPath.split('/')[-1])
            ]
            # print(frMap)
            mapFilePath.append(mapPath)
            directExtractFile.append(mapPath)
            mapFilePath += frMap
            directExtractFile += frMap
    if len(allWdmID) > 0:
        for wdmID in allWdmID:
            if wdmID not in wdmLst:
                errorLog.append(wdmID + '\t不在wdm列表中')
                continue
            wdmFilePath = getLstPath('worldmap', wdmID, wdmLst)

            wdmC = fromPvfGetContent(port, wdmFilePath)
            if wdmC is False:
                errorLog.append(wdmFilePath + '\t读取错误')
                continue
            directExtractFile.append(wdmFilePath)
            wdmCList = fileText2List(wdmC)
            for index, line in enumerate(wdmCList):
                # UI路径
                if line == "[ui path]":
                    directExtractFile.append(wdmCList[index + 1].replace(
                        '`', '').lower())
        # print(mapFilePath)

    mapDirectExtractFile, couldRepeatGetFileList, allObjID, allMobID, changeMapID, npcID = mapPathFunc(
        mapFilePath, port, errorLog)

    directExtractFile += mapDirectExtractFile
    allApcID = []
    directExtractList, allObjID, allMobID, errorLog = repeatGet(
        allObjID, objLst, allMobID, mobLst, couldRepeatGetFileList,
        directExtractFile, allApcID, port, errorLog)

    npcLst = toList(fromPvfGetContent(port, "npc/npc.lst"))
    itemShopLst = toList(fromPvfGetContent(port, "itemshop/itemshop.lst"))

    directNpc, allItemID, npcWritID, itemshopWriteID, npcItemDIct, errorLog = extractNpc(
        npcLst, itemShopLst, npcID, port, errorLog)

    directExtractFile += directNpc

    name = "\\城镇\\{}".format(twnId)

    lstDict = {
        "passiveObject": [allObjID, objLst],
        "monster": [allMobID, mobLst],
        "town": [[twnId], twnLst],
        "worldmap": [allWdmID, wdmLst],
        "npc": [npcWritID, npcLst],
        "itemshop": [itemshopWriteID, itemShopLst]
    }

    itemIDFilePath = savePath + name + "\\商店物品列表.txt"
    iep(savePath + name)
    with open(itemIDFilePath, 'w', encoding='utf-8') as f:
        f.write('**所有商店物品代码**\n')
        items = ','.join(allItemID)
        f.write('-' * (len(items) + 4) + '\n')
        f.write('+ ' + items + ' +\n')
        f.write('-' * (len(items) + 4) + '\n\n')
        f.write('\n\n**对应NPC/ItemShop商店物品代码**\n')
        for npc, item in npcItemDIct.items():
            f.write('npcName:' + item[2] + '\n' + 'npcID:\t' + npc + '\n' +
                    'itemShopID:\t' + item[0] + '\n')
            items = ','.join(item[1])
            f.write('-' * (len(items) + 4) + '\n')
            f.write('+ ' + items + ' +\n')
            f.write('-' * (len(items) + 4) + '\n\n')
    return name, directExtractFile, lstDict, errorLog
Exemplo n.º 5
0
def extractEquStk(allItemID, errorLog, port, allLst, partSetIndexDict):
    # allItemID, (dgnLst, mapLst, mobLst, objLst, equLst, stkLst, apcLst, apdLst, creLst, twnLst), errorLog = result
    stkLst, equLst, objLst, mobLst, apcLst, apdLst, creLst = allLst[8], allLst[1], allLst[7], \
                                                             allLst[2], allLst[3], allLst[11], \
                                                             allLst[4]

    allEquID, allStkID = listJoin(allItemID,
                                  equLst), listJoin(allItemID, stkLst)

    [
        allMobID, allObjID, allApcID, allCreID, allApdID, iconImgs,
        directExtractFiles, repeatFileList, repeatStk
    ] = getEmptyList(9)

    getContentList = directExtractFiles, repeatStk, allEquID, allMobID, allObjID, allApcID, repeatFileList, iconImgs

    getContentList, errorLog = stkIDFunc(allStkID, stkLst, equLst,
                                         getContentList, port, errorLog)

    repeatStk = list(set(list(set(repeatStk))) - set(allStkID))
    # ------------新获取的STK重复
    allStkID, getContentList = stkRepeat(repeatStk, allStkID, getContentList,
                                         stkLst, equLst, port, errorLog)

    directExtractFiles, repeatStk, allEquID, allMobID, allObjID, allApcID, repeatFileList, iconImgs = getContentList

    # ------------提取装备
    partSetContent = ''
    trueVars = []
    result = equExtract(allEquID, equLst, port, errorLog, partSetIndexDict)
    if result:
        _directExtractFiles, _repeatFileList, \
        allEquID, _MobID, _ObjID, _ApdID, _CreID, _ApcID, \
        _iconImgs, _trueVars, _partSetContent = result

        directExtractFiles += _directExtractFiles
        repeatFileList += _repeatFileList
        allMobID += _MobID
        allObjID += _ObjID
        allApdID += _ApdID
        allApcID += _ApcID
        allCreID += _CreID
        iconImgs += _iconImgs
        trueVars += _trueVars
        partSetContent += _partSetContent + '\n'

    # ------------重复获取可重复文件
    directExtractFiles, allObjID, allMobID, errorLog = repeatGet(
        allObjID, objLst, allMobID, mobLst, repeatFileList, directExtractFiles,
        allApcID, port, errorLog)
    notInLstApc = checkInList(allApcID, apcLst)
    errorLog += [apcID + "\tAPC不在列表中" for apcID in notInLstApc]

    apdFilePathList, allApdID = getApdFilePathList(allApdID, apdLst, port,
                                                   errorLog)
    directExtractFiles += apdFilePathList

    # ------------写出文件

    lstDict = {
        "stackable": [allStkID, stkLst],
        "equipment": [allEquID, equLst],
        "aicharacter": [allApcID, apcLst],
        "appendage": [allApdID, apdLst],
        "creature": [allCreID, creLst],
        "passiveObject": [allObjID, objLst],
        "monster": [allMobID, mobLst]
    }

    # ------------导出整合IMG
    return "\\装备-消耗品\\" + allItemID[0], [
        trueVars, iconImgs
    ], directExtractFiles, lstDict, errorLog
Exemplo n.º 6
0
while True:
    result = getExtractIndex("obj", objLst)
    if len(result) == 1:
        flag = printErrorLog(result)
        if flag == 0:
            print("程序已退出。")
            break
        else:
            continue
    # 提取
    allObjID, errorLog = result

    directExtractFile, couldRepeatGetFileList, allMobID, allApcID = getEmptyList(
        4)
    directExtractFile, allObjID, allMobID, errorLog = repeatGet(
        allObjID, objLst, allMobID, mobLst, couldRepeatGetFileList,
        directExtractFile, allApcID, port, errorLog)

    # 去重排序
    allObjID = reCSort(allObjID)
    allMobID = reCSort(allMobID)
    directExtractFile = list(set(directExtractFile))
    # 导出文件
    objName = 'obj' + "_".join(allObjID)
    lstDict = {
        "passiveObject": [allObjID, objLst],
        "monster": [allMobID, mobLst]
    }
    newSaveMainDir = saveMainDir + '\\特效\\{name}\\'.format(name=objName)
    imgList, errorLog = outPutFileAndNPK(newSaveMainDir, lstDict, imgDir, npk,
                                         directExtractFile, errorLog, port)
Exemplo n.º 7
0
        newPackage = packageStk.format(name=apcName,
                                       job=apcJob,
                                       package=packageContent)

        start_id, stkList = saveFile(start_id, newSummon, stkList, apcSaveDir)
        start_id, stkList = saveFile(start_id, newPackage, stkList, apcSaveDir)

        newCashShopList.append(
            cashShopFileC.format(a=str(shpID),
                                 b=str(start_id - 1),
                                 name=apcName))

        shpID += 1

    allDirectFile, allObjID, allMobID, errorLog = repeatGet(
        allObjID, objLst, allMobID, mobLst, allRepeatFile, allDirectFile,
        allApcID, port, errorLog)

    allDirectFile = [
        file.replace('key/key/', 'key/') for file in allDirectFile
    ]
    # 写出物品TXT

    exLstText = apcExLst(stkList, newCashShopList, allItems, apcNameList)

    lstDict = {
        "aicharacter": [allApcID, apcLst],
        "passiveObject": [allObjID, objLst],
        "monster": [allMobID, mobLst]
    }