rollnw

class rollnw.Appearance

Class containing creature’s appearance

body_parts: BodyParts

body_parts

hair: int

hair

id: int

Index into appearance.2da

phenotype: int

phenotype

portrait_id: int

Index into portraits.2da

skin: int

skin

tail: int

tail

tattoo1: int

tattoo1

tattoo2: int

tattoo2

wings: int

wings

class rollnw.Area

Area object

comments: str
creator_id: int
creatures: List[Creature]
doors: List[Door]
encounters: List[Encounter]
flags: AreaFlags
height: int
id: int
items: List[Item]
json_archive_version: ClassVar[int]
listen_check_mod: int
loadscreen: int
name: LocString
no_rest: int
object_type: ClassVar[int]
placeables: List[Placeable]
pvp: int
scripts: AreaScripts
shadow_opacity: int
skybox: int
sounds: List[Sound]
spot_check_mod: int
stores: List[Store]
tiles: List[Tile]
tileset: str
triggers: List[Trigger]
version: int
waypoints: List[Waypoint]
weather: AreaWeather
width: int
flag rollnw.AreaFlags(value)

Valid values are as follows:

interior = <AreaFlags.interior: 1>
underground = <AreaFlags.underground: 2>
natural = <AreaFlags.natural: 4>
class rollnw.AreaScripts

Area’s scripts

on_enter: str
on_exit: str
on_heartbeat: str
on_user_defined: str
class rollnw.AreaWeather

Area’s weather

chance_lightning: int
chance_rain: int
chance_snow: int
color_moon_ambient: int
color_moon_diffuse: int
color_moon_fog: int
color_sun_ambient: int
color_sun_diffuse: int
color_sun_fog: int
day_night_cycle: int
fog_clip_distance: int
fog_moon_amount: int
fog_sun_amount: int
is_night: int
lighting_scheme: int
moon_shadows: int
sun_shadows: int
wind_power: int
class rollnw.AttackData

Class aggregating attack data

Attributes:

armor_class: int
attack_bonus: int
attack_roll: int
attacker: Creature
concealment: int
is_ranged_attack: bool
iteration_penalty: int
multiplier: int
nth_attack: int
result: AttackResult
target: ObjectBase
target_is_creature: bool
target_state: int
threat_range: int
type: int
enum rollnw.AttackResult(value)

Attack Result Type

Member Type:

int

Valid values are as follows:

hit_by_auto_success = <AttackResult.hit_by_auto_success: 1>
hit_by_critical = <AttackResult.hit_by_critical: 2>
hit_by_roll = <AttackResult.hit_by_roll: 3>
miss_by_auto_fail = <AttackResult.miss_by_auto_fail: 4>
miss_by_concealment = <AttackResult.miss_by_concealment: 5>
miss_by_miss_chance = <AttackResult.miss_by_miss_chance: 6>
miss_by_roll = <AttackResult.miss_by_roll: 7>
class rollnw.BodyParts

Class containing references to creature’s body parts

belt: int
bicep_left: int
bicep_right: int
foot_left: int
foot_right: int
forearm_left: int
forearm_right: int
hand_left: int
hand_right: int
head: int
neck: int
pelvis: int
shin_left: int
shin_right: int
shoulder_left: int
shoulder_right: int
thigh_left: int
thigh_right: int
class rollnw.ClassEntry

Class level data

id: int
level: int
spells: SpellBook
class rollnw.CombatInfo

Class containing combat related data

ac_armor_base: int
ac_natural_bonus: int
ac_shield_base: int
combat_mode: int
size_ab_modifier: int
size_ac_modifier: int
target_state: int
class rollnw.Common

Class containing attributes common to all objects

comment: str
locals: LocalData
location: Location
name: LocString
palette_id: int
resref: str
tag: str
class rollnw.Container

Base container interface

all()

Get all resources

contains(res: Resource | str) bool

Get if container contains resource

demand(res: Resource | str) bytes

Reads resource data, empty ByteArray if no match.

extract(pattern, output) int

Extract elements from a container by regex

extract_by_glob(glob: str, output: str) int

Extract elements from a container by glob pattern

name() str

Equivalent to basename path()

path() str

Path to container, for basic containers, should be canonical

size() int

Gets the number of resources, if applicable, of the container

stat(res) ResourceDescriptor

Get some general data about a resource

valid() bool

Return true if loaded, false if not.

working_directory() str

Get container working directory

class rollnw.Creature

Class that represents a Creature object

appearance: Appearance
bodybag: int
chunk_death: int
common: Common
conversation: str

Dialog resref

cr: float
cr_adjust: int
decay_time: int
deity: str
description: LocString
disarmable: int
property equipment: Equips

Gets creatures equipped items

faction_id: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

gender: int
good_evil: int
property history: LevelHistory

Gets creatures level history

hp: int
hp_current: int
hp_max: int
immortal: int
interruptable: int
property inventory: Inventory

