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
This commit is contained in:
Lector
2026-06-10 20:46:41 +02:00
parent 80873e445e
commit 10e476b3e4
2 changed files with 88 additions and 52 deletions
+1 -1
View File
@@ -232,7 +232,7 @@ export const EnhancementPrerequisites = DB.TypeAlias(import.meta.url, {
})
export const LinguisticPrerequisites = DB.TypeAlias(import.meta.url, {
name: "BookLinguisticPrerequisites",
name: "LinguisticPrerequisites",
type: () =>
DB.GenIncludeIdentifier(PlainPrerequisites, [
DB.IncludeIdentifier(LinguisticPrerequisiteGroup),
+87 -51
View File
@@ -39,7 +39,12 @@ export const Book = DB.Entity(import.meta.url, {
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(LinguisticPrerequisites),
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(
@@ -54,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" }),
@@ -257,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" }),
}),
}),
),
}),
})
@@ -286,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" }),
}),
}),
),
}),
})
@@ -297,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" }),
}),
}),
),
}),
})