esp_parser.subrecords

Subrecord types used by multiple records.

Classes:

ACBS(flags, fatigue, barter_gold, ...)

Configuration.

AIDT(aggression, confidence, energy_level, ...)

AI Data.

AidtAggroEnum(value)

Enum for AIDT.aggression.

AidtAssistanceEnum(value)

Enum for AIDT.assistance.

AidtConfidenceEnum(value)

Enum for AIDT.confidence.

AidtMoodEnum(value)

Enum for AIDT.mood.

BMDT(biped_flags, general_flags, unused)

Biped Data.

CTDA(type, unused, comparison_value, ...)

Condition.

DNAM(ar, flags)

DNAM record type for ARMA and ARMO in Fallout 3 only.

Destruction()

Destruction subrecord collection.

DialType(value)

Enum for DIAL.DATA.type and INFO.DATA.type.

EDID([cstring])

Editor ID.

Effect()

Effect Subrecord Collection.

InfoNextSpeaker(value)

Enum for INFO.DATA.next_speaker.

Item()

Subrecords for items.

Model()

Subrecords for models.

OBND([X1, Y1, Z1, X2, Y2, Z2])

Object Bounds.

PositionRotation()

Subrecord for position/rotation.

Script()

Subrecords for scripts.

SkillEnum(value)