Gets creatures inventory

json_archive_version: ClassVar[int]
lawful_chaotic: int
levels: LevelStats
lootable: int
name_first: LocString
name_last: LocString
object_type: ClassVar[int]
pc: int
perception_range: float
plot: int
race: int
scripts: CreatureScripts
soundset: str
starting_package: int
stats: CreatureStats

Offensive and defensive stats.

subrace: str
walkrate: int
class rollnw.CreatureScripts

A class containing a creature’s script set.

on_attacked: str
on_blocked: str
on_conversation: str
on_damaged: str
on_death: str
on_disturbed: str
on_endround: str
on_heartbeat: str
on_perceived: str
on_rested: str
on_spawn: str
on_spell_cast_at: str
on_user_defined: str
class rollnw.CreatureStats

Implementation of a creature’s general attributes and stats

add_feat(feat) bool

Attempts to add a feat to a creature, returning true if successful

get_ability_score(id: int)

Gets an ability score

get_skill_rank(id: int)

Gets a skill rank

has_feat(feat) bool

Determines if creature has feat

set_ability_score(id: int, value: int) bool

Sets an ability score, returning true if successful

set_skill_rank(id: int, value: int) bool

Sets a skill rank, returning true if successful

class rollnw.Dialog
add() DialogPtr

Adds empty Dialog Pointer and Node

add_ptr(ptr: DialogPtr, is_link: bool = False) DialogPtr

Adds Dialog Pointer, if is_link is false no new pointer or node is created. if is_link is true a new pointer will created with the node copied from input pointer.

add_string(value: str, lang: LanguageID = LanguageID.english, feminine: bool = False) DialogPtr

Adds Dialog Pointer and Node with string value set

delay_entry: int = 0
delay_reply: int = 0
delete_ptr(ptr: DialogPtr)

Deletes a dialog pointer @warning ptr should be removed from / not added to a dialog prior to deletion

static from_file(path: str) Dialog

Creates a dialog from a GFF or rollnw JSON file

json_archive_version: ClassVar[int]
prevent_zoom: bool = False
remove_ptr(ptr: DialogPtr)

Removes Dialog Ptr from underlying node

restype: ClassVar[ObjectType]
save(path: str)

Saves a dialog to file, valid extentions are “.dlg” and “.dlg.json”

script_abort: str
script_end: str
valid() bool

Checks id dialog was successfully parsed

word_count: int = 0
enum rollnw.DialogAnimation(value)
Member Type:

int

Valid values are as follows:

default = <DialogAnimation.default: 0>
taunt = <DialogAnimation.taunt: 28>
greeting = <DialogAnimation.greeting: 29>
listen = <DialogAnimation.listen: 30>
worship = <DialogAnimation.worship: 33>
salute = <DialogAnimation.salute: 34>
bow = <DialogAnimation.bow: 35>
steal = <DialogAnimation.steal: 37>
talk_normal = <DialogAnimation.talk_normal: 38>
talk_pleading = <DialogAnimation.talk_pleading: 39>
talk_forceful = <DialogAnimation.talk_forceful: 40>
talk_laugh = <DialogAnimation.talk_laugh: 41>
victory_1 = <DialogAnimation.victory_1: 44>
victory_2 = <DialogAnimation.victory_2: 45>
victory_3 = <DialogAnimation.victory_3: 46>
look_far = <DialogAnimation.look_far: 48>
drink = <DialogAnimation.drink: 70>
read = <DialogAnimation.read: 71>
none = <DialogAnimation.none: 88>
class rollnw.DialogNode
animation: DialogAnimation = 0
comment: str
copy() DialogNode

Copies a Node

delay: int = -1
get_action_param(key: str) str | None

Gets action parameter if it exists

parent: Dialog
pointers: List[DialogPtr]
quest: str
quest_entry: int = -1
remove_action_param(key: str)

Removes action parameter by key

script_action: str
set_action_param(key: str, value: str)

Sets action parameter, if key does not exist key and value are appended

sound: str
speaker: str
text: LocString
type: DialogNodeType
enum rollnw.DialogNodeType(value)
Member Type:

int

Valid values are as follows:

entry = <DialogNodeType.entry: 0>
reply = <DialogNodeType.reply: 1>
class rollnw.DialogPtr
add() DialogPtr

Adds empty Dialog Pointer and Node

add_ptr(ptr: DialogPtr, is_link: bool = False) DialogPtr

Adds Dialog Pointer, if is_link is false no new pointer or node is created. if is_link is true a new pointer will created with the node copied from input pointer.

add_string(value: str, lang: LanguageID = LanguageID.english, feminine: bool = False) DialogPtr

Adds Dialog Pointer and Node with string value set

comment: str
copy() DialogPtr

Copies dialog pointer and all sub-nodes

get_condition_param(key: str) str | None

Gets condition parameter by key

is_start: bool
node: DialogNode
parent: Dialog
remove_condition_param(key: str)

