Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const schema = new Schema<TSONDBTypes>(
Types.BlessedTradition,
Types.Blessing,
Types.Book,
Types.BotanicRegion,
Types.BowlEnchantment,
Types.BrawlingSpecialAbility,
Types.Brew,
Expand Down Expand Up @@ -99,6 +100,7 @@ export const schema = new Schema<TSONDBTypes>(
Types.HairColor,
Types.Haubenzauber,
Types.HerbalAid,
Types.HerbalPreservation,
Types.HomunculusType,
Types.IlluminationLightSource,
Types.IlluminationRefillOrSupply,
Expand Down Expand Up @@ -165,6 +167,7 @@ export const schema = new Schema<TSONDBTypes>(
Types.StaffEnchantment,
Types.State,
Types.Stationery,
Types.SubBiome,
Types.Subject,
Types.Talisman,
Types.TargetCategory,
Expand Down
6 changes: 6 additions & 0 deletions src/types/Locale.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,12 @@ export const Locale = DB.Entity(import.meta.url, {
".input {$value :number} .input {$style :string} {{{$value} years}}": null,
"{$value} years": null,
"years": null,
".input {$value :number} .input {$style :string} {{{$value} dcs.}}": null,
"{$value} dcs.": null,
"dcs.": null,
".input {$value :number} .input {$style :string} {{{$value} decades}}": null,
"{$value} decades": null,
"decades": null,
".input {$value :number} .input {$style :string} {{{$value} cent.}}": null,
"{$value} cent.": null,
"cent.": null,
Expand Down
1 change: 1 addition & 0 deletions src/types/_ActivatableSkillDuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ export const DurationUnit = DB.Enum(import.meta.url, {
Weeks: DB.EnumCase({ type: null }),
Months: DB.EnumCase({ type: null }),
Years: DB.EnumCase({ type: null }),
Decades: DB.EnumCase({ type: null }),
Comment thread
Lector marked this conversation as resolved.
Centuries: DB.EnumCase({ type: null }),
Actions: DB.EnumCase({ type: null }),
CombatRounds: DB.EnumCase({ type: null }),
Expand Down
6 changes: 6 additions & 0 deletions src/types/_Identifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { Elixir } from "./equipment/item/Elixir.js"
import { EquipmentOfBlessedOnes } from "./equipment/item/EquipmentOfBlessedOnes.js"
import { GemOrPreciousStone } from "./equipment/item/GemOrPreciousStone.js"
import { HerbalAid } from "./equipment/item/HerbalAid.js"
import { HerbalPreservation } from "./equipment/item/HerbalPreservation.js"
import { IlluminationLightSource } from "./equipment/item/IlluminationLightSource.js"
import { IlluminationRefillOrSupply } from "./equipment/item/IlluminationRefillOrSupply.js"
import { Jewelry } from "./equipment/item/Jewelry.js"
Expand All @@ -49,7 +50,9 @@ import { RopeOrChain } from "./equipment/item/RopeOrChain.js"
import { Stationery } from "./equipment/item/Stationery.js"
import { ArmorType } from "./equipment/item/sub/ArmorType.js"
import { Biome } from "./equipment/item/sub/Biome.js"
import { SubBiome } from "./equipment/item/sub/SubBiome.js"
import { Reach } from "./equipment/item/sub/Reach.js"
import { BotanicRegion } from "./equipment/item/sub/BotanicRegion.js"
import { ThievesTool } from "./equipment/item/ThievesTool.js"
import { ToolOfTheTrade } from "./equipment/item/ToolOfTheTrade.js"
import { TravelGearOrTool } from "./equipment/item/TravelGearOrTool.js"
Expand Down Expand Up @@ -243,6 +246,7 @@ export const GuidelineIdentifier: () => R = () => R(Guideline)
export const HairColorIdentifier: () => R = () => R(HairColor)
export const HaubenzauberIdentifier: () => R = () => R(Haubenzauber)
export const HerbalAidIdentifier: () => R = () => R(HerbalAid)
export const HerbalPreservationIdentifier: () => R = () => R(HerbalPreservation)
export const IlluminationLightSourceIdentifier: () => R = () => R(IlluminationLightSource)
export const IlluminationRefillOrSupplyIdentifier: () => R = () => R(IlluminationRefillOrSupply)
export const InfluenceIdentifier: () => R = () => R(Influence)
Expand Down Expand Up @@ -297,6 +301,7 @@ export const RaceIdentifier: () => R = () => R(Race)
export const RaceVariantIdentifier: () => R = () => R(RaceVariant)
export const RangedCombatTechniqueIdentifier: () => R = () => R(RangedCombatTechnique)
export const ReachIdentifier: () => R = () => R(Reach)
export const BotanicRegionIdentifier: () => R = () => R(BotanicRegion)
export const RingEnchantmentIdentifier: () => R = () => R(RingEnchantment)
export const RitualIdentifier: () => R = () => R(Ritual)
export const RopeOrChainIdentifier: () => R = () => R(RopeOrChain)
Expand All @@ -319,6 +324,7 @@ export const SpellSwordEnchantmentIdentifier: () => R = () => R(SpellSwordEnchan
export const StaffEnchantmentIdentifier: () => R = () => R(StaffEnchantment)
export const StateIdentifier: () => R = () => R(State)
export const StationeryIdentifier: () => R = () => R(Stationery)
export const SubBiomeIdentifier: () => R = () => R(SubBiome)
export const SubjectIdentifier: () => R = () => R(Subject)
export const TargetCategoryIdentifier: () => R = () => R(TargetCategory)
export const ThievesToolIdentifier: () => R = () => R(ThievesTool)
Expand Down
93 changes: 93 additions & 0 deletions src/types/equipment/item/HerbalPreservation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import * as DB from "tsondb/schema/dsl"
import { NestedTranslationMap } from "../../Locale.js"
import { DurationUnit } from "../../_ActivatableSkillDuration.js"
import { ResponsiveTextReplace } from "../../_ResponsiveText.js"
import { Dice } from "../../_Dice.js"
import { MathOperation } from "../../_MathExpression.js"
import { EffectType } from "./_Herbary.js"
import { src } from "../../source/_PublicationRef.js"

export const HerbalPreservation = DB.Entity(import.meta.url, {
name: "HerbalPreservation",
namePlural: "HerbalPreservations",
type: () =>
DB.Object({
types: DB.Required({
comment: "The types of this preservation.",
type: DB.Array(DB.IncludeIdentifier(EffectType), { minItems: 1, uniqueItems: true }),
}),
longevity: DB.Required({
comment: "How long this preservation lasts.",
type: DB.IncludeIdentifier(HerbalPreservationLongevity),
}),
src,
translations: NestedTranslationMap(
DB.Required,
"HerbalPreservation",
DB.Object({
name: DB.Required({
comment: "The herbal preservation's name.",
type: DB.String({ minLength: 1 }),
}),
preparation: DB.Required({
comment: "How to prepare this preservation.",
type: DB.String({ minLength: 1, markdown: "inline" }),
}),
alternative_effect: DB.Required({
comment: "The herbal preservation's alternative effect.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
}),
),
}),
instanceDisplayName: {},
uniqueConstraints: [
{
entityMapKeyPath: "translations",
keyPathInEntityMap: "name",
},
],
})

export const HerbalPreservationLongevity = DB.TypeAlias(import.meta.url, {
name: "HerbalPreservationLongevity",
type: () =>
DB.Object({
value: DB.Required({
comment: "An expression that evaluates to the duration.",
type: DB.IncludeIdentifier(HerbalPreservationLongevityExpression),
}),
unit: DB.Required({
comment: "The duration unit.",
type: DB.IncludeIdentifier(DurationUnit),
}),
translations: NestedTranslationMap(
DB.Optional,
"HerbalPreservationLongevity",
DB.Object({
replacement: DB.Required({
comment: "A replacement string.",
type: DB.IncludeIdentifier(ResponsiveTextReplace),
}),
}),
),
}),
})

export const HerbalPreservationLongevityExpression = DB.TypeAlias(import.meta.url, {
name: "HerbalPreservationLongevityExpression",
type: () =>
DB.GenIncludeIdentifier(MathOperation, [
DB.IncludeIdentifier(HerbalPreservationLongevityValue),
]),
})

export const HerbalPreservationLongevityValue = DB.Enum(import.meta.url, {
name: "HerbalPreservationLongevityValue",
values: () => ({
Constant: DB.EnumCase({ type: DB.Integer({ minimum: 1 }) }),
Dice: DB.EnumCase({
type: DB.IncludeIdentifier(Dice),
}),
}),
})
92 changes: 86 additions & 6 deletions src/types/equipment/item/Plant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ import { NestedTranslationMap } from "../../Locale.js"
import { AlternativeName } from "../../_AlternativeNames.js"
import {
BiomeIdentifier,
SubBiomeIdentifier,
BotanicRegionIdentifier,
HerbalAidIdentifier,
HerbalPreservationIdentifier,
ElixirIdentifier,
PoisonIdentifier,
} from "../../_Identifier.js"
Expand All @@ -26,15 +29,15 @@ export const Plant = DB.Entity(import.meta.url, {
}),
search_difficulty: DB.Required({
comment: "The search difficulty for this plant.",
type: DB.Integer(),
type: DB.IncludeIdentifier(PlantDifficulty),
}),
identification_difficulty: DB.Required({
comment: "The identification difficulty for this plant.",
type: DB.Integer(),
type: DB.IncludeIdentifier(PlantDifficulty),
}),
applications: DB.Required({
comment: "The applications of this plant per quality level.",
type: DB.Array(DB.Integer(), { minItems: 6, maxItems: 6 }),
type: DB.IncludeIdentifier(PlantApplications),
}),
touch: DB.Optional({
comment: "The plant's touch effect.",
Expand All @@ -56,6 +59,10 @@ export const Plant = DB.Entity(import.meta.url, {
comment: "The herbal aids and elixirs that can be crafted with this plant.",
type: DB.Array(DB.IncludeIdentifier(PlantRecipe), { minItems: 1 }),
}),
longevity: DB.Optional({
comment: "The longevity of the plant.",
type: DB.IncludeIdentifier(PlantLongevity),
}),
src,
translations: NestedTranslationMap(
DB.Required,
Expand Down Expand Up @@ -123,9 +130,9 @@ const PlantOccurrence = DB.TypeAlias(import.meta.url, {
name: "PlantOccurrence",
type: () =>
DB.Object({
biome: DB.Required({
comment: "The biome this plant occurs in.",
type: BiomeIdentifier(),
regions: DB.Required({
comment: "Where this plant occurs in.",
type: DB.IncludeIdentifier(PlantOccurrenceTier),
}),
rarity: DB.Required({
comment: "The rarity of this plant in the biome.",
Expand All @@ -144,6 +151,54 @@ const PlantOccurrence = DB.TypeAlias(import.meta.url, {
}),
})

const PlantOccurrenceTier = DB.Enum(import.meta.url, {
name: "PlantOccurrenceTier",
values: () => ({
Biomes: DB.EnumCase({
type: DB.Array(BiomeIdentifier(), { minItems: 1 }),
}),
SubBiomes: DB.EnumCase({
type: DB.Array(SubBiomeIdentifier(), { minItems: 1 }),
}),
BotanicRegions: DB.EnumCase({
type: DB.Array(BotanicRegionIdentifier(), { minItems: 1 }),
}),
}),
})

const PlantDifficulty = DB.Enum(import.meta.url, {
name: "PlantDifficulty",
values: () => ({
Constant: DB.EnumCase({ type: DB.Integer() }),
Indefinite: DB.EnumCase({ type: DB.IncludeIdentifier(IndefinitePlantDescription) }),
}),
})

const IndefinitePlantDescription = DB.TypeAlias(import.meta.url, {
name: "IndefinitePlantDescription",
type: () =>
DB.Object({
translations: NestedTranslationMap(
DB.Required,
"IndefinitePlantDescription",
DB.Object({
description: DB.Required({
comment: "A description of whatever is indefinite of this plant.",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
}),
),
}),
})

const PlantApplications = DB.Enum(import.meta.url, {
name: "PlantApplications",
values: () => ({
Constant: DB.EnumCase({ type: DB.Array(DB.Integer(), { minItems: 6, maxItems: 6 }) }),
Indefinite: DB.EnumCase({ type: DB.IncludeIdentifier(IndefinitePlantDescription) }),
}),
})

const PlantEffect = DB.TypeAlias(import.meta.url, {
name: "PlantEffect",
type: () =>
Expand Down Expand Up @@ -279,3 +334,28 @@ const IndefiniteRecipe = DB.TypeAlias(import.meta.url, {
),
}),
})

const PlantLongevity = DB.TypeAlias(import.meta.url, {
name: "PlantLongevity",
type: () =>
DB.Object({
preservations: DB.Optional({
comment: "The preservations with alternative effect of this preserved plant",
type: DB.Array(HerbalPreservationIdentifier(), { minItems: 1, uniqueItems: true }),
}),
translations: NestedTranslationMap(
DB.Required,
"PlantLongevity",
DB.Object({
raw: DB.Required({
comment: "The longevity of the raw plant",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
preserved: DB.Optional({
comment: "The longevity of the preserved plant",
type: DB.String({ minLength: 1, markdown: "block" }),
}),
}),
),
}),
})
Comment thread
Lector marked this conversation as resolved.
4 changes: 4 additions & 0 deletions src/types/equipment/item/sub/Biome.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as DB from "tsondb/schema/dsl"
import { NestedTranslationMap } from "../../../Locale.js"
import { SubBiome } from "./SubBiome.js"

export const Biome = DB.Entity(import.meta.url, {
name: "Biome",
Expand All @@ -16,6 +17,9 @@ export const Biome = DB.Entity(import.meta.url, {
}),
}),
),
sub_biomes: DB.Required({
type: DB.ChildEntitiesType(SubBiome),
}),
}),
instanceDisplayName: {},
uniqueConstraints: [
Expand Down
33 changes: 33 additions & 0 deletions src/types/equipment/item/sub/BotanicRegion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import * as DB from "tsondb/schema/dsl"
import { NestedTranslationMap } from "../../../Locale.js"
import { SubBiomeIdentifier } from "../../../_Identifier.js"

export const BotanicRegion = DB.Entity(import.meta.url, {
name: "BotanicRegion",
namePlural: "BotanicRegions",
type: () =>
DB.Object({
parent: DB.Required({
comment: "The subbiome this region belongs to.",
type: SubBiomeIdentifier(),
}),
translations: NestedTranslationMap(
DB.Required,
"BotanicRegion",
DB.Object({
name: DB.Required({
comment: "The region's name.",
type: DB.String({ minLength: 1 }),
}),
}),
),
}),
parentReferenceKey: "parent",
instanceDisplayName: {},
uniqueConstraints: [
{
entityMapKeyPath: "translations",
keyPathInEntityMap: "name",
},
],
})
Loading
Loading