Skip to main content

佳能是模拟两个企鹅俱乐部迷你游戏中的压缩的工具。

项目描述

佳能

这个库是新的并且相对未经测试,在为您的项目选择使用它时请谨慎。

佳能是模拟两个企鹅俱乐部迷你游戏中的压缩的工具。

Canon 是为 Club Penguin 服务器模拟器Houdini编写的,但它可以用于其他模拟器或生成您自己的游戏存档。

压缩算法取自 Club Penguin 客户端 ( com.clubpenguin.lib.data.compression.Compressor)。

该库目前仅具有将 Puffle Launch 游戏保存转换为对象的实用功能,但它可以将任何压缩字符串转换为Canon._DataSet.

安装

佳能现在可以在 PyPI 上使用,万岁!

pip install Canon

佳能在 PyPI 上不可用。您必须克隆存储库并手动导入它。

$ git clone https://github.com/ketnipz/canon

用法

解压游戏存档

这是最常见的用法,也是在 Houdini 中使用该库的方式。

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from Canon import Compressor
from Canon.Data.Launch import load_data_set_into_object

if __name__ == "__main__":
	decompressed = Compressor.decompress(u"Ȑ Ȑ ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?Ȑ㺀Ȑ?ȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȠ?ȑ?ȑ?ŀ")
	new_data = load_data_set_into_object(decompressed, filtered=True)
	print(new_data)

	# Result: {0: {'PuffleOs': 32, 'BestTime': 16000, 'TurboDone': True}, 1: {'PuffleOs': 32, 'BestTime': 17, 'TurboDone': True}}

生成保存游戏

虽然可以使用 canon 将 unicode 保存游戏转换为对象,但它也可以用于反向操作!

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from Canon import Compressor
from Canon.Data.Launch import load_data_set_from_object

if __name__ == "__main__":
    data = {
        0: {
            "PuffleOs": 32,
            "BestTime": 16000,
            "TurboDone": True
        },
        1: {
            "PuffleOs": 32,
            "BestTime": 17,
            "TurboDone": True
        }
    }

    new_data_set = load_data_set_from_object(data)
    compressed = Compressor.compress(new_data_set)
    print(compressed)

    # Result: u"Ȑ Ȑ ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?ȑ?Ȑ㺀Ȑ?ȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȐɘȠ?ȑ?ȑ?ŀ"

过滤标志

load_data_set_into_object有一个参数filtered。这可用于过滤尚未完成的级别结果。由于 Puffle Launch 游戏保存包含每个级别的数据,您可能只需要已完成的数据,如果是这种情况,请传递filter= True给函数。

new_data = Compressor.load_data_set_into_object(decompressed)
print(new_data)
# Result: {0: {'PuffleOs': 32, 'BestTime': 16000, 'TurboDone': True}, 1: {'PuffleOs': 32, 'BestTime': 17, 'TurboDone': True}, 2: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 3: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 4: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 5: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 6: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 7: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 8: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 9: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 10: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 11: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 12: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 13: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 14: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 15: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 16: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 17: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 18: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 19: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 20: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 21: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 22: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 23: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 24: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 25: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 26: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 27: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 28: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 29: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 30: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 31: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 32: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 33: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 34: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}, 35: {'PuffleOs': 0, 'BestTime': 600, 'TurboDone': False}}
new_data = Compressor.load_data_set_into_object(decompressed, filtered=True)
print(new_data)
# Result: {0: {'PuffleOs': 32, 'BestTime': 16000, 'TurboDone': True}, 1: {'PuffleOs': 32, 'BestTime': 17, 'TurboDone': True}}

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

源分布

canon-0.0.1.tar.gz (5.0 kB 查看哈希

已上传 source

内置分布

canon-0.0.1-py2-none-any.whl (7.0 kB 查看哈希

已上传 py2