Removes condition parameter by key

remove_ptr(ptr: DialogPtr)

Removes Dialog Ptr from underlying node

script_appears: str
set_condition_param(key: str, value: str)

Sets condition parameter, if key does not exist key and value are appended

type: DialogNodeType
class rollnw.DiceRoll

Dice roll

bonus: int
dice: int
sides: int
class rollnw.Directory(path: str)

Implementation of a directory as a rollnw.Container

Parameters:

path (str) – Directory to load

class rollnw.Door

Class that represents a Door object

animation_state: DoorAnimationState
appearance: int
conversation: str

Door’s conversation resref

description: LocString
faction: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

generic_type: int
hardness: int
hp: int
hp_current: int
interruptable: int
json_archive_version: ClassVar[int]
linked_to: str
linked_to_flags: int
loadscreen: int
lock: Lock
object_type: ClassVar[int]
plot: int
portrait_id: int
saves: Saves
scripts: DoorScripts
trap: Trap
enum rollnw.DoorAnimationState(value)

Door animation states

Valid values are as follows:

closed = <DoorAnimationState.closed: 1>
opened1 = <DoorAnimationState.opened1: 2>
opened2 = <DoorAnimationState.opened2: 3>
class rollnw.DoorScripts

Door’s scripts

on_click: str
on_closed: str
on_damaged: str
on_death: str
on_disarm: str
on_heartbeat: str
on_lock: str
on_melee_attacked: str
on_open: str
on_open_failure: str
on_spell_cast_at: str
on_trap_triggered: str
on_unlock: str
on_user_defined: str
class rollnw.Effect
clear()

Clears the effect such that it’s as if default constructed

get_float(index)

Gets a floating point value

get_int(index)

Gets an integer point value

get_string(index)

Gets a string value

handle()

Gets the effect’s handle

id()

Gets the effect’s ID

set_float(index: int, value: float)

Sets a floating point value

set_int(index: int, value: int)

Sets an integer point value

set_string(index: int, value: str)

Sets a string value

set_versus(vs)

Sets the versus value

versus()

Gets the versus value

enum rollnw.EffectCategory(value)

Effect category

Member Type:

int

Valid values are as follows:

magical = <EffectCategory.magical: 1>
extraordinary = <EffectCategory.extraordinary: 2>
supernatural = <EffectCategory.supernatural: 3>
item = <EffectCategory.item: 4>
innate = <EffectCategory.innate: 5>
class rollnw.EffectHandle

Effect Handle

category: EffectCategory
creator: ObjectHandle
effect: Effect
spell_id: int
subtype: int
type: int
class rollnw.EffectID

Effect ID

index: int
version: int
class rollnw.Encounter

Class that represents an Encounter object

active: bool
creatures: List[SpawnCreature]
creatures_max: int
difficulty: int
difficulty_index: int
faction: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

geometry: List[Vector3]
player_only: bool
reset: bool
reset_time: int
respawns: int
scripts: EncounterScripts
spawn_option: int
spawn_points: List[SpawnPoint]
class rollnw.EncounterScripts

Encounter’s scripts

on_entered: str
on_exhausted: str
on_exit: str
on_heartbeat: str
on_user_defined: str
enum rollnw.EquipIndex(value)
Member Type:

int

Valid values are as follows:

head = <EquipIndex.head: 0>
chest = <EquipIndex.chest: 1>
boots = <EquipIndex.boots: 2>
arms = <EquipIndex.arms: 3>
righthand = <EquipIndex.righthand: 4>
lefthand = <EquipIndex.lefthand: 5>
cloak = <EquipIndex.cloak: 6>
leftring = <EquipIndex.leftring: 7>
rightring = <EquipIndex.rightring: 8>
neck = <EquipIndex.neck: 9>
belt = <EquipIndex.belt: 10>
arrows = <EquipIndex.arrows: 11>
bullets = <EquipIndex.bullets: 12>
bolts = <EquipIndex.bolts: 13>
creature_left = <EquipIndex.creature_left: 14>
creature_right = <EquipIndex.creature_right: 15>
creature_bite = <EquipIndex.creature_bite: 16>
creature_skin = <EquipIndex.creature_skin: 17>
invalid = <EquipIndex.invalid: 4294967295>
flag rollnw.EquipSlot(value)

Equipment slot flags

Valid values are as follows:

head = <EquipSlot.head: 1>
chest = <EquipSlot.chest: 2>
boots = <EquipSlot.boots: 4>
arms = <EquipSlot.arms: 8>
righthand = <EquipSlot.righthand: 16>
lefthand = <EquipSlot.lefthand: 32>
cloak = <EquipSlot.cloak: 64>
leftring = <EquipSlot.leftring: 128>
rightring = <EquipSlot.rightring: 256>
neck = <EquipSlot.neck: 512>
belt = <EquipSlot.belt: 1024>
arrows = <EquipSlot.arrows: 2048>
bullets = <EquipSlot.bullets: 4096>
bolts = <EquipSlot.bolts: 8192>
creature_left = <EquipSlot.creature_left: 16384>
creature_right = <EquipSlot.creature_right: 32768>
creature_bite = <EquipSlot.creature_bite: 65536>
creature_skin = <EquipSlot.creature_skin: 131072>
class rollnw.Equips

