fixed build errors

This commit is contained in:
2025-07-06 20:35:52 +02:00
parent dc354a6738
commit c220f14593
24 changed files with 398 additions and 393 deletions

View File

@@ -11,7 +11,7 @@ export interface Blessing {
range: string; range: string;
duration: string; duration: string;
target: string; target: string;
src: any[]; src: BlessingSource[];
} }
export type Blessings = Blessing[]; export type Blessings = Blessing[];

View File

@@ -11,7 +11,7 @@ export interface Cantrip {
range: string; range: string;
duration: string; duration: string;
target: string; target: string;
src: any[]; src: CantripSource[];
} }
export type Cantrips = Cantrip[]; export type Cantrips = Cantrip[];

View File

@@ -7,7 +7,7 @@ export interface CombatTechniqueSource {
export interface CombatTechnique { export interface CombatTechnique {
id: string; id: string;
name: string; name: string;
src: any[]; src: CombatTechniqueSource[];
} }
export type CombatTechniques = CombatTechnique[]; export type CombatTechniques = CombatTechnique[];

View File

@@ -12,7 +12,7 @@ export interface Condition {
level2: string; level2: string;
level3: string; level3: string;
level4: string; level4: string;
src: any[]; src: ConditionSource[];
} }
export type Conditions = Condition[]; export type Conditions = Condition[];

View File

@@ -17,7 +17,7 @@ export interface Culture {
uncommonAdvantages?: string; uncommonAdvantages?: string;
uncommonDisadvantages?: string; uncommonDisadvantages?: string;
commonNames: string; commonNames: string;
src: any[]; src: CultureSource[];
} }
export type Cultures = Culture[]; export type Cultures = Culture[];

View File

@@ -12,7 +12,7 @@ export interface Curse {
aeCostShort: string; aeCostShort: string;
duration: string; duration: string;
durationShort: string; durationShort: string;
src: any[]; src: CurseSource[];
} }
export type Curses = Curse[]; export type Curses = Curse[];

View File

@@ -9,7 +9,7 @@ export interface Disadvantage {
name: string; name: string;
rules: string; rules: string;
input?: string; input?: string;
src: any[]; src: DisadvantageSource[];
} }
export type Disadvantages = Disadvantage[]; export type Disadvantages = Disadvantage[];

View File

@@ -12,7 +12,7 @@ export interface DominationRitual {
aeCostShort: string; aeCostShort: string;
duration: string; duration: string;
durationShort: string; durationShort: string;
src: any[]; src: DominationRitualSource[];
} }
export type DominationRituals = DominationRitual[]; export type DominationRituals = DominationRitual[];

View File

@@ -10,7 +10,7 @@ export interface ElvenMagicalSong {
effect: string; effect: string;
aeCost: string; aeCost: string;
aeCostShort: string; aeCostShort: string;
src: any[]; src: ElvenMagicalSongSource[];
} }
export type ElvenMagicalSongs = ElvenMagicalSong[]; export type ElvenMagicalSongs = ElvenMagicalSong[];

View File

@@ -4,4 +4,4 @@ export interface Equipment {
versions: any[]; versions: any[];
} }
export type Equipment = Equipment[]; export type Equipments = Equipment[];

View File

@@ -7,7 +7,7 @@ export interface EquipmentPackageSource {
export interface EquipmentPackage { export interface EquipmentPackage {
id: string; id: string;
name: string; name: string;
src: any[]; src: EquipmentPackageSource[];
} }
export type EquipmentPackages = EquipmentPackage[]; export type EquipmentPackages = EquipmentPackage[];

View File

@@ -8,7 +8,7 @@ export interface FocusRule {
id: string; id: string;
name: string; name: string;
description: string; description: string;
src: any[]; src: FocusRuleSource[];
} }
export type FocusRules = FocusRule[]; export type FocusRules = FocusRule[];

View File

@@ -17,7 +17,7 @@ export interface GeodeRitual {
duration: string; duration: string;
durationShort: string; durationShort: string;
target: string; target: string;
src: any[]; src: GeodeRitualSource[];
} }
export type GeodeRituals = GeodeRitual[]; export type GeodeRituals = GeodeRitual[];

View File

@@ -17,7 +17,7 @@ export interface LiturgicalChant {
duration: string; duration: string;
durationShort: string; durationShort: string;
target: string; target: string;
src: any[]; src: LiturgicalChantSource[];
} }
export type LiturgicalChants = LiturgicalChant[]; export type LiturgicalChants = LiturgicalChant[];

View File

@@ -9,7 +9,7 @@ export interface LiturgicalChantEnhancement {
level1: Record<string, any>; level1: Record<string, any>;
level2: Record<string, any>; level2: Record<string, any>;
level3: Record<string, any>; level3: Record<string, any>;
src: any[]; src: LiturgicalChantEnhancementSource[];
} }
export type LiturgicalChantEnhancements = LiturgicalChantEnhancement[]; export type LiturgicalChantEnhancements = LiturgicalChantEnhancement[];

View File

