@scrolled/nav-graph 0.1.1-dev.7c21e18 → 0.1.1-dev.f60e1cd

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 (43) hide show
  1. package/README.md +12 -7
  2. package/dist/compile/compileGraph.d.ts.map +1 -1
  3. package/dist/compile/compileGraph.js +23 -0
  4. package/dist/compile/compileGraph.js.map +1 -1
  5. package/dist/dsl/builder.d.ts +41 -8
  6. package/dist/dsl/builder.d.ts.map +1 -1
  7. package/dist/dsl/builder.js +26 -4
  8. package/dist/dsl/builder.js.map +1 -1
  9. package/dist/dsl/index.d.ts +1 -1
  10. package/dist/dsl/index.d.ts.map +1 -1
  11. package/dist/dsl/index.js.map +1 -1
  12. package/dist/dsl/requirements.d.ts +2 -1
  13. package/dist/dsl/requirements.d.ts.map +1 -1
  14. package/dist/dsl/requirements.js +10 -2
  15. package/dist/dsl/requirements.js.map +1 -1
  16. package/dist/graphs/starter/index.d.ts.map +1 -1
  17. package/dist/graphs/starter/index.js +16 -7
  18. package/dist/graphs/starter/index.js.map +1 -1
  19. package/dist/index.d.ts +5 -4
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +3 -2
  22. package/dist/index.js.map +1 -1
  23. package/dist/ir/schema.d.ts +115 -31
  24. package/dist/ir/schema.d.ts.map +1 -1
  25. package/dist/ir/schema.js +20 -3
  26. package/dist/ir/schema.js.map +1 -1
  27. package/dist/ir/types.d.ts +29 -3
  28. package/dist/ir/types.d.ts.map +1 -1
  29. package/dist/ir/types.js +10 -1
  30. package/dist/ir/types.js.map +1 -1
  31. package/dist/path/findPath.d.ts +33 -0
  32. package/dist/path/findPath.d.ts.map +1 -1
  33. package/dist/path/findPath.js +135 -27
  34. package/dist/path/findPath.js.map +1 -1
  35. package/dist/path/index.d.ts +4 -2
  36. package/dist/path/index.d.ts.map +1 -1
  37. package/dist/path/index.js +2 -1
  38. package/dist/path/index.js.map +1 -1
  39. package/dist/path/unlockables.d.ts +36 -0
  40. package/dist/path/unlockables.d.ts.map +1 -0
  41. package/dist/path/unlockables.js +62 -0
  42. package/dist/path/unlockables.js.map +1 -0
  43. package/package.json +1 -1
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import type { GroupId, NodeId, Requirement } from './types';
3
3
  declare const nodeIdSchema: z.ZodEffects<z.ZodString, NodeId, string>;
4
4
  declare const groupIdSchema: z.ZodEffects<z.ZodString, GroupId, string>;
5
- declare const travelMethodSchema: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
5
+ declare const travelMethodSchema: z.ZodEnum<["walk", "transport", "portal", "npc", "item", "skill", "scroll", "other"]>;
6
6
  declare const requirementSchema: z.ZodType<Requirement>;
