Merge branch 'master' into 066-switch-to-foundry-vtt-types
This commit is contained in:
commit
0a911cf196
25 changed files with 460 additions and 441 deletions
|
@ -9,205 +9,310 @@ export const DS4 = {
|
|||
=============================================================================================`,
|
||||
|
||||
/**
|
||||
* Define the set of acttack types that can be performed with weapon items
|
||||
* A dictionary of dictionaries each mapping keys to localized strings
|
||||
* resp. their localization keys.
|
||||
* The localization is assumed to take place on each reload.
|
||||
*/
|
||||
attackTypes: {
|
||||
melee: "DS4.AttackTypeMelee",
|
||||
ranged: "DS4.AttackTypeRanged",
|
||||
meleeRanged: "DS4.AttackTypeMeleeRanged",
|
||||
i18n: {
|
||||
/**
|
||||
* Define the set of acttack types that can be performed with weapon items
|
||||
*/
|
||||
attackTypes: {
|
||||
melee: "DS4.AttackTypeMelee",
|
||||
ranged: "DS4.AttackTypeRanged",
|
||||
meleeRanged: "DS4.AttackTypeMeleeRanged",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of item availabilties
|
||||
*/
|
||||
itemAvailabilities: {
|
||||
unset: "DS4.ItemAvailabilityUnset",
|
||||
hamlet: "DS4.ItemAvailabilityHamlet",
|
||||
village: "DS4.ItemAvailabilityVilage",
|
||||
city: "DS4.ItemAvailabilityCity",
|
||||
elves: "DS4.ItemAvailabilityElves",
|
||||
dwarves: "DS4.ItemAvailabilityDwarves",
|
||||
nowhere: "DS4.ItemAvailabilityNowhere",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of item types
|
||||
*/
|
||||
itemTypes: {
|
||||
weapon: "DS4.ItemTypeWeapon",
|
||||
armor: "DS4.ItemTypeArmor",
|
||||
shield: "DS4.ItemTypeShield",
|
||||
spell: "DS4.ItemTypeSpell",
|
||||
trinket: "DS4.ItemTypeTrinket",
|
||||
equipment: "DS4.ItemTypeEquipment",
|
||||
talent: "DS4.ItemTypeTalent",
|
||||
racialAbility: "DS4.ItemTypeRacialAbility",
|
||||
language: "DS4.ItemTypeLanguage",
|
||||
alphabet: "DS4.ItemTypeAlphabet",
|
||||
specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of armor types, a character may only wear one item of each at any given time
|
||||
*/
|
||||
armorTypes: {
|
||||
body: "DS4.ArmorTypeBody",
|
||||
helmet: "DS4.ArmorTypeHelmet",
|
||||
vambrace: "DS4.ArmorTypeVambrace",
|
||||
greaves: "DS4.ArmorTypeGreaves",
|
||||
vambraceGreaves: "DS4.ArmorTypeVambraceGreaves",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define abbreviations for the armor types
|
||||
*/
|
||||
armorTypesAbbr: {
|
||||
body: "DS4.ArmorTypeBodyAbbr",
|
||||
helmet: "DS4.ArmorTypeHelmetAbbr",
|
||||
vambrace: "DS4.ArmorTypeVambraceAbbr",
|
||||
greaves: "DS4.ArmorTypeGreavesAbbr",
|
||||
vambraceGreaves: "DS4.ArmorTypeVambraceGreavesAbbr",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of armor materials, used to determine if a characer may wear the armor without additional penalties
|
||||
*/
|
||||
armorMaterialTypes: {
|
||||
cloth: "DS4.ArmorMaterialTypeCloth",
|
||||
leather: "DS4.ArmorMaterialTypeLeather",
|
||||
chain: "DS4.ArmorMaterialTypeChain",
|
||||
plate: "DS4.ArmorMaterialTypePlate",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the abbreviations of armor materials
|
||||
*/
|
||||
armorMaterialTypesAbbr: {
|
||||
cloth: "DS4.ArmorMaterialTypeClothAbbr",
|
||||
leather: "DS4.ArmorMaterialTypeLeatherAbbr",
|
||||
chain: "DS4.ArmorMaterialTypeChainAbbr",
|
||||
plate: "DS4.ArmorMaterialTypePlateAbbr",
|
||||
},
|
||||
|
||||
spellTypes: {
|
||||
spellcasting: "DS4.SpellTypeSpellcasting",
|
||||
targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting",
|
||||
},
|
||||
|
||||
spellCategories: {
|
||||
healing: "DS4.SpellCategoryHealing",
|
||||
fire: "DS4.SpellCategoryFire",
|
||||
ice: "DS4.SpellCategoryIce",
|
||||
light: "DS4.SpellCategoryLight",
|
||||
darkness: "DS4.SpellCategoryDarkness",
|
||||
mindAffecting: "DS4.SpellCategoryMindAffecting",
|
||||
electricity: "DS4.SpellCategoryElectricity",
|
||||
none: "DS4.SpellCategoryNone",
|
||||
unset: "DS4.SpellCategoryUnset",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of actor types
|
||||
*/
|
||||
actorTypes: {
|
||||
character: "DS4.ActorTypeCharacter",
|
||||
creature: "DS4.ActorTypeCreature",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of attributes an actor has
|
||||
*/
|
||||
attributes: {
|
||||
body: "DS4.AttributeBody",
|
||||
mobility: "DS4.AttributeMobility",
|
||||
mind: "DS4.AttributeMind",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of traits an actor has
|
||||
*/
|
||||
traits: {
|
||||
strength: "DS4.TraitStrength",
|
||||
agility: "DS4.TraitAgility",
|
||||
intellect: "DS4.TraitIntellect",
|
||||
constitution: "DS4.TraitConstitution",
|
||||
dexterity: "DS4.TraitDexterity",
|
||||
aura: "DS4.TraitAura",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of combat values an actor has
|
||||
*/
|
||||
combatValues: {
|
||||
hitPoints: "DS4.CombatValuesHitPoints",
|
||||
defense: "DS4.CombatValuesDefense",
|
||||
initiative: "DS4.CombatValuesInitiative",
|
||||
movement: "DS4.CombatValuesMovement",
|
||||
meleeAttack: "DS4.CombatValuesMeleeAttack",
|
||||
rangedAttack: "DS4.CombatValuesRangedAttack",
|
||||
spellcasting: "DS4.CombatValuesSpellcasting",
|
||||
targetedSpellcasting: "DS4.CombatValuesTargetedSpellcasting",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the base info of a character
|
||||
*/
|
||||
characterBaseInfo: {
|
||||
race: "DS4.CharacterBaseInfoRace",
|
||||
class: "DS4.CharacterBaseInfoClass",
|
||||
heroClass: "DS4.CharacterBaseInfoHeroClass",
|
||||
culture: "DS4.CharacterBaseInfoCulture",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the progression info of a character
|
||||
*/
|
||||
characterProgression: {
|
||||
level: "DS4.CharacterProgressionLevel",
|
||||
experiencePoints: "DS4.CharacterProgressionExperiencePoints",
|
||||
talentPoints: "DS4.CharacterProgressionTalentPoints",
|
||||
progressPoints: "DS4.CharacterProgressionProgressPoints",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the language info of a character
|
||||
*/
|
||||
characterLanguage: {
|
||||
languages: "DS4.CharacterLanguageLanguages",
|
||||
alphabets: "DS4.CharacterLanguageAlphabets",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the profile info of a character
|
||||
*/
|
||||
characterProfile: {
|
||||
biography: "DS4.CharacterProfileBiography",
|
||||
gender: "DS4.CharacterProfileGender",
|
||||
birthday: "DS4.CharacterProfileBirthday",
|
||||
birthplace: "DS4.CharacterProfileBirthplace",
|
||||
age: "DS4.CharacterProfileAge",
|
||||
height: "DS4.CharacterProfileHeight",
|
||||
hairColor: "DS4.CharacterProfileHairColor",
|
||||
weight: "DS4.CharacterProfileWeight",
|
||||
eyeColor: "DS4.CharacterProfileEyeColor",
|
||||
specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics",
|
||||
},
|
||||
/**
|
||||
* Define currency elements of a character
|
||||
*/
|
||||
characterCurrency: {
|
||||
gold: "DS4.CharacterCurrencyGold",
|
||||
silver: "DS4.CharacterCurrencySilver",
|
||||
copper: "DS4.CharacterCurrencyCopper",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the different creature types a creature can be
|
||||
*/
|
||||
creatureTypes: {
|
||||
animal: "DS4.CreatureTypeAnimal",
|
||||
construct: "DS4.CreatureTypeConstruct",
|
||||
humanoid: "DS4.CreatureTypeHumanoid",
|
||||
magicalEntity: "DS4.CreatureTypeMagicalEntity",
|
||||
plantBeing: "DS4.CreatureTypePlantBeing",
|
||||
undead: "DS4.CreatureTypeUndead",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the different size categories creatures fall into
|
||||
*/
|
||||
creatureSizeCategories: {
|
||||
tiny: "DS4.CreatureSizeCategoryTiny",
|
||||
small: "DS4.CreatureSizeCategorySmall",
|
||||
normal: "DS4.CreatureSizeCategoryNormal",
|
||||
large: "DS4.CreatureSizeCategoryLarge",
|
||||
huge: "DS4.CreatureSizeCategoryHuge",
|
||||
colossal: "DS4.CreatureSizeCategoryColossal",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the base info of a creature
|
||||
*/
|
||||
creatureBaseInfo: {
|
||||
loot: "DS4.CreatureBaseInfoLoot",
|
||||
foeFactor: "DS4.CreatureBaseInfoFoeFactor",
|
||||
creatureType: "DS4.CreatureBaseInfoCreatureType",
|
||||
sizeCategory: "DS4.CreatureBaseInfoSizeCategory",
|
||||
experiencePoints: "DS4.CreatureBaseInfoExperiencePoints",
|
||||
description: "DS4.CreatureBaseInfoDescription",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define translations for available distance units
|
||||
*/
|
||||
distanceUnits: {
|
||||
meter: "DS4.UnitMeters",
|
||||
kilometer: "DS4.UnitKilometers",
|
||||
custom: "DS4.UnitCustom",
|
||||
},
|
||||
/**
|
||||
* Define abbreviations for available distance units
|
||||
*/
|
||||
distanceUnitsAbbr: {
|
||||
meter: "DS4.UnitMetersAbbr",
|
||||
kilometer: "DS4.UnitKilometersAbbr",
|
||||
custom: "DS4.UnitCustomAbbr",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define translations for available distance units
|
||||
*/
|
||||
temporalUnits: {
|
||||
rounds: "DS4.UnitRounds",
|
||||
minutes: "DS4.UnitMinutes",
|
||||
hours: "DS4.UnitHours",
|
||||
days: "DS4.UnitDays",
|
||||
custom: "DS4.UnitCustom",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define abbreviations for available units
|
||||
*/
|
||||
temporalUnitsAbbr: {
|
||||
rounds: "DS4.UnitRoundsAbbr",
|
||||
minutes: "DS4.UnitMinutesAbbr",
|
||||
hours: "DS4.UnitHoursAbbr",
|
||||
days: "DS4.UnitDaysAbbr",
|
||||
custom: "DS4.UnitCustomAbbr",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define localization strings for Chat Visibility
|
||||
*/
|
||||
chatVisibilities: {
|
||||
roll: "DS4.ChatVisibilityRoll",
|
||||
gmroll: "DS4.ChatVisibilityGmRoll",
|
||||
blindroll: "DS4.ChatVisibilityBlindRoll",
|
||||
selfroll: "DS4.ChatVisibilitySelfRoll",
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the file paths to icon images
|
||||
* A dictionary of dictionaries mapping keys to icon file paths.
|
||||
*/
|
||||
attackTypesIcons: {
|
||||
melee: "systems/ds4/assets/icons/official/combat-values/melee-attack.png",
|
||||
meleeRanged: "systems/ds4/assets/icons/official/combat-values/melee-ranged-attack.png",
|
||||
ranged: "systems/ds4/assets/icons/official/combat-values/ranged-attack.png",
|
||||
},
|
||||
icons: {
|
||||
/**
|
||||
* Define the file paths to icon images
|
||||
*/
|
||||
attackTypes: {
|
||||
melee: "systems/ds4/assets/icons/official/combat-values/melee-attack.png",
|
||||
meleeRanged: "systems/ds4/assets/icons/official/combat-values/melee-ranged-attack.png",
|
||||
ranged: "systems/ds4/assets/icons/official/combat-values/ranged-attack.png",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the file paths to icon images
|
||||
*/
|
||||
spellTypesIcons: {
|
||||
spellcasting: "systems/ds4/assets/icons/official/combat-values/spellcasting.png",
|
||||
targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of item availabilties
|
||||
*/
|
||||
itemAvailabilities: {
|
||||
unset: "DS4.ItemAvailabilityUnset",
|
||||
hamlet: "DS4.ItemAvailabilityHamlet",
|
||||
village: "DS4.ItemAvailabilityVilage",
|
||||
city: "DS4.ItemAvailabilityCity",
|
||||
elves: "DS4.ItemAvailabilityElves",
|
||||
dwarves: "DS4.ItemAvailabilityDwarves",
|
||||
nowhere: "DS4.ItemAvailabilityNowhere",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of item types
|
||||
*/
|
||||
itemTypes: {
|
||||
weapon: "DS4.ItemTypeWeapon",
|
||||
armor: "DS4.ItemTypeArmor",
|
||||
shield: "DS4.ItemTypeShield",
|
||||
spell: "DS4.ItemTypeSpell",
|
||||
trinket: "DS4.ItemTypeTrinket",
|
||||
equipment: "DS4.ItemTypeEquipment",
|
||||
talent: "DS4.ItemTypeTalent",
|
||||
racialAbility: "DS4.ItemTypeRacialAbility",
|
||||
language: "DS4.ItemTypeLanguage",
|
||||
alphabet: "DS4.ItemTypeAlphabet",
|
||||
specialCreatureAbility: "DS4.ItemTypeSpecialCreatureAbility",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of armor types, a character may only wear one item of each at any given time
|
||||
*/
|
||||
armorTypes: {
|
||||
body: "DS4.ArmorTypeBody",
|
||||
helmet: "DS4.ArmorTypeHelmet",
|
||||
vambrace: "DS4.ArmorTypeVambrace",
|
||||
greaves: "DS4.ArmorTypeGreaves",
|
||||
vambraceGreaves: "DS4.ArmorTypeVambraceGreaves",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define abbreviations for the armor types
|
||||
*/
|
||||
armorTypesAbbr: {
|
||||
body: "DS4.ArmorTypeBodyAbbr",
|
||||
helmet: "DS4.ArmorTypeHelmetAbbr",
|
||||
vambrace: "DS4.ArmorTypeVambraceAbbr",
|
||||
greaves: "DS4.ArmorTypeGreavesAbbr",
|
||||
vambraceGreaves: "DS4.ArmorTypeVambraceGreavesAbbr",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of armor materials, used to determine if a characer may wear the armor without additional penalties
|
||||
*/
|
||||
armorMaterialTypes: {
|
||||
cloth: "DS4.ArmorMaterialTypeCloth",
|
||||
leather: "DS4.ArmorMaterialTypeLeather",
|
||||
chain: "DS4.ArmorMaterialTypeChain",
|
||||
plate: "DS4.ArmorMaterialTypePlate",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the abbreviations of armor materials
|
||||
*/
|
||||
armorMaterialTypesAbbr: {
|
||||
cloth: "DS4.ArmorMaterialTypeClothAbbr",
|
||||
leather: "DS4.ArmorMaterialTypeLeatherAbbr",
|
||||
chain: "DS4.ArmorMaterialTypeChainAbbr",
|
||||
plate: "DS4.ArmorMaterialTypePlateAbbr",
|
||||
},
|
||||
|
||||
spellTypes: {
|
||||
spellcasting: "DS4.SpellTypeSpellcasting",
|
||||
targetedSpellcasting: "DS4.SpellTypeTargetedSpellcasting",
|
||||
},
|
||||
|
||||
spellCategories: {
|
||||
healing: "DS4.SpellCategoryHealing",
|
||||
fire: "DS4.SpellCategoryFire",
|
||||
ice: "DS4.SpellCategoryIce",
|
||||
light: "DS4.SpellCategoryLight",
|
||||
darkness: "DS4.SpellCategoryDarkness",
|
||||
mindAffecting: "DS4.SpellCategoryMindAffecting",
|
||||
electricity: "DS4.SpellCategoryElectricity",
|
||||
none: "DS4.SpellCategoryNone",
|
||||
unset: "DS4.SpellCategoryUnset",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of actor types
|
||||
*/
|
||||
actorTypes: {
|
||||
character: "DS4.ActorTypeCharacter",
|
||||
creature: "DS4.ActorTypeCreature",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of attributes an actor has
|
||||
*/
|
||||
attributes: {
|
||||
body: "DS4.AttributeBody",
|
||||
mobility: "DS4.AttributeMobility",
|
||||
mind: "DS4.AttributeMind",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of traits an actor has
|
||||
*/
|
||||
traits: {
|
||||
strength: "DS4.TraitStrength",
|
||||
agility: "DS4.TraitAgility",
|
||||
intellect: "DS4.TraitIntellect",
|
||||
constitution: "DS4.TraitConstitution",
|
||||
dexterity: "DS4.TraitDexterity",
|
||||
aura: "DS4.TraitAura",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the set of combat values an actor has
|
||||
*/
|
||||
combatValues: {
|
||||
hitPoints: "DS4.CombatValuesHitPoints",
|
||||
defense: "DS4.CombatValuesDefense",
|
||||
initiative: "DS4.CombatValuesInitiative",
|
||||
movement: "DS4.CombatValuesMovement",
|
||||
meleeAttack: "DS4.CombatValuesMeleeAttack",
|
||||
rangedAttack: "DS4.CombatValuesRangedAttack",
|
||||
spellcasting: "DS4.CombatValuesSpellcasting",
|
||||
targetedSpellcasting: "DS4.CombatValuesTargetedSpellcasting",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the base info of a character
|
||||
*/
|
||||
characterBaseInfo: {
|
||||
race: "DS4.CharacterBaseInfoRace",
|
||||
class: "DS4.CharacterBaseInfoClass",
|
||||
heroClass: "DS4.CharacterBaseInfoHeroClass",
|
||||
culture: "DS4.CharacterBaseInfoCulture",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the progression info of a character
|
||||
*/
|
||||
characterProgression: {
|
||||
level: "DS4.CharacterProgressionLevel",
|
||||
experiencePoints: "DS4.CharacterProgressionExperiencePoints",
|
||||
talentPoints: "DS4.CharacterProgressionTalentPoints",
|
||||
progressPoints: "DS4.CharacterProgressionProgressPoints",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the language info of a character
|
||||
*/
|
||||
characterLanguage: {
|
||||
languages: "DS4.CharacterLanguageLanguages",
|
||||
alphabets: "DS4.CharacterLanguageAlphabets",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the profile info of a character
|
||||
*/
|
||||
characterProfile: {
|
||||
biography: "DS4.CharacterProfileBiography",
|
||||
gender: "DS4.CharacterProfileGender",
|
||||
birthday: "DS4.CharacterProfileBirthday",
|
||||
birthplace: "DS4.CharacterProfileBirthplace",
|
||||
age: "DS4.CharacterProfileAge",
|
||||
height: "DS4.CharacterProfileHeight",
|
||||
hairColor: "DS4.CharacterProfileHairColor",
|
||||
weight: "DS4.CharacterProfileWeight",
|
||||
eyeColor: "DS4.CharacterProfileEyeColor",
|
||||
specialCharacteristics: "DS4.CharacterProfileSpecialCharacteristics",
|
||||
/**
|
||||
* Define the file paths to icon images
|
||||
*/
|
||||
spellTypes: {
|
||||
spellcasting: "systems/ds4/assets/icons/official/combat-values/spellcasting.png",
|
||||
targetedSpellcasting: "systems/ds4/assets/icons/official/combat-values/targeted-spellcasting.png",
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -225,98 +330,4 @@ export const DS4 = {
|
|||
eyeColor: "String",
|
||||
specialCharacteristics: "String",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define currency elements of a character
|
||||
*/
|
||||
characterCurrency: {
|
||||
gold: "DS4.CharacterCurrencyGold",
|
||||
silver: "DS4.CharacterCurrencySilver",
|
||||
copper: "DS4.CharacterCurrencyCopper",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the different creature types a creature can be
|
||||
*/
|
||||
creatureTypes: {
|
||||
animal: "DS4.CreatureTypeAnimal",
|
||||
construct: "DS4.CreatureTypeConstruct",
|
||||
humanoid: "DS4.CreatureTypeHumanoid",
|
||||
magicalEntity: "DS4.CreatureTypeMagicalEntity",
|
||||
plantBeing: "DS4.CreatureTypePlantBeing",
|
||||
undead: "DS4.CreatureTypeUndead",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the different size categories creatures fall into
|
||||
*/
|
||||
creatureSizeCategories: {
|
||||
tiny: "DS4.CreatureSizeCategoryTiny",
|
||||
small: "DS4.CreatureSizeCategorySmall",
|
||||
normal: "DS4.CreatureSizeCategoryNormal",
|
||||
large: "DS4.CreatureSizeCategoryLarge",
|
||||
huge: "DS4.CreatureSizeCategoryHuge",
|
||||
colossal: "DS4.CreatureSizeCategoryColossal",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define the base info of a creature
|
||||
*/
|
||||
creatureBaseInfo: {
|
||||
loot: "DS4.CreatureBaseInfoLoot",
|
||||
foeFactor: "DS4.CreatureBaseInfoFoeFactor",
|
||||
creatureType: "DS4.CreatureBaseInfoCreatureType",
|
||||
sizeCategory: "DS4.CreatureBaseInfoSizeCategory",
|
||||
experiencePoints: "DS4.CreatureBaseInfoExperiencePoints",
|
||||
description: "DS4.CreatureBaseInfoDescription",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define translations for available distance units
|
||||
*/
|
||||
distanceUnits: {
|
||||
meter: "DS4.UnitMeters",
|
||||
kilometer: "DS4.UnitKilometers",
|
||||
custom: "DS4.UnitCustom",
|
||||
},
|
||||
/**
|
||||
* Define abbreviations for available distance units
|
||||
*/
|
||||
distanceUnitsAbbr: {
|
||||
meter: "DS4.UnitMetersAbbr",
|
||||
kilometer: "DS4.UnitKilometersAbbr",
|
||||
custom: "DS4.UnitCustomAbbr",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define translations for available distance units
|
||||
*/
|
||||
temporalUnits: {
|
||||
rounds: "DS4.UnitRounds",
|
||||
minutes: "DS4.UnitMinutes",
|
||||
hours: "DS4.UnitHours",
|
||||
days: "DS4.UnitDays",
|
||||
custom: "DS4.UnitCustom",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define abbreviations for available units
|
||||
*/
|
||||
temporalUnitsAbbr: {
|
||||
rounds: "DS4.UnitRoundsAbbr",
|
||||
minutes: "DS4.UnitMinutesAbbr",
|
||||
hours: "DS4.UnitHoursAbbr",
|
||||
days: "DS4.UnitDaysAbbr",
|
||||
custom: "DS4.UnitCustomAbbr",
|
||||
},
|
||||
|
||||
/**
|
||||
* Define localization strings for Chat Visibility
|
||||
*/
|
||||
chatVisibilities: {
|
||||
roll: "DS4.ChatVisibilityRoll",
|
||||
gmroll: "DS4.ChatVisibilityGmRoll",
|
||||
blindroll: "DS4.ChatVisibilityBlindRoll",
|
||||
selfroll: "DS4.ChatVisibilitySelfRoll",
|
||||
},
|
||||
};
|
||||
|
|
|
@ -29,8 +29,8 @@ Hooks.once("init", async function () {
|
|||
CONFIG.Item.entityClass = DS4Item as typeof Item;
|
||||
|
||||
// Define localized type labels
|
||||
CONFIG.Actor.typeLabels = DS4.actorTypes;
|
||||
CONFIG.Item.typeLabels = DS4.itemTypes;
|
||||
CONFIG.Actor.typeLabels = DS4.i18n.actorTypes;
|
||||
CONFIG.Item.typeLabels = DS4.i18n.itemTypes;
|
||||
|
||||
// Configure Dice
|
||||
CONFIG.Dice.types = [Die, DS4Check];
|
||||
|
@ -84,46 +84,16 @@ async function registerHandlebarsPartials() {
|
|||
* This function runs after game data has been requested and loaded from the servers, so entities exist
|
||||
*/
|
||||
Hooks.once("setup", function () {
|
||||
// Localize CONFIG objects once up-front
|
||||
const toLocalize = [
|
||||
"attackTypes",
|
||||
"itemAvailabilities",
|
||||
"itemTypes",
|
||||
"armorTypes",
|
||||
"armorTypesAbbr",
|
||||
"armorMaterialTypes",
|
||||
"armorMaterialTypesAbbr",
|
||||
"armorMaterialTypes",
|
||||
"spellTypes",
|
||||
"spellCategories",
|
||||
"attributes",
|
||||
"traits",
|
||||
"combatValues",
|
||||
"characterBaseInfo",
|
||||
"characterProgression",
|
||||
"characterLanguage",
|
||||
"characterProfile",
|
||||
"characterCurrency",
|
||||
"creatureTypes",
|
||||
"creatureSizeCategories",
|
||||
"creatureBaseInfo",
|
||||
"temporalUnits",
|
||||
"temporalUnitsAbbr",
|
||||
"distanceUnits",
|
||||
"distanceUnitsAbbr",
|
||||
"chatVisibilities",
|
||||
];
|
||||
|
||||
// Exclude some from sorting where the default order matters
|
||||
const noSort = ["attributes", "traits", "combatValues", "creatureSizeCategories"];
|
||||
|
||||
// Localize and sort CONFIG objects
|
||||
for (const o of toLocalize) {
|
||||
const localized = Object.entries(CONFIG.DS4[o]).map((e) => {
|
||||
for (const o of Object.keys(CONFIG.DS4.i18n)) {
|
||||
const localized = Object.entries(CONFIG.DS4.i18n[o]).map((e) => {
|
||||
return [e[0], game.i18n.localize(e[1] as string)];
|
||||
});
|
||||
if (!noSort.includes(o)) localized.sort((a, b) => a[1].localeCompare(b[1]));
|
||||
CONFIG.DS4[o] = localized.reduce((obj, e) => {
|
||||
CONFIG.DS4.i18n[o] = localized.reduce((obj, e) => {
|
||||
obj[e[0]] = e[1];
|
||||
return obj;
|
||||
}, {});
|
||||
|
@ -133,3 +103,21 @@ Hooks.once("setup", function () {
|
|||
Hooks.once("ready", function () {
|
||||
migration.migrate();
|
||||
});
|
||||
|
||||
/**
|
||||
* Select the text of input elements in given sheets via onfocus listener.
|
||||
* The hook names are of the form "render"+sheet_superclassname and are called within
|
||||
* the render() method of the foundry Application class.
|
||||
* Note: The render hooks of all classes in the class hierarchy are called,
|
||||
* so e.g. for a Dialog, both "renderDialog" and "renderApplication" are called
|
||||
* (in this order).
|
||||
*/
|
||||
["renderApplication", "renderActorSheet", "renderItemSheet"].forEach((hookName: string) => {
|
||||
Hooks.on(hookName, (app: Dialog, html: JQueryStatic, data: any) => {
|
||||
$(html)
|
||||
.find("input")
|
||||
.on("focus", (ev: JQuery.FocusEvent<HTMLInputElement>) => {
|
||||
ev.currentTarget.select();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ModifiableData } from "../common/common-data";
|
||||
import { DS4 } from "../config";
|
||||
|
||||
export type ItemType = keyof typeof DS4.itemTypes;
|
||||
export type ItemType = keyof typeof DS4.i18n.itemTypes;
|
||||
|
||||
export type DS4ItemData = Item.Data<DS4ItemDataType>;
|
||||
|
||||
|
|
|
@ -4,10 +4,10 @@ import { DS4 } from "../config";
|
|||
* Provides default values for all arguments the `CheckFactory` expects.
|
||||
*/
|
||||
class DefaultCheckOptions implements DS4CheckFactoryOptions {
|
||||
maxCritSuccess = 1;
|
||||
minCritFailure = 20;
|
||||
useSlayingDice = false;
|
||||
rollMode: DS4RollMode = "roll";
|
||||
readonly maxCritSuccess = 1;
|
||||
readonly minCritFailure = 20;
|
||||
readonly useSlayingDice = false;
|
||||
readonly rollMode: DS4RollMode = "roll";
|
||||
|
||||
mergeWith(other: Partial<DS4CheckFactoryOptions>): DS4CheckFactoryOptions {
|
||||
return { ...this, ...other } as DS4CheckFactoryOptions;
|
||||
|
@ -28,7 +28,7 @@ class CheckFactory {
|
|||
private gmModifier: number,
|
||||
passedOptions: Partial<DS4CheckFactoryOptions> = {},
|
||||
) {
|
||||
this.checkOptions = new DefaultCheckOptions().mergeWith(passedOptions);
|
||||
this.checkOptions = defaultCheckOptions.mergeWith(passedOptions);
|
||||
}
|
||||
|
||||
private checkOptions: DS4CheckFactoryOptions;
|
||||
|
@ -45,7 +45,6 @@ class CheckFactory {
|
|||
const roll = new rollCls(formula);
|
||||
|
||||
const rollModeTemplate = this.checkOptions.rollMode;
|
||||
console.log(rollModeTemplate);
|
||||
return roll.toMessage({}, { rollMode: rollModeTemplate, create: true });
|
||||
}
|
||||
|
||||
|
@ -76,8 +75,8 @@ class CheckFactory {
|
|||
|
||||
/**
|
||||
* Asks the user for all unknown/necessary information and passes them on to perform a roll.
|
||||
* @param targetValue {number} The Check Target Number ("CTN")
|
||||
* @param options {Partial<DS4CheckFactoryOptions>} Options changing the behaviour of the roll and message.
|
||||
* @param targetValue The Check Target Number ("CTN")
|
||||
* @param options Options changing the behaviour of the roll and message.
|
||||
*/
|
||||
export async function createCheckRoll(
|
||||
targetValue: number,
|
||||
|
@ -86,6 +85,8 @@ export async function createCheckRoll(
|
|||
// Ask for additional required data;
|
||||
const gmModifierData = await askGmModifier(targetValue, options);
|
||||
|
||||
const newTargetValue = gmModifierData.checkTargetValue ?? targetValue;
|
||||
const gmModifier = gmModifierData.gmModifier ?? 0;
|
||||
const newOptions: Partial<DS4CheckFactoryOptions> = {
|
||||
maxCritSuccess: gmModifierData.maxCritSuccess ?? options.maxCritSuccess ?? undefined,
|
||||
minCritFailure: gmModifierData.minCritFailure ?? options.minCritFailure ?? undefined,
|
||||
|
@ -94,7 +95,7 @@ export async function createCheckRoll(
|
|||
};
|
||||
|
||||
// Create Factory
|
||||
const cf = new CheckFactory(gmModifierData.checkTargetValue, gmModifierData.gmModifier, newOptions);
|
||||
const cf = new CheckFactory(newTargetValue, gmModifier, newOptions);
|
||||
|
||||
// Possibly additional processing
|
||||
|
||||
|
@ -108,13 +109,13 @@ export async function createCheckRoll(
|
|||
* @notes
|
||||
* At the moment, this asks for more data than it will do after some iterations.
|
||||
*
|
||||
* @returns {Promise<IntermediateGmModifierData>} The data given by the user.
|
||||
* @returns The data given by the user.
|
||||
*/
|
||||
async function askGmModifier(
|
||||
targetValue: number,
|
||||
options: Partial<DS4CheckFactoryOptions> = {},
|
||||
{ template, title }: { template?: string; title?: string } = {},
|
||||
): Promise<IntermediateGmModifierData> {
|
||||
): Promise<Partial<IntermediateGmModifierData>> {
|
||||
// Render model interface and return value
|
||||
const usedTemplate = template ?? "systems/ds4/templates/roll/roll-options.hbs";
|
||||
const usedTitle = title ?? game.i18n.localize("DS4.RollDialogDefaultTitle");
|
||||
|
@ -124,7 +125,7 @@ async function askGmModifier(
|
|||
checkTargetValue: targetValue,
|
||||
maxCritSuccess: options.maxCritSuccess ?? defaultCheckOptions.maxCritSuccess,
|
||||
minCritFailure: options.minCritFailure ?? defaultCheckOptions.minCritFailure,
|
||||
rollModes: rollModes,
|
||||
rollMode: options.rollMode,
|
||||
config: DS4,
|
||||
};
|
||||
const renderedHtml = await renderTemplate(usedTemplate, templateData);
|
||||
|
@ -164,22 +165,20 @@ async function askGmModifier(
|
|||
}).render(true);
|
||||
});
|
||||
const dialogForm = await dialogPromise;
|
||||
return parseDialogFormData(dialogForm, targetValue);
|
||||
return parseDialogFormData(dialogForm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts Dialog data from the returned DOM element.
|
||||
* @param formData {HTMLFormElement} The filed dialog
|
||||
* @param targetValue {number} The previously known target value (slated for removal once data automation is available)
|
||||
* @param formData The filed dialog
|
||||
*/
|
||||
function parseDialogFormData(formData: HTMLFormElement, targetValue: number): IntermediateGmModifierData {
|
||||
function parseDialogFormData(formData: HTMLFormElement): Partial<IntermediateGmModifierData> {
|
||||
return {
|
||||
checkTargetValue: parseInt(formData["ctv"]?.value) ?? targetValue,
|
||||
gmModifier: parseInt(formData["gmmod"]?.value) ?? 0,
|
||||
maxCritSuccess: parseInt(formData["maxcoup"]?.value) ?? defaultCheckOptions.maxCritSuccess,
|
||||
minCritFailure: parseInt(formData["minfumble"]?.value) ?? defaultCheckOptions.minCritFailure,
|
||||
useSlayingDice: false,
|
||||
rollMode: formData["visibility"]?.value ?? defaultCheckOptions.rollMode,
|
||||
checkTargetValue: parseInt(formData["ctv"]?.value),
|
||||
gmModifier: parseInt(formData["gmmod"]?.value),
|
||||
maxCritSuccess: parseInt(formData["maxcoup"]?.value),
|
||||
minCritFailure: parseInt(formData["minfumble"]?.value),
|
||||
rollMode: formData["visibility"]?.value,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue