当前位置: 首页>>代码示例>>Python>>正文


Python ByteWriter.get方法代码示例

本文整理汇总了Python中cuwo.bytes.ByteWriter.get方法的典型用法代码示例。如果您正苦于以下问题:Python ByteWriter.get方法的具体用法?Python ByteWriter.get怎么用?Python ByteWriter.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cuwo.bytes.ByteWriter的用法示例。


在下文中一共展示了ByteWriter.get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: set_entity

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
 def set_entity(self, entity, entity_id, mask=None):
     if mask is None:
         mask = FULL_MASK
     writer = ByteWriter()
     writer.write_uint64(entity_id)
     write_masked_data(entity, writer, mask)
     self.data = writer.get()
开发者ID:Cahor007,项目名称:cuwo,代码行数:9,代码来源:packet.py

示例2: write

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
    def write(self, writer):
        data = ByteWriter()
        write_list(data, self.items_1)
        write_list(data, self.player_hits)
        write_list(data, self.particles)
        write_list(data, self.sound_actions)
        write_list(data, self.shoot_actions)
        write_list(data, self.static_entities)
        write_list(data, self.chunk_items)

        data.write_uint32(len(self.items_8))
        for item in self.items_8:
            something, sub_items = item
            data.write_uint64(something)
            data.write_uint32(len(sub_items))
            for item in sub_items:
                data.write(item)

        write_list(data, self.pickups)
        write_list(data, self.kill_actions)
        write_list(data, self.damage_actions)

        data.write_uint32(len(self.items_12))
        for item in self.items_12:
            data.write(item)

        write_list(data, self.missions)

        compressed_data = zlib.compress(data.get())
        writer.write_uint32(len(compressed_data))
        writer.write(compressed_data)
开发者ID:Endimmion,项目名称:cuwo,代码行数:33,代码来源:packet.py

示例3: convert_qmo

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
def convert_qmo(data, path):
    qmo_file = QubicleFile()
    qmo_model = QubicleModel()
    x_size, y_size, z_size = 256, 256, 256
    qmo_model.x_size = x_size
    qmo_model.y_size = y_size
    qmo_model.z_size = z_size
    qmo_model.x_offset = -x_size / 2
    qmo_model.y_offset = 0
    qmo_model.z_offset = -z_size / 2

    blocks = data.get_dict()

    min_z = max_z = None
    for pos in blocks.keys():
        x, y, z = pos
        if min_z is None:
            min_z = max_z = z
        min_z = min(min_z, z)
        max_z = max(max_z, z)

    qmo_model.y_size = max_z - min_z + 1

    for pos, color in blocks.items():
        x, y, z = switch_axes(*pos)
        y -= min_z
        qmo_model.blocks[(x, y, z)] = color

    qmo_file.models.append(qmo_model)
    writer = ByteWriter()
    qmo_file.write(writer)
    open(path, 'wb').write(writer.get())
开发者ID:matpow2,项目名称:cuwo,代码行数:34,代码来源:genchunk.py

示例4: convert_qmo

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
def convert_qmo(path):
    data = ByteReader(open(path, 'rb').read())

    qmo_file = QubicleFile()
    qmo_model = QubicleModel()
    x_size, y_size, z_size = 256, 256, 256
    qmo_model.x_size = x_size
    qmo_model.y_size = y_size
    qmo_model.z_size = z_size
    qmo_model.x_offset = -x_size / 2
    qmo_model.y_offset = 0
    qmo_model.z_offset = -z_size / 2

    min_z = None
    max_z = None

    for i in xrange(256*256):
        something = data.read_float()
        something2 = data.read_float()
        something3 = data.read_float()
        something4 = data.read_uint32()
        something5 = data.read_uint32()
        size = data.read_uint32()*4
        chunk_data = data.read(size)

        x = i % 256
        y = i / 256

        z = something4

        if min_z is None or max_z is None:
            min_z = z
            max_z = z + len(chunk_data) / 4
        else:
            min_z = min(z, min_z)
            max_z = max(max_z, len(chunk_data) / 4)

        for i in xrange(len(chunk_data) / 4):
            r = ord(chunk_data[i*4])
            g = ord(chunk_data[i*4+1])
            b = ord(chunk_data[i*4+2])
            a = ord(chunk_data[i*4+3])
            if a == 0:
                z += 1
                continue
            qmo_model.blocks[switch_axes(x, y, z)] = (r, g, b)
            z += 1

    qmo_model.y_offset

    qmo_file.models.append(qmo_model)
    writer = ByteWriter()
    qmo_file.write(writer)
    name = os.path.splitext(os.path.basename(path))[0]
    out_path = os.path.join('genqmo', name + '.qmo')
    open(out_path, 'wb').write(writer.get())

    print 'Converted', path
