Esempio n. 1
0
def readLevelupGuide(file):
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()
        levelupData = br.ReadIntToList(dataCount)

        return {"levelupMsgData": levelupData}
Esempio n. 2
0
def readItemCompose(file):
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()
        composeData = br.ReadIntToList(dataCount)

        return {"composeData": composeData}
Esempio n. 3
0
def readShop(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            id = br.ReadInt()
            shopName = br.ReadBytesToString(br.ReadInt(), 'latin1')
            sellRate = br.ReadInt()
            buyRate = br.ReadInt()
            itemCount = br.ReadInt()
            sellItems = br.ReadIntToList(itemCount)

            data.append({
                "npcId": id,
                "shopName": shopName,
                "rate": {
                    "sell": sellRate,
                    "buy": buyRate
                },
                "itemCount": itemCount,
                "items": sellItems
            })

            if dataCount == id:
                break

    return data
Esempio n. 4
0
def readTitletool(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "id": br.ReadInt(),
                "enable": br.ByteToInt(br.ReadByte()),
                "effect": {
                    "normal": br.ReadBytesToString(64, 'latin1'),
                    "attack": br.ReadBytesToString(64, 'latin1'),
                    "damage": br.ReadBytesToString(64, 'latin1')
                },
                "color": {
                    "text": "{:08x}".format(br.ReadInt()),
                    "background": "{:08x}".format(br.ReadInt()),
                },
                "option": {
                    "id":
                    br.ReadIntToList(5),
                    "level": [
                        br.ByteToInt(br.ReadByte()),
                        br.ByteToInt(br.ReadByte()),
                        br.ByteToInt(br.ReadByte()),
                        br.ByteToInt(br.ReadByte()),
                        br.ByteToInt(br.ReadByte())
                    ]
                },
                "itemId": br.ReadInt()
            })

    return data
Esempio n. 5
0
def readItemExchange(file):
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount, dataMax = br.ReadInt(), br.ReadInt()

        return {
            "tradeItemData": br.ReadIntToList(dataMax),
        }
Esempio n. 6
0
def readItemFortune(file):
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        return {
            "itemFortuneData": br.ReadIntToList(dataCount),
        }
Esempio n. 7
0
def readNpcChannel(file):
    CHANNEL_ARRAY_SIZE = 16

    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        return {
            "npcIndex": br.ReadInt(),
            "channel": br.ReadIntToList(CHANNEL_ARRAY_SIZE)
        }
Esempio n. 8
0
def readChangeItem(file):
    with open(file, "rb") as f:
        br = BinaryReader(f)

        changeWeapon = br.ReadIntToList(br.ReadInt())
        changeHelmet = br.ReadIntToList(br.ReadInt())
        changeTop = br.ReadIntToList(br.ReadInt())
        changePants = br.ReadIntToList(br.ReadInt())
        changeGloves = br.ReadIntToList(br.ReadInt())
        changeBoots = br.ReadIntToList(br.ReadInt())

    return {
        "changeWeapon": changeWeapon,
        "changeArmor": {
            "helmet": changeHelmet,
            "top": changeTop,
            "pants": changePants,
            "gloves": changeGloves,
            "boots": changeBoots
        }
    }
Esempio n. 9
0
def readMoonstone(file):
    MOONSTONE_MAX_GAMIGO = 6
    MOONSTONE_MAX_OTHER = 5

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)

        for i in range(MOONSTONE_MAX_GAMIGO):
            itemCount = br.ReadInt()

            data.append({"id": i, "items": br.ReadIntToList(itemCount)})

    return data
Esempio n. 10
0
def readAction(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "id": br.ReadInt(),
                "type": br.ByteToInt(br.ReadByte()),
                "job": br.ReadInt(),
                "iconPosition": br.ReadIntToList(3)
            })

    return data
Esempio n. 11
0
def readCombo(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "id": br.ReadInt(),
                "gold": br.ReadInt(),
                "iconPosition": br.ReadIntToList(3),
                "skill": br.ByteToInt(br.ReadByte()),
                "point": br.ReadInt()
            })

    return data
Esempio n. 12
0
def readOption(file):
    DEF_OPTION_MAX_LEVEL = 36

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "id": br.ReadInt(),
                "type": br.ReadInt(),
                "levels": br.ReadIntToList(DEF_OPTION_MAX_LEVEL)
            })

    return data
