@crowdedkingdoms/crowdyjs 8.2.0 → 8.3.0

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.
Files changed (102) hide show
  1. package/README.md +21 -3
  2. package/dist/crowdy-client.d.ts.map +1 -1
  3. package/dist/crowdy-client.js +5 -1
  4. package/dist/index.d.ts +2 -2
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +2 -2
  7. package/dist/kit/blueprints/combat.d.ts +75 -0
  8. package/dist/kit/blueprints/combat.d.ts.map +1 -0
  9. package/dist/kit/blueprints/combat.js +351 -0
  10. package/dist/kit/blueprints/core.d.ts +222 -0
  11. package/dist/kit/blueprints/core.d.ts.map +1 -0
  12. package/dist/kit/blueprints/core.js +185 -0
  13. package/dist/kit/blueprints/decks.d.ts +50 -0
  14. package/dist/kit/blueprints/decks.d.ts.map +1 -0
  15. package/dist/kit/blueprints/decks.js +163 -0
  16. package/dist/kit/blueprints/economy.d.ts +88 -0
  17. package/dist/kit/blueprints/economy.d.ts.map +1 -0
  18. package/dist/kit/blueprints/economy.js +533 -0
  19. package/dist/kit/blueprints/guild.d.ts +51 -0
  20. package/dist/kit/blueprints/guild.d.ts.map +1 -0
  21. package/dist/kit/blueprints/guild.js +50 -0
  22. package/dist/kit/blueprints/index.d.ts +21 -0
  23. package/dist/kit/blueprints/index.d.ts.map +1 -0
  24. package/dist/kit/blueprints/index.js +20 -0
  25. package/dist/kit/blueprints/inventory.d.ts +38 -0
  26. package/dist/kit/blueprints/inventory.d.ts.map +1 -0
  27. package/dist/kit/blueprints/inventory.js +157 -0
  28. package/dist/kit/blueprints/leaderboards.d.ts +49 -0
  29. package/dist/kit/blueprints/leaderboards.d.ts.map +1 -0
  30. package/dist/kit/blueprints/leaderboards.js +126 -0
  31. package/dist/kit/blueprints/locks.d.ts +82 -0
  32. package/dist/kit/blueprints/locks.d.ts.map +1 -0
  33. package/dist/kit/blueprints/locks.js +155 -0
  34. package/dist/kit/blueprints/loot.d.ts +84 -0
  35. package/dist/kit/blueprints/loot.d.ts.map +1 -0
  36. package/dist/kit/blueprints/loot.js +228 -0
  37. package/dist/kit/blueprints/matches.d.ts +59 -0
  38. package/dist/kit/blueprints/matches.d.ts.map +1 -0
  39. package/dist/kit/blueprints/matches.js +246 -0
  40. package/dist/kit/blueprints/npcs.d.ts +71 -0
  41. package/dist/kit/blueprints/npcs.d.ts.map +1 -0
  42. package/dist/kit/blueprints/npcs.js +122 -0
  43. package/dist/kit/blueprints/plots.d.ts +54 -0
  44. package/dist/kit/blueprints/plots.d.ts.map +1 -0
  45. package/dist/kit/blueprints/plots.js +146 -0
  46. package/dist/kit/blueprints/progression.d.ts +68 -0
  47. package/dist/kit/blueprints/progression.d.ts.map +1 -0
  48. package/dist/kit/blueprints/progression.js +324 -0
  49. package/dist/kit/blueprints/quests.d.ts +65 -0
  50. package/dist/kit/blueprints/quests.d.ts.map +1 -0
  51. package/dist/kit/blueprints/quests.js +284 -0
  52. package/dist/kit/blueprints/worldsim.d.ts +84 -0
  53. package/dist/kit/blueprints/worldsim.d.ts.map +1 -0
  54. package/dist/kit/blueprints/worldsim.js +461 -0
  55. package/dist/kit/combat.d.ts +103 -0
  56. package/dist/kit/combat.d.ts.map +1 -0
  57. package/dist/kit/combat.js +151 -0
  58. package/dist/kit/decks.d.ts +123 -0
  59. package/dist/kit/decks.d.ts.map +1 -0
  60. package/dist/kit/decks.js +138 -0
  61. package/dist/kit/economy.d.ts +244 -0
  62. package/dist/kit/economy.d.ts.map +1 -0
  63. package/dist/kit/economy.js +365 -0
  64. package/dist/kit/features.d.ts +60 -0
  65. package/dist/kit/features.d.ts.map +1 -0
  66. package/dist/kit/features.js +65 -0
  67. package/dist/kit/index.d.ts +13 -2
  68. package/dist/kit/index.d.ts.map +1 -1
  69. package/dist/kit/index.js +12 -1
  70. package/dist/kit/inventory.d.ts +5 -0
  71. package/dist/kit/inventory.d.ts.map +1 -1
  72. package/dist/kit/inventory.js +14 -1
  73. package/dist/kit/kit.d.ts +58 -2
  74. package/dist/kit/kit.d.ts.map +1 -1
  75. package/dist/kit/kit.js +24 -2
  76. package/dist/kit/leaderboards.d.ts +66 -0
  77. package/dist/kit/leaderboards.d.ts.map +1 -0
  78. package/dist/kit/leaderboards.js +94 -0
  79. package/dist/kit/loot.d.ts +106 -0
  80. package/dist/kit/loot.d.ts.map +1 -0
  81. package/dist/kit/loot.js +120 -0
  82. package/dist/kit/matches.d.ts +140 -0
  83. package/dist/kit/matches.d.ts.map +1 -0
  84. package/dist/kit/matches.js +253 -0
  85. package/dist/kit/objects.js +1 -1
  86. package/dist/kit/plots.js +1 -1
  87. package/dist/kit/progression.d.ts +181 -0
  88. package/dist/kit/progression.d.ts.map +1 -0
  89. package/dist/kit/progression.js +265 -0
  90. package/dist/kit/quests.d.ts +110 -0
  91. package/dist/kit/quests.d.ts.map +1 -0
  92. package/dist/kit/quests.js +158 -0
  93. package/dist/kit/social.d.ts +267 -0
  94. package/dist/kit/social.d.ts.map +1 -0
  95. package/dist/kit/social.js +230 -0
  96. package/dist/kit/worldsim.d.ts +225 -0
  97. package/dist/kit/worldsim.d.ts.map +1 -0
  98. package/dist/kit/worldsim.js +231 -0
  99. package/package.json +1 -1
  100. package/dist/kit/blueprints.d.ts +0 -370
  101. package/dist/kit/blueprints.d.ts.map +0 -1
  102. package/dist/kit/blueprints.js +0 -643
