Compare commits

...

8 Commits

Author SHA1 Message Date
Lector 598d2d36f8 Merge branch 'main' into feature/books-rework 2026-06-26 01:42:09 +02:00
Lector fa89e8636f prettier 2026-06-10 20:50:24 +02:00
Lector 2696159729 Merge branch 'main' into feature/books-rework 2026-06-10 20:48:00 +02:00
Lector b8933b9439 Merge branch 'feature/books-rework' of https://github.com/elyukai/optolith-database-schema into feature/books-rework 2026-06-10 20:46:52 +02:00
Lector 10e476b3e4 Reworked the books so it is possible to enter language prerequisites seperately to a version of a book
To achieve this i separated the versioning from the translation and entered a lot of different translation-fields
2026-06-10 20:46:41 +02:00
Lector ba73e0b02f Merge branch 'main' into feature/books-rework 2026-06-08 15:32:22 +02:00
Lector 31b64d9382 Merge branch 'main' into feature/books-rework 2026-06-08 15:03:17 +02:00
Lector 80873e445e First sketch of Books Prereqs 2026-06-01 13:40:55 +02:00
5 changed files with 148 additions and 49 deletions
+9
View File
@@ -22,6 +22,7 @@ import {
RulePrerequisiteGroup,
SpellworkPrerequisiteGroup,
TribePrerequisiteGroup,
LinguisticPrerequisiteGroup,
} from "./prerequisites/PrerequisiteGroups.js"
const PrerequisiteGroup = DB.GenTypeAlias(import.meta.url, {
@@ -229,3 +230,11 @@ export const EnhancementPrerequisites = DB.TypeAlias(import.meta.url, {
DB.IncludeIdentifier(EnhancementPrerequisiteGroup),
]),
})
export const LinguisticPrerequisites = DB.TypeAlias(import.meta.url, {
name: "LinguisticPrerequisites",
type: () =>
DB.GenIncludeIdentifier(PlainPrerequisites, [
DB.IncludeIdentifier(LinguisticPrerequisiteGroup),
]),
})
+91 -49
View File
@@ -4,6 +4,7 @@ import { NestedTranslationMap } from "../../Locale.js"
import { Errata } from "../../source/_Erratum.js"
import { src } from "../../source/_PublicationRef.js"
import { Complexity, Cost, StructurePoints, Weight } from "./_Item.js"
import { LinguisticPrerequisites } from "../../_Prerequisite.js"
export const Book = DB.Entity(import.meta.url, {
name: "Book",
@@ -35,6 +36,16 @@ export const Book = DB.Entity(import.meta.url, {
comment: "The quality of the books content.",
type: DB.IncludeIdentifier(BookContentQuality),
}),
prerequisites: DB.Optional({
comment:
"Which prerequisites must be met to buy the stat block? For example, a character might need the advantage Spellcaster or Blessed. Note: the AP cost for a profession package does not include these prerequisites.",
type: DB.IncludeIdentifier(BookLinguisticPrerequisites),
}),
rules: DB.Required({
comment:
"Skills and abilities you can learn by reading the book, as well as any other rules and effects concerning the book.",
type: DB.IncludeIdentifier(BookRules),
}),
src,
translations: NestedTranslationMap(
DB.Required,
@@ -48,22 +59,10 @@ export const Book = DB.Entity(import.meta.url, {
comment: "An auxiliary name or label of the item, if available.",
type: DB.String({ minLength: 1 }),
}),
language: DB.Optional({
comment: "The language the book is written in, if specified.",
type: DB.String({ minLength: 1, markdown: "inline" }),
}),
script: DB.Optional({
comment: "The script that was used for the book, if specified.",
type: DB.String({ minLength: 1, markdown: "inline" }),
}),
note: DB.Optional({
comment: "Note text.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
rules: DB.Optional({
comment: "Special rules text.",
type: DB.IncludeIdentifier(BookRules),
}),
legality: DB.Optional({
comment: "The legality of the item, if specified.",
type: DB.String({ minLength: 1, markdown: "inline" }),
@@ -251,23 +250,29 @@ const PlainBookRules = DB.TypeAlias(import.meta.url, {
comment: "The books rules without any special effects or conditions.",
type: () =>
DB.Object({
text: DB.Required({
comment: "The (main) rules text.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
reconstruction: DB.Optional({
comment: "Rules for reconstructing certain skills or abilities from the book.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
references: DB.Optional({
comment:
"References to skills and abilities that, while mentioned in the book, cannot be learned from this book alone.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
textAfter: DB.Optional({
comment: "Additional rules text that comes after all other rules.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
translation: NestedTranslationMap(
DB.Required,
"PlainBookRules",
DB.Object({
text: DB.Required({
comment: "The (main) rules text.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
reconstruction: DB.Optional({
comment: "Rules for reconstructing certain skills or abilities from the book.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
references: DB.Optional({
comment:
"References to skills and abilities that, while mentioned in the book, cannot be learned from this book alone.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
textAfter: DB.Optional({
comment: "Additional rules text that comes after all other rules.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
}),
),
}),
})
@@ -280,10 +285,16 @@ const BookRulesByEdition = DB.TypeAlias(import.meta.url, {
editions: DB.Required({
type: DB.Array(DB.IncludeIdentifier(BookRulesOfEdition), { minItems: 1 }),
}),
textAfter: DB.Optional({
comment: "Additional rules text that comes after all other rules.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
translation: NestedTranslationMap(
DB.Optional,
"BookRulesByEdition",
DB.Object({
textAfter: DB.Optional({
comment: "Additional rules text that comes after all other rules.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
}),
),
}),
})
@@ -291,22 +302,53 @@ const BookRulesOfEdition = DB.TypeAlias(import.meta.url, {
name: "BookRulesOfEdition",
type: () =>
DB.Object({
label: DB.Required({
comment: "The edition(s) the rules apply to.",
type: DB.String({ minLength: 1 }),
}),
text: DB.Required({
comment: "The rules text.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
reconstruction: DB.Optional({
comment: "Rules for reconstructing certain skills or abilities from the book.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
references: DB.Optional({
comment:
"References to skills and abilities that, while mentioned in the book, cannot be learned from this book alone.",
type: DB.String({ minLength: 1, markdown: "block" }),
prerequisities: DB.Optional({
comment: "The prerequisites for learning the rules of this edition.",
type: DB.IncludeIdentifier(BookLinguisticPrerequisites),
}),
translation: NestedTranslationMap(
DB.Required,
"BookRulesOfEdition",
DB.Object({
label: DB.Required({
comment: "The edition(s) the rules apply to.",
type: DB.String({ minLength: 1 }),
}),
text: DB.Required({
comment: "The rules text.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
reconstruction: DB.Optional({
comment: "Rules for reconstructing certain skills or abilities from the book.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
references: DB.Optional({
comment:
"References to skills and abilities that, while mentioned in the book, cannot be learned from this book alone.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
}),
),
}),
})
const BookLinguisticPrerequisites = DB.TypeAlias(import.meta.url, {
name: "BookLinguisticPrerequisites",
type: () =>
DB.Object({
linguistic: DB.Required({
comment: "The linguistic prerequisites for this book.",
type: DB.IncludeIdentifier(LinguisticPrerequisites),
}),
translations: NestedTranslationMap(
DB.Optional,
"BookLinguisticPrerequisitesTranslation",
DB.Object({
replacement: DB.Required({
comment: "The label for this linguistic prerequisites.",
type: DB.String({ minLength: 1, markdown: "inline" }),
}),
}),
),
}),
})
@@ -20,6 +20,8 @@ import { SexualCharacteristicPrerequisite } from "./single/SexualCharacteristicP
import { SocialStatusPrerequisite } from "./single/SocialStatusPrerequisite.js"
import { StatePrerequisite } from "./single/StatePrerequisite.js"
import { TextPrerequisite } from "./single/TextPrerequisite.js"
import { ScriptPrerequisite } from "./single/ScriptPrerequisite.js"
import { LanguagePrerequisite } from "./single/LanguagePrerequisite.js"
import {
BlessedTraditionPrerequisite,
MagicalTraditionPrerequisite,
@@ -200,3 +202,11 @@ export const PreconditionGroup = DB.Enum(import.meta.url, {
}),
}),
})
export const LinguisticPrerequisiteGroup = DB.Enum(import.meta.url, {
name: "LinguisticPrerequisiteGroup",
values: () => ({
Language: DB.EnumCase({ type: DB.IncludeIdentifier(LanguagePrerequisite) }),
Script: DB.EnumCase({ type: DB.IncludeIdentifier(ScriptPrerequisite) }),
}),
})
@@ -0,0 +1,21 @@
import * as DB from "tsondb/schema/dsl"
import { LanguageIdentifier } from "../../_Identifier.js"
//import { DisplayOption } from "../DisplayOption.js"
export const LanguagePrerequisite = DB.TypeAlias(import.meta.url, {
name: "LanguagePrerequisite",
type: () =>
DB.Object({
id: DB.Required({
comment: "The languagess identifier.",
type: LanguageIdentifier(),
}),
value: DB.Required({
comment: "The required minimum value.",
type: DB.Integer({ minimum: 0 }),
}),
//display_option: DB.Optional({
// type: DB.IncludeIdentifier(DisplayOption),
//}),
}),
})
@@ -0,0 +1,17 @@
import * as DB from "tsondb/schema/dsl"
import { ScriptIdentifier } from "../../_Identifier.js"
//import { DisplayOption } from "../DisplayOption.js"
export const ScriptPrerequisite = DB.TypeAlias(import.meta.url, {
name: "ScriptPrerequisite",
type: () =>
DB.Object({
id: DB.Required({
comment: "The scriptss identifier.",
type: ScriptIdentifier(),
}),
//display_option: DB.Optional({
// type: DB.IncludeIdentifier(DisplayOption),
//}),
}),
})