@optolith/entity-descriptions 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +65 -0
- package/lib/creator.d.ts +32 -0
- package/lib/creator.js +72 -0
- package/lib/entities/activatable.d.ts +52 -0
- package/lib/entities/activatable.js +609 -0
- package/lib/entities/alternativeRule.d.ts +7 -0
- package/lib/entities/alternativeRule.js +21 -0
- package/lib/entities/attribute.d.ts +6 -0
- package/lib/entities/attribute.js +15 -0
- package/lib/entities/combatTechnique.d.ts +5 -7
- package/lib/entities/combatTechnique.js +34 -24
- package/lib/entities/condition.d.ts +12 -0
- package/lib/entities/condition.js +63 -0
- package/lib/entities/culture.d.ts +8 -0
- package/lib/entities/culture.js +309 -0
- package/lib/entities/curriculum.d.ts +11 -0
- package/lib/entities/curriculum.js +266 -0
- package/lib/entities/derivedCharacteristic.d.ts +9 -0
- package/lib/entities/derivedCharacteristic.js +91 -0
- package/lib/entities/disease.d.ts +9 -0
- package/lib/entities/disease.js +88 -0
- package/lib/entities/elixir.d.ts +10 -0
- package/lib/entities/elixir.js +76 -0
- package/lib/entities/equipment.d.ts +24 -0
- package/lib/entities/equipment.js +613 -0
- package/lib/entities/equipmentPackage.d.ts +8 -0
- package/lib/entities/equipmentPackage.js +301 -0
- package/lib/entities/experienceLevel.d.ts +3 -2
- package/lib/entities/experienceLevel.js +33 -28
- package/lib/entities/focusRule.d.ts +3 -4
- package/lib/entities/focusRule.js +13 -5
- package/lib/entities/influence.d.ts +7 -0
- package/lib/entities/influence.js +35 -0
- package/lib/entities/liturgicalChant.d.ts +10 -23
- package/lib/entities/liturgicalChant.js +169 -131
- package/lib/entities/optionalRule.d.ts +3 -2
- package/lib/entities/optionalRule.js +4 -3
- package/lib/entities/partial/activatableNameChunks.d.ts +58 -0
- package/lib/entities/partial/activatableNameChunks.js +356 -0
- package/lib/entities/partial/adventurePointsValue.d.ts +9 -0
- package/lib/entities/partial/adventurePointsValue.js +243 -0
- package/lib/entities/partial/animalTypes.d.ts +11 -0
- package/lib/entities/partial/animalTypes.js +13 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.d.ts +16 -0
- package/lib/entities/partial/commonnessRatedAdvantagesAndDisadvantages.js +40 -0
- package/lib/entities/partial/dice.d.ts +10 -0
- package/lib/entities/partial/dice.js +13 -0
- package/lib/entities/partial/herbary.d.ts +28 -0
- package/lib/entities/partial/herbary.js +65 -0
- package/lib/entities/partial/map.d.ts +49 -0
- package/lib/entities/partial/map.js +43 -0
- package/lib/entities/partial/mathOperation.d.ts +36 -0
- package/lib/entities/partial/mathOperation.js +107 -0
- package/lib/entities/partial/prerequisites/displayOption.d.ts +7 -0
- package/lib/entities/partial/prerequisites/displayOption.js +19 -0
- package/lib/entities/partial/prerequisites/index.d.ts +67 -0
- package/lib/entities/partial/prerequisites/index.js +189 -0
- package/lib/entities/partial/prerequisites/part.d.ts +26 -0
- package/lib/entities/partial/prerequisites/part.js +88 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.d.ts +65 -0
- package/lib/entities/partial/prerequisites/prerequisiteGroups.js +269 -0
- package/lib/entities/partial/prerequisites/single/activatable.d.ts +18 -0
- package/lib/entities/partial/prerequisites/single/activatable.js +40 -0
- package/lib/entities/partial/prerequisites/single/animistPower.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/animistPower.js +23 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/blessedTradition.js +32 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/commonSuggestedByRCP.js +19 -0
- package/lib/entities/partial/prerequisites/single/culture.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/culture.js +20 -0
- package/lib/entities/partial/prerequisites/single/enhancement.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/enhancement.js +41 -0
- package/lib/entities/partial/prerequisites/single/influence.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/influence.js +17 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/magicalTradition.js +27 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.d.ts +6 -0
- package/lib/entities/partial/prerequisites/single/noOtherAncestorBloodAdvantage.js +8 -0
- package/lib/entities/partial/prerequisites/single/pact.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/pact.js +30 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/personalityTrait.js +28 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/primaryAttribute.js +15 -0
- package/lib/entities/partial/prerequisites/single/publication.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/publication.js +19 -0
- package/lib/entities/partial/prerequisites/single/race.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/race.js +20 -0
- package/lib/entities/partial/prerequisites/single/rated.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/rated.js +41 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedMinimumNumber.js +89 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/ratedSum.js +21 -0
- package/lib/entities/partial/prerequisites/single/rule.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/rule.js +4 -0
- package/lib/entities/partial/prerequisites/single/sex.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sex.js +19 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/sexualCharacteristic.js +21 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/socialStatus.js +21 -0
- package/lib/entities/partial/prerequisites/single/state.d.ts +8 -0
- package/lib/entities/partial/prerequisites/single/state.js +20 -0
- package/lib/entities/partial/prerequisites/single/text.d.ts +7 -0
- package/lib/entities/partial/prerequisites/single/text.js +9 -0
- package/lib/entities/partial/professions.d.ts +15 -0
- package/lib/entities/partial/professions.js +19 -0
- package/lib/entities/partial/rated/activatable/castingTime.d.ts +16 -7
- package/lib/entities/partial/rated/activatable/castingTime.js +35 -20
- package/lib/entities/partial/rated/activatable/checkResultBased.d.ts +18 -3
- package/lib/entities/partial/rated/activatable/checkResultBased.js +18 -10
- package/lib/entities/partial/rated/activatable/cost.d.ts +88 -8
- package/lib/entities/partial/rated/activatable/cost.js +183 -115
- package/lib/entities/partial/rated/activatable/duration.d.ts +36 -13
- package/lib/entities/partial/rated/activatable/duration.js +72 -61
- package/lib/entities/partial/rated/activatable/effect.d.ts +4 -4
- package/lib/entities/partial/rated/activatable/effect.js +32 -25
- package/lib/entities/partial/rated/activatable/index.d.ts +31 -27
- package/lib/entities/partial/rated/activatable/index.js +63 -28
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.d.ts +5 -6
- package/lib/entities/partial/rated/activatable/isMinimumMaximum.js +8 -5
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.d.ts +2 -4
- package/lib/entities/partial/rated/activatable/nonModifiableSuffix.js +7 -42
- package/lib/entities/partial/rated/activatable/range.d.ts +22 -14
- package/lib/entities/partial/rated/activatable/range.js +54 -54
- package/lib/entities/partial/rated/activatable/speed.d.ts +11 -2
- package/lib/entities/partial/rated/activatable/speed.js +14 -1
- package/lib/entities/partial/rated/activatable/targetCategory.d.ts +4 -5
- package/lib/entities/partial/rated/activatable/targetCategory.js +19 -24
- package/lib/entities/partial/rated/improvementCost.d.ts +16 -4
- package/lib/entities/partial/rated/improvementCost.js +63 -4
- package/lib/entities/partial/rated/skillCheck.d.ts +20 -17
- package/lib/entities/partial/rated/skillCheck.js +56 -54
- package/lib/entities/partial/reader.d.ts +266 -0
- package/lib/entities/partial/reader.js +175 -0
- package/lib/entities/partial/responsiveText.d.ts +10 -5
- package/lib/entities/partial/responsiveText.js +19 -3
- package/lib/entities/partial/units/energy.d.ts +5 -8
- package/lib/entities/partial/units/energy.js +5 -23
- package/lib/entities/partial/units/length.d.ts +20 -2
- package/lib/entities/partial/units/length.js +24 -5
- package/lib/entities/partial/units/timeSpan.d.ts +25 -4
- package/lib/entities/partial/units/timeSpan.js +27 -15
- package/lib/entities/partial/unknown.d.ts +5 -1
- package/lib/entities/partial/unknown.js +5 -1
- package/lib/entities/personalityTrait.d.ts +7 -0
- package/lib/entities/personalityTrait.js +56 -0
- package/lib/entities/poison.d.ts +12 -0
- package/lib/entities/poison.js +356 -0
- package/lib/entities/profession.d.ts +12 -0
- package/lib/entities/profession.js +585 -0
- package/lib/entities/race.d.ts +9 -0
- package/lib/entities/race.js +146 -0
- package/lib/entities/sexPractice.d.ts +6 -0
- package/lib/entities/sexPractice.js +33 -0
- package/lib/entities/skill.d.ts +9 -9
- package/lib/entities/skill.js +124 -91
- package/lib/entities/spell.d.ts +83 -26
- package/lib/entities/spell.js +835 -147
- package/lib/entities/state.d.ts +6 -0
- package/lib/entities/state.js +17 -0
- package/lib/helpers/enums.d.ts +11 -0
- package/lib/helpers/enums.js +6 -0
- package/lib/helpers/getTypes.d.ts +12 -482
- package/lib/helpers/getTypes.js +1 -0
- package/lib/helpers/identifiers.d.ts +314 -0
- package/lib/helpers/identifiers.js +333 -0
- package/lib/helpers/locale.d.ts +21 -2
- package/lib/helpers/translate.d.ts +47 -5
- package/lib/helpers/translate.js +13 -6
- package/lib/index.d.ts +848 -21
- package/lib/index.js +182 -17
- package/lib/references/index.d.ts +6 -3
- package/lib/references/index.js +25 -33
- package/lib/references/page.d.ts +1 -1
- package/lib/references/page.js +14 -14
- package/lib/references/pageRange.d.ts +1 -5
- package/lib/references/pageRange.js +7 -16
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/package.json +30 -10
- package/.prettierrc.yml +0 -1
- package/lib/entities/partial/rated/activatable/entity.d.ts +0 -11
- package/lib/entities/partial/rated/activatable/entity.js +0 -12
- package/lib/references/occurrence.d.ts +0 -4
- package/lib/references/occurrence.js +0 -3
package/lib/index.js
CHANGED
|
@@ -1,22 +1,187 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getActivatableEntityDescription } from "./entities/activatable.js";
|
|
2
|
+
import { getAlternativeRuleEntityDescription } from "./entities/alternativeRule.js";
|
|
3
|
+
import { getAttributeEntityDescription } from "./entities/attribute.js";
|
|
4
|
+
import { getCloseCombatTechniqueEntityDescription, getRangedCombatTechniqueEntityDescription, } from "./entities/combatTechnique.js";
|
|
5
|
+
import { getConditionEntityDescription, getMetaConditionEntityDescription, } from "./entities/condition.js";
|
|
6
|
+
import { getCultureEntityDescription } from "./entities/culture.js";
|
|
7
|
+
import { getCurriculumEntityDescription } from "./entities/curriculum.js";
|
|
8
|
+
import { getDerivedCharacteristicEntityDescription } from "./entities/derivedCharacteristic.js";
|
|
9
|
+
import { getDiseaseEntityDescription } from "./entities/disease.js";
|
|
10
|
+
import { getElixirEntityDescription } from "./entities/elixir.js";
|
|
11
|
+
import { getEquipmentEntityDescription } from "./entities/equipment.js";
|
|
12
|
+
import { getEquipmentPackageEntityDescription } from "./entities/equipmentPackage.js";
|
|
13
|
+
import { getExperienceLevelEntityDescription } from "./entities/experienceLevel.js";
|
|
14
|
+
import { getFocusRuleEntityDescription } from "./entities/focusRule.js";
|
|
15
|
+
import { getInfluenceEntityDescription } from "./entities/influence.js";
|
|
16
|
+
import { getBlessingEntityDescription, getCeremonyEntityDescription, getLiturgicalChantEntityDescription, } from "./entities/liturgicalChant.js";
|
|
17
|
+
import { getOptionalRuleEntityDescription } from "./entities/optionalRule.js";
|
|
18
|
+
import { getPersonalityTraitEntityDescription } from "./entities/personalityTrait.js";
|
|
19
|
+
import { getPoisonEntityDescription } from "./entities/poison.js";
|
|
20
|
+
import { getProfessionVersionEntityDescription } from "./entities/profession.js";
|
|
21
|
+
import { getRaceEntityDescription } from "./entities/race.js";
|
|
22
|
+
import { getSexPracticeEntityDescription } from "./entities/sexPractice.js";
|
|
23
|
+
import { getSkillEntityDescription } from "./entities/skill.js";
|
|
24
|
+
import { getAnimistPowerEntityDescription, getCantripEntityDescription, getCurseEntityDescription, getDominationRitualEntityDescription, getElvenMagicalSongEntityDescription, getFamiliarsTrickEntityDescription, getGeodeRitualEntityDescription, getJesterTrickEntityDescription, getMagicalDanceEntityDescription, getMagicalMelodyEntityDescription, getMagicalRuneEntityDescription, getRitualEntityDescription, getSpellEntityDescription, getZibiljaRitualEntityDescription, } from "./entities/spell.js";
|
|
25
|
+
import { getStateEntityDescription } from "./entities/state.js";
|
|
26
|
+
const registeredEntityDescriptionCreators = {
|
|
27
|
+
// rules
|
|
28
|
+
// CoreRule: getCoreRuleEntityDescription,
|
|
29
|
+
FocusRule: getFocusRuleEntityDescription,
|
|
30
|
+
OptionalRule: getOptionalRuleEntityDescription,
|
|
31
|
+
AlternativeRule: getAlternativeRuleEntityDescription,
|
|
32
|
+
Condition: getConditionEntityDescription,
|
|
33
|
+
MetaCondition: getMetaConditionEntityDescription,
|
|
34
|
+
State: getStateEntityDescription,
|
|
35
|
+
// character creation
|
|
36
|
+
ExperienceLevel: getExperienceLevelEntityDescription,
|
|
37
|
+
DerivedCharacteristic: getDerivedCharacteristicEntityDescription,
|
|
38
|
+
Race: getRaceEntityDescription,
|
|
39
|
+
Culture: getCultureEntityDescription,
|
|
40
|
+
ProfessionVersion: getProfessionVersionEntityDescription,
|
|
41
|
+
Advantage: getActivatableEntityDescription,
|
|
42
|
+
Disadvantage: getActivatableEntityDescription,
|
|
43
|
+
// core values
|
|
44
|
+
Attribute: getAttributeEntityDescription,
|
|
45
|
+
Skill: getSkillEntityDescription,
|
|
46
|
+
CloseCombatTechnique: getCloseCombatTechniqueEntityDescription,
|
|
47
|
+
RangedCombatTechnique: getRangedCombatTechniqueEntityDescription,
|
|
48
|
+
// spellworks
|
|
49
|
+
Cantrip: getCantripEntityDescription,
|
|
50
|
+
Spell: getSpellEntityDescription,
|
|
51
|
+
Ritual: getRitualEntityDescription,
|
|
52
|
+
// magical actions
|
|
53
|
+
AnimistPower: getAnimistPowerEntityDescription,
|
|
54
|
+
Curse: getCurseEntityDescription,
|
|
55
|
+
DominationRitual: getDominationRitualEntityDescription,
|
|
56
|
+
ElvenMagicalSong: getElvenMagicalSongEntityDescription,
|
|
57
|
+
GeodeRitual: getGeodeRitualEntityDescription,
|
|
58
|
+
JesterTrick: getJesterTrickEntityDescription,
|
|
59
|
+
MagicalDance: getMagicalDanceEntityDescription,
|
|
60
|
+
MagicalMelody: getMagicalMelodyEntityDescription,
|
|
61
|
+
MagicalRune: getMagicalRuneEntityDescription,
|
|
62
|
+
ZibiljaRitual: getZibiljaRitualEntityDescription,
|
|
63
|
+
// auxiliary magical
|
|
64
|
+
Curriculum: getCurriculumEntityDescription,
|
|
65
|
+
FamiliarsTrick: getFamiliarsTrickEntityDescription,
|
|
66
|
+
// work of the gods
|
|
67
|
+
Blessing: getBlessingEntityDescription,
|
|
68
|
+
LiturgicalChant: getLiturgicalChantEntityDescription,
|
|
69
|
+
Ceremony: getCeremonyEntityDescription,
|
|
70
|
+
// special abilities and enchantments
|
|
71
|
+
AdvancedCombatSpecialAbility: getActivatableEntityDescription,
|
|
72
|
+
AdvancedKarmaSpecialAbility: getActivatableEntityDescription,
|
|
73
|
+
AdvancedMagicalSpecialAbility: getActivatableEntityDescription,
|
|
74
|
+
AdvancedSkillSpecialAbility: getActivatableEntityDescription,
|
|
75
|
+
AncestorGlyph: getActivatableEntityDescription,
|
|
76
|
+
ArcaneOrbEnchantment: getActivatableEntityDescription,
|
|
77
|
+
AttireEnchantment: getActivatableEntityDescription,
|
|
78
|
+
Beutelzauber: getActivatableEntityDescription,
|
|
79
|
+
BlessedTradition: getActivatableEntityDescription,
|
|
80
|
+
BowlEnchantment: getActivatableEntityDescription,
|
|
81
|
+
BrawlingSpecialAbility: getActivatableEntityDescription,
|
|
82
|
+
CauldronEnchantment: getActivatableEntityDescription,
|
|
83
|
+
CeremonialItemSpecialAbility: getActivatableEntityDescription,
|
|
84
|
+
ChronicleEnchantment: getActivatableEntityDescription,
|
|
85
|
+
CombatSpecialAbility: getActivatableEntityDescription,
|
|
86
|
+
CombatStyleSpecialAbility: getActivatableEntityDescription,
|
|
87
|
+
CommandSpecialAbility: getActivatableEntityDescription,
|
|
88
|
+
DaggerRitual: getActivatableEntityDescription,
|
|
89
|
+
FamiliarSpecialAbility: getActivatableEntityDescription,
|
|
90
|
+
FatePointSexSpecialAbility: getActivatableEntityDescription,
|
|
91
|
+
FatePointSpecialAbility: getActivatableEntityDescription,
|
|
92
|
+
FoolsHatEnchantment: getActivatableEntityDescription,
|
|
93
|
+
GeneralSpecialAbility: getActivatableEntityDescription,
|
|
94
|
+
Haubenzauber: getActivatableEntityDescription,
|
|
95
|
+
InstrumentEnchantment: getActivatableEntityDescription,
|
|
96
|
+
KarmaSpecialAbility: getActivatableEntityDescription,
|
|
97
|
+
Krallenkettenzauber: getActivatableEntityDescription,
|
|
98
|
+
Kristallkugelzauber: getActivatableEntityDescription,
|
|
99
|
+
LiturgicalStyleSpecialAbility: getActivatableEntityDescription,
|
|
100
|
+
LycantropicGift: getActivatableEntityDescription,
|
|
101
|
+
MagicalSign: getActivatableEntityDescription,
|
|
102
|
+
MagicalSpecialAbility: getActivatableEntityDescription,
|
|
103
|
+
MagicalTradition: getActivatableEntityDescription,
|
|
104
|
+
MagicStyleSpecialAbility: getActivatableEntityDescription,
|
|
105
|
+
OrbEnchantment: getActivatableEntityDescription,
|
|
106
|
+
PactGift: getActivatableEntityDescription,
|
|
107
|
+
ProtectiveWardingCircleSpecialAbility: getActivatableEntityDescription,
|
|
108
|
+
RingEnchantment: getActivatableEntityDescription,
|
|
109
|
+
Sermon: getActivatableEntityDescription,
|
|
110
|
+
SexSpecialAbility: getActivatableEntityDescription,
|
|
111
|
+
SickleRitual: getActivatableEntityDescription,
|
|
112
|
+
SikaryanDrainSpecialAbility: getActivatableEntityDescription,
|
|
113
|
+
SkillStyleSpecialAbility: getActivatableEntityDescription,
|
|
114
|
+
SpellSwordEnchantment: getActivatableEntityDescription,
|
|
115
|
+
StaffEnchantment: getActivatableEntityDescription,
|
|
116
|
+
ToyEnchantment: getActivatableEntityDescription,
|
|
117
|
+
Trinkhornzauber: getActivatableEntityDescription,
|
|
118
|
+
VampiricGift: getActivatableEntityDescription,
|
|
119
|
+
Vision: getActivatableEntityDescription,
|
|
120
|
+
WandEnchantment: getActivatableEntityDescription,
|
|
121
|
+
WeaponEnchantment: getActivatableEntityDescription,
|
|
122
|
+
// equipment
|
|
123
|
+
Ammunition: getEquipmentEntityDescription,
|
|
124
|
+
Animal: getEquipmentEntityDescription,
|
|
125
|
+
AnimalCare: getEquipmentEntityDescription,
|
|
126
|
+
Armor: getEquipmentEntityDescription,
|
|
127
|
+
BandageOrRemedy: getEquipmentEntityDescription,
|
|
128
|
+
Book: getEquipmentEntityDescription,
|
|
129
|
+
CeremonialItem: getEquipmentEntityDescription,
|
|
130
|
+
Clothes: getEquipmentEntityDescription,
|
|
131
|
+
ClothingPackage: getEquipmentEntityDescription,
|
|
132
|
+
Container: getEquipmentEntityDescription,
|
|
133
|
+
Elixir: getElixirEntityDescription,
|
|
134
|
+
EquipmentOfBlessedOnes: getEquipmentEntityDescription,
|
|
135
|
+
GemOrPreciousStone: getEquipmentEntityDescription,
|
|
136
|
+
IlluminationLightSource: getEquipmentEntityDescription,
|
|
137
|
+
IlluminationRefillOrSupply: getEquipmentEntityDescription,
|
|
138
|
+
Jewelry: getEquipmentEntityDescription,
|
|
139
|
+
Laboratory: getEquipmentEntityDescription,
|
|
140
|
+
Liebesspielzeug: getEquipmentEntityDescription,
|
|
141
|
+
LuxuryGood: getEquipmentEntityDescription,
|
|
142
|
+
MagicalArtifact: getEquipmentEntityDescription,
|
|
143
|
+
MusicalInstrument: getEquipmentEntityDescription,
|
|
144
|
+
Newspaper: getEquipmentEntityDescription,
|
|
145
|
+
OrienteeringAid: getEquipmentEntityDescription,
|
|
146
|
+
Poison: getPoisonEntityDescription,
|
|
147
|
+
RopeOrChain: getEquipmentEntityDescription,
|
|
148
|
+
Stationery: getEquipmentEntityDescription,
|
|
149
|
+
ThievesTool: getEquipmentEntityDescription,
|
|
150
|
+
ToolOfTheTrade: getEquipmentEntityDescription,
|
|
151
|
+
TravelGearOrTool: getEquipmentEntityDescription,
|
|
152
|
+
Vehicle: getEquipmentEntityDescription,
|
|
153
|
+
Weapon: getEquipmentEntityDescription,
|
|
154
|
+
WeaponAccessory: getEquipmentEntityDescription,
|
|
155
|
+
EquipmentPackage: getEquipmentPackageEntityDescription,
|
|
156
|
+
// other
|
|
157
|
+
Disease: getDiseaseEntityDescription,
|
|
158
|
+
AnimalDisease: getDiseaseEntityDescription,
|
|
159
|
+
Influence: getInfluenceEntityDescription,
|
|
160
|
+
PersonalityTrait: getPersonalityTraitEntityDescription,
|
|
161
|
+
SexPractice: getSexPracticeEntityDescription,
|
|
162
|
+
};
|
|
3
163
|
/**
|
|
4
|
-
*
|
|
5
|
-
* a library entry.
|
|
164
|
+
* Checks if there is a registered description creator for the given entity name.
|
|
6
165
|
*/
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
166
|
+
export const isSupportedEntity = (entityName) => entityName in registeredEntityDescriptionCreators;
|
|
167
|
+
/**
|
|
168
|
+
* Get a JSON representation of the rules text for an entry in the database.
|
|
169
|
+
*/
|
|
170
|
+
export const getEntityDescription = (database, localeEnv, idMap, getResolvedSelectOptionById, getAllResolvedSelectOptions, getAllResolvedNewSkillApplications, getAllResolvedSkillUses, entityName, instanceId) => {
|
|
171
|
+
const creator = registeredEntityDescriptionCreators[entityName];
|
|
172
|
+
const instance = database.getInstanceOfEntityById(entityName, instanceId);
|
|
173
|
+
if (!instance) {
|
|
13
174
|
return undefined;
|
|
14
175
|
}
|
|
15
|
-
return {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
176
|
+
return creator({
|
|
177
|
+
getInstanceById: database.getInstanceOfEntityById.bind(database),
|
|
178
|
+
getAllInstances: database.getAllInstanceContainersOfEntity.bind(database),
|
|
179
|
+
countInstances: database.countInstancesOfEntity.bind(database),
|
|
180
|
+
getChildInstancesForInstanceId: (childEntityName, parentId) => database.getAllChildInstanceContainersForParent(childEntityName, parentId),
|
|
181
|
+
getResolvedSelectOptionById,
|
|
182
|
+
getAllResolvedSelectOptions,
|
|
183
|
+
getAllResolvedNewSkillApplications,
|
|
184
|
+
getAllResolvedSkillUses,
|
|
185
|
+
idMap,
|
|
186
|
+
}, localeEnv, { entity: entityName, content: instance, id: instanceId });
|
|
22
187
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { PublicationRefs } from "optolith-database-schema/
|
|
2
|
-
import {
|
|
1
|
+
import type { PublicationRefs } from "optolith-database-schema/gen";
|
|
2
|
+
import type { GetInstanceById } from "../helpers/getTypes.js";
|
|
3
3
|
import { LocaleEnvironment } from "../helpers/locale.js";
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Returns the translation of the references.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getReferencesTranslation: (getInstanceById: GetInstanceById<"Publication">, locale: LocaleEnvironment, references: PublicationRefs) => string;
|
package/lib/references/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { isNotNullish } from "@optolith/helpers/nullable";
|
|
2
2
|
import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
import { fromRawPageRange, normalizePageRanges, printPageRanges, } from "./pageRange.js";
|
|
4
|
+
/**
|
|
5
|
+
* Returns the translation of the references.
|
|
6
|
+
*/
|
|
7
|
+
export const getReferencesTranslation = (getInstanceById, locale, references) => references
|
|
8
|
+
.map(ref => {
|
|
9
|
+
const publication = getInstanceById("Publication", ref.id);
|
|
8
10
|
const publicationTranslations = locale.translateMap(publication?.translations);
|
|
9
11
|
const occurrences = locale.translateMap(ref.occurrences);
|
|
10
12
|
if (publication === undefined ||
|
|
@@ -12,35 +14,25 @@ export const getReferencesTranslation = (getPublicationById, locale, references)
|
|
|
12
14
|
occurrences === undefined) {
|
|
13
15
|
return undefined;
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const initial = occurrences.initial.printing === undefined
|
|
25
|
-
? printPageRanges(locale.translate, initialPageRanges)
|
|
26
|
-
: `${printPageRanges(locale.translate, initialPageRanges)} (${locale.translate("since the {0}. printing", occurrences.initial.printing)})`;
|
|
27
|
-
const revisions = occurrences.revisions?.map((rev) => {
|
|
28
|
-
switch (rev.tag) {
|
|
29
|
-
case "Since": {
|
|
30
|
-
const pageRanges = normalizePageRanges(rev.since.pages.map(fromRawPageRange));
|
|
31
|
-
return `${printPageRanges(locale.translate, pageRanges)} (${locale.translate("since the {0}. printing", rev.since.printing)})`;
|
|
32
|
-
}
|
|
33
|
-
case "Deprecated": {
|
|
34
|
-
return locale.translate("removed in {0}. printing", rev.deprecated.printing);
|
|
35
|
-
}
|
|
36
|
-
default:
|
|
37
|
-
return assertExhaustive(rev);
|
|
17
|
+
const initialPageRanges = normalizePageRanges(occurrences.initial.pages.map(fromRawPageRange));
|
|
18
|
+
const initial = occurrences.initial.printing === undefined
|
|
19
|
+
? printPageRanges(locale.translate, initialPageRanges)
|
|
20
|
+
: `${printPageRanges(locale.translate, initialPageRanges)} (${locale.translate(".input {$printing :number} {{since the {$printing}. printing}}", { printing: occurrences.initial.printing })})`;
|
|
21
|
+
const revisions = occurrences.revisions?.map(rev => {
|
|
22
|
+
switch (rev.kind) {
|
|
23
|
+
case "Since": {
|
|
24
|
+
const pageRanges = normalizePageRanges(rev.Since.pages.map(fromRawPageRange));
|
|
25
|
+
return `${printPageRanges(locale.translate, pageRanges)} (${locale.translate(".input {$printing :number} {{since the {$printing}. printing}}", { printing: rev.Since.printing })})`;
|
|
38
26
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
27
|
+
case "Deprecated": {
|
|
28
|
+
return locale.translate(".input {$printing :number} {{removed in {$printing}. printing}}", { printing: rev.Deprecated.printing });
|
|
29
|
+
}
|
|
30
|
+
default:
|
|
31
|
+
return assertExhaustive(rev);
|
|
32
|
+
}
|
|
33
|
+
}) ?? [];
|
|
34
|
+
const allPageRanges = [initial, ...revisions].join("; ");
|
|
35
|
+
return `${publicationTranslations.name} ${allPageRanges}`;
|
|
44
36
|
})
|
|
45
37
|
.filter(isNotNullish)
|
|
46
38
|
.join("; ");
|
package/lib/references/page.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Compare } from "@optolith/helpers/compare";
|
|
2
|
-
import { Page } from "optolith-database-schema/
|
|
2
|
+
import { Page } from "optolith-database-schema/gen";
|
|
3
3
|
import { Translate } from "../helpers/translate.js";
|
|
4
4
|
/**
|
|
5
5
|
* A comparison function for two pages.
|
package/lib/references/page.js
CHANGED
|
@@ -3,15 +3,15 @@ import { assertExhaustive } from "@optolith/helpers/typeSafety";
|
|
|
3
3
|
* A comparison function for two pages.
|
|
4
4
|
*/
|
|
5
5
|
export const comparePage = (a, b) => {
|
|
6
|
-
switch (a.
|
|
6
|
+
switch (a.kind) {
|
|
7
7
|
case "InsideCoverFront":
|
|
8
|
-
return b.
|
|
8
|
+
return b.kind === "InsideCoverFront" ? 0 : -1;
|
|
9
9
|
case "InsideCoverBack":
|
|
10
|
-
return b.
|
|
10
|
+
return b.kind === "InsideCoverBack" ? 0 : 1;
|
|
11
11
|
case "Numbered":
|
|
12
|
-
return b.
|
|
13
|
-
? a.
|
|
14
|
-
: b.
|
|
12
|
+
return b.kind === "Numbered"
|
|
13
|
+
? a.Numbered - b.Numbered
|
|
14
|
+
: b.kind === "InsideCoverFront"
|
|
15
15
|
? 1
|
|
16
16
|
: -1;
|
|
17
17
|
default:
|
|
@@ -26,13 +26,13 @@ export const equalsPage = (a, b) => comparePage(a, b) === 0;
|
|
|
26
26
|
* Returns the successor of a page.
|
|
27
27
|
*/
|
|
28
28
|
export const succ = (page) => {
|
|
29
|
-
switch (page.
|
|
29
|
+
switch (page.kind) {
|
|
30
30
|
case "InsideCoverFront":
|
|
31
|
-
return {
|
|
31
|
+
return { kind: "Numbered", Numbered: 1 };
|
|
32
32
|
case "InsideCoverBack":
|
|
33
|
-
return {
|
|
33
|
+
return { kind: "InsideCoverFront" };
|
|
34
34
|
case "Numbered":
|
|
35
|
-
return {
|
|
35
|
+
return { kind: "Numbered", Numbered: page.Numbered + 1 };
|
|
36
36
|
default:
|
|
37
37
|
return assertExhaustive(page);
|
|
38
38
|
}
|
|
@@ -41,20 +41,20 @@ export const succ = (page) => {
|
|
|
41
41
|
* Creates a page object for a page number.
|
|
42
42
|
*/
|
|
43
43
|
export const numberToPage = (number) => ({
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
kind: "Numbered",
|
|
45
|
+
Numbered: number,
|
|
46
46
|
});
|
|
47
47
|
/**
|
|
48
48
|
* Returns a string representation of a page.
|
|
49
49
|
*/
|
|
50
50
|
export const printPage = (translate, page) => {
|
|
51
|
-
switch (page.
|
|
51
|
+
switch (page.kind) {
|
|
52
52
|
case "InsideCoverFront":
|
|
53
53
|
return translate("Front Cover Inside");
|
|
54
54
|
case "InsideCoverBack":
|
|
55
55
|
return translate("Back Cover Inside");
|
|
56
56
|
case "Numbered":
|
|
57
|
-
return page.
|
|
57
|
+
return page.Numbered.toString();
|
|
58
58
|
default:
|
|
59
59
|
return assertExhaustive(page);
|
|
60
60
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Page, PageRange as RawPageRange
|
|
1
|
+
import { Page, PageRange as RawPageRange } from "optolith-database-schema/gen";
|
|
2
2
|
import { Translate } from "../helpers/translate.js";
|
|
3
3
|
/**
|
|
4
4
|
* A range of pages, including the first and last page, if the range includes
|
|
@@ -8,10 +8,6 @@ export type PageRange = {
|
|
|
8
8
|
firstPage: Page;
|
|
9
9
|
lastPage?: Page;
|
|
10
10
|
};
|
|
11
|
-
/**
|
|
12
|
-
* Converts a numeric range to a page object range.
|
|
13
|
-
*/
|
|
14
|
-
export declare const numberRangeToPageRange: (numberRange: SimpleOccurrence) => PageRange;
|
|
15
11
|
/**
|
|
16
12
|
* Converts a page object range from the database to a local page object range.
|
|
17
13
|
*/
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { range } from "@optolith/helpers/array";
|
|
2
|
-
import { comparePage, equalsPage,
|
|
3
|
-
/**
|
|
4
|
-
* Converts a numeric range to a page object range.
|
|
5
|
-
*/
|
|
6
|
-
export const numberRangeToPageRange = (numberRange) => numberRange.last_page === undefined
|
|
7
|
-
? { firstPage: numberToPage(numberRange.first_page) }
|
|
8
|
-
: {
|
|
9
|
-
firstPage: numberToPage(numberRange.first_page),
|
|
10
|
-
lastPage: numberToPage(numberRange.last_page),
|
|
11
|
-
};
|
|
2
|
+
import { comparePage, equalsPage, printPage, succ } from "./page.js";
|
|
12
3
|
/**
|
|
13
4
|
* Converts a page object range from the database to a local page object range.
|
|
14
5
|
*/
|
|
@@ -23,17 +14,17 @@ export const fromRawPageRange = (pageRange) => pageRange.last_page === undefined
|
|
|
23
14
|
*/
|
|
24
15
|
export const normalizePageRanges = (ranges) => ranges
|
|
25
16
|
.flatMap(({ firstPage, lastPage = firstPage }) => {
|
|
26
|
-
if (firstPage.
|
|
27
|
-
return range(firstPage.
|
|
28
|
-
|
|
29
|
-
numbered,
|
|
17
|
+
if (firstPage.kind === "Numbered" && lastPage.kind === "Numbered") {
|
|
18
|
+
return range(firstPage.Numbered, lastPage.Numbered).map(numbered => ({
|
|
19
|
+
kind: "Numbered",
|
|
20
|
+
Numbered: numbered,
|
|
30
21
|
}));
|
|
31
22
|
}
|
|
32
23
|
else {
|
|
33
24
|
return [firstPage, lastPage];
|
|
34
25
|
}
|
|
35
26
|
})
|
|
36
|
-
.filter((page, i, pages) => pages.findIndex(
|
|
27
|
+
.filter((page, i, pages) => pages.findIndex(p => equalsPage(page, p)) === i)
|
|
37
28
|
.sort(comparePage)
|
|
38
29
|
.reduce((acc, page) => {
|
|
39
30
|
const lastRange = acc[acc.length - 1];
|
|
@@ -55,4 +46,4 @@ export const printPageRange = (translate, pageRange) => pageRange.lastPage === u
|
|
|
55
46
|
/**
|
|
56
47
|
* Returns a string representation of a list of page ranges.
|
|
57
48
|
*/
|
|
58
|
-
export const printPageRanges = (translate, pageRanges) => pageRanges.map(
|
|
49
|
+
export const printPageRanges = (translate, pageRanges) => pageRanges.map(pageRange => printPageRange(translate, pageRange)).join(", ");
|