Esempio n. 13
0
def readZoneData(file):
    DEF_EXTRA_MAX = 30

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        zoneCount = br.ReadInt()

        zoneInfoChunk = []
        for i in range(zoneCount):
            zoneType = br.ReadInt()
            extraCnt = br.ReadInt()
            nString = br.ReadInt()
            wldFileName = br.ReadBytesToString(128, 'latin1')
            texName1 = br.ReadBytesToString(64, 'latin1')
            texName2 = br.ReadBytesToString(64, 'latin1')
            fLoadingStep = br.ReadFloat()
            fTer_Lodmul = br.ReadFloat()

            zoneInfoChunk.append({
                "zoneType": zoneType,
                "extraCnt": extraCnt,
                "nString": nString,
                "wldFileName": wldFileName,
                "texture": {
                    "texName1": texName1,
                    "texName2": texName2
                },
                "loadingStep": fLoadingStep,
                "terLodmul": fTer_Lodmul
            })

        nExtraCnt = br.ReadInt()
        zoneExtraChunk = []
        for i in range(nExtraCnt):
            zoneExtraChunk.append(br.ReadIntToList(DEF_EXTRA_MAX))

        data.append({"zoneData": zoneInfoChunk, "zoneExtra": zoneExtraChunk})

    return data
Esempio n. 14
0
def readStatTooltip(file):
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        return br.ReadIntToList(dataCount)
Esempio n. 15
0
def readItem(file, isGamigo):
    MAX_MAKE_ITEM_MATERIAL = 10
    DEF_SMC_DEFAULT_LENGTH = 64
    DEF_MAX_ORIGIN_OPTION = 10
    DEF_EFFECT_DEFAULT_LENGTH = 32

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "itemId":
                br.ReadInt(),
                "jobFlag":
                br.ReadInt(),
                "stack":
                br.ReadInt(),
                "fame/maxuse":
                br.ReadInt(),
                "level":
                br.ReadInt(),
                "flag":
                br.ReadInt64(),
                "wearing":
                br.ReadInt(),
                "type":
                br.ReadInt(),
                "subtype":
                br.ReadInt(),
                "crafting": {
                    "needItemId": br.ReadIntToList(MAX_MAKE_ITEM_MATERIAL),
                    "needItemCount": br.ReadIntToList(MAX_MAKE_ITEM_MATERIAL)
                },
                "specialSkill": {
                    "needSpecialSkill1": br.ReadIntToList(2),
                    "needSpecialSkill2": br.ReadIntToList(2),
                },
                "iconPosition":
                br.ReadIntToList(3),
                "num":
                br.ReadIntToList(4),
                "price":
                br.ReadInt(),
                "set":
                br.ReadIntToList(7 if isGamigo else 5),
                "smc":
                br.ReadBytesToString(DEF_SMC_DEFAULT_LENGTH, 'latin1'),
                "effect": {
                    "normal":
                    br.ReadBytesToString(DEF_EFFECT_DEFAULT_LENGTH, 'latin1'),
                    "attack":
                    br.ReadBytesToString(DEF_EFFECT_DEFAULT_LENGTH, 'latin1'),
                    "damage":
                    br.ReadBytesToString(DEF_EFFECT_DEFAULT_LENGTH, 'latin1')
                },
                "rareOption": {
                    "id": br.ReadInt(),
                    "chance": br.ReadInt(),
                    "optionIds": br.ReadIntToList(DEF_MAX_ORIGIN_OPTION),
                    "optionLevels": br.ReadIntToList(DEF_MAX_ORIGIN_OPTION)
                },
                "rvr": {
                    "type": br.ReadInt(),
                    "grade": br.ReadInt()
                },
                "fortuneId":
                br.ByteToInt(br.ReadByte()),
                "castleWar":
                br.ReadInt()
            })

    return data