7
7
  declare const entityRefsSchema: z.ZodObject<{
8
8
  itemId: z.ZodOptional<z.ZodNumber>;
@@ -21,22 +21,25 @@ declare const areaNodeSchema: z.ZodObject<{
21
21
  id: z.ZodEffects<z.ZodString, NodeId, string>;
22
22
  name: z.ZodString;
23
23
  group: z.ZodOptional<z.ZodEffects<z.ZodString, GroupId, string>>;
24
+ nearestTown: z.ZodOptional<z.ZodEffects<z.ZodString, NodeId, string>>;
24
25
  }, "strip", z.ZodTypeAny, {
26
+ name: string;
25
27
  id: string & {
26
28
  readonly __brand: "NodeId";
27
29
  };
28
- name: string;
29
30
  group?: GroupId | undefined;
31
+ nearestTown?: NodeId | undefined;
30
32
  }, {
31
- id: string;
32
33
  name: string;
34
+ id: string;
33
35
  group?: string | undefined;
36
+ nearestTown?: string | undefined;
34
37
  }>;
35
- declare const travelEdgeSchema: z.ZodObject<{
38
+ declare const travelEdgeSchema: z.ZodEffects<z.ZodObject<{
36
39
  from: z.ZodEffects<z.ZodString, NodeId, string>;
37
40
  to: z.ZodEffects<z.ZodString, NodeId, string>;
38
41
  bidirectional: z.ZodOptional<z.ZodBoolean>;
39
- method: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
42
+ method: z.ZodEnum<["walk", "transport", "portal", "npc", "item", "skill", "scroll", "other"]>;
40
43
  via: z.ZodOptional<z.ZodString>;
41
44
  refs: z.ZodOptional<z.ZodObject<{
42
45
  itemId: z.ZodOptional<z.ZodNumber>;
@@ -52,8 +55,9 @@ declare const travelEdgeSchema: z.ZodObject<{
52
55
  npcId?: number | undefined;
53
56
  }>>;
54
57
  requirements: z.ZodOptional<z.ZodArray<z.ZodType<Requirement, z.ZodTypeDef, Requirement>, "many">>;
55
- weight: z.ZodOptional<z.ZodNumber>;
58
+ seconds: z.ZodOptional<z.ZodNumber>;
56
59
  notes: z.ZodOptional<z.ZodString>;
60
+ minor: z.ZodOptional<z.ZodBoolean>;
57
61
  }, "strip", z.ZodTypeAny, {
58
62
  from: string & {
59
63
  readonly __brand: "NodeId";
@@ -61,7 +65,7 @@ declare const travelEdgeSchema: z.ZodObject<{
61
65
  to: string & {
62
66
  readonly __brand: "NodeId";
63
67
  };
64
- method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
68
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
65
69
  bidirectional?: boolean | undefined;
66
70
  via?: string | undefined;
67
71
  refs?: {
@@ -70,12 +74,32 @@ declare const travelEdgeSchema: z.ZodObject<{
70
74
  npcId?: number | undefined;
71
75
  } | undefined;
72
76
  requirements?: Requirement[] | undefined;
73
- weight?: number | undefined;
77
+ seconds?: number | undefined;
74
78
  notes?: string | undefined;
79
+ minor?: boolean | undefined;
75
80
  }, {
76
81
  from: string;
77
82
  to: string;
78
- method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
83
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
84
+ bidirectional?: boolean | undefined;
85
+ via?: string | undefined;
86
+ refs?: {
87
+ itemId?: number | undefined;
88
+ questId?: number | undefined;
89
+ npcId?: number | undefined;
90
+ } | undefined;
91
+ requirements?: Requirement[] | undefined;
92
+ seconds?: number | undefined;
93
+ notes?: string | undefined;
94
+ minor?: boolean | undefined;
95
+ }>, {
96
+ from: string & {
97
+ readonly __brand: "NodeId";
98
+ };
99
+ to: string & {
100
+ readonly __brand: "NodeId";
101
+ };
102
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
79
103
  bidirectional?: boolean | undefined;
80
104
  via?: string | undefined;
81
105
  refs?: {
@@ -84,20 +108,36 @@ declare const travelEdgeSchema: z.ZodObject<{
84
108
  npcId?: number | undefined;
85
109
  } | undefined;
86
110
  requirements?: Requirement[] | undefined;
87
- weight?: number | undefined;
111
+ seconds?: number | undefined;
88
112
  notes?: string | undefined;
113
+ minor?: boolean | undefined;
114
+ }, {
115
+ from: string;
116
+ to: string;
117
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
118
+ bidirectional?: boolean | undefined;
119
+ via?: string | undefined;
120
+ refs?: {
121
+ itemId?: number | undefined;
122
+ questId?: number | undefined;
123
+ npcId?: number | undefined;
124
+ } | undefined;
125
+ requirements?: Requirement[] | undefined;
126
+ seconds?: number | undefined;
127
+ notes?: string | undefined;
128
+ minor?: boolean | undefined;
89
129
  }>;
90
130
  declare const groupDefSchema: z.ZodObject<{
91
131
  id: z.ZodEffects<z.ZodString, GroupId, string>;
92
132
  name: z.ZodString;
93
133
  }, "strip", z.ZodTypeAny, {
134
+ name: string;
94
135
  id: string & {
95
136
  readonly __brand: "GroupId";
96
137
  };
97
- name: string;
98
138
  }, {
99
- id: string;
100
139
  name: string;
140
+ id: string;
101
141
  }>;
102
142
  export declare const navGraphSourceSchema: z.ZodObject<{
103
143
  profileId: z.ZodString;
@@ -105,22 +145,25 @@ export declare const navGraphSourceSchema: z.ZodObject<{
105
145
  id: z.ZodEffects<z.ZodString, NodeId, string>;
106
146
  name: z.ZodString;
107
147
  group: z.ZodOptional<z.ZodEffects<z.ZodString, GroupId, string>>;
148
+ nearestTown: z.ZodOptional<z.ZodEffects<z.ZodString, NodeId, string>>;
108
149
  }, "strip", z.ZodTypeAny, {
150
+ name: string;
109
151
  id: string & {
110
152
  readonly __brand: "NodeId";
111
153
  };
112
- name: string;
113
154
  group?: GroupId | undefined;
155
+ nearestTown?: NodeId | undefined;
114
156
  }, {
115
- id: string;
116
157
  name: string;
158
+ id: string;
117
159
  group?: string | undefined;
160
+ nearestTown?: string | undefined;
118
161
  }>, "many">;
119
- edges: z.ZodArray<z.ZodObject<{
162
+ edges: z.ZodArray<z.ZodEffects<z.ZodObject<{
120
163
  from: z.ZodEffects<z.ZodString, NodeId, string>;
121
164
  to: z.ZodEffects<z.ZodString, NodeId, string>;
122
165
  bidirectional: z.ZodOptional<z.ZodBoolean>;
123
- method: z.ZodEnum<["walk", "portal", "npc", "item", "skill", "other"]>;
166
+ method: z.ZodEnum<["walk", "transport", "portal", "npc", "item", "skill", "scroll", "other"]>;
124
167
  via: z.ZodOptional<z.ZodString>;
125
168
  refs: z.ZodOptional<z.ZodObject<{
126
169
  itemId: z.ZodOptional<z.ZodNumber>;
@@ -136,8 +179,9 @@ export declare const navGraphSourceSchema: z.ZodObject<{
136
179
  npcId?: number | undefined;
137
180
  }>>;
138
181
  requirements: z.ZodOptional<z.ZodArray<z.ZodType<Requirement, z.ZodTypeDef, Requirement>, "many">>;
139
- weight: z.ZodOptional<z.ZodNumber>;
182
+ seconds: z.ZodOptional<z.ZodNumber>;
140
183
  notes: z.ZodOptional<z.ZodString>;
184
+ minor: z.ZodOptional<z.ZodBoolean>;
141
185
  }, "strip", z.ZodTypeAny, {
142
186
  from: string & {
143
187
  readonly __brand: "NodeId";
@@ -145,7 +189,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
145
189
  to: string & {
146
190
  readonly __brand: "NodeId";
147
191
  };
148
- method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
192
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
149
193
  bidirectional?: boolean | undefined;
150
194
  via?: string | undefined;
151
195
  refs?: {
@@ -154,12 +198,13 @@ export declare const navGraphSourceSchema: z.ZodObject<{
154
198
  npcId?: number | undefined;
155
199
  } | undefined;
156
200
  requirements?: Requirement[] | undefined;
157
- weight?: number | undefined;
201
+ seconds?: number | undefined;
158
202
  notes?: string | undefined;
203
+ minor?: boolean | undefined;
159
204
  }, {
160
205
  from: string;
161
206
  to: string;
162
- method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
207
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
163
208
  bidirectional?: boolean | undefined;
164
209
  via?: string | undefined;
165
210
  refs?: {
@@ -168,29 +213,65 @@ export declare const navGraphSourceSchema: z.ZodObject<{
168
213
  npcId?: number | undefined;
169
214
  } | undefined;
170
215
  requirements?: Requirement[] | undefined;
171
- weight?: number | undefined;
216
+ seconds?: number | undefined;
172
217
  notes?: string | undefined;
218
+ minor?: boolean | undefined;
219
+ }>, {
220
+ from: string & {
221
+ readonly __brand: "NodeId";
222
+ };
223
+ to: string & {
224
+ readonly __brand: "NodeId";
225
+ };
226
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
227
+ bidirectional?: boolean | undefined;
228
+ via?: string | undefined;
229
+ refs?: {
230
+ itemId?: number | undefined;
231
+ questId?: number | undefined;
232
+ npcId?: number | undefined;
233
+ } | undefined;
234
+ requirements?: Requirement[] | undefined;
235
+ seconds?: number | undefined;
236
+ notes?: string | undefined;
237
+ minor?: boolean | undefined;
238
+ }, {
239
+ from: string;
240
+ to: string;
241
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
242
+ bidirectional?: boolean | undefined;
243
+ via?: string | undefined;
244
+ refs?: {
245
+ itemId?: number | undefined;
246
+ questId?: number | undefined;
247
+ npcId?: number | undefined;
248
+ } | undefined;
249
+ requirements?: Requirement[] | undefined;
250
+ seconds?: number | undefined;
251
+ notes?: string | undefined;
252
+ minor?: boolean | undefined;
173
253
  }>, "many">;
174
254
  groups: z.ZodOptional<z.ZodArray<z.ZodObject<{
175
255
  id: z.ZodEffects<z.ZodString, GroupId, string>;
176
256
  name: z.ZodString;
177
257
  }, "strip", z.ZodTypeAny, {
258
+ name: string;
178
259
  id: string & {
179
260
  readonly __brand: "GroupId";
180
261
  };
181
- name: string;
182
262
  }, {
183
- id: string;
184
263
  name: string;
264
+ id: string;
185
265
  }>, "many">>;
186
266
  }, "strip", z.ZodTypeAny, {
187
267
  profileId: string;
188
268
  nodes: {
269
+ name: string;
189
270
  id: string & {
190
271
  readonly __brand: "NodeId";
191
272
  };
192
- name: string;
193
273
  group?: GroupId | undefined;
274
+ nearestTown?: NodeId | undefined;
194
275
  }[];
195
276
  edges: {
196
277
  from: string & {
@@ -199,7 +280,7 @@ export declare const navGraphSourceSchema: z.ZodObject<{
199
280
  to: string & {
200
281
  readonly __brand: "NodeId";
201
282
  };
202
- method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
283
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
203
284
  bidirectional?: boolean | undefined;
204
285
  via?: string | undefined;
205
286
  refs?: {
@@ -208,26 +289,28 @@ export declare const navGraphSourceSchema: z.ZodObject<{
208
289
  npcId?: number | undefined;
209
290
  } | undefined;
210
291
  requirements?: Requirement[] | undefined;
211
- weight?: number | undefined;
292
+ seconds?: number | undefined;
212
293
  notes?: string | undefined;
294
+ minor?: boolean | undefined;
213
295
  }[];
214
296
  groups?: {
297
+ name: string;
215
298
  id: string & {
216
299
  readonly __brand: "GroupId";
217
300
  };
218
- name: string;
219
301
  }[] | undefined;
220
302
  }, {
221
303
  profileId: string;
222
304
  nodes: {
223
- id: string;
224
305
  name: string;
306
+ id: string;
225
307
  group?: string | undefined;
308
+ nearestTown?: string | undefined;
226
309
  }[];
227
310
  edges: {
228
311
  from: string;
229
312
  to: string;
230
- method: "walk" | "portal" | "npc" | "item" | "skill" | "other";
313
+ method: "walk" | "transport" | "portal" | "npc" | "item" | "skill" | "scroll" | "other";
231
314
  bidirectional?: boolean | undefined;
232
315
  via?: string | undefined;
233
316
  refs?: {
@@ -236,12 +319,13 @@ export declare const navGraphSourceSchema: z.ZodObject<{
236
319
  npcId?: number | undefined;
237
320
  } | undefined;
238
321
  requirements?: Requirement[] | undefined;
239
- weight?: number | undefined;
322
+ seconds?: number | undefined;
240
323
  notes?: string | undefined;
324
+ minor?: boolean | undefined;
241
325
  }[];
242
326
  groups?: {
243
- id: string;
244
327
  name: string;
328
+ id: string;
245
329
  }[] | undefined;
246
330
  }>;
247
331
  export { areaNodeSchema, entityRefsSchema, groupDefSchema, groupIdSchema, nodeIdSchema, requirementSchema, travelEdgeSchema, travelMethodSchema, };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/ir/schema.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAG5D,QAAA,MAAM,YAAY,2CAIc,CAAC;AAEjC,QAAA,MAAM,aAAa,4CAIc,CAAC;AAElC,QAAA,MAAM,kBAAkB,gEAAyB,CAAC;AAElD,QAAA,MAAM,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,WAAW,CAU5C,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;EAIpB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;EAIlB,CAAC;AAEH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAUpB,CAAC;AAEH,QAAA,MAAM,cAAc;;;;;;;;;;;EAGlB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAC"}
package/dist/ir/schema.js CHANGED
@@ -21,8 +21,13 @@ const requirementSchema = z.discriminatedUnion('kind', [
21
21
  itemId: z.number().int().positive(),
22
22
  consumed: z.boolean(),
23
23
  quantity: z.number().int().positive().optional(),
24
+ name: z.string().min(1).optional(),
25
+ }),
26
+ z.object({
27
+ kind: z.literal('quest'),
28
+ questId: z.number().int().positive(),
29
+ name: z.string().min(1).optional(),
24
30
  }),
25
- z.object({ kind: z.literal('quest'), questId: z.number().int().positive() }),
26
31
  z.object({ kind: z.literal('level'), min: z.number().int().min(1).max(300) }),
27
32
  ]);
28
33
  const entityRefsSchema = z.object({
@@ -34,8 +39,10 @@ const areaNodeSchema = z.object({
34
39
  id: nodeIdSchema,
35
40
  name: z.string().min(1),
36
41
  group: groupIdSchema.optional(),
42
+ nearestTown: nodeIdSchema.optional(),
37
43
  });
38
- const travelEdgeSchema = z.object({
44
+ const travelEdgeSchema = z
45
+ .object({
39
46
  from: nodeIdSchema,
40
47
  to: nodeIdSchema,
41
48
  bidirectional: z.boolean().optional(),
@@ -43,8 +50,18 @@ const travelEdgeSchema = z.object({
43
50
  via: z.string().optional(),
44
51
  refs: entityRefsSchema.optional(),
45
52
  requirements: z.array(requirementSchema).optional(),
46
- weight: z.number().nonnegative().optional(),
53
+ seconds: z.number().positive().optional(),
47
54
  notes: z.string().optional(),
55
+ minor: z.boolean().optional(),
56
+ })
57
+ .superRefine((edge, ctx) => {
58
+ if (edge.seconds !== undefined && edge.method !== 'walk' && edge.method !== 'transport') {
59
+ ctx.addIssue({
60
+ code: z.ZodIssueCode.custom,
61
+ path: ['seconds'],
62
+ message: `seconds is only valid on walk or transport edges; "${edge.method}" transitions are instant.`,
63
+ });
64
+ }
48
65
  });
49
66
  const groupDefSchema = z.object({
50
67
  id: groupIdSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/ir/schema.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,8EAA8E;AAC9E,6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GroupId';
8
8
  };
9
- export declare const TRAVEL_METHODS: readonly ["walk", "portal", "npc", "item", "skill", "other"];
9
+ export declare const TRAVEL_METHODS: readonly ["walk", "transport", "portal", "npc", "item", "skill", "scroll", "other"];
10
10
  export type TravelMethod = (typeof TRAVEL_METHODS)[number];
11
11
  export type Requirement = {
12
12
  kind: 'meso';
@@ -16,9 +16,11 @@ export type Requirement = {
16
16
  itemId: number;
17
17
  consumed: boolean;
18
18
  quantity?: number;
19
+ name?: string;
19
20
  } | {
20
21
  kind: 'quest';
21
22
  questId: number;
23
+ name?: string;
22
24
  } | {
23
25
  kind: 'level';
24
26
  min: number;
@@ -27,6 +29,15 @@ export interface AreaNode {
27
29
  id: NodeId;
28
30
  name: string;
29
31
  group?: GroupId;
32
+ /**
33
+ * The town a "return to nearest town" scroll sends you to from this node.
34
+ * Every node is a town, so this defaults to the node itself (a scroll there
35
+ * is a no-op). Set it when the game routes the scroll elsewhere — e.g. a
36
+ * dungeon whose scroll drops you at its continent's hub town. Must reference
37
+ * a declared node. Enables an optional `scroll` edge used only when the
38
+ * traveller has declared they carry return scrolls (see findPath).
39
+ */
40
+ nearestTown?: NodeId;
30
41
  }
31
42
  export interface EntityRefs {
32
43
  itemId?: number;
@@ -43,9 +54,24 @@ export interface TravelEdge {
43
54
  via?: string;
44
55
  refs?: EntityRefs;
45
56
  requirements?: Requirement[];
46
- /** Reserved for the future weighted-cost model; BFS ignores it. */
47
- weight?: number;
57
+ /**
58
+ * Estimated travel time for this edge, in seconds. Valid only on the timed
59
+ * methods — `walk` and `transport` (boats/trains/carpets); every other method
60
+ * is an instant transition and the schema rejects `seconds` on it. Pathfinding
61
+ * minimizes the summed time of a route (Dijkstra). Omit when unknown — untimed
62
+ * timed-edges fall back to their method default, so a graph with no times set
63
+ * still routes sensibly. A `transport` edge's time is waived entirely when the
64
+ * route is found with fast travel enabled (see `findPath`).
65
+ */
66
+ seconds?: number;
48
67
  notes?: string;
68
+ /**
69
+ * Hide this edge from the default map to reduce clutter. Purely a rendering
70
+ * hint — pathfinding ignores it, so a `minor` edge is still routable and is
71
+ * drawn (highlighted) whenever it lies on the computed route. Use it for
72
+ * noisy or rarely-taken connections that would otherwise crowd the graph.
73
+ */
74
+ minor?: boolean;
49
75
  }
50
76
  export interface GroupDef {
51
77
  id: GroupId;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAKA,qFAAqF;AACrF,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAC;AAE7D,kFAAkF;AAClF,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAA;CAAE,CAAC;AAE/D,eAAO,MAAM,cAAc,8DAA+D,CAAC;AAC3F,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAE3D,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAChC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACtE;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC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AED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,OAAO,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;CACrB;AAED,oEAAoE;AACpE,eAAO,MAAM,QAAQ,GAAI,GAAG,MAAM,KAAG,MAAqB,CAAC;AAC3D,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,KAAG,OAAuB,CAAC"}
package/dist/ir/types.js CHANGED
@@ -2,7 +2,16 @@
2
2
  // autocomplete, and compile errors instead of writing JSON or a query language.
3
3
  // The shapes here are the schema the rest of the package operates on; the
4
4
  // runtime mirror lives next door in `schema.ts` (Zod).
5
- export const TRAVEL_METHODS = ['walk', 'portal', 'npc', 'item', 'skill', 'other'];
5
+ export const TRAVEL_METHODS = [
6
+ 'walk',
7
+ 'transport',
8
+ 'portal',
9
+ 'npc',
10
+ 'item',
11
+ 'skill',
12
+ 'scroll',
13
+ 'other',
14
+ ];
6
15
  /** Helper for narrowing string literals to the branded id types. */
7
16
  export const asNodeId = (s) => s;
8
17
  export const asGroupId = (s) => s;
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,0EAA0E;AAC1E,uDAAuD;AAQvD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAgD3F,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAW,CAAC;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAW,EAAE,CAAC,CAAY,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ir/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,gFAAgF;AAChF,0EAA0E;AAC1E,uDAAuD;AAQvD,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM;IACN,WAAW;IACX,QAAQ;IACR,KAAK;IACL,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;CACC,CAAC;AA6EX,oEAAoE;AACpE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,CAAW,CAAC;AAC3D,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAS,EAAW,EAAE,CAAC,CAAY,CAAC"}
@@ -1,16 +1,49 @@
1
1
  import type { NavGraph } from '../compile/compileGraph';
2
2
  import type { NodeId, TravelEdge } from '../ir/types';
3
+ /** Assumed travel time, in seconds, for a walk edge that declares no `seconds`. */
4
+ export declare const DEFAULT_WALK_SECONDS = 60;
5
+ /**
6
+ * Assumed ride time, in seconds, for a transport edge that declares no
7
+ * `seconds`. Longer than a walk hop: boarding a boat/train means waiting for it.
8
+ */
9
+ export declare const DEFAULT_TRANSPORT_SECONDS = 300;
10
+ /** Cost inputs that depend on the traveller, not the edge. */
11
+ export interface EdgeCostOptions {
12
+ /** When true, `transport` hops are instant (the player has a fast-travel ticket). */
13
+ fastTravel?: boolean;
14
+ }
15
+ /**
16
+ * Travel time an edge contributes to a route. `walk` always costs time;
17
+ * `transport` costs its ride time unless `fastTravel` waives it; portal / npc /
18
+ * item / skill transitions teleport the player instantly.
19
+ */
20
+ export declare function edgeSeconds(edge: TravelEdge, opts?: EdgeCostOptions): number;
3
21
  export interface PathResult {
4
22
  status: 'found' | 'unreachable' | 'unreachable-when-filtered';
5
23
  steps: TravelEdge[];
24
+ /** Total estimated travel time of `steps`, in seconds. 0 when `steps` empty. */
25
+ totalSeconds: number;
6
26
  fallback?: {
7
27
  steps: TravelEdge[];
28
+ totalSeconds: number;
8
29
  /** Indices into `fallback.steps` whose eligibility predicate failed. */
9
30
  blocked: number[];
10
31
  };
11
32
  }
12
33
  export interface FindPathOptions {
13
34
  eligible?: (edge: TravelEdge) => boolean;
35
+ /**
36
+ * When true, `transport` hops (boats/trains/carpets) are treated as instant —
37
+ * the traveller holds a fast-travel ticket. Affects route *cost*, never
38
+ * *reachability*: transports are always traversable either way.
39
+ */
40
+ fastTravel?: boolean;
41
+ /**
42
+ * When true, `scroll` edges (return to nearest town) are traversable — the
43
+ * traveller carries return scrolls. When false (default) they are skipped
44
+ * entirely, so a route never assumes a scroll the player doesn't have.
45
+ */
46
+ nearestTownScroll?: boolean;
14
47
  }
15
48
  export declare function findPath(graph: NavGraph, from: NodeId, to: NodeId, opts?: FindPathOptions): PathResult;
16
49
  //# sourceMappingURL=findPath.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"findPath.d.ts","sourceRoot":"","sources":["../../src/path/findPath.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,OAAO,GAAG,aAAa,GAAG,2BAA2B,CAAC;IAC9D,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE;QACT,KAAK,EAAE,UAAU,EAAE,CAAC;QACpB,wEAAwE;QACxE,OAAO,EAAE,MAAM,EAAE,CAAC;KACnB,CAAC;CACH;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,OAAO,CAAC;CAC1C;AAED,wBAAgB,QAAQ,CACtB,KAAK,EAAE,QAAQ,EACf,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,eAAoB,GACzB,UAAU,CAyBZ"}
1
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