Creature’s equipment

equips: List[str | Item]

len(equips) == 18

Type:

Note

instantiate()

Instantiates equipment by loading contained items from the resource manager

class rollnw.Erf(path: str)

Implementation of Erf file format

Parameters:

path (str) – Erf file to load

add(path)

Adds resources from path

erase(resource)

Removes resource

merge(container)

Merges the contents of another rollnw.Container

reload()

Reloads Erf

Notes

Erf:: working_directory() will not change

save()

Saves Erf to Erf:: path()

Notes

It’s probably best to call Erf:: reload after save.

save_as(path)

Saves Erf to different path

Notes

Current Erf unmodified, to load Erf at new path a new Erf must be constructed.

enum rollnw.GameVersion(value)

Game versions

Valid values are as follows:

v1_69 = <GameVersion.v1_69: 1>
vEE = <GameVersion.vEE: 2>
nwn2 = <GameVersion.nwn2: 3>
class rollnw.IVector4
w: int
x: int
y: int
z: int
class rollnw.Image(filename: str)

Loads an image

Parameters:

filename (str) – image file to load

channels()

Gets BPP

data()

Get raw data

height()

Get height

valid()

Determine if successfully loaded.

width()

Get width

write_to()

Write Image to file

class rollnw.Ini(filename: str)

Loads an ini

Parameters:

filename (str) – ini file to load

get_float(key: str) float | None

Gets an INI value

get_int(key: str) int | None

Gets an INI value

get_str(key: str) str | None

Gets an INI value

valid()

Deterimes if Ini file was successfully parsed

class rollnw.Inventory

An Object’s inventory

instantiate()

Instantiates inventory by loading contained items from the resource manager

items: List[InventoryItem]
owner: ObjectBase
class rollnw.InventoryItem

An inventory item

infinite: bool

Only applicable to stores

item: str | Item
x: int
y: int
class rollnw.Item

Class that represents an Item object

additional_cost: int
baseitem: int
charges: int
cost: int
cursed: bool
description: LocString

Description

description_id: LocString

Description after being identified.

static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

identified: bool
inventory: Inventory
model_colors: List[int]
model_parts: List[int]
model_type: ItemModelType
plot: bool

Is a plot item.

properties: List[ItemProperty]
stacksize: int
stolen: bool
enum rollnw.ItemColors(value)

Valid values are as follows:

cloth1 = <ItemColors.cloth1: 1>
cloth2 = <ItemColors.cloth2: 2>
leather1 = <ItemColors.leather1: 3>
leather2 = <ItemColors.leather2: 4>
metal1 = <ItemColors.metal1: 5>
metal2 = <ItemColors.metal2: 6>
enum rollnw.ItemModelParts(value)

Valid values are as follows:

model1 = <ItemModelParts.model1: 1>
model2 = <ItemModelParts.model2: 2>
model3 = <ItemModelParts.model3: 3>
armor_belt = <ItemModelParts.armor_belt: 4>
armor_lbicep = <ItemModelParts.armor_lbicep: 5>
armor_lfarm = <ItemModelParts.armor_lfarm: 6>
armor_lfoot = <ItemModelParts.armor_lfoot: 7>
armor_lhand = <ItemModelParts.armor_lhand: 8>
armor_lshin = <ItemModelParts.armor_lshin: 9>
armor_lshoul = <ItemModelParts.armor_lshoul: 10>
armor_lthigh = <ItemModelParts.armor_lthigh: 11>
armor_neck = <ItemModelParts.armor_neck: 12>
armor_pelvis = <ItemModelParts.armor_pelvis: 13>
armor_rbicep = <ItemModelParts.armor_rbicep: 14>
armor_rfarm = <ItemModelParts.armor_rfarm: 15>
armor_rfoot = <ItemModelParts.armor_rfoot: 16>
armor_rhand = <ItemModelParts.armor_rhand: 17>
armor_robe = <ItemModelParts.armor_robe: 18>
armor_rshin = <ItemModelParts.armor_rshin: 19>
armor_rshoul = <ItemModelParts.armor_rshoul: 20>
armor_rthigh = <ItemModelParts.armor_rthigh: 21>
armor_torso = <ItemModelParts.armor_torso: 22>
enum rollnw.ItemModelType(value)

Valid values are as follows:

simple = <ItemModelType.simple: 1>
layered = <ItemModelType.layered: 2>
composite = <ItemModelType.composite: 3>
armor = <ItemModelType.armor: 4>
class rollnw.ItemProperty

An item property

cost_table: int
cost_value: int
param_table: int
param_value: int
subtype: int
type: int
class rollnw.Key(path: str)

