resources

kernel service

The resource services provides access the file system and resources stored in NWN container files. The main goals mostly satisfied: the ability to read all NWN(:EE) containers. The ability to add new container types is limited in utility due to NWNX:EE’s lack of a ResMan plugin, even so the ability to load files from a Zip file is included.

Example - Demanding a resource from resman

import rollnw
from rollnw.kernel import resman

rollnw.kernel.start()
assert resman().contains('nw_chicken.utc')
data = resman().demand('nw_chicken.utc')
data2 = resman().demand(rollnw.Resource('nw_chicken', rollnw.ResourceType.utc))
assert data == data2

containers

Directory

Status: Read, Write (file format dependant)

Erf

Status: Read

Example - Load an Erf and Print Contents

import rollnw

erf = rollnw.Erf("tests/test_data/user/hak/hak_with_description.hak")
print(erf.name(), erf.size())
for rd in erf.all():
    print(rd.name.filename(), rd.size)

Key/Bif

Status: Read

NWSync

Status: Read

Example - Loading and Reading From NWSync Manifest

import rollnw

nws = rollnw.NWSync("path/to/nwsync")
if nws.is_loaded():
    # One of the curated modules
    manifest = nws.get('9a84e512dd3971eb215d6f9b0816a2e3ae2fee54')
    if manifest:
        tga = manifest.demand('002metal.tga')
        # Do something with this image..

Zip

Status: Read