package documentation

A python package with various modules for accessing Neverwinter Nights: Enhanced Edition data formats and functionality.

Stability

This package is currently in ALPHA state. API stability is not guaranteed.

Installation

The package is available on PyPI and can be installed with pip:

pip install nwn

License

This package is licensed under the MIT license.

Module compressedbuf Read and write compressedbuf files, used in NWSync and campaign databases.
Module erf Read and write ERF (Encapsulated Resource Format) archives.
Package gff Transform GFF (Generic File Format) files from/to native python types.
Module key Read keyfiles, which store base game resources in the installation directory.
Package nwscript nwscript-related utilities.
Package nwsync nwsync file formats and utilities.
Module ssf Read and write soundset files.
Module tileset A parser for .set files (tilesets configuration).
Module tlk Read and write TLK (Talk Table) files (for translation and base game string references).
Module twoda Read and write 2DA files (2-dimensional array, similar to CSV).
Module _shared Shared types and helpers useful across the whole library.

From __init__.py:

Class FileMagic A file magic identifies a file type: For NWN, it is the first four characters on certain file types.
Class Gender Maps engine gender IDs.
Class GenderedLanguage A combination of Language and Gender.
Class Language Maps engine language IDs.
Function extension_to_restype Convert a file extension to its corresponding resource type identifier.
Function get_nwn_encoding A stand-in to enable dynamic configuration later.
Function restype_to_extension Convert a resource type to its corresponding file extension.
def extension_to_restype(extension: str) -> int: (source)

Convert a file extension to its corresponding resource type identifier.

Parameters
extension:strThe file extension to convert.
Returns
intThe resource type identifier corresponding to the given extension.
Raises
ValueErrorIf the extension is not recognized.
def get_nwn_encoding(): (source)

A stand-in to enable dynamic configuration later.

Currently hardcoded to "windows-1252".

Returns
The encoding used by NWN.
def restype_to_extension(restype: int) -> str: (source)

Convert a resource type to its corresponding file extension.

Parameters
restype:intThe resource type to convert.
Returns
strThe corresponding file extension for the given resource type.
Raises
ValueErrorIf the given resource type is unknown.