Implementation Key/Bif file format as a rollnw.Container

Parameters:

path (str) – Path to key file

class rollnw.Language
static encoding(language: LanguageID) str

Gets the encoding for a particular language

static from_string(string: str) LanguageID

Converts string (short or long form) to ID

static has_feminine(language: LanguageID) bool

Determines if language has feminine translations

static to_base_id(id: int) Tuple[LanguageID, bool]

Convert runtime language identifier to base language and bool indicating masc/fem.

static to_runtime_id(language: LanguageID, feminine: bool = False) int

Convert language ID to runtime identifier.

static to_string(language: LanguageID, long_name: bool = False) str

Converts language to string form

enum rollnw.LanguageID(value)
Member Type:

int

Valid values are as follows:

invalid = <LanguageID.invalid: -1>
english = <LanguageID.english: 0>
french = <LanguageID.french: 1>
german = <LanguageID.german: 2>
italian = <LanguageID.italian: 3>
spanish = <LanguageID.spanish: 4>
polish = <LanguageID.polish: 5>
korean = <LanguageID.korean: 128>
chinese_traditional = <LanguageID.chinese_traditional: 129>
chinese_simplified = <LanguageID.chinese_simplified: 130>
japanese = <LanguageID.japanese: 131>
class rollnw.LevelHistory

Implements a creatures levelup history

entries: List[LevelUp]

Entries for levels

class rollnw.LevelStats

Implements a creatures level related stats

entries: List[ClassEntry]

Entries for levels

level() int

Gets total level

level_by_class(class_: int) int

Gets level by class

class rollnw.LevelUp

Level up data

ability: int

Ability score that was raised, if any. -1 if none

class_: int

Class the level was taken as

epic: bool

True if level is an epic level

feats: List[int]

Added feats

hitpoints: int

Hitpoints gained.

known_spells: List[Tuple[int, int]]

Level, Spell pair for gained spells

skillpoints: int

Roll over skill points

skills: List[Tuple[int, int]]

Skill and the amount increased

class rollnw.LocString(strref: int = -1)

Implements a localized string

Parameters:

strref (int) – String reference. (default -1)

add(language: LanguageID, string: str, feminine: bool = False)

Adds a localized string

contains(language: LanguageID, feminine: bool = False)

Checks if a localized string is contained

static from_dict(data: dict)

Converts python dict to LocString

get(language: LanguageID, feminine: bool = False)

Gets a localized string

remove(language: LanguageID, feminine: bool = False)

Removes a localized string

size()

Gets number of localized strings

strref()

Gets string reference

to_dict() DefaultDict

Converts LocString to python dict

class rollnw.LocalData
delete_float(varname: str)

Deletes float variable

delete_int(varname: str)

Deletes int variable

delete_location(varname: str)

Deletes location variable

delete_object(varname: str)

Deletes object variable

delete_string(varname: str)

Deletes string variable

get_float(varname: str)

Gets float variable

get_int(varname: str) int

Gets int variable

get_location(varname: str)

Gets location variable

get_object(varname: str)

Gets object variable

get_string(varname: str) str

Gets string variable

set_float(varname: str, value: float)

Sets float variable

set_int(varname: str, value: int)

Sets int variable

set_location(varname: str, value: Location)

Sets location variable

set_object(varname: str, value: ObjectHandle)

Sets object variable

set_string(varname: str, value: str)

Sets string variable

size()

Gets number of variables

class rollnw.Location

Class representing an objects location

area: int
orientation: Vector3
position: Vector3
class rollnw.Lock

Class representing a lock on an object

key_name: str
key_required: bool
lock_dc: int
lockable: bool
locked: bool
remove_key: bool
unlock_dc: int
class rollnw.Module

Class that represents a Module object

area_count() int

Gets number of areas in module

creator: int
dawn_hour: int
description: LocString
dusk_hour: int
entry_area: str
entry_orientation: Vector3
entry_position: Vector3
expansion_pack: int
get_area(index: int) Area | None

Gets number of areas in module

haks: List[str]
id: ByteString
is_save_game: bool
locals: LocalData
min_game_version: int
minutes_per_hour: int
name: LocString
scripts: ModuleScripts
start_day: int
start_hour: int
start_month: int
start_movie: str
start_year: int
tag: str
tlk: str
property uuid: str

Gets modules UUID

version: int
xpscale: int
class rollnw.ModuleScripts

Module Scripts

on_client_enter: str
on_client_leave: str
on_cutsnabort: str
on_heartbeat: str
on_item_acquire: str
on_item_activate: str
on_item_unaquire: str
on_load: str
on_player_chat: str
on_player_death: str
on_player_dying: str
on_player_equip: str
on_player_level_up: str
on_player_rest: str
on_player_uneqiup: str
on_spawnbtndn: str
on_start: str
on_user_defined: str
class rollnw.NWSync(path: str)

