ConversionTtrpgExtraction.h header

#include <ew/app/ConversionTtrpgExtraction.h>

Namespace ew::app

ConvertedLexiconEntry struct

struct ew::app::ConvertedLexiconEntry

One conlang word the conversion proposes for a Language's lexicon.

Members

QString ew::app::ConvertedLexiconEntry::word

The invented word (required).

QString ew::app::ConvertedLexiconEntry::meaning

Its meaning (required – a word without a gloss is noise).

bool ew::app::ConvertedLexiconEntry::operator==(const ConvertedLexiconEntry &) const =default

Value equality across all fields.

ConvertedRollTable struct

struct ew::app::ConvertedRollTable

One random/roll table the conversion proposes.

Members

QString ew::app::ConvertedRollTable::title

The table's title (required).

QStringList ew::app::ConvertedRollTable::outcomes

The outcomes in listed order (at least one; uniform weight on apply).

bool ew::app::ConvertedRollTable::operator==(const ConvertedRollTable &) const =default

Value equality across all fields.

ConvertedStatBlock struct

struct ew::app::ConvertedStatBlock

One TTRPG stat block the conversion proposes.

Members

QString ew::app::ConvertedStatBlock::name

The creature/character name (required).

QString ew::app::ConvertedStatBlock::system

The game system when the text names one ("D&D 5e"); empty otherwise.

std::vector<std::pair<QString, QString> > ew::app::ConvertedStatBlock::stats

Labelled stats as (label, value) pairs ("STR" -> "18", "Armor Class" -> "15").

QString ew::app::ConvertedStatBlock::notes

Freeform actions/notes text; may be empty.

bool ew::app::ConvertedStatBlock::operator==(const ConvertedStatBlock &) const =default

Value equality across all fields.

ConvertedTtrpg struct

struct ew::app::ConvertedTtrpg

Everything the TTRPG stage proposes from one batch of source text (docs/AI_FOLDER_CONVERSION.md §4 C10).

Members

QString ew::app::ConvertedTtrpg::languageName

The conlang the lexicon entries belong to, when the text names it; empty otherwise (the apply stage then uses the source file's stem).

std::vector<ConvertedLexiconEntry> ew::app::ConvertedTtrpg::lexicon

Word/meaning pairs (both required; duplicates by word collapsed).

std::vector<ConvertedStatBlock> ew::app::ConvertedTtrpg::statBlocks

Stat blocks (name required; duplicates by name collapsed).

std::vector<ConvertedRollTable> ew::app::ConvertedTtrpg::rollTables

Roll tables (title + at least one outcome required; duplicates by title collapsed; outcomes bounded – see parseConversionTtrpgResponse).

bool ew::app::ConvertedTtrpg::operator==(const ConvertedTtrpg &) const =default

Value equality across all fields.

Functions

AiRequest ew::app::buildConversionTtrpgRequest(const QString &sourceText)

Builds the AI request asking for conlang words, stat blocks, and roll tables found in sourceText, as strict JSON for parseConversionTtrpgResponse. Pure; the caller sets the model and sends it.

ConvertedTtrpg ew::app::parseConversionTtrpgResponse(const QString &content)

Parses the model reply. Tolerant like every conversion parser (hardened JSON isolation, scalar stat values kept); entries missing a required part are dropped, duplicates collapse to the first (case-insensitive), and a degenerate table is bounded at 1000 outcomes. Returns an empty proposal when no well-formed object is present.