@@ -13,7 +13,7 @@ export interface MagicalDance {
durationShort: string; durationShort: string;
aeCost: string; aeCost: string;
aeCostShort: string; aeCostShort: string;
src: any[]; src: MagicalDanceSource[];
} }
export type MagicalDances = MagicalDance[]; export type MagicalDances = MagicalDance[];

View File

@@ -13,7 +13,7 @@ export interface MagicalMelodie {
durationShort: string; durationShort: string;
aeCost: string; aeCost: string;
aeCostShort: string; aeCostShort: string;
src: any[]; src: MagicalMelodieSource[];
} }
export type MagicalMelodies = MagicalMelodie[]; export type MagicalMelodies = MagicalMelodie[];

View File

@@ -8,7 +8,7 @@ export interface OptionalRule {
id: string; id: string;
name: string; name: string;
description: string; description: string;
src: any[]; src: OptionalRuleSource[];
} }
export type OptionalRules = OptionalRule[]; export type OptionalRules = OptionalRule[];

View File

@@ -17,7 +17,7 @@ export interface RogueSpell {
duration: string; duration: string;
durationShort: string; durationShort: string;
target: string; target: string;
src: any[]; src: RogueSpellSource[];
} }
export type RogueSpells = RogueSpell[]; export type RogueSpells = RogueSpell[];

View File

@@ -13,7 +13,7 @@ export interface Skill {
failed: string; failed: string;
critical: string; critical: string;
botch: string; botch: string;
src: unknown[]; src: SkillSource[];
} }
export type Skills = Skill[]; export type Skills = Skill[];

View File

@@ -9,7 +9,7 @@ export interface SpecialAbilitie {
name: string; name: string;
rules?: string; rules?: string;
input?: string; input?: string;
src: any[]; src: SpecialAbilitieSource[];
} }
export type SpecialAbilities = SpecialAbilitie[]; export type SpecialAbilities = SpecialAbilitie[];

View File

@@ -9,7 +9,7 @@ export interface SpellEnhancement {
level1: Record<string, any>; level1: Record<string, any>;
level2: Record<string, any>; level2: Record<string, any>;
level3: Record<string, any>; level3: Record<string, any>;
src: any[]; src: SpellEnhancementSource[];
} }
export type SpellEnhancements = SpellEnhancement[]; export type SpellEnhancements = SpellEnhancement[];

View File

@@ -8,7 +8,7 @@ export interface State {
id: string; id: string;
name: string; name: string;
description: string; description: string;
src: any[]; src: StateSource[];
} }
export type States = State[]; export type States = State[];

View File

