Skip to main content

league-tools

PyPI 版本 Python 版本 许可证 发布流程

WAD、BIN、BNK、WPK 文件处理工具库。

介绍

league-tools 是一个用于处理英雄联盟资源文件的 Python 库,提供对以下格式的底层解析能力:

  • WAD(.wad.client):资源包(模型、贴图、音频等)
  • BIN(.bin):游戏配置与逻辑数据
  • BNK(.bnk):Wwise SoundBank 音频元数据
  • WPK(.wpk):Wwise 打包音频文件

音频事件映射默认推荐使用 NativeHIRC:

  • 只关注事件映射所需的 HIRC 音频信息
  • 直接从 events.bnk 读取,速度明显快于 wwiser -> XML
  • 更适合默认映射链和批量分析

现支持 Layer/Blend 容器(HIRC 9)的子对象映射,已用 Wwise 145 的真实 VALORANT BNK 与官方 wwiser 对照验证。测试代码和本地样本准备说明见 样本目录说明。

如果你需要更完整的 BNK/HIRC 结构、XML 对照能力或调试信息,再使用 WwiserHIRC。

安装

pip install league-tools

如需基于发布分支安装最新代码:

pip install -e "git+https://github.com/Virace/league-tools@package#egg=league_tools"

使用

基础使用示例(四种核心格式):

from pathlib import Path

from league_tools import BIN, BNK, NativeHIRC, WAD, WPK

# 1) WPK:提取音频文件
wpk = WPK("path/to/audio.wpk")
wem_files = wpk.extract_files()

# 2) BNK:提取内嵌WEM
bnk = BNK("path/to/events.bnk")
bnk_wem_files = bnk.extract_files()

# 3) WAD:按已知路径提取文件
wad = WAD("path/to/archive.wad.client")
wad.extract(
    ["assets/sounds/vo/champions/gwen/skin01/vo_gwen_skin01_events.bnk"],
    out_dir=Path("./wad_output"),
)

# 4) BIN:读取音频事件组数据
bin_file = BIN("path/to/skin.bin")
audio_groups = bin_file.data

# 5) NativeHIRC:默认推荐的 events.bnk 解析入口
hirc = NativeHIRC.from_bnk("path/to/vo_events.bnk")

日志默认关闭;上游项目可按需手动开启:

from league_tools import enable_logging, disable_logging

enable_logging()
# ... 业务逻辑 ...
disable_logging()

WAD 打包与替换(输出固定 v3.4):

from league_tools import WAD, WADBuilder

# 从零创建
WADBuilder() \
    .add('plugins/demo/config.json', b'{"enabled": true}') \
    .save('demo.wad.client')

# 打开已有 WAD,替换其中的文件后另存(output 省略则覆盖源文件)
wad = WAD('path/to/archive.wad.client')
wad.rebuild(
    {'plugins/demo/config.json': b'{"enabled": false}'},
    output='archive.modified.wad.client',
)

说明:.bnk/.wpk 原样存储,其余 zstd 压缩;头部签名置零(客户端不校验)。 注意游戏客户端更新/修复会按清单还原被修改的 WAD。

详细示例与格式文档:

音频映射建议

默认工作流:

from league_tools import AudioEventMapper, BIN, NativeHIRC

bin_file = BIN("path/to/skin.bin")
hirc = NativeHIRC.from_bnk("path/to/events.bnk")
mapping = AudioEventMapper(bin_file, hirc).build_mapping()

何时切到 WwiserHIRC:

  • 需要完整 XML / HIRC 结构对照
  • 需要调试 wwiser 输出或排查版本差异
  • 需要的信息超出 NativeHIRC 当前只关注的音频事件映射范围

参考

维护

感谢

Metadata

Release files for league-tools 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for league-tools 1.2.2
File Size Uploaded
league_tools-1.2.2.tar.gz 135.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for league-tools 1.2.2
File Interpreter ABI Platform
league_tools-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 238.6 kB

Release files / league_tools-1.2.2.tar.gz

Download URL league_tools-1.2.2.tar.gz
Size 135.8 kB
Tags Source
SHA-256 checksum
How to use checksums
af52c20e94a2563fd5b10cfb6e5acbc34fc9e465b9eb1a897e2eefb1e63e6a22
BLAKE2b-256 checksum
How to use checksums
5aefce4ff86dd715ec50ed29f79a84bd3ffa735dd51a12095295575913406c78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log

Release files / league_tools-1.2.2-py3-none-any.whl

Download URL league_tools-1.2.2-py3-none-any.whl
Size 102.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be0e2b28f6f2d5f85b6683de11f19e68e3b2c8f9a3c4a6877fd2cd8033bd53b9
BLAKE2b-256 checksum
How to use checksums
312e2de73f5f4a9c9e1d78407f94cb1b52118c80df7e3f2a8e786339fd049a6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 12, 2026.

Transparency log
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page