Skip to content

Plugin Record Suite

Mutagen offers custom classes, interfaces, and functionality for each Bethesda record type.

Here's an example of what a Potion record might look like:

public class Potion : IPotion
{
    // Major Record Fields
    FormKey FormKey { get; }
    string? EditorID { get; set; }

    // Spell Fields
    string? Name { get; set; }
    Model? Model { get; set; }
    string? Icon { get; set; }
    IFormLink<IEquipTypeGetter> EquipmentType { get; }

    ...
}
public interface IPotion : IMajorRecord, IPotionGetter
{
    // Major Record Fields
    FormKey FormKey { get; }
    string? EditorID { get; set; }

    // Spell Fields
    string? Name { get; set; }
    Model? Model { get; set; }
    string? Icon { get; set; }
    IFormLink<IEquipTypeGetter> EquipmentType { get; }

    ...
}
public interface IPotionGetter : IMajorRecordGetter
{
    // Major Record Fields
    FormKey FormKey { get; }
    string? EditorID { get; }

    // Spell Fields
    string? Name { get; }
    Model? Model { get; }
    string? Icon { get; }
    IFormLinkGetter<IEquipTypeGetter> EquipmentType { get; }

    ...
}

These are generated for each record and are pivotal touchstones of the entire library. All functionality exposed will typically deal in one of these types of interfaces, depending on whether the API requires/desires readonly functionality.

Code is Generated

Records and their functionality are created and maintained via a code generation library. As such, the records feel like they are hand written, without actually needing to write them by hand. As new functionality is added or internal optimization is improved, most of Mutagen's code is regenerated to gain all the benefits without needing to manually update the definitions for every record that exists.