コード例 #1
0
def readNotice(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "id":
                br.ReadInt(),
                "enabled":
                br.ReadInt(),
                "title":
                br.ReadString('latin1'),
                "message":
                br.ReadString('latin1'),
                "time": {
                    "start": br.ReadString('latin1'),
                    "end": br.ReadString('latin1')
                },
                "cycle":
                br.ReadInt(),
                "color": [
                    br.ByteToInt(br.ReadByte()),
                    br.ByteToInt(br.ReadByte()),
                    br.ByteToInt(br.ReadByte()),
                    br.ByteToInt(br.ReadByte())
                ]
            })

    return data
コード例 #2
0
def readStr(file, fileType, encoding, gamigo, simple):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount, dataMax = br.ReadInt() - 1, br.ReadInt()
        fileTypeLower = fileType.lower()

        descCount = 1

        emptyDescFiles = [
            'strclient', 'straffinity', 'strcombo', 'strrareoption',
            'strsetitem', 'stroption'
        ]

        if 'strskill' in fileTypeLower: descCount = 2
        elif 'strquest' in fileTypeLower: descCount = 3
        elif fileTypeLower in emptyDescFiles: descCount = 0

        for i in range(dataCount):

            if br.pos() >= br.size():
                break

            id = br.ReadInt()
            name = br.ReadString(encoding)

            desc = []
            for j in range(descCount):
                desc.append(br.ReadString(encoding))

            if 'stritem' in fileTypeLower and gamigo:
                unknown0 = br.ReadInt()
                unknown1 = br.ReadBytesToString(
                    unknown0, encoding) if unknown0 else 'False'

            if not simple:
                chunk = {"id": id, "name": name}

                if descCount:
                    chunk["description"] = desc
            else:
                chunk = []
                chunk.append(id)
                chunk.append(name)

                if descCount:
                    chunk.append(desc)

            data.append(chunk)

    return data
コード例 #3
0
def readRaidObjectList(file):
    data = []
    with open(file, "rb") as f:
        br = BinaryReader(f)
        dataCount = br.ReadInt()

        for i in range(dataCount):
            data.append({
                "id": br.ReadInt(),
                "assignZone": br.ReadInt(),
                "object": {
                    "id": br.ReadInt(),
                    "type": br.ReadInt(),
                    "name": br.ReadString('latin1'),
                }
            })

    return data