tormenta20 - v0.0.0
    Preparing search index...

    Class Tabela

    A Tabela (reference table) in Tormenta20.

    Tables store structured tabular data from T20 sourcebooks (e.g. random loot tables, encounter tables, etc.).

    Tabela.all()
    Tabela.find("tesouros_por_nd")

    const t = Tabela.find("tesouros_por_nd")!
    t.headers // ["ND", "Tibares", "Itens"]
    t.rows // [{ "ND": "1", "Tibares": "50", "Itens": "—" }, ...]

    Hierarchy

    • BaseModel
      • Tabela
    Index

    Constructors

    • Parameters

      • _row: Record<string, unknown>

      Returns Tabela

    Accessors

    • get createdAt(): string

      ISO 8601 timestamp of record creation.

      Returns string

    • get dice(): string | null

      Dice expression (e.g. "1d100"), if this table is rollable.

      Returns string | null

    • get id(): string

      Unique string identifier (e.g. "espada_longa", "guerreiro").

      Returns string

    • get livroId(): string

      Slug of the sourcebook this record was published in (e.g. "t20_eja").

      Returns string

    • get name(): string

      Display name.

      Returns string

    • get rows(): Record<string, unknown>[]

      Array of rows, each an object keyed by header.

      Returns Record<string, unknown>[]

    • get sorteavel(): boolean

      True if this table has a dice value and can be rolled on.

      Returns boolean

    • get updatedAt(): string

      ISO 8601 timestamp of last update.

      Returns string

    Methods

    • Rolls the table's dice and returns the matching row (same shape as rows entries). Assumes the first header's column holds a range string (e.g. "01-05") or a single value (e.g. "06") that the roll falls within.

      Returns Record<string, unknown> | null

    • Returns a plain-object representation of this record.

      Returns {
          description: string | null;
          dice: string | null;
          headers: string[];
          id: string;
          name: string;
          rows: Record<string, unknown>[];
      }