Skip to main content

decode Touhou Shooting Game's replay files and get the infomation in it

Project description

![build](https://github.com/wasupandceacar/threp/actions/workflows/build.yml/badge.svg)

![pypi](https://github.com/wasupandceacar/threp/actions/workflows/pypi.yml/badge.svg)

![CodeFactor](https://www.codefactor.io/repository/github/wasupandceacar/threp/badge)

一、介绍

threp用于解析东方project系列游戏的replay文件,即游戏回放文件,可以获取replay文件的通关情况,机师,难度,通关情况,机体,处理落,日期,屏幕移动,按键记录。 支持TH06-18整数作以及TH9.5、12.5、TH12.8、TH14.3、TH16.5(即现有所有非黑历史的东方STG全部支持)。

二、安装方法

在 Python 3.6+ 下使用,用 pip 安装:

pip install threp

三、使用方法

from threp import THReplay

# 载入一个replay文件,参数为路径 tr=THReplay(‘th14_03.rpy’)

# 获取rep基本信息,包含机体,难度,通关情况,字符串 # etc. Reimu A normal all print(tr.getBaseInfo())

# 获取rep基本信息的字典,包含机体,难度,通关情况,字符串 # 字典的键分别为 character shottype rank stage # etc. Reimu A Normal All print(tr.getBaseInfoDic())

# 获取rep每个stage的分数,list,包含一串整数 # etc. [13434600, 50759200, 103025260, 152519820, 230440680, 326777480] print(tr.getStageScore())

# 获取rep的屏幕移动,list,包含一些字符串 # etc. # 其中一个字符串:[0 ]→→→→→→→→→→→→→→→→↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↖↖↖↖↖↖↖↖↖↑↑○○○○○○○○○○○○○○○○○○ # 开头括号里的数字表示这是在该stage的第几帧,箭头表示方向,圆圈表示不动 print(tr.getScreenAction())

# 获取rep的按键记录,list,包含一些子list,每个子list包含60个字符串,代表一秒 # etc. # 其中一个子list:[’→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘→’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑←’, ‘↑’, ‘↑’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’, ‘○’] # 每个字符串记录了这帧按下的方向键,箭头表示方向,圆圈表示没按 print(tr.getKeyboardAction())

# 获取rep的机签,字符串 # etc. WASUP print(tr.getPlayer())

# 获取rep的处理落,浮点数 # etc. 0.03 print(tr.getSlowRate())

# 获取rep的时间,字符串 # etc. 2015/02/17 22:23 print(tr.getDate())

# 获取解析错误信息,list,包含一些字典 # etc. 共有三种错误 # 1.length so short error,单面长度过短错误 # 2.frame read error,单面帧数读取错误 # 3.length read error,单面长度读取错误 print(tr.getError())

# 获取rep的总帧数,整数 # etc. 84565 print(tr.getFrameCount())

# 获取rep中按下Z键的帧数的list,帧数从1开始数 # etc. [63, 98, 136] print(tr.getZ())

# 获取rep中按下X键的帧数的list,帧数从1开始数 # etc. [193, 480, 766] print(tr.getX())

# 获取rep中按下C键的帧数的list,帧数从1开始数,这个按键从TH128开始记录,TH125及以前无记录 # etc. [1046, 1260] print(tr.getC())

# 获取rep中按下Shift键的帧数的list,帧数从1开始数 # etc. [1495, 1532, 1568] print(tr.getShift())

#载入一个新的replay文件,参数为路径 tr.reload_replay(“th15_02.rpy”)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

threp-2.0.2.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

threp-2.0.2-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file threp-2.0.2.tar.gz.

File metadata

  • Download URL: threp-2.0.2.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13

File hashes

Hashes for threp-2.0.2.tar.gz
Algorithm Hash digest
SHA256 a5ce234f988afda2df78b056e240441f74ec19b486d7dd77deced276efb90521
MD5 b7a04362d8c62efc91b76e7aa38e1c10
BLAKE2b-256 1d56a8a92a0f627d6443295b6f77cbc78307816d046ddd85266f133f7feaadbb

See more details on using hashes here.

File details

Details for the file threp-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: threp-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.2.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.0 CPython/3.6.13

File hashes

Hashes for threp-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fe26f78a0e022a74e0bc674c66eddff4f40e0fc800c9d1bf0ed2bed5171a1e3d
MD5 d505fb752e40e0101ccdb3bd0c7c0eaf
BLAKE2b-256 d977cee87b07f89cdd3f953ac55c600c71f087dcf20ac09be837cf038d660474

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page