@@ -1,64 +1,64 @@
import type { Race, Races } from '../types/Race'; import type {Race} from '../types/Race';
import type { Profession, Professions } from '../types/Profession'; import type {Profession} from '../types/Profession';
import type { Attribute, Attributes } from '../types/Attribute'; import type {Attribute} from '../types/Attribute';
import type { AttributeValue } from '../types/CharacterJson'; import type {AttributeValue} from '../types/CharacterJson';
import type { Advantage } from '../types/Advantage'; import type {Advantage} from '../types/Advantage';
import type { AnimistForce } from '../types/AnimistForce'; import type {AnimistForce} from '../types/AnimistForce';
import type { ArcaneBardTradition } from '../types/ArcaneBardTradition'; // import type { ArcaneBardTradition } from '../types/ArcaneBardTradition';
import type { ArcaneDancerTradition } from '../types/ArcaneDancerTradition'; // import type { ArcaneDancerTradition } from '../types/ArcaneDancerTradition';
import type { ArmorType } from '../types/ArmorType'; // import type { ArmorType } from '../types/ArmorType';
import type { Aspect } from '../types/Aspect'; // import type { Aspect } from '../types/Aspect';
import type { BlessedTradition } from '../types/BlessedTradition'; // import type { BlessedTradition } from '../types/BlessedTradition';
import type { Blessing } from '../types/Blessing'; // import type { Blessing } from '../types/Blessing';
import type { Book } from '../types/Book'; // import type { Book } from '../types/Book';
import type { Brew } from '../types/Brew'; // import type { Brew } from '../types/Brew';
import type { Cantrip } from '../types/Cantrip'; // import type { Cantrip } from '../types/Cantrip';
import type { CombatSpecialAbilityGroup } from '../types/CombatSpecialAbilityGroup'; // import type { CombatSpecialAbilityGroup } from '../types/CombatSpecialAbilityGroup';
import type { CombatTechniqueGroup } from '../types/CombatTechniqueGroup'; // import type { CombatTechniqueGroup } from '../types/CombatTechniqueGroup';
import type { CombatTechnique } from '../types/CombatTechnique'; // import type { CombatTechnique } from '../types/CombatTechnique';
import type { Condition } from '../types/Condition'; // import type { Condition } from '../types/Condition';
import type { Culture } from '../types/Culture'; // import type { Culture } from '../types/Culture';
import type { Curse } from '../types/Curse'; // import type { Curse } from '../types/Curse';
import type { DerivedCharacteristic } from '../types/DerivedCharacteristic'; // import type { DerivedCharacteristic } from '../types/DerivedCharacteristic';
import type { Disadvantage } from '../types/Disadvantage'; // import type { Disadvantage } from '../types/Disadvantage';
import type { DominationRitual } from '../types/DominationRitual'; // import type { DominationRitual } from '../types/DominationRitual';
import type { Element } from '../types/Element'; // import type { Element } from '../types/Element';
import type { ElvenMagicalSong } from '../types/ElvenMagicalSong'; // import type { ElvenMagicalSong } from '../types/ElvenMagicalSong';
import type { EquipmentGroup } from '../types/EquipmentGroup'; // import type { EquipmentGroup } from '../types/EquipmentGroup';
import type { EquipmentPackage } from '../types/EquipmentPackage'; // import type { EquipmentPackage } from '../types/EquipmentPackage';
import type { Equipment } from '../types/Equipment'; // import type { Equipment } from '../types/Equipment';
import type { ExperienceLevel } from '../types/ExperienceLevel'; // import type { ExperienceLevel } from '../types/ExperienceLevel';
import type { EyeColor } from '../types/EyeColor'; // import type { EyeColor } from '../types/EyeColor';
import type { FocusRule } from '../types/FocusRule'; // import type { FocusRule } from '../types/FocusRule';
import type { GeodeRitual } from '../types/GeodeRitual'; // import type { GeodeRitual } from '../types/GeodeRitual';
import type { HairColor } from '../types/HairColor'; // import type { HairColor } from '../types/HairColor';
import type { LiturgicalChantEnhancement } from '../types/LiturgicalChantEnhancement'; // import type { LiturgicalChantEnhancement } from '../types/LiturgicalChantEnhancement';
import type { LiturgicalChantGroup } from '../types/LiturgicalChantGroup'; // import type { LiturgicalChantGroup } from '../types/LiturgicalChantGroup';
import type { LiturgicalChant } from '../types/LiturgicalChant'; // import type { LiturgicalChant } from '../types/LiturgicalChant';
import type { MagicalDance } from '../types/MagicalDance'; // import type { MagicalDance } from '../types/MagicalDance';
import type { MagicalMelodie } from '../types/MagicalMelodie'; // import type { MagicalMelodie } from '../types/MagicalMelodie';
import type { MagicalTradition } from '../types/MagicalTradition'; // import type { MagicalTradition } from '../types/MagicalTradition';
import type { OptionalRule } from '../types/OptionalRule'; // import type { OptionalRule } from '../types/OptionalRule';
import type { Pact } from '../types/Pact'; // import type { Pact } from '../types/Pact';
import type { PatronCategorie } from '../types/PatronCategorie'; // import type { PatronCategorie } from '../types/PatronCategorie';
import type { Patron } from '../types/Patron'; // import type { Patron } from '../types/Patron';
import type { ProfessionVariant } from '../types/ProfessionVariant'; // import type { ProfessionVariant } from '../types/ProfessionVariant';
import type { Propertie } from '../types/Propertie'; // import type { Propertie } from '../types/Propertie';
import type { RaceVariant } from '../types/RaceVariant'; // import type { RaceVariant } from '../types/RaceVariant';
import type { Reache } from '../types/Reache'; // import type { Reache } from '../types/Reache';
import type { RogueSpell } from '../types/RogueSpell'; // import type { RogueSpell } from '../types/RogueSpell';
import type { SkillGroup } from '../types/SkillGroup'; // import type { SkillGroup } from '../types/SkillGroup';
import type { Skill } from '../types/Skill'; import type {Skill, Skills} from '../types/Skill';
import type { SocialStatuse } from '../types/SocialStatuse'; // import type { SocialStatuse } from '../types/SocialStatuse';
import type { SpecialAbilitie } from '../types/SpecialAbilitie'; // import type { SpecialAbilitie } from '../types/SpecialAbilitie';
import type { SpecialAbilityGroup } from '../types/SpecialAbilityGroup'; // import type { SpecialAbilityGroup } from '../types/SpecialAbilityGroup';
import type { SpellEnhancement } from '../types/SpellEnhancement'; // import type { SpellEnhancement } from '../types/SpellEnhancement';
import type { SpellGroup } from '../types/SpellGroup'; // import type { SpellGroup } from '../types/SpellGroup';
import type { Spell } from '../types/Spell'; // import type { Spell } from '../types/Spell';
import type { State } from '../types/State'; // import type { State } from '../types/State';
import type { Subject } from '../types/Subject'; // import type { Subject } from '../types/Subject';
import type { Tribe } from '../types/Tribe'; // import type { Tribe } from '../types/Tribe';
import type { ZibiljaRitual } from '../types/ZibiljaRitual'; // import type { ZibiljaRitual } from '../types/ZibiljaRitual';
/** /**
* Generic function to load data from a JSON file * Generic function to load data from a JSON file
@@ -89,39 +89,40 @@ async function getItemById<T extends { id: string }>(fileName: string, id: strin
return data.find(item => item.id === id); return data.find(item => item.id === id);
} }
/** //
* Function to get the name of an item by ID // /**
* @param fileName The name of the JSON file to load // * Function to get the name of an item by ID
* @param id The ID of the item to find // * @param fileName The name of the JSON file to load
* @returns A promise that resolves to the name of the item with the specified ID, or the ID if not found // * @param id The ID of the item to find
*/ // * @returns A promise that resolves to the name of the item with the specified ID, or the ID if not found
export async function getItemNameById(fileName: string, id: string): Promise<string> { // */
try { // export async function getItemNameById(fileName: string, id: string): Promise<string> {
const response = await fetch(`/data/database/${fileName.replace('.yaml', '.json')}`); // try {
if (!response.ok) { // const response = await fetch(`/data/database/${fileName.replace('.yaml', '.json')}`);
throw new Error(`Failed to load ${fileName}: ${response.statusText}`); // if (!response.ok) {
} // throw new Error(`Failed to load ${fileName}: ${response.statusText}`);
const data = await response.json(); // }
const item = data.find((item: any) => item.id === id); // const data = await response.json();
// const item = data.find((item: any) => item.id === id);
if (!item) { //
return id; // if (!item) {
} // return id;
// }
// Handle different name formats //
if (typeof item.name === 'string') { // // Handle different name formats
return item.name; // if (typeof item.name === 'string') {
} else if (item.name && (item.name.m || item.name.f)) { // return item.name;
// For gendered names, return male name by default // } else if (item.name && (item.name.m || item.name.f)) {
return item.name.m || item.name.f; // // For gendered names, return male name by default
} // return item.name.m || item.name.f;
// }
return id; //
} catch (error) { // return id;
console.error(`Error getting name for ${id} from ${fileName}:`, error); // } catch (error) {
return id; // console.error(`Error getting name for ${id} from ${fileName}:`, error);
} // return id;
} // }
// }
// Race loader // Race loader
export async function loadRace(id: string): Promise<Race | undefined> { export async function loadRace(id: string): Promise<Race | undefined> {
@@ -146,11 +147,11 @@ export async function loadAttribute(id: string): Promise<Attribute | undefined>
// Load attribute with value, name, and short // Load attribute with value, name, and short
export async function loadAttributeWithValue(attributeValue: AttributeValue): Promise<AttributeWithValue | undefined> { export async function loadAttributeWithValue(attributeValue: AttributeValue): Promise<AttributeWithValue | undefined> {
const attribute = await loadAttribute(attributeValue.id); const attribute = await loadAttribute(attributeValue.id);
if (!attribute) { if (!attribute) {
return undefined; return undefined;
} }
return { return {
...attribute, ...attribute,
value: attributeValue.value value: attributeValue.value
@@ -161,7 +162,7 @@ export async function loadAttributeWithValue(attributeValue: AttributeValue): Pr
export async function loadAttributesWithValues(attributeValues: AttributeValue[]): Promise<AttributeWithValue[]> { export async function loadAttributesWithValues(attributeValues: AttributeValue[]): Promise<AttributeWithValue[]> {
const promises = attributeValues.map(attrValue => loadAttributeWithValue(attrValue)); const promises = attributeValues.map(attrValue => loadAttributeWithValue(attrValue));
const attributes = await Promise.all(promises); const attributes = await Promise.all(promises);
// Filter out undefined values // Filter out undefined values
return attributes.filter((attr): attr is AttributeWithValue => attr !== undefined); return attributes.filter((attr): attr is AttributeWithValue => attr !== undefined);
} }
@@ -176,231 +177,233 @@ export async function loadAnimistForce(id: string): Promise<AnimistForce | undef
return getItemById<AnimistForce>('AnimistForces.json', id); return getItemById<AnimistForce>('AnimistForces.json', id);
} }
// ArcaneBardTradition loader //
export async function loadArcaneBardTradition(id: string): Promise<ArcaneBardTradition | undefined> { // // ArcaneBardTradition loader
return getItemById<ArcaneBardTradition>('ArcaneBardTraditions.json', id); // export async function loadArcaneBardTradition(id: string): Promise<ArcaneBardTradition | undefined> {
} // return getItemById<ArcaneBardTradition>('ArcaneBardTraditions.json', id);
// }
// ArcaneDancerTradition loader //
export async function loadArcaneDancerTradition(id: string): Promise<ArcaneDancerTradition | undefined> { // // ArcaneDancerTradition loader
return getItemById<ArcaneDancerTradition>('ArcaneDancerTraditions.json', id); // export async function loadArcaneDancerTradition(id: string): Promise<ArcaneDancerTradition | undefined> {
} // return getItemById<ArcaneDancerTradition>('ArcaneDancerTraditions.json', id);
// }
// ArmorType loader //
export async function loadArmorType(id: string): Promise<ArmorType | undefined> { // // ArmorType loader
return getItemById<ArmorType>('ArmorTypes.json', id); // export async function loadArmorType(id: string): Promise<ArmorType | undefined> {
} // return getItemById<ArmorType>('ArmorTypes.json', id);
// }
// Aspect loader //
export async function loadAspect(id: string): Promise<Aspect | undefined> { // // Aspect loader
return getItemById<Aspect>('Aspects.json', id); // export async function loadAspect(id: string): Promise<Aspect | undefined> {
} // return getItemById<Aspect>('Aspects.json', id);
// }
// BlessedTradition loader //
export async function loadBlessedTradition(id: string): Promise<BlessedTradition | undefined> { // // BlessedTradition loader
return getItemById<BlessedTradition>('BlessedTraditions.json', id); // export async function loadBlessedTradition(id: string): Promise<BlessedTradition | undefined> {
} // return getItemById<BlessedTradition>('BlessedTraditions.json', id);
// }
// Blessing loader //
export async function loadBlessing(id: string): Promise<Blessing | undefined> { // // Blessing loader
return getItemById<Blessing>('Blessings.json', id); // export async function loadBlessing(id: string): Promise<Blessing | undefined> {
} // return getItemById<Blessing>('Blessings.json', id);
// }
// Book loader //
export async function loadBook(id: string): Promise<Book | undefined> { // // Book loader
return getItemById<Book>('Books.json', id); // export async function loadBook(id: string): Promise<Book | undefined> {
} // return getItemById<Book>('Books.json', id);
// }
// Brew loader //
export async function loadBrew(id: string): Promise<Brew | undefined> { // // Brew loader
return getItemById<Brew>('Brews.json', id); // export async function loadBrew(id: string): Promise<Brew | undefined> {
} // return getItemById<Brew>('Brews.json', id);
// }
// Cantrip loader //
export async function loadCantrip(id: string): Promise<Cantrip | undefined> { // // Cantrip loader
return getItemById<Cantrip>('Cantrips.json', id); // export async function loadCantrip(id: string): Promise<Cantrip | undefined> {
} // return getItemById<Cantrip>('Cantrips.json', id);
// }
// CombatSpecialAbilityGroup loader //
export async function loadCombatSpecialAbilityGroup(id: string): Promise<CombatSpecialAbilityGroup | undefined> { // // CombatSpecialAbilityGroup loader
return getItemById<CombatSpecialAbilityGroup>('CombatSpecialAbilityGroups.json', id); // export async function loadCombatSpecialAbilityGroup(id: string): Promise<CombatSpecialAbilityGroup | undefined> {
} // return getItemById<CombatSpecialAbilityGroup>('CombatSpecialAbilityGroups.json', id);
// }
// CombatTechniqueGroup loader //
export async function loadCombatTechniqueGroup(id: string): Promise<CombatTechniqueGroup | undefined> { // // CombatTechniqueGroup loader
return getItemById<CombatTechniqueGroup>('CombatTechniqueGroups.json', id); // export async function loadCombatTechniqueGroup(id: string): Promise<CombatTechniqueGroup | undefined> {
} // return getItemById<CombatTechniqueGroup>('CombatTechniqueGroups.json', id);
// }
// CombatTechnique loader //
export async function loadCombatTechnique(id: string): Promise<CombatTechnique | undefined> { // // CombatTechnique loader
return getItemById<CombatTechnique>('CombatTechniques.json', id); // export async function loadCombatTechnique(id: string): Promise<CombatTechnique | undefined> {
} // return getItemById<CombatTechnique>('CombatTechniques.json', id);
// }
// Condition loader //
export async function loadCondition(id: string): Promise<Condition | undefined> { // // Condition loader
return getItemById<Condition>('Conditions.json', id); // export async function loadCondition(id: string): Promise<Condition | undefined> {
} // return getItemById<Condition>('Conditions.json', id);
// }
// Culture loader //
export async function loadCulture(id: string): Promise<Culture | undefined> { // // Culture loader
return getItemById<Culture>('Cultures.json', id); // export async function loadCulture(id: string): Promise<Culture | undefined> {
} // return getItemById<Culture>('Cultures.json', id);
// }
// Curse loader //
export async function loadCurse(id: string): Promise<Curse | undefined> { // // Curse loader
return getItemById<Curse>('Curses.json', id); // export async function loadCurse(id: string): Promise<Curse | undefined> {
} // return getItemById<Curse>('Curses.json', id);
// }
// DerivedCharacteristic loader //
export async function loadDerivedCharacteristic(id: string): Promise<DerivedCharacteristic | undefined> { // // DerivedCharacteristic loader
return getItemById<DerivedCharacteristic>('DerivedCharacteristics.json', id); // export async function loadDerivedCharacteristic(id: string): Promise<DerivedCharacteristic | undefined> {
} // return getItemById<DerivedCharacteristic>('DerivedCharacteristics.json', id);
// }
// Disadvantage loader //
export async function loadDisadvantage(id: string): Promise<Disadvantage | undefined> { // // Disadvantage loader
return getItemById<Disadvantage>('Disadvantages.json', id); // export async function loadDisadvantage(id: string): Promise<Disadvantage | undefined> {
} // return getItemById<Disadvantage>('Disadvantages.json', id);
// }
// DominationRitual loader //
export async function loadDominationRitual(id: string): Promise<DominationRitual | undefined> { // // DominationRitual loader
return getItemById<DominationRitual>('DominationRituals.json', id); // export async function loadDominationRitual(id: string): Promise<DominationRitual | undefined> {
} // return getItemById<DominationRitual>('DominationRituals.json', id);
// }
// Element loader //
export async function loadElement(id: string): Promise<Element | undefined> { // // Element loader
return getItemById<Element>('Elements.json', id); // export async function loadElement(id: string): Promise<Element | undefined> {
} // return getItemById<Element>('Elements.json', id);
// }
// ElvenMagicalSong loader //
export async function loadElvenMagicalSong(id: string): Promise<ElvenMagicalSong | undefined> { // // ElvenMagicalSong loader
return getItemById<ElvenMagicalSong>('ElvenMagicalSongs.json', id); // export async function loadElvenMagicalSong(id: string): Promise<ElvenMagicalSong | undefined> {
} // return getItemById<ElvenMagicalSong>('ElvenMagicalSongs.json', id);
// }
// EquipmentGroup loader //
export async function loadEquipmentGroup(id: string): Promise<EquipmentGroup | undefined> { // // EquipmentGroup loader
return getItemById<EquipmentGroup>('EquipmentGroups.json', id); // export async function loadEquipmentGroup(id: string): Promise<EquipmentGroup | undefined> {
} // return getItemById<EquipmentGroup>('EquipmentGroups.json', id);
// }
// Equipment loader //
export async function loadEquipment(id: string): Promise<Equipment | undefined> { // // Equipment loader
return getItemById<Equipment>('Equipment.json', id); // export async function loadEquipment(id: string): Promise<Equipment | undefined> {
} // return getItemById<Equipment>('Equipment.json', id);
// }
// EquipmentPackage loader //
export async function loadEquipmentPackage(id: string): Promise<EquipmentPackage | undefined> { // // EquipmentPackage loader
return getItemById<EquipmentPackage>('EquipmentPackages.json', id); // export async function loadEquipmentPackage(id: string): Promise<EquipmentPackage | undefined> {
} // return getItemById<EquipmentPackage>('EquipmentPackages.json', id);
// }
// ExperienceLevel loader //
export async function loadExperienceLevel(id: string): Promise<ExperienceLevel | undefined> { // // ExperienceLevel loader
return getItemById<ExperienceLevel>('ExperienceLevels.json', id); // export async function loadExperienceLevel(id: string): Promise<ExperienceLevel | undefined> {
} // return getItemById<ExperienceLevel>('ExperienceLevels.json', id);
// }
// EyeColor loader //
export async function loadEyeColor(id: string): Promise<EyeColor | undefined> { // // EyeColor loader
return getItemById<EyeColor>('EyeColors.json', id); // export async function loadEyeColor(id: string): Promise<EyeColor | undefined> {
} // return getItemById<EyeColor>('EyeColors.json', id);
// }
// FocusRule loader //
export async function loadFocusRule(id: string): Promise<FocusRule | undefined> { // // FocusRule loader
return getItemById<FocusRule>('FocusRules.json', id); // export async function loadFocusRule(id: string): Promise<FocusRule | undefined> {
} // return getItemById<FocusRule>('FocusRules.json', id);
// }
// GeodeRitual loader //
export async function loadGeodeRitual(id: string): Promise<GeodeRitual | undefined> { // // GeodeRitual loader
return getItemById<GeodeRitual>('GeodeRituals.json', id); // export async function loadGeodeRitual(id: string): Promise<GeodeRitual | undefined> {
} // return getItemById<GeodeRitual>('GeodeRituals.json', id);
// }
// HairColor loader //
export async function loadHairColor(id: string): Promise<HairColor | undefined> { // // HairColor loader
return getItemById<HairColor>('HairColors.json', id); // export async function loadHairColor(id: string): Promise<HairColor | undefined> {
} // return getItemById<HairColor>('HairColors.json', id);
// }
// LiturgicalChantEnhancement loader //
export async function loadLiturgicalChantEnhancement(id: string): Promise<LiturgicalChantEnhancement | undefined> { // // LiturgicalChantEnhancement loader
return getItemById<LiturgicalChantEnhancement>('LiturgicalChantEnhancements.json', id); // export async function loadLiturgicalChantEnhancement(id: string): Promise<LiturgicalChantEnhancement | undefined> {
} // return getItemById<LiturgicalChantEnhancement>('LiturgicalChantEnhancements.json', id);
// }
// LiturgicalChantGroup loader //
export async function loadLiturgicalChantGroup(id: string): Promise<LiturgicalChantGroup | undefined> { // // LiturgicalChantGroup loader
return getItemById<LiturgicalChantGroup>('LiturgicalChantGroups.json', id); // export async function loadLiturgicalChantGroup(id: string): Promise<LiturgicalChantGroup | undefined> {
} // return getItemById<LiturgicalChantGroup>('LiturgicalChantGroups.json', id);
// }
// LiturgicalChant loader //
export async function loadLiturgicalChant(id: string): Promise<LiturgicalChant | undefined> { // // LiturgicalChant loader
return getItemById<LiturgicalChant>('LiturgicalChants.json', id); // export async function loadLiturgicalChant(id: string): Promise<LiturgicalChant | undefined> {
} // return getItemById<LiturgicalChant>('LiturgicalChants.json', id);
// }
// MagicalDance loader //
export async function loadMagicalDance(id: string): Promise<MagicalDance | undefined> { // // MagicalDance loader
return getItemById<MagicalDance>('MagicalDances.json', id); // export async function loadMagicalDance(id: string): Promise<MagicalDance | undefined> {
} // return getItemById<MagicalDance>('MagicalDances.json', id);
// }
// MagicalMelodie loader //
export async function loadMagicalMelodie(id: string): Promise<MagicalMelodie | undefined> { // // MagicalMelodie loader
return getItemById<MagicalMelodie>('MagicalMelodies.json', id); // export async function loadMagicalMelodie(id: string): Promise<MagicalMelodie | undefined> {
} // return getItemById<MagicalMelodie>('MagicalMelodies.json', id);
// }
// MagicalTradition loader //
export async function loadMagicalTradition(id: string): Promise<MagicalTradition | undefined> { // // MagicalTradition loader
return getItemById<MagicalTradition>('MagicalTraditions.json', id); // export async function loadMagicalTradition(id: string): Promise<MagicalTradition | undefined> {
} // return getItemById<MagicalTradition>('MagicalTraditions.json', id);
// }
// OptionalRule loader //
export async function loadOptionalRule(id: string): Promise<OptionalRule | undefined> { // // OptionalRule loader
return getItemById<OptionalRule>('OptionalRules.json', id); // export async function loadOptionalRule(id: string): Promise<OptionalRule | undefined> {
} // return getItemById<OptionalRule>('OptionalRules.json', id);
// }
// Pact loader //
export async function loadPact(id: string): Promise<Pact | undefined> { // // Pact loader
return getItemById<Pact>('Pacts.json', id); // export async function loadPact(id: string): Promise<Pact | undefined> {
} // return getItemById<Pact>('Pacts.json', id);
// }
// PatronCategorie loader //
export async function loadPatronCategorie(id: string): Promise<PatronCategorie | undefined> { // // PatronCategorie loader
return getItemById<PatronCategorie>('PatronCategories.json', id); // export async function loadPatronCategorie(id: string): Promise<PatronCategorie | undefined> {
} // return getItemById<PatronCategorie>('PatronCategories.json', id);
// }
// Patron loader //
export async function loadPatron(id: string): Promise<Patron | undefined> { // // Patron loader
return getItemById<Patron>('Patrons.json', id); // export async function loadPatron(id: string): Promise<Patron | undefined> {
} // return getItemById<Patron>('Patrons.json', id);
// }
// ProfessionVariant loader //
export async function loadProfessionVariant(id: string): Promise<ProfessionVariant | undefined> { // // ProfessionVariant loader
return getItemById<ProfessionVariant>('ProfessionVariants.json', id); // export async function loadProfessionVariant(id: string): Promise<ProfessionVariant | undefined> {
} // return getItemById<ProfessionVariant>('ProfessionVariants.json', id);
// }
// Propertie loader //
export async function loadPropertie(id: string): Promise<Propertie | undefined> { // // Propertie loader
return getItemById<Propertie>('Properties.json', id); // export async function loadPropertie(id: string): Promise<Propertie | undefined> {
} // return getItemById<Propertie>('Properties.json', id);
// }
// RaceVariant loader //
export async function loadRaceVariant(id: string): Promise<RaceVariant | undefined> { // // RaceVariant loader
return getItemById<RaceVariant>('RaceVariants.json', id); // export async function loadRaceVariant(id: string): Promise<RaceVariant | undefined> {
} // return getItemById<RaceVariant>('RaceVariants.json', id);
// }
// Reache loader //
export async function loadReache(id: string): Promise<Reache | undefined> { // // Reache loader
return getItemById<Reache>('Reaches.json', id); // export async function loadReache(id: string): Promise<Reache | undefined> {
} // return getItemById<Reache>('Reaches.json', id);
// }
// RogueSpell loader //
export async function loadRogueSpell(id: string): Promise<RogueSpell | undefined> { // // RogueSpell loader
return getItemById<RogueSpell>('RogueSpells.json', id); // export async function loadRogueSpell(id: string): Promise<RogueSpell | undefined> {
} // return getItemById<RogueSpell>('RogueSpells.json', id);
// }
// SkillGroup loader //
export async function loadSkillGroup(id: string): Promise<SkillGroup | undefined> { // // SkillGroup loader
return getItemById<SkillGroup>('SkillGroups.json', id); // export async function loadSkillGroup(id: string): Promise<SkillGroup | undefined> {
} // return getItemById<SkillGroup>('SkillGroups.json', id);
// }
//
// Skill loader // Skill loader
export async function loadSkill(id: string): Promise<Skill | undefined> { export async function loadSkill(id: string): Promise<Skill | undefined> {
return getItemById<Skill>('Skills.json', id); return getItemById<Skill>('Skills.json', id);
} }
//
// Interface for skill with value // Interface for skill with value
export interface SkillWithValue extends Skill { export interface SkillWithValue extends Skill {
value: number; value: number;
@@ -409,11 +412,11 @@ export interface SkillWithValue extends Skill {
// Load skill with value // Load skill with value
export async function loadSkillWithValue(id: string, value: number): Promise<SkillWithValue | undefined> { export async function loadSkillWithValue(id: string, value: number): Promise<SkillWithValue | undefined> {
const skill = await loadSkill(id); const skill = await loadSkill(id);
if (!skill) { if (!skill) {
return undefined; return undefined;
} }
return { return {
...skill, ...skill,
value value
@@ -423,59 +426,61 @@ export async function loadSkillWithValue(id: string, value: number): Promise<Ski
// Load multiple skills with values // Load multiple skills with values
export async function loadSkillsWithValues(talents: Skills): Promise<SkillWithValue[]> { export async function loadSkillsWithValues(talents: Skills): Promise<SkillWithValue[]> {
const skillIds = Object.keys(talents); const skillIds = Object.keys(talents);
const promises = skillIds.map(id => loadSkillWithValue(id, talents[id])); // @ts-ignore
const promises = skillIds.map((id) => loadSkillWithValue(id, talents[id]));
const skills = await Promise.all(promises); const skills = await Promise.all(promises);
// Filter out undefined values // Filter out undefined values
return skills.filter((skill): skill is SkillWithValue => skill !== undefined); return skills.filter((skill): skill is SkillWithValue => skill !== undefined);
} }
// SocialStatuse loader //
export async function loadSocialStatuse(id: string): Promise<SocialStatuse | undefined> { // // SocialStatuse loader
return getItemById<SocialStatuse>('SocialStatuses.json', id); // export async function loadSocialStatuse(id: string): Promise<SocialStatuse | undefined> {
} // return getItemById<SocialStatuse>('SocialStatuses.json', id);
// }
// SpecialAbilitie loader //
export async function loadSpecialAbilitie(id: string): Promise<SpecialAbilitie | undefined> { // // SpecialAbilitie loader
return getItemById<SpecialAbilitie>('SpecialAbilities.json', id); // export async function loadSpecialAbilitie(id: string): Promise<SpecialAbilitie | undefined> {
} // return getItemById<SpecialAbilitie>('SpecialAbilities.json', id);
// }
// SpecialAbilityGroup loader //
export async function loadSpecialAbilityGroup(id: string): Promise<SpecialAbilityGroup | undefined> { // // SpecialAbilityGroup loader
return getItemById<SpecialAbilityGroup>('SpecialAbilityGroups.json', id); // export async function loadSpecialAbilityGroup(id: string): Promise<SpecialAbilityGroup | undefined> {
} // return getItemById<SpecialAbilityGroup>('SpecialAbilityGroups.json', id);
// }
// SpellEnhancement loader //
export async function loadSpellEnhancement(id: string): Promise<SpellEnhancement | undefined> { // // SpellEnhancement loader
return getItemById<SpellEnhancement>('SpellEnhancements.json', id); // export async function loadSpellEnhancement(id: string): Promise<SpellEnhancement | undefined> {
} // return getItemById<SpellEnhancement>('SpellEnhancements.json', id);
// }
// SpellGroup loader //
export async function loadSpellGroup(id: string): Promise<SpellGroup | undefined> { // // SpellGroup loader
return getItemById<SpellGroup>('SpellGroups.json', id); // export async function loadSpellGroup(id: string): Promise<SpellGroup | undefined> {
} // return getItemById<SpellGroup>('SpellGroups.json', id);
// }
// Spell loader //
export async function loadSpell(id: string): Promise<Spell | undefined> { // // Spell loader
return getItemById<Spell>('Spells.json', id); // export async function loadSpell(id: string): Promise<Spell | undefined> {
} // return getItemById<Spell>('Spells.json', id);
// }
// State loader //
export async function loadState(id: string): Promise<State | undefined> { // // State loader
return getItemById<State>('States.json', id); // export async function loadState(id: string): Promise<State | undefined> {
} // return getItemById<State>('States.json', id);
// }
// Subject loader //
export async function loadSubject(id: string): Promise<Subject | undefined> { // // Subject loader
return getItemById<Subject>('Subjects.json', id); // export async function loadSubject(id: string): Promise<Subject | undefined> {
} // return getItemById<Subject>('Subjects.json', id);
// }
// Tribe loader //
export async function loadTribe(id: string): Promise<Tribe | undefined> { // // Tribe loader
return getItemById<Tribe>('Tribes.json', id); // export async function loadTribe(id: string): Promise<Tribe | undefined> {
} // return getItemById<Tribe>('Tribes.json', id);
// }
// ZibiljaRitual loader //
export async function loadZibiljaRitual(id: string): Promise<ZibiljaRitual | undefined> { // // ZibiljaRitual loader
return getItemById<ZibiljaRitual>('ZibiljaRituals.json', id); // export async function loadZibiljaRitual(id: string): Promise<ZibiljaRitual | undefined> {
} // return getItemById<ZibiljaRitual>('ZibiljaRituals.json', id);
// }