Implementation of NWSync file format

Parameters:

path (str) – Path to NWSync repository

get(manifest)

Gets a particular manifest as a container

is_loaded()

Gets if NWSync was successfully loaded

manifests()

Get list of all manifests

shard_count()

Get the number of shards

class rollnw.NWSyncManifest

Implementation of NWSync Manifest as a rollnw.Container

class rollnw.ObjectBase
handle()

Gets object handle

class rollnw.ObjectHandle

Object handle

id: int

index into object array

type: ObjectType

object type

valid()

Determines if handle is valid

version: int

object index version

enum rollnw.ObjectType(value)

Object types

Valid values are as follows:

invalid = <ObjectType.invalid: 1>
gui = <ObjectType.gui: 2>
tile = <ObjectType.tile: 3>
module = <ObjectType.module: 4>
area = <ObjectType.area: 5>
creature = <ObjectType.creature: 6>
item = <ObjectType.item: 7>
trigger = <ObjectType.trigger: 8>
projectile = <ObjectType.projectile: 9>
placeable = <ObjectType.placeable: 10>
door = <ObjectType.door: 11>
areaofeffect = <ObjectType.areaofeffect: 12>
waypoint = <ObjectType.waypoint: 13>
encounter = <ObjectType.encounter: 14>
store = <ObjectType.store: 15>
portal = <ObjectType.portal: 16>
sound = <ObjectType.sound: 17>
class rollnw.Placeable

Class that represents a Placeable object

animation_state: PlaceableAnimationState
appearance: int
bodybag: int
common: Common
conversation: str
description: LocString
faction: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

hardness: int
has_inventory: bool
hp: int
hp_current: int
interruptable: bool
inventory: Inventory
json_archive_version: ClassVar[int]
lock: Lock
object_type: ClassVar[int]
plot: bool
portrait_id: int
saves: Saves
scripts: PlaceableScripts
static: bool
trap: Trap
useable: bool
enum rollnw.PlaceableAnimationState(value)

Valid values are as follows:

none = <PlaceableAnimationState.none: 1>
open = <PlaceableAnimationState.open: 2>
closed = <PlaceableAnimationState.closed: 3>
destroyed = <PlaceableAnimationState.destroyed: 4>
activated = <PlaceableAnimationState.activated: 5>
deactivated = <PlaceableAnimationState.deactivated: 6>
class rollnw.PlaceableScripts

Placeable’s scripts

on_click: str
on_closed: str
on_damaged: str
on_death: str
on_disarm: str
on_heartbeat: str
on_inventory_disturbed: str
on_lock: str
on_melee_attacked: str
on_open: str
on_spell_cast_at: str
on_trap_triggered: str
on_unlock: str
on_used: str
on_user_defined: str
class rollnw.Player

Player character

Warning

This is very incomplete

class rollnw.Plt

Implementation of PLT file format

height()
pixels()
valid()
width()
class rollnw.PltColors

Plt Color Array

Notes

This would be the colors that a player would select

colors: List[int]
enum rollnw.PltLayer(value)

Plt layers

Member Type:

int

Valid values are as follows:

plt_layer_skin = <PltLayer.plt_layer_skin: 0>
plt_layer_hair = <PltLayer.plt_layer_hair: 1>
plt_layer_metal1 = <PltLayer.plt_layer_metal1: 2>
plt_layer_metal2 = <PltLayer.plt_layer_metal2: 3>
plt_layer_cloth1 = <PltLayer.plt_layer_cloth1: 4>
plt_layer_cloth2 = <PltLayer.plt_layer_cloth2: 5>
plt_layer_leather1 = <PltLayer.plt_layer_leather1: 6>
plt_layer_leather2 = <PltLayer.plt_layer_leather2: 7>
plt_layer_tattoo1 = <PltLayer.plt_layer_tattoo1: 8>
plt_layer_tattoo2 = <PltLayer.plt_layer_tattoo2: 9>
class rollnw.PltPixel

Plt pixel

color
layer
class rollnw.Resource

Resource name

Parameters:
  • name (str) – resref or filename

  • type (ResourceType | None) – (Default None)

Notes

If a resource type is not passed name is assumed to be a file name, e.g. ‘nw_chicken.utc’

resref
Type:

str

type
Type:

ResourceType

filename() str

Returns resource as ‘resref.ext’

static from_filename(filename: str) Resource

Creates resource from file name

valid() bool

Determines if is valid resource name

class rollnw.ResourceDescriptor

Resource descriptor

name
size
mtime
parent
enum rollnw.ResourceType(value)

Valid values are as follows:

invalid = <ResourceType.invalid: 1>
container = <ResourceType.container: 2>
gff_archive = <ResourceType.gff_archive: 3>
movie = <ResourceType.movie: 4>
player = <ResourceType.player: 5>
sound = <ResourceType.sound: 6>
texture = <ResourceType.texture: 7>
json = <ResourceType.json: 8>
bmp = <ResourceType.bmp: 9>
mve = <ResourceType.mve: 10>
tga = <ResourceType.tga: 11>
wav = <ResourceType.wav: 12>
plt = <ResourceType.plt: 13>
ini = <ResourceType.ini: 14>
bmu = <ResourceType.bmu: 15>
mpg = <ResourceType.mpg: 16>
txt = <ResourceType.txt: 17>
plh = <ResourceType.plh: 18>
tex = <ResourceType.tex: 19>
mdl = <ResourceType.mdl: 20>
thg = <ResourceType.thg: 21>
fnt = <ResourceType.fnt: 22>
lua = <ResourceType.lua: 23>
slt = <ResourceType.slt: 24>
nss = <ResourceType.nss: 25>
ncs = <ResourceType.ncs: 26>
mod = <ResourceType.mod: 27>
are = <ResourceType.are: 28>
set = <ResourceType.set: 29>
ifo = <ResourceType.ifo: 30>
bic = <ResourceType.bic: 31>
wok = <ResourceType.wok: 32>
twoda = <ResourceType.twoda: 33>
tlk = <ResourceType.tlk: 34>
txi = <ResourceType.txi: 35>
git = <ResourceType.git: 36>
bti = <ResourceType.bti: 37>
uti = <ResourceType.uti: 38>
btc = <ResourceType.btc: 39>
utc = <ResourceType.utc: 40>
dlg = <ResourceType.dlg: 41>
itp = <ResourceType.itp: 42>
btt = <ResourceType.btt: 43>
utt = <ResourceType.utt: 44>
dds = <ResourceType.dds: 45>
bts = <ResourceType.bts: 46>
uts = <ResourceType.uts: 47>
ltr = <ResourceType.ltr: 48>
gff = <ResourceType.gff: 49>
fac = <ResourceType.fac: 50>
bte = <ResourceType.bte: 51>
ute = <ResourceType.ute: 52>
btd = <ResourceType.btd: 53>
utd = <ResourceType.utd: 54>
btp = <ResourceType.btp: 55>
utp = <ResourceType.utp: 56>
dft = <ResourceType.dft: 57>
gic = <ResourceType.gic: 58>
gui = <ResourceType.gui: 59>
css = <ResourceType.css: 60>
ccs = <ResourceType.ccs: 61>
btm = <ResourceType.btm: 62>
utm = <ResourceType.utm: 63>
dwk = <ResourceType.dwk: 64>
pwk = <ResourceType.pwk: 65>
btg = <ResourceType.btg: 66>
utg = <ResourceType.utg: 67>
jrl = <ResourceType.jrl: 68>
sav = <ResourceType.sav: 69>
utw = <ResourceType.utw: 70>
fourpc = <ResourceType.fourpc: 71>
ssf = <ResourceType.ssf: 72>
hak = <ResourceType.hak: 73>
nwm = <ResourceType.nwm: 74>
bik = <ResourceType.bik: 75>
ndb = <ResourceType.ndb: 76>
ptm = <ResourceType.ptm: 77>
ptt = <ResourceType.ptt: 78>
bak = <ResourceType.bak: 79>
dat = <ResourceType.dat: 80>
shd = <ResourceType.shd: 81>
xbc = <ResourceType.xbc: 82>
wbm = <ResourceType.wbm: 83>
mtr = <ResourceType.mtr: 84>
ktx = <ResourceType.ktx: 85>
ttf = <ResourceType.ttf: 86>
sql = <ResourceType.sql: 87>
tml = <ResourceType.tml: 88>
sq3 = <ResourceType.sq3: 89>
lod = <ResourceType.lod: 90>
gif = <ResourceType.gif: 91>
png = <ResourceType.png: 92>
jpg = <ResourceType.jpg: 93>
caf = <ResourceType.caf: 94>
ids = <ResourceType.ids: 95>
erf = <ResourceType.erf: 96>
bif = <ResourceType.bif: 97>
key = <ResourceType.key: 98>
class rollnw.Saves

An objects saves

fort: int
reflex: int
will: int
class rollnw.Sound

Class that represents a Sound object

active: bool
common: Common
continuous: bool
distance_max: float
distance_min: float
elevation: float
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

generated_type: int
hours: int
interval: int
interval_variation: int
json_archive_version: ClassVar[int]
looping: bool
object_type: ClassVar[int]
pitch_variation: float
positional: bool
priority: int
random: bool
random_position: bool
random_x: float
random_y: float
sounds: List[str]
times: int
volume: int
volume_variation: int
class rollnw.SpawnCreature

Encounter creature spawn

appearance: int
cr: int
resref: str
single_spawn: bool
class rollnw.SpawnPoint

A spawn point

orientation: Vector3
position: Vector3
class rollnw.SpecialAbility

Special Ability

flags: SpellFlags
level: int
spell: int
class rollnw.SpellBook

Implements a spell casters spellbook

add_known_spell(level: int, entry: SpellEntry)

