當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。