开发者ID:waoler,项目名称:cuwo,代码行数:60,代码来源:convertchunk.py

示例5: write_debug

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
    def write_debug(self):
        if self.debug_fp is None:
            return
        writer = ByteWriter()
        writer.write_uint32(len(self.entities))
        for entity in self.entities.values():
            writer.write_uint8(int(entity.is_tgen))
            entity.write(writer)

        self.debug_fp.write(writer.get())
开发者ID:matpow2,项目名称:cuwo,代码行数:12,代码来源:world.py

示例6: to_cub

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
def to_cub(in_file, out_file):
    qmo_file = QubicleFile(ByteReader(open(in_file, "rb").read()))
    qmo_model = qmo_file.models[0]
    cub = CubModel()
    x_size, y_size, z_size = switch_axes(qmo_model.x_size, qmo_model.y_size, qmo_model.z_size)
    cub.x_size = x_size
    cub.y_size = y_size
    cub.z_size = z_size
    for k, v in qmo_model.blocks.items():
        x, y, z = k
        x2, y2, z2 = switch_axes(x, y, z)
        cub.blocks[x2, y2, z2] = v
    writer = ByteWriter()
    cub.write(writer)
    with open(out_file, "wb") as fp:
        fp.write(writer.get())
开发者ID:carriercomm,项目名称:cuwo,代码行数:18,代码来源:convertqmo.py

示例7: to_qmo

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
def to_qmo(in_file, out_file):
    cub = CubModel(ByteReader(open(in_file, "rb").read()))
    qmo_file = QubicleFile()
    qmo_model = QubicleModel()
    x_size, y_size, z_size = switch_axes(cub.x_size, cub.y_size, cub.z_size)
    qmo_model.x_size = x_size
    qmo_model.y_size = y_size
    qmo_model.z_size = z_size
    qmo_model.x_offset = -x_size / 2
    qmo_model.y_offset = 0
    qmo_model.z_offset = -z_size / 2
    for k, v in cub.blocks.items():
        x, y, z = k
        x2, y2, z2 = switch_axes(x, y, z)
        qmo_model.blocks[x2, y2, z2] = v
    qmo_file.models.append(qmo_model)
    writer = ByteWriter()
    qmo_file.write(writer)
    with open(out_file, "wb") as fp:
        fp.write(writer.get())
开发者ID:carriercomm,项目名称:cuwo,代码行数:22,代码来源:convertqmo.py

示例8: write_packet

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
def write_packet(packet):
    writer = ByteWriter()
    writer.write_uint32(packet.packet_id)
    packet.write(writer)
    return writer.get()
开发者ID:IFraserAu,项目名称:cuwo,代码行数:7,代码来源:packet.py

示例9: set_entity

# 需要导入模块: from cuwo.bytes import ByteWriter [as 别名]
# 或者: from cuwo.bytes.ByteWriter import get [as 别名]
 def set_entity(self, entity, entity_id):
     writer = ByteWriter()
     writer.write_uint64(entity_id)
     write_masked_data(entity, writer)
     self.data = writer.get()
开发者ID:IFraserAu,项目名称:cuwo,代码行数:7,代码来源:packet.py


注:本文中的cuwo.bytes.ByteWriter.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。