import { ModifiableData, ModifiableDataBase, ResourceData, UsableResource } from "../common/common-data"; import { DS4 } from "../config"; import { DS4ItemData } from "../item/item-data"; export type DS4ActorData = DS4CharacterData | DS4CreatureData; type ActorType = keyof typeof DS4.i18n.actorTypes; export interface DS4ActorDataHelper extends Actor.Data { type: U; } type DS4CharacterData = DS4ActorDataHelper; type DS4CreatureData = DS4ActorDataHelper; // templates interface DS4ActorDataDataBase { attributes: DS4ActorDataDataAttributes; traits: DS4ActorDataDataTraits; combatValues: DS4ActorDataDataCombatValues; } type DS4ActorDataDataAttributes = { [Key in keyof typeof DS4.i18n.attributes]: ModifiableDataBase }; type Attribute = keyof DS4ActorDataDataAttributes; export function isAttribute(value: unknown): value is Attribute { return (Object.keys(DS4.i18n.attributes) as Array).includes(value); } type DS4ActorDataDataTraits = { [Key in keyof typeof DS4.i18n.traits]: ModifiableDataBase }; type Trait = keyof DS4ActorDataDataTraits; export function isTrait(value: unknown): value is Trait { return (Object.keys(DS4.i18n.traits) as Array).includes(value); } type DS4ActorDataDataCombatValues = { [Key in keyof typeof DS4.i18n.combatValues]: Key extends "hitPoints" ? ResourceData : ModifiableData; }; type CombatValue = keyof DS4ActorDataDataCombatValues; export function isCombatValue(value: string): value is CombatValue { return (Object.keys(DS4.i18n.combatValues) as Array).includes(value); } // types interface DS4CharacterDataData extends DS4ActorDataDataBase { baseInfo: DS4CharacterDataDataBaseInfo; progression: DS4CharacterDataDataProgression; language: DS4CharacterDataDataLanguage; profile: DS4CharacterDataDataProfile; currency: DS4CharacterDataDataCurrency; slayerPoints: DS4CharacterDataDataSlayerPoints; } export interface DS4CharacterDataDataBaseInfo { race: string; class: string; heroClass: string; culture: string; } export interface DS4CharacterDataDataProgression { level: number; experiencePoints: number; talentPoints: UsableResource; progressPoints: UsableResource; } export interface DS4CharacterDataDataLanguage { languages: string; alphabets: string; } export interface DS4CharacterDataDataProfile { biography: string; gender: string; birthday: string; birthplace: string; age: number; height: number; hairColor: string; weight: number; eyeColor: string; specialCharacteristics: string; } export interface DS4CharacterDataDataCurrency { gold: number; silver: number; copper: number; } export interface DS4CharacterDataDataSlayerPoints { value: number; } interface DS4CreatureDataData extends DS4ActorDataDataBase { baseInfo: DS4CreatureDataDataBaseInfo; } export interface DS4CreatureDataDataBaseInfo { loot: string; foeFactor: number; creatureType: CreatureType; sizeCategory: SizeCategory; experiencePoints: number; description: string; } type CreatureType = keyof typeof DS4.i18n.creatureTypes; type SizeCategory = keyof typeof DS4.i18n.creatureSizeCategories;