@@ -0,0 +1,68 @@
1
+ import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js';
2
+ /** Options for {@link progressionBlueprint}. */
3
+ export interface ProgressionBlueprintOptions {
4
+ /**
5
+ * Prefix applied to the container type names (`'Pvp'` → `PvpProgress` /
6
+ * `PvpSkillDef` / …) and, snake-cased, to the function names
7
+ * (`pvp_grant_xp`, …). Defaults to none.
8
+ */
9
+ typePrefix?: string;
10
+ /**
11
+ * Who may grant XP. Trusted grants should be `'server'` (the default),
12
+ * `'automation'` (e.g. an event automation on a `mob_died` function), or
13
+ * `'host'` — never plain players.
14
+ */
15
+ xpAuthority?: KitTrustedAuthority;
16
+ /**
17
+ * Who may adjust the competitive rating (the match layer's
18
+ * `applyMatchResult` calls this). Defaults to `'host'`.
19
+ */
20
+ ratingAuthority?: KitTrustedAuthority;
21
+ /**
22
+ * The XP curve: an expression over `$level` returning the TOTAL xp required
23
+ * to reach that level. Evaluated via the read-only `fn:` helper-call
24
+ * pattern (`fn:xp_for_level(self.level + 1)`), so the curve lives in ONE
25
+ * `internal` function and every reader stays in sync. Defaults to
26
+ * `'100 * $level * $level'`.
27
+ */
28
+ xpForLevelExpression?: string;
29
+ /** Skill points granted per level-up. Defaults to 1. */
30
+ skillPointsPerLevel?: number;
31
+ /** Initial competitive rating for new players. Defaults to 1000. */
32
+ initialRating?: number;
33
+ /** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */
34
+ ownerIdKind?: KitOwnerIdKind;
35
+ }
36
+ /** Names derived by {@link progressionBlueprint} for a given prefix. */
37
+ export interface ProgressionNames {
38
+ progressType: string;
39
+ skillDefType: string;
40
+ skillRankType: string;
41
+ achievementDefType: string;
42
+ achievementUnlockType: string;
43
+ xpForLevelFn: string;
44
+ grantXpFn: string;
45
+ buySkillFn: string;
46
+ unlockAchievementFn: string;
47
+ adjustRatingFn: string;
48
+ }
49
+ /** Compute the type/function names a progression blueprint (and its runtime helper) uses. */
50
+ export declare function progressionNames(typePrefix?: string): ProgressionNames;
51
+ /**
52
+ * Blueprint for **character progression**: per-player `Progress` (xp / level /
53
+ * skill points / rating), an admin `SkillDef` catalog with prerequisite
54
+ * chains bought into per-player `SkillRank`s, threshold `AchievementDef`s
55
+ * unlocked into `AchievementUnlock`s, and an ELO-style `adjust_rating` hook
56
+ * for the match layer.
57
+ *
58
+ * Level-ups are computed server-side inside `grant_xp` using the `fn:`
59
+ * helper pattern: the XP curve lives in ONE `internal` function
60
+ * (`xp_for_level`, not directly invocable) that mutation expressions call as
61
+ * `fn:xp_for_level(self.level + 1)`. Ordered mutations see earlier writes,
62
+ * so xp is applied first, then the skill-point award, then the level bump —
63
+ * one level per grant (call repeatedly for multi-level jumps).
64
+ *
65
+ * Runtime counterpart: `client.kit(appId).progression`.
66
+ */
67
+ export declare function progressionBlueprint(options?: ProgressionBlueprintOptions): KitBlueprint;
68
+ //# sourceMappingURL=progression.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"progression.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/progression.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAEnB,gDAAgD;AAChD,MAAM,WAAW,2BAA2B;IAC1C;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC;;;OAGG;IACH,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,wDAAwD;IACxD,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,oEAAoE;IACpE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,yEAAyE;IACzE,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,wEAAwE;AACxE,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,6FAA6F;AAC7F,wBAAgB,gBAAgB,CAAC,UAAU,SAAK,GAAG,gBAAgB,CAclE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,GAAE,2BAAgC,GACxC,YAAY,CAoTd"}
@@ -0,0 +1,324 @@
1
+ import { kitPolicyJson, ownerEqualsCaller, ownerMirrorProperty, toSnakeCase, trustedAuthorityFields, } from './core.js';
2
+ /** Compute the type/function names a progression blueprint (and its runtime helper) uses. */
3
+ export function progressionNames(typePrefix = '') {
4
+ const fnPrefix = typePrefix ? `${toSnakeCase(typePrefix)}_` : '';
5
+ return {
6
+ progressType: `${typePrefix}Progress`,
7
+ skillDefType: `${typePrefix}SkillDef`,
8
+ skillRankType: `${typePrefix}SkillRank`,
9
+ achievementDefType: `${typePrefix}AchievementDef`,
10
+ achievementUnlockType: `${typePrefix}AchievementUnlock`,
11
+ xpForLevelFn: `${fnPrefix}xp_for_level`,
12
+ grantXpFn: `${fnPrefix}grant_xp`,
13
+ buySkillFn: `${fnPrefix}spend_skill_point`,
14
+ unlockAchievementFn: `${fnPrefix}unlock_achievement`,
15
+ adjustRatingFn: `${fnPrefix}adjust_rating`,
16
+ };
17
+ }
18
+ /**
19
+ * Blueprint for **character progression**: per-player `Progress` (xp / level /
20
+ * skill points / rating), an admin `SkillDef` catalog with prerequisite
21
+ * chains bought into per-player `SkillRank`s, threshold `AchievementDef`s
22
+ * unlocked into `AchievementUnlock`s, and an ELO-style `adjust_rating` hook
23
+ * for the match layer.
24
+ *
25
+ * Level-ups are computed server-side inside `grant_xp` using the `fn:`
26
+ * helper pattern: the XP curve lives in ONE `internal` function
27
+ * (`xp_for_level`, not directly invocable) that mutation expressions call as
28
+ * `fn:xp_for_level(self.level + 1)`. Ordered mutations see earlier writes,
29
+ * so xp is applied first, then the skill-point award, then the level bump —
30
+ * one level per grant (call repeatedly for multi-level jumps).
31
+ *
32
+ * Runtime counterpart: `client.kit(appId).progression`.
33
+ */
34
+ export function progressionBlueprint(options = {}) {
35
+ const { typePrefix = '', xpAuthority = 'server', ratingAuthority = 'host', xpForLevelExpression = '100 * $level * $level', skillPointsPerLevel = 1, initialRating = 1000, ownerIdKind: kind = 'int', } = options;
36
+ const names = progressionNames(typePrefix);
37
+ const levelUpCondition = `self.xp >= fn:${names.xpForLevelFn}(self.level + 1)`;
38
+ const propertyDefinitions = [
39
+ ownerMirrorProperty(names.progressType, kind),
40
+ {
41
+ containerTypeName: names.progressType,
42
+ key: 'xp',
43
+ valueType: 'int',
44
+ defaultValueJson: '0',
45
+ description: 'Lifetime experience points.',
46
+ },
47
+ {
48
+ containerTypeName: names.progressType,
49
+ key: 'level',
50
+ valueType: 'int',
51
+ defaultValueJson: '1',
52
+ description: 'Current level, advanced server-side by grant_xp.',
53
+ },
54
+ {
55
+ containerTypeName: names.progressType,
56
+ key: 'skill_points',
57
+ valueType: 'int',
58
+ defaultValueJson: '0',
59
+ description: 'Unspent skill points (earned on level-up).',
60
+ },
61
+ {
62
+ containerTypeName: names.progressType,
63
+ key: 'rating',
64
+ valueType: 'int',
65
+ defaultValueJson: String(initialRating),
66
+ description: 'Competitive rating (ELO-style), adjusted by the match layer.',
67
+ },
68
+ {
69
+ containerTypeName: names.skillDefType,
70
+ key: 'skill_id',
71
+ valueType: 'string',
72
+ description: 'Stable skill identifier.',
73
+ },
74
+ {
75
+ containerTypeName: names.skillDefType,
76
+ key: 'cost',
77
+ valueType: 'int',
78
+ defaultValueJson: '1',
79
+ description: 'Skill points per rank.',
80
+ },
81
+ {
82
+ containerTypeName: names.skillDefType,
83
+ key: 'requires_skill_id',
84
+ valueType: 'string',
85
+ defaultValueJson: '""',
86
+ description: 'Prerequisite skill_id (empty for none); rank ≥ 1 required.',
87
+ },
88
+ {
89
+ containerTypeName: names.skillDefType,
90
+ key: 'max_rank',
91
+ valueType: 'int',
92
+ defaultValueJson: '1',
93
+ description: 'Maximum purchasable rank.',
94
+ },
95
+ ownerMirrorProperty(names.skillRankType, kind),
96
+ {
97
+ containerTypeName: names.skillRankType,
98
+ key: 'skill_id',
99
+ valueType: 'string',
100
+ defaultValueJson: '""',
101
+ description: 'The skill this rank row tracks.',
102
+ },
103
+ {
104
+ containerTypeName: names.skillRankType,
105
+ key: 'rank',
106
+ valueType: 'int',
107
+ defaultValueJson: '0',
108
+ description: 'Current rank (0 = not learned).',
109
+ },
110
+ {
111
+ containerTypeName: names.achievementDefType,
112
+ key: 'achievement_id',
113
+ valueType: 'string',
114
+ description: 'Stable achievement identifier.',
115
+ },
116
+ {
117
+ containerTypeName: names.achievementDefType,
118
+ key: 'threshold',
119
+ valueType: 'int',
120
+ defaultValueJson: '0',
121
+ description: 'Total xp required to unlock.',
122
+ },
123
+ ownerMirrorProperty(names.achievementUnlockType, kind),
124
+ {
125
+ containerTypeName: names.achievementUnlockType,
126
+ key: 'achievement_id',
127
+ valueType: 'string',
128
+ defaultValueJson: '""',
129
+ description: 'The achievement this unlock row tracks.',
130
+ },
131
+ {
132
+ containerTypeName: names.achievementUnlockType,
133
+ key: 'unlocked',
134
+ valueType: 'bool',
135
+ defaultValueJson: 'false',
136
+ description: 'True once the threshold check has passed (idempotent).',
137
+ },
138
+ ];
139
+ const functions = [
140
+ {
141
+ name: names.xpForLevelFn,
142
+ containerTypeName: names.progressType,
143
+ returnType: 'int',
144
+ invokeScope: 'internal',
145
+ parameters: [
146
+ {
147
+ name: 'level',
148
+ valueType: 'int',
149
+ required: true,
150
+ description: 'The level whose total-xp requirement to compute.',
151
+ },
152
+ ],
153
+ mutations: [],
154
+ returnExpression: xpForLevelExpression,
155
+ description: 'The XP curve: total xp required to reach $level. Internal-only; read via fn: calls from grant_xp (the fn: helper pattern).',
156
+ },
157
+ {
158
+ name: names.grantXpFn,
159
+ containerTypeName: names.progressType,
160
+ returnType: 'int',
161
+ parameters: [
162
+ {
163
+ name: 'amount',
164
+ valueType: 'int',
165
+ required: true,
166
+ description: 'XP to add (negative values are ignored).',
167
+ },
168
+ ],
169
+ mutations: [
170
+ { target: 'self', property: 'xp', expression: 'self.xp + max(0, $amount)' },
171
+ {
172
+ target: 'self',
173
+ property: 'skill_points',
174
+ expression: `self.skill_points + if(${levelUpCondition}, ${skillPointsPerLevel}, 0)`,
175
+ },
176
+ {
177
+ target: 'self',
178
+ property: 'level',
179
+ expression: `if(${levelUpCondition}, self.level + 1, self.level)`,
180
+ },
181
+ ],
182
+ returnExpression: 'self.level',
183
+ ...trustedAuthorityFields(xpAuthority),
184
+ description: 'Trusted XP grant: adds xp, then awards skill points and bumps the level when the fn:xp_for_level curve is crossed (one level per grant).',
185
+ },
186
+ {
187
+ name: names.buySkillFn,
188
+ containerTypeName: names.skillRankType,
189
+ returnType: 'int',
190
+ parameters: [
191
+ {
192
+ name: 'progress_id',
193
+ valueType: 'container_ref',
194
+ required: true,
195
+ description: "The caller's Progress container (pays the skill points).",
196
+ },
197
+ {
198
+ name: 'def_id',
199
+ valueType: 'container_ref',
200
+ required: true,
201
+ description: 'The SkillDef being bought.',
202
+ },
203
+ {
204
+ name: 'prereq_id',
205
+ valueType: 'container_ref',
206
+ required: true,
207
+ description: "The caller's SkillRank for the prerequisite skill (pass this rank container itself when the skill has no prerequisite).",
208
+ },
209
+ ],
210
+ mutations: [
211
+ {
212
+ target: 'ref($progress_id)',
213
+ property: 'skill_points',
214
+ expression: 'ref($progress_id).skill_points - ref($def_id).cost',
215
+ },
216
+ { target: 'self', property: 'rank', expression: 'self.rank + 1' },
217
+ ],
218
+ returnExpression: 'self.rank',
219
+ invokePolicyJson: kitPolicyJson({
220
+ type: 'condition',
221
+ expression: [
222
+ ownerEqualsCaller('self.owner_user_id', kind),
223
+ ownerEqualsCaller('ref($progress_id).owner_user_id', kind),
224
+ 'self.skill_id == ref($def_id).skill_id',
225
+ 'ref($progress_id).skill_points >= ref($def_id).cost',
226
+ 'self.rank < ref($def_id).max_rank',
227
+ `if(ref($def_id).requires_skill_id == "", true, ref($prereq_id).skill_id == ref($def_id).requires_skill_id && ref($prereq_id).rank >= 1 && ${ownerEqualsCaller('ref($prereq_id).owner_user_id', kind)})`,
228
+ ].join(' && '),
229
+ }),
230
+ description: 'Buy one rank of a skill: point cost, max rank, and the prerequisite chain are all checked server-side; the spend and the rank-up are one transaction.',
231
+ },
232
+ {
233
+ name: names.unlockAchievementFn,
234
+ containerTypeName: names.achievementUnlockType,
235
+ returnType: 'bool',
236
+ parameters: [
237
+ {
238
+ name: 'progress_id',
239
+ valueType: 'container_ref',
240
+ required: true,
241
+ description: "The caller's Progress container (xp threshold source).",
242
+ },
243
+ {
244
+ name: 'def_id',
245
+ valueType: 'container_ref',
246
+ required: true,
247
+ description: 'The AchievementDef whose threshold to check.',
248
+ },
249
+ ],
250
+ mutations: [{ target: 'self', property: 'unlocked', expression: 'true' }],
251
+ returnExpression: 'self.unlocked',
252
+ invokePolicyJson: kitPolicyJson({
253
+ type: 'condition',
254
+ expression: [
255
+ ownerEqualsCaller('self.owner_user_id', kind),
256
+ ownerEqualsCaller('ref($progress_id).owner_user_id', kind),
257
+ 'self.achievement_id == ref($def_id).achievement_id',
258
+ 'ref($progress_id).xp >= ref($def_id).threshold',
259
+ ].join(' && '),
260
+ }),
261
+ description: 'Unlock an achievement once its xp threshold is met (idempotent: re-invoking just re-writes true).',
262
+ },
263
+ {
264
+ name: names.adjustRatingFn,
265
+ containerTypeName: names.progressType,
266
+ returnType: 'int',
267
+ parameters: [
268
+ {
269
+ name: 'delta',
270
+ valueType: 'int',
271
+ required: true,
272
+ description: 'Signed rating change (an ELO delta computed by the match layer).',
273
+ },
274
+ ],
275
+ mutations: [
276
+ {
277
+ target: 'self',
278
+ property: 'rating',
279
+ expression: 'max(0, self.rating + $delta)',
280
+ },
281
+ ],
282
+ returnExpression: 'self.rating',
283
+ ...trustedAuthorityFields(ratingAuthority),
284
+ description: 'Trusted rating adjustment (host-gated by default) — wired from kit.matches match results.',
285
+ },
286
+ ];
287
+ return {
288
+ name: names.progressType,
289
+ containerTypes: [
290
+ {
291
+ typeName: names.progressType,
292
+ displayName: names.progressType,
293
+ instantiableBy: 'member',
294
+ description: 'Per-player progression: xp, level, skill points, rating.',
295
+ },
296
+ {
297
+ typeName: names.skillDefType,
298
+ displayName: names.skillDefType,
299
+ instantiableBy: 'admin',
300
+ description: 'Studio skill catalog row (cost, prerequisite, max rank).',
301
+ },
302
+ {
303
+ typeName: names.skillRankType,
304
+ displayName: names.skillRankType,
305
+ instantiableBy: 'member',
306
+ description: "A player's purchased rank of one skill.",
307
+ },
308
+ {
309
+ typeName: names.achievementDefType,
310
+ displayName: names.achievementDefType,
311
+ instantiableBy: 'admin',
312
+ description: 'Studio achievement catalog row (xp threshold).',
313
+ },
314
+ {
315
+ typeName: names.achievementUnlockType,
316
+ displayName: names.achievementUnlockType,
317
+ instantiableBy: 'member',
318
+ description: "A player's unlock state for one achievement.",
319
+ },
320
+ ],
321
+ propertyDefinitions,
322
+ functions,
323
+ };
324
+ }
@@ -0,0 +1,65 @@
1
+ import { type KitBlueprint, type KitOwnerIdKind, type KitTrustedAuthority } from './core.js';
2
+ /** An event-driven quest advance: bump matching QuestProgress rows on a model event. */
3
+ export interface QuestAdvanceSpec {
4
+ /** Automation name (unique per app), e.g. `'advance-on-craft'`. */
5
+ name: string;
6
+ /** Only progress rows of this quest advance. */
7
+ questId: string;
8
+ /** The gameplay event that advances the quest (e.g. `consume_stack` invoked). */
9
+ onEvent: 'function_invoked' | 'property_changed' | 'container_created';
10
+ functionName?: string;
11
+ containerTypeName?: string;
12
+ propertyKey?: string;
13
+ debounceMs?: number;
14
+ /** Progress added per event. Defaults to 1. */
15
+ amount?: number;
16
+ /** Progress rows advanced per event. Defaults to 8. */
17
+ maxTargets?: number;
18
+ }
19
+ /** Options for {@link questsBlueprint}. */
20
+ export interface QuestsBlueprintOptions {
21
+ /** Prefix for the type/function names. Defaults to none. */
22
+ typePrefix?: string;
23
+ /**
24
+ * Who may advance quest progress. Defaults to `'server'`; use
25
+ * `'automation'` when driving progress purely through `advanceOn` event
26
+ * automations. Never plain players — they would complete their own quests.
27
+ */
28
+ advanceAuthority?: KitTrustedAuthority;
29
+ /**
30
+ * The wallet currency property that `claim_reward` pays `reward_gold`
31
+ * into. Defaults to `'gold'` (compose with the economy blueprint's
32
+ * wallet).
33
+ */
34
+ currencyProperty?: string;
35
+ /** Cron for the daily reset automation. Defaults to `'0 0 * * *'` (UTC midnight). */
36
+ dailyResetCron?: string;
37
+ /** Event automations that advance quests from gameplay functions. */
38
+ advanceOn?: QuestAdvanceSpec[];
39
+ /** Owner-mirror typing (see the kit convention). Defaults to `'int'`. */
40
+ ownerIdKind?: KitOwnerIdKind;
41
+ }
42
+ /** Names derived by {@link questsBlueprint} for a given prefix. */
43
+ export interface QuestsNames {
44
+ defType: string;
45
+ progressType: string;
46
+ advanceFn: string;
47
+ claimFn: string;
48
+ resetFn: string;
49
+ dailyResetAutomation: string;
50
+ }
51
+ /** Compute the type/function names a quests blueprint (and its runtime helper) uses. */
52
+ export declare function questsNames(typePrefix?: string): QuestsNames;
53
+ /**
54
+ * Blueprint for **quests**: an admin `QuestDef` catalog (objective count +
55
+ * reward spec + daily flag) and per-player `QuestProgress` rows. Progress
56
+ * advances through trusted calls or event automations on your gameplay
57
+ * functions; `claim_reward` marks the progress claimed AND grants the item
58
+ * and currency rewards through `container_ref` params in ONE transaction
59
+ * (composing with the inventory stack and economy wallet types); a **cron
60
+ * automation** resets daily quests at midnight.
61
+ *
62
+ * Runtime counterpart: `client.kit(appId).quests`.
63
+ */
64
+ export declare function questsBlueprint(options?: QuestsBlueprintOptions): KitBlueprint;
65
+ //# sourceMappingURL=quests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quests.d.ts","sourceRoot":"","sources":["../../../src/kit/blueprints/quests.ts"],"names":[],"mappings":"AAIA,OAAO,EAQL,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACzB,MAAM,WAAW,CAAC;AAEnB,wFAAwF;AACxF,MAAM,WAAW,gBAAgB;IAC/B,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,EAAE,kBAAkB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC;IACvE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,2CAA2C;AAC3C,MAAM,WAAW,sBAAsB;IACrC,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,mBAAmB,CAAC;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qFAAqF;IACrF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,SAAS,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC/B,yEAAyE;IACzE,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,oBAAoB,EAAE,MAAM,CAAC;CAC9B;AAED,wFAAwF;AACxF,wBAAgB,WAAW,CAAC,UAAU,SAAK,GAAG,WAAW,CAUxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,OAAO,GAAE,sBAA2B,GAAG,YAAY,CAkRlF"}