Enum for Skills (e.g.

XNAM(faction, modifier, group_combat_reaction)

Relation used for FACT and RACE records.

XnamCombatReactionEnum(value)

Group Combat Reaction.

class ACBS(flags, fatigue, barter_gold, level_or_level_mult, calc_min, calc_max, speed_multiplier, karma, disposition_base, template_flags)[source]

Bases: RecordType

Configuration.

Used by the CREA and NPC_ record types.

Parameters
  • flags (int)

  • fatigue (int)

  • barter_gold (int)

  • level_or_level_mult (int) – Level or level multiplier. If the 0x00000080 flag is set, the value is divided by 1000 to give a multiplier.

  • calc_min (int)

  • calc_max (int)

  • speed_multiplier (int)

  • karma (float) – Karma (Alignment)

  • disposition_base (int)

  • template_flags (int)

Attributes:

barter_gold

calc_max

calc_min

disposition_base

fatigue

flags

karma

Karma (Alignment)

level_or_level_mult

Level or level multiplier.

speed_multiplier

template_flags

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

barter_gold

Type:    int

calc_max

Type:    int

calc_min

Type:    int

disposition_base

Type:    int

fatigue

Type:    int

flags

Type:    int

karma

Type:    float

Karma (Alignment)

level_or_level_mult

Type:    int

Level or level multiplier.

If the 0x00000080 flag is set, the value is divided by 1000 to give a multiplier.

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

speed_multiplier

Type:    int

template_flags

Type:    int

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class AIDT(aggression, confidence, energy_level, responsibility, mood, unused, buys_sells_services_flags, teaches, max_training_level, assistance, aggro_radius_behaviour_flags, aggro_radius)[source]

Bases: RecordType

AI Data.

Used by the CREA and NPC_ record types.

Parameters

Attributes:

aggression

aggro_radius

aggro_radius_behaviour_flags

assistance

buys_sells_services_flags

confidence

energy_level

max_training_level

mood

responsibility

teaches

unused

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

aggression

Type:    AidtAggroEnum

aggro_radius

Type:    int

aggro_radius_behaviour_flags

Type:    int

assistance

Type:    AidtAssistanceEnum

buys_sells_services_flags

Type:    int

confidence

Type:    AidtConfidenceEnum

energy_level

Type:    int

max_training_level

Type:    int

mood

Type:    AidtMoodEnum

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

responsibility

Type:    int

teaches

Type:    SkillEnum

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

unused

Type:    bytes

class AidtAggroEnum(value)[source]

Bases: IntEnum

Enum for AIDT.aggression.

class AidtAssistanceEnum(value)[source]

Bases: IntEnum

Enum for AIDT.assistance.

class AidtConfidenceEnum(value)[source]

Bases: IntEnum

Enum for AIDT.confidence.

class AidtMoodEnum(value)[source]

Bases: IntEnum

Enum for AIDT.mood.

class BMDT(biped_flags, general_flags, unused)[source]

Bases: StructRecord

Biped Data.

Used in the ARMO and ARMA record types.

Parameters

Attributes:

biped_flags

general_flags

unused

Methods:

get_field_names()

Returns a list of attributes on this class in the order they should be packed.

get_struct_and_size()

Returns the pack/unpack struct string and the corresponding size.

biped_flags

Type:    int

general_flags

Type:    int

static get_field_names()[source]

Returns a list of attributes on this class in the order they should be packed.

Return type

Tuple[str, …]

static get_struct_and_size()[source]

Returns the pack/unpack struct string and the corresponding size.

Return type

Tuple[str, int]

unused

Type:    bytes

class CTDA(type, unused, comparison_value, function, param1, param2, run_on, reference)[source]

Bases: RecordType

Condition.

Parameters
  • type (int)

  • unused (bytes)

  • comparison_value (bytes) – A form ID or a float32 value

  • function (int) – Function index.

  • param1 (bytes) – First parameter to pass to the function.

  • param2 (bytes) – Second parameter to pass to the function.

  • run_on (int)

  • reference (bytes) – A form ID of a ACHR, ACRE, REFR, PMIS or PGRE reference on which to apply the function, or null.

Attributes:

comparison_value

A form ID or a float32 value

function

Function index.

param1

First parameter to pass to the function.

param2

Second parameter to pass to the function.

reference

A form ID of a ACHR, ACRE, REFR, PMIS or PGRE reference on which to apply the function, or null.

run_on

type

unused

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

comparison_value

Type:    bytes

A form ID or a float32 value

function

Type:    int

Function index.

param1

Type:    bytes

First parameter to pass to the function.

param2

Type:    bytes

Second parameter to pass to the function.

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

reference

Type:    bytes

A form ID of a ACHR, ACRE, REFR, PMIS or PGRE reference on which to apply the function, or null.

run_on

Type:    int

type

Type:    int

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

unused

Type:    bytes

class DNAM(ar, flags)[source]

Bases: StructRecord

DNAM record type for ARMA and ARMO in Fallout 3 only.

In New Vegas ARMA and ARMO have their own versions.

Parameters
  • ar (int) – Value is divided by 100.

  • flags (int)

Attributes:

ar

Value is divided by 100.

flags

Methods:

get_field_names()

Returns a list of attributes on this class in the order they should be packed.

get_struct_and_size()

Returns the pack/unpack struct string and the corresponding size.

ar

Type:    int

Value is divided by 100.

flags

Type:    int

static get_field_names()[source]

Returns a list of attributes on this class in the order they should be packed.

Return type

Tuple[str, …]

static get_struct_and_size()[source]

Returns the pack/unpack struct string and the corresponding size.

Return type

Tuple[str, int]

class Destruction[source]

Bases: Collection

Destruction subrecord collection.

Classes:

DEST(health, count, flags, unknown)

Destruction data header.

DSTD(health_percentage, index, damage_stage, ...)

Destruction Stage Data.

DSTF(*args, **kwargs)

Stage End Marker.

Attributes:

members

Names of subrecords in this collection.

class DEST(health, count, flags, unknown)[source]

Bases: RecordType

Destruction data header.

Parameters

Attributes:

count

flags

health

unknown

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

count

Type:    int

flags

Type:    int

health

Type:    int

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unknown

Type:    bytes

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class DSTD(health_percentage, index, damage_stage, flags, self_dps, explosion, debris, debris_count)[source]

Bases: RecordType

Destruction Stage Data.

Parameters
  • health_percentage (int)

  • index (int)

  • damage_stage (int)

  • flags (int)

  • self_dps (int)

  • explosion (bytes) – Form ID of an EXPL record or null.

  • debris (bytes) – Form ID of an DEBR record or null.

  • debris_count (int)

Attributes:

damage_stage

debris

Form ID of an DEBR record or null.

debris_count

explosion

Form ID of an EXPL record or null.

flags

health_percentage

index

self_dps

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

damage_stage

Type:    int

debris

Type:    bytes

Form ID of an DEBR record or null.

debris_count

Type:    int

explosion

Type:    bytes

Form ID of an EXPL record or null.

flags

Type:    int

health_percentage

Type:    int

index

Type:    int

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

self_dps

Type:    int

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class DSTF(*args, **kwargs)[source]

Bases: MarkerRecord

Stage End Marker.

members: typing.Set[bytes] = {b'DEST', b'DSTD', b'DSTF'}

Names of subrecords in this collection.

class DialType(value)[source]

Bases: IntEnum

Enum for DIAL.DATA.type and INFO.DATA.type.

class EDID(cstring: Union[str, bytes] = b'')[source]

Bases: CStringRecord

Editor ID.

class Effect[source]

Bases: Collection

Effect Subrecord Collection.

Classes:

EFID([cstring])

Base effect.

EFIT(magnitude, area, duration, type, ...)

Effect Data.

EfitTypeEnum(value)

Enum for SPEL.EFIT.

Attributes:

members

Names of subrecords in this collection.

class EFID(cstring: Union[str, bytes] = b'')[source]

Bases: FormIDRecord

Base effect.

Form ID of a MGEF record.

class EFIT(magnitude, area, duration, type, actor_value)[source]

Bases: StructRecord

Effect Data.

Parameters
  • magnitude (int)

  • area (int)

  • duration (int)

  • type

  • actor_value (int)

Attributes:

actor_value

area

duration

magnitude

type

Methods:

get_field_names()

Returns a list of attributes on this class in the order they should be packed.

get_struct_and_size()

Returns the pack/unpack struct string and the corresponding size.

actor_value

Type:    int

area

Type:    int

duration

Type:    int

static get_field_names()[source]

Returns a list of attributes on this class in the order they should be packed.

Return type

Tuple[str, …]

static get_struct_and_size()[source]

Returns the pack/unpack struct string and the corresponding size.

Return type

Tuple[str, int]

magnitude

Type:    int

type

Type:    EfitTypeEnum

class EfitTypeEnum(value)[source]

Bases: IntEnum

Enum for SPEL.EFIT.

members: typing.Set[bytes] = {b'EFID', b'EFIT'}

Names of subrecords in this collection.

class InfoNextSpeaker(value)[source]

Bases: IntEnum

Enum for INFO.DATA.next_speaker.

class Item[source]

Bases: Collection

Subrecords for items.

Classes:

CNTO(item, item_count)

Item.

COED(owner, glob_var_req_rank, condition)

Extra item data.

Attributes:

members

Names of subrecords in this collection.

namedtuple CNTO(item, item_count)[source]

Bases: NamedTuple

Item.

Fields
  1.  item (bytes) – Form ID of the item. Form ID of an ARMO, AMMO, MISC, WEAP, BOOK, LVLI, KEYM, ALCH, NOTE, MSTT or STAT record.

  2.  item_count (int) – Alias for field number 1

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

namedtuple COED(owner, glob_var_req_rank, condition)[source]

Bases: NamedTuple

Extra item data.

Fields
  1.  owner (bytes) – Form ID of the owner. Form ID of an NPC_ or FACT record, or null.

  2.  glob_var_req_rank (bytes) – Form ID of a GLOB record, an integer representing the required rank, or null. If an integer representing the required rank it will be stored as the 4 bytes of a uint32 (little endian).

  3.  condition (float) – Alias for field number 2

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

members: typing.Set[bytes] = {b'CNTO', b'COED'}

Names of subrecords in this collection.

class Model[source]

Bases: Collection

Subrecords for models.

Classes:

AlternateTexture(name, texture, index)

A texture in a MODS.

MO2S([iterable])

List of alternate textures (2nd instance).

MO2T([iterable])

Texture File Hashes (2nd instance).

MO3S([iterable])

List of alternate textures (2nd instance).

MO3T([iterable])

Texture File Hashes (3rd instance).

MO4S([iterable])

List of alternate textures (2nd instance).

MO4T([iterable])

Texture File Hashes (4th instance).

MOD2([cstring])

Model Filename (2nd instance).

MOD3([cstring])

Model Filename (3rd instance).

MOD4([cstring])

Model Filename (4th instance).

MODB([cstring])

MODL([cstring])

Model Filename.

MODS([iterable])

List of alternate textures.

MODT([iterable])

Texture File Hashes.

Attributes:

members

Names of subrecords in this collection.

class AlternateTexture(name, texture, index)[source]

Bases: object

A texture in a MODS.

Parameters
  • name (bytes) – 3D Name

  • texture (bytes) – New Texture. Form ID of a TXST record.

  • index (int)

Attributes:

index

name

3D Name

texture

New Texture.

Methods:

pack()

Pack the AlternateTexture to bytes.

unpack(raw_bytes)

Unpack bytes for the AlternateTexture.

index

Type:    int

name

Type:    bytes

3D Name

pack()[source]

Pack the AlternateTexture to bytes.

Return type

bytes

texture

Type:    bytes

New Texture. Form ID of a TXST record.

classmethod unpack(raw_bytes)[source]

Unpack bytes for the AlternateTexture.

Parameters

raw_bytes (BytesIO)

Return type

Self

class MO2S(iterable=(), /)[source]

Bases: MODS

List of alternate textures (2nd instance).

class MO2T(iterable=(), /)[source]

Bases: MODT

Texture File Hashes (2nd instance).

class MO3S(iterable=(), /)[source]

Bases: MODS

List of alternate textures (2nd instance).

class MO3T(iterable=(), /)[source]

Bases: MODT

Texture File Hashes (3rd instance).

class MO4S(iterable=(), /)[source]

Bases: MODS

List of alternate textures (2nd instance).

class MO4T(iterable=(), /)[source]

Bases: MODT

Texture File Hashes (4th instance).

class MOD2(cstring: Union[str, bytes] = b'')[source]

Bases: MODL

Model Filename (2nd instance).

class MOD3(cstring: Union[str, bytes] = b'')[source]

Bases: MODL

Model Filename (3rd instance).

class MOD4(cstring: Union[str, bytes] = b'')[source]

Bases: MODL

Model Filename (4th instance).

class MODB(cstring: Union[str, bytes] = b'')[source]

Bases: FormIDRecord

class MODL(cstring: Union[str, bytes] = b'')[source]

Bases: CStringRecord

Model Filename.

class MODS(iterable=(), /)[source]

Bases: List[AlternateTexture], RecordType

List of alternate textures.

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class MODT(iterable=(), /)[source]

Bases: List[int], RecordType

Texture File Hashes.

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

members: typing.Set[bytes] = {b'MO2S', b'MO2T', b'MO3S', b'MO3T', b'MO4S', b'MO4T', b'MOD2', b'MOD3', b'MOD4', b'MODB', b'MODL', b'MODS', b'MODT'}

Names of subrecords in this collection.

namedtuple OBND(X1=0, Y1=0, Z1=0, X2=0, Y2=0, Z2=0)[source]

Bases: NamedTuple

Object Bounds.

Fields
  1.  X1 (int) – Alias for field number 0

  2.  Y1 (int) – Alias for field number 1

  3.  Z1 (int) – Alias for field number 2

  4.  X2 (int) – Alias for field number 3

  5.  Y2 (int) – Alias for field number 4

  6.  Z2 (int) – Alias for field number 5

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class PositionRotation[source]

Bases: object

Subrecord for position/rotation.

Used in REFR, ACHR and ACRE.

Classes:

DATA([xp, yp, zp, xr, yr, zr])

Position / Rotation.

namedtuple DATA(xp=0.0, yp=0.0, zp=0.0, xr=0.0, yr=0.0, zr=0.0)[source]

Bases: NamedTuple

Position / Rotation.

Fields
  1.  xp (float) – Alias for field number 0

  2.  yp (float) – Alias for field number 1

  3.  zp (float) – Alias for field number 2

  4.  xr (float) – Alias for field number 3

  5.  yr (float) – Alias for field number 4

  6.  zr (float) – Alias for field number 5

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class Script[source]

Bases: object

Subrecords for scripts.

Classes:

SCDA([cstring])

Compiled Script Source.

SCHR([unused, ref_count, compiled_size, ...])

Basic Script Data.

SCRO([cstring])

Reference.

SCRV(*args, **kwargs)

Referenced Variable.

SCTX([cstring])

Script Source.

SCVR([cstring])

Local Variable Name.

SLSD(index[, unused, flags, unused_])

Local Variable Data.

class SCDA(cstring: Union[str, bytes] = b'')[source]

Bases: BytesRecordType

Compiled Script Source.

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class SCHR(unused=b'\x00\x00\x00\x00', ref_count=0, compiled_size=0, variable_count=0, type=0, flags=1)[source]

Bases: RecordType

Basic Script Data.

Parameters
  • unused (bytes) – Default b'\x00\x00\x00\x00'.

  • ref_count (int) – Default 0.

  • compiled_size (int) – Default 0.

  • variable_count (int) – Default 0.

  • type (int) – Default 0.

  • flags (int) – Default 1.

Attributes:

compiled_size

flags

ref_count

type

unused

variable_count

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

compiled_size

Type:    int

flags

Type:    int

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

ref_count

Type:    int

type

Type:    int

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

unused

Type:    bytes

variable_count

Type:    int

class SCRO(cstring: Union[str, bytes] = b'')[source]

Bases: FormIDRecord

Reference.

A local variable reference, or the form ID of an ACTI, DOOR, STAT, FURN, CREA, SPEL, NPC_, CONT, ARMO, AMMO, MISC, WEAP, IMAD, BOOK, KEYM, ALCH, LIGH, QUST, PACK, LVLI, ECZN, EXPL, FLST, IDLM, PMIS, FACT, ACHR, REFR, ACRE, GLOB, DIAL, CELL, SOUN, MGEF, WTHR, CLAS, EFSH, RACE, LVLC, CSTY, WRLD, SCPT, IMGS, MESG, MSTT, MUSC, NOTE, PERK, PGRE, PROJ, LVLN, WATR, ENCH, TREE, TERM, HAIR, EYES, ADDN record, or null.

class SCRV(*args, **kwargs)[source]

Bases: Int32Record

Referenced Variable.

class SCTX(cstring: Union[str, bytes] = b'')[source]

Bases: BytesRecordType

Script Source.

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class SCVR(cstring: Union[str, bytes] = b'')[source]

Bases: CStringRecord

Local Variable Name.

class SLSD(index, unused=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00', flags=1, unused_=b'\x00\x00\x00\x00\x00\x00\x00')[source]

Bases: RecordType

Local Variable Data.

Parameters
  • index (int)

  • unused (bytes) – Default b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'.

  • flags (int) – Default 1.

  • unused

Attributes:

flags

index

unused

unused_

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

flags

Type:    int

index

Type:    int

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

unused

Type:    bytes

unused_

Type:    bytes

class SkillEnum(value)[source]

Bases: IntEnum

Enum for Skills (e.g. AI teaching, skill book).

As used in the AIDT, BOOK and CLAS record types.

class XNAM(faction, modifier, group_combat_reaction)[source]

Bases: RecordType

Relation used for FACT and RACE records.

Parameters

Attributes:

faction

Form ID of a FACT or RACE record.

group_combat_reaction

modifier

Methods:

parse(raw_bytes)

Parse this subrecord.

unparse()

Turn this subrecord back into raw bytes for an ESP file.

faction

Type:    bytes

Form ID of a FACT or RACE record.

group_combat_reaction

Type:    XnamCombatReactionEnum

modifier

Type:    int

classmethod parse(raw_bytes)[source]

Parse this subrecord.

Parameters

raw_bytes (BytesIO) – Raw bytes for this record

Return type

Self

unparse()[source]

Turn this subrecord back into raw bytes for an ESP file.

Return type

bytes

class XnamCombatReactionEnum(value)[source]

Bases: IntEnum

Group Combat Reaction.