Esempio n. 16
0
def readQuest(file):
    QUEST_MAX_NEED_ITEM = 5
    QUEST_MAX_CONDITION = 3
    QUEST_MAX_CONDITION_DATA = 4
    QUEST_MAX_PRIZE = 5
    QUEST_MAX_OPTPRIZE = 7

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            id = br.ReadInt()
            type1 = br.ReadInt()
            type2 = br.ReadInt()
            startType = br.ReadInt()
            startData = br.ReadInt()
            prizeNpc = br.ReadInt()
            preQuestNo = br.ReadInt()
            startNpcZoneNo = br.ReadInt()
            prizeNpcZoneNo = br.ReadInt()
            needExp = br.ReadInt()
            needMinLevel = br.ReadInt()
            needMaxLevel = br.ReadInt()
            needJob = br.ReadInt()
            needMinPenalty = br.ReadInt()
            needMaxPenalty = br.ReadInt()
            needItemIndex = br.ReadIntToList(QUEST_MAX_NEED_ITEM)
            needItemCount = br.ReadIntToList(QUEST_MAX_NEED_ITEM)
            rvrType = br.ReadInt()
            rvrGrade = br.ReadInt()

            conditionType = br.ReadIntToList(QUEST_MAX_CONDITION)
            conditionIndex = br.ReadIntToList(QUEST_MAX_CONDITION)
            conditionNum = br.ReadIntToList(QUEST_MAX_CONDITION)

            conditionData = []
            for i in range(QUEST_MAX_CONDITION):
                conditionData.append(
                    br.ReadIntToList(QUEST_MAX_CONDITION_DATA))

            prizeType = br.ReadIntToList(QUEST_MAX_PRIZE)
            prizeIndex = br.ReadIntToList(QUEST_MAX_PRIZE)
            prizeData = br.ReadInt64ToList(QUEST_MAX_PRIZE)

            optionPrize = br.ReadInt()
            optPrizeType = br.ReadIntToList(QUEST_MAX_OPTPRIZE)
            optPrizeIndex = br.ReadIntToList(QUEST_MAX_OPTPRIZE)
            optPrizeData = br.ReadIntToList(QUEST_MAX_OPTPRIZE)
            optPrizePlus = br.ReadIntToList(QUEST_MAX_OPTPRIZE)

            partyScale = br.ReadInt()
            onlyOptPrize = br.ReadInt()

            data.append({
                "id": id,
                "questType": {
                    "type1": type1,
                    "type2": type2
                },
                "startType": startType,
                "startNpc": startData,
                "prizeNpc": prizeNpc,
                "preQuestId": preQuestNo,
                "startNpcZoneId": startNpcZoneNo,
                "prizeNpcZoneId": prizeNpcZoneNo,
                "needExp": needExp,
                "minLevel": needMinLevel,
                "maxLevel": needMaxLevel,
                "requiredJob": needJob,
                "pkPenaltyMin": needMinPenalty,
                "pkPenaltyMax": needMaxPenalty,
                "requiredItems": {
                    "itemIds": needItemIndex,
                    "itemCount": needItemCount
                },
                "rvrTypeId": rvrType,
                "rvrGradeId": rvrGrade,
                "condition": {
                    "types": conditionType,
                    "ids": conditionIndex,
                    "count": conditionNum,
                    "data": conditionData
                },
                "prize": {
                    "types": prizeType,
                    "ids": prizeIndex,
                    "data": prizeData,
                    "optionPrize": optionPrize,
                    "optionPrizeType": optPrizeType,
                    "optionPrizeIndex": optPrizeIndex,
                    "optionPrizeData": optPrizeData,
                    "optionPrizePlus": optPrizePlus
                },
                "groupType": partyScale,
                "onlyOptPrize": onlyOptPrize
            })

    return data
