Skip to main content

kiclass

kiclass is a Rust-powered Python extension for working with KingsIsle class definition files and binary XML data.

It can:

  • load class tables from .cdb definition files,
  • convert definition XML files into .cdb,
  • merge client and server definition tables,
  • deserialize KI binary XML files into dynamic Python objects,
  • serialize parsed objects back to JSON or XML,
  • expose the hashing helpers used by Wizard101 and Pirate101.
  • parse .nav zone navigation map files.

Install

From PyPI:

pip install kiclass

From source:

maturin develop --release

To build a wheel manually:

maturin build --release

CDB Setup

kiclass loads class definitions from .cdb files. These are compiled class tables generated from KingsIsle definition XML files.

Typical layout:

ClientDefs.xml
ServerDefs.xml
ClientDefs.cdb
ServerDefs.cdb
MergedDefs.cdb

Recommended workflow:

  1. Obtain ClientDefs.xml and ServerDefs.xml.
  2. Convert each XML file into a .cdb file.
  3. Merge the client and server .cdb files into one combined table.
  4. Load MergedDefs.cdb when reading binary XML files.

Example:

from kiclass import Mode, convert_xml_to_cdb, merge_cdb_defs

convert_xml_to_cdb("ClientDefs.xml", "ClientDefs.cdb", Mode.Wizard)
convert_xml_to_cdb("ServerDefs.xml", "ServerDefs.cdb", Mode.Wizard)
merge_cdb_defs("ClientDefs.cdb", "ServerDefs.cdb", "MergedDefs.cdb")

If you are working with Pirate101 data, use Mode.Pirate when generating the .cdb files.

kiclass expects the current .cdb file format. If your generated files are stale or invalid, regenerate them from the XML sources instead of relying on backwards compatibility.

Usage

Load a class table and read a binary XML file

from kiclass import KIBinaryFileReader, load_classes

classes = load_classes("MergedDefs.cdb")
reader = KIBinaryFileReader(classes)

result = reader.read_file("some_file.xml")

if result is None:
	print("Not a valid KI binary XML file")
elif not result.is_known():
	print(f"Unknown class id: {result.id()}")
else:
	print(result.class_name())
	print(result.to_json())

Create a class from the loaded table

from kiclass import load_classes

classes = load_classes("MergedDefs.cdb")
obj = classes.create_class("ClientObject")

if obj is not None:
	print(obj.class_name())
	print(obj.to_json())

Use the hashing helpers

from kiclass import Mode, hash_field_type, light_hash_string, wiz_hash_string

print(wiz_hash_string("ClientObject"))
print(light_hash_string("string"))
print(hash_field_type("m_templateID", "unsigned int", Mode.Wizard))

Notes

  • read_file() returns a dynamic class for known data, UnknownClass for valid but unmapped data, and None for invalid binary XML.
  • The loader expects .cdb files generated in the current format.
  • The repository includes scripts such as convert_worlddata.py and the easy_deserialize tooling for larger batch workflows.

Nav files

.nav files are zlib-compressed zone navigation maps. Each node represents a game zone and each edge a navigable connection (e.g. ship route, storm gate) between zones on the world map.

from kiclass import parse_nav

nav = parse_nav("zonemap.nav")

print(nav)                    # NavMap(nodes=3352, edges=10193)
print(nav.node_count)         # 3352
print(nav.edge_count)         # 10193

# Look up a zone by name
node = nav.node_by_zone("Aquila/AQ_Z00_Hub")
print(node.index, node.zone_name)

# Find all zones reachable from node 0
for nid in nav.neighbors(0):
    print(nav.get_zone_name(nid))

# Iterate all nodes / edges
for node in nav.nodes:
    print(node.index, node.zone_name)

for edge in nav.edges:
    print(edge.from_node, "->", edge.to_node)

Metadata

Release files for kiclass 0.7.1

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

Source distribution (sdist)

Source distribution for kiclass 0.7.1
File Size Uploaded Provenance Actions
kiclass-0.7.1.tar.gz 673.2 kB Without provenance Details for kiclass-0.7.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for kiclass 0.7.1
File Interpreter ABI Platform Actions
kiclass-0.7.1-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for kiclass-0.7.1-cp310-abi3-win_amd64.whl
kiclass-0.7.1-cp310-abi3-manylinux_2_34_x86_64.whl CPython 3.10 abi3 Linux glibc 2.34+ x86-64 Details for kiclass-0.7.1-cp310-abi3-manylinux_2_34_x86_64.whl

Total release size: 1.9 MB

Release files / kiclass-0.7.1.tar.gz

Download URL kiclass-0.7.1.tar.gz
Size 673.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f1cff4ae7528afa61932e27f6131e47a370d0e95bbeb8e085f954de6ddae340d
BLAKE2b-256 checksum
How to use checksums
4c06a2c36db0ba40d8d51e274672ed96f76a645f2e472643993617ec1bfe945d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / kiclass-0.7.1-cp310-abi3-win_amd64.whl

Download URL kiclass-0.7.1-cp310-abi3-win_amd64.whl
Size 599.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
f8389fe0e1d9aa18bddc1f325fd677e2ab1c497d3a4b89fa9d692a660ad8e93f
BLAKE2b-256 checksum
How to use checksums
f8e733039ce7d186a1bd52aeb5fa3b1e3e04bb90cb9320ee8d2c4635e9c2ebf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / kiclass-0.7.1-cp310-abi3-manylinux_2_34_x86_64.whl

Download URL kiclass-0.7.1-cp310-abi3-manylinux_2_34_x86_64.whl
Size 669.2 kB
Tags CPython 3.10 Linux glibc 2.34+ x86-64 abi3
SHA-256 checksum
How to use checksums
fc1f13486fd1bf551a5a970acdd89a977261537d8c3a0a9d94f5034ea407b17a
BLAKE2b-256 checksum
How to use checksums
4807e99842bfe6ea7a4ee0066236fee47ed9b503632f050575dc2d2649dc6cf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Security for kiclass 0.7.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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