Adds a known spell at level

add_memorized_spell(level: int, entry: SpellEntry)

Adds a memorized spell at level

get_known_spell(level: int, index: int)

Gets a known spell entry

get_known_spell_count(level: int)

Gets the number of known at a given level

get_memorized_spell(level: int, index: int)

Gets a memorized spell entry

get_memorized_spell_count(level: int)

Gets the number of memorized at a given level

remove_known_spell(level: int, entry: SpellEntry)

Removes a known spell entry

remove_memorized_spell(level: int, entry: SpellEntry)

Removes a memorized spell entry

class rollnw.SpellEntry

An entry in a spellbook

flags: SpellFlags
meta: SpellMetaMagic
spell: int
flag rollnw.SpellFlags(value)

Valid values are as follows:

readied = <SpellFlags.readied: 1>
spontaneous = <SpellFlags.spontaneous: 2>
unlimited = <SpellFlags.unlimited: 4>
flag rollnw.SpellMetaMagic(value)

Valid values are as follows:

empower = <SpellMetaMagic.empower: 1>
extend = <SpellMetaMagic.extend: 2>
maximize = <SpellMetaMagic.maximize: 4>
quicken = <SpellMetaMagic.quicken: 8>
silent = <SpellMetaMagic.silent: 16>
still = <SpellMetaMagic.still: 32>
class rollnw.Store

Class that represents a Store object

armor: Inventory
blackmarket: bool
blackmarket_markdown: int
static from_dict(value: dict) Store

Constructs object from python dict.

static from_file(path: str) Store

Constructs object from file. The file can be JSON or Gff.

gold: int
identify_price: int
json_archive_version: ClassVar[int]
markdown: int
markup: int
max_price: int
miscellaneous: Inventory
object_type: ClassVar[int]
potions: Inventory
rings: Inventory
scripts: StoreScripts
weapons: Inventory
class rollnw.StoreScripts

A Store’s scripts

on_closed: str
on_opened: str
class rollnw.Tile

Area tile

animloop1: int
animloop2: int
animloop3: int
height: int
id: int
mainlight1: int
mainlight2: int
orientation: int
srclight1: int
srclight2: int
class rollnw.Tlk(init: str | LanguageID)

Implementation of the TLK file format

Parameters:

init (str | LanguageID) – if passed a string, init will be treated as a path to a TLK file, if passed a LanguageID, default constructs with the TLKs language set to init.

get(strref: int) str

Gets a tlk entry.

language_id()

Gets the language ID

modified()

Is Tlk modfied

save()

Writes TLK to file

save_as(path: str)

Writes TLK to file

set(strref: int, string: str)

Sets a localized string

size()

Gets the highest set strref

valid()

Gets if successfully parsed

class rollnw.Trap

Class representing a trap on an object

detect_dc: int
detectable: bool
disarm_dc: int
disarmable: bool
is_trapped: bool
one_shot: bool
type: int
class rollnw.Trigger

Class that represents a Trigger object

cursor: int
faction: int
static from_dict(value: dict) Trigger

Constructs object from python dict.

static from_file(path: str) Trigger

Constructs object from file. The file can be JSON or Gff.

geometry: List[Vector3]
highlight_height: float
linked_to: str
linked_to_flags: int
loadscreen: int
portrait: int
scripts: TriggerScripts
trap: Trap
type: int
class rollnw.TriggerScripts

A trigger’s scripts

on_click: str
on_disarm: str
on_enter: str
on_exit: str
on_heartbeat: str
on_trap_triggered: str
on_user_defined: str
class rollnw.TwoDA(filename: str)

Implementation of 2da file format

Parameters:

filename (str) – 2da file to load

get(row: int, column: int | str)

Gets a TwoDA value

Parameters:
  • row (int) – Row number

  • column (int | str) – Column number or label

Returns:

An int | float | string depending on the underlying value

set(row: int, column: int | str, value: int | float | str)

Sets a TwoDA value

Parameters:
  • row (int) – Row number

  • column (int | str) – Column number or label

  • value (int | float | str) – New value

class rollnw.Vector2
x: float
y: float
class rollnw.Vector3
x: float
y: float
z: float
class rollnw.Vector4
W: float
x: float
y: float
z: float
class rollnw.Waypoint

Class that represents a Waypoint object

appearance: int
description: LocString
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

has_map_note: bool

Has a map note

linked_to: str

Tag of linked object

map_note: LocString
map_note_enabled: bool
class rollnw.Zip(path: str)

Implementation of Zip file format as a container

Parameters:

path (str) – Path to zip file

rollnw.decode_plt_color(plt: Plt, colors: PltColors, x: int, y: int) List[int]

Decodes PLT and user selected colors to RBGA

rollnw.resmatch(res: Resource, pattern: str) bool

Analog of fnmatch but for resource names

Parameters:
  • res (Resource) – Resource name

  • pattern (str) – glob pattern