Esempio n. 17
0
def readAffinity(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            id = br.ReadInt()
            iconPosition = br.ReadIntToList(3)
            needItemId = br.ReadInt()
            needItemCount = br.ReadInt()
            needLevel = br.ReadInt()
            needId = br.ReadInt()
            needPoints = br.ReadInt()

            affinityNpcsData = []
            npcsRows = br.ReadInt()

            for j in range(npcsRows):
                affinityNpcsData.append({
                    "npcId": br.ReadInt(),
                    "npcFlag": br.ReadInt(),
                    "npcStringId": br.ReadInt()
                })

            affinityContributeItemData = []
            contributeItemRows = br.ReadInt()

            for k in range(contributeItemRows):
                affinityContributeItemData.append({
                    "itemId": br.ReadInt(),
                    "points": br.ReadInt()
                })

            affinityContributeMonsterData = []
            contributeMonsterRows = br.ReadInt()

            for l in range(contributeMonsterRows):
                affinityContributeMonsterData.append({
                    "npcId":
                    br.ReadInt(),
                    "points":
                    br.ReadInt(),
                    "iconPosition":
                    br.ReadIntToList(3)
                })

            affinityContributeQuestData = []
            contributeQuestRows = br.ReadInt()

            for m in range(contributeQuestRows):
                affinityContributeQuestData.append({
                    "questId": br.ReadInt(),
                    "points": br.ReadInt()
                })

            affinityRewardItemData = []
            rewardItemRows = br.ReadInt()

            for n in range(rewardItemRows):
                affinityRewardItemData.append({
                    "itemId": br.ReadInt(),
                    "points": br.ReadInt()
                })

            data.append({
                "id": id,
                "iconPosition": iconPosition,
                "itemRequirements": {
                    "itemId": needItemId,
                    "itemCount": needItemCount,
                },
                "requiredLevel": needLevel,
                "requirements": {
                    "affinityId": needId,
                    "affinityPoints": needPoints,
                },
                "npcs": affinityNpcsData,
                "contributeItems": affinityContributeItemData,
                "contributeMonsters": affinityContributeMonsterData,
                "contributeQuests": affinityContributeQuestData,
                "rewardItems": affinityRewardItemData
            })

    return data
Esempio n. 18
0
def readMob(file):
    DEF_SMC_LENGTH = 128
    DEF_ANI_LENGTH = 64

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "npcId": br.ReadInt(),
                "level": br.ReadInt(),
                "health": br.ReadInt(),
                "mana": br.ReadInt(),
                "flag": br.ReadInt(),
                "flag1": br.ReadInt(),
                "speed": {
                    "attack": br.ReadInt(),
                    "walk": br.ReadFloat(),
                    "run": br.ReadFloat(),
                },
                "scale": br.ReadFloat(),
                "attackArea": br.ReadFloat(),
                "size": br.ReadFloat(),
                "master": {
                    "skill": br.ByteToInt(br.ReadByte()),
                    "specialSkill": br.ByteToInt(br.ReadByte())
                },
                "skillEffect": br.ReadIntToList(5),
                "attackType": br.ByteToInt(br.ReadByte()),
                "fire": {
                    "delayCount": br.ByteToInt(br.ReadByte()),
                    "delay": br.ReadFloatToList(4),
                    "object": br.ByteToInt(br.ReadByte()),
                    "speed": br.ReadFloat()
                },
                "skill": {
                    "skill0": [br.ReadInt(),
                               br.ByteToInt(br.ReadByte())],
                    "skill1": [br.ReadInt(),
                               br.ByteToInt(br.ReadByte())]
                },
                "rvr": {
                    "grade": br.ReadInt(),
                    "value": br.ReadInt()
                },
                "bound": br.ReadFloat(),
                "model": {
                    "smc": br.ReadBytesToString(DEF_SMC_LENGTH, 'latin1'),
                    "animation": {
                        "idle": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                        "walk": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                        "damage": br.ReadBytesToString(DEF_ANI_LENGTH,
                                                       'latin1'),
                        "attack": br.ReadBytesToString(DEF_ANI_LENGTH,
                                                       'latin1'),
                        "die": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                        "run": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                        "idle2": br.ReadBytesToString(DEF_ANI_LENGTH,
                                                      'latin1'),
                        "attack2":
                        br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                    },
                },
                "fireEffect": {
                    "0": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                    "1": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1'),
                    "2": br.ReadBytesToString(DEF_ANI_LENGTH, 'latin1')
                }
            })

    return data
Esempio n. 19
0
def readBigpet(file):
    DEF_APET_NAME_LENGTH = 20
    DEF_SMCFILE_LENGTH = 64
    DEF_APET_ANI_LENGTH = 32
    DEF_MAX_EVOLUTION = 4

    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            id = br.ReadInt()
            name = br.ReadBytesToString(DEF_APET_NAME_LENGTH, 'latin-1')
            type = br.ReadInt()
            itemId = br.ReadInt()
            aiSlot = br.ReadInt()
            mount = br.ReadIntToList(2)
            summonSkill = br.ReadIntToList(2)
            flag = br.ReadInt()
            smc = [
                br.ReadBytesToString(DEF_SMCFILE_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_SMCFILE_LENGTH, 'latin-1')
            ]
            idle1 = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            idle2 = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            attack1 = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            attack2 = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            damage = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            die = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            walk = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            run = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]
            levelup = [
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1'),
                br.ReadBytesToString(DEF_APET_ANI_LENGTH, 'latin-1')
            ]

            apetEvolutionData = []
            for j in range(DEF_MAX_EVOLUTION):
                apetEvolutionData.append({
                    "level": br.ReadInt(),
                    "stamina": br.ReadInt(),
                    "faith": br.ReadInt(),
                    "evPetId": br.ReadInt()
                })

            data.append({
                "id": id,
                "name": name,
                "type": type,
                "itemId": itemId,
                "aiSlot": aiSlot,
                "mount": mount,
                "summonSkill": summonSkill,
                "flag": flag,
                "model": {
                    "smc": smc,
                    "animation": {
                        "idle1": idle1,
                        "idle2": idle2,
                        "attack1": attack1,
                        "attack2": attack2,
                        "damage": damage,
                        "die": die,
                        "walk": walk,
                        "run": run,
                        "levelup": levelup
                    }
                },
                "evolutionData": apetEvolutionData,
                # DEF_MAX_ACCEXP = 1
                "accExpData": {
                    "maxAccParam1": br.ReadInt(),
                    "maxAccParam2": br.ReadInt(),
                    "accRateParam1": br.ReadInt(),
                    "accRateParam2": br.ReadInt()
                }
            })

    return data