@shipload/sdk 1.0.0-next.0 → 1.0.0-next.10

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 (51) hide show
  1. package/lib/shipload.d.ts +512 -320
  2. package/lib/shipload.js +1960 -1060
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +1920 -1056
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +8 -3
  7. package/src/capabilities/modules.ts +3 -0
  8. package/src/capabilities/storage.ts +1 -1
  9. package/src/contracts/platform.ts +13 -1
  10. package/src/contracts/server.ts +227 -282
  11. package/src/data/capabilities.ts +5 -330
  12. package/src/data/capability-formulas.ts +70 -0
  13. package/src/data/catalog.ts +0 -5
  14. package/src/data/colors.ts +2 -16
  15. package/src/data/entities.json +33 -10
  16. package/src/data/item-ids.ts +3 -1
  17. package/src/data/items.json +258 -0
  18. package/src/data/metadata.ts +57 -1
  19. package/src/data/recipes-runtime.ts +1 -0
  20. package/src/data/recipes.json +82 -11
  21. package/src/derivation/capability-mappings.ts +122 -0
  22. package/src/derivation/index.ts +1 -0
  23. package/src/derivation/resources.ts +116 -37
  24. package/src/derivation/stats.ts +1 -2
  25. package/src/entities/container.ts +25 -10
  26. package/src/entities/extractor.ts +144 -0
  27. package/src/entities/gamestate.ts +0 -9
  28. package/src/entities/makers.ts +71 -20
  29. package/src/entities/ship-deploy.ts +114 -56
  30. package/src/entities/ship.ts +17 -0
  31. package/src/entities/slot-multiplier.ts +21 -0
  32. package/src/entities/warehouse.ts +20 -3
  33. package/src/index-module.ts +67 -26
  34. package/src/managers/actions.ts +53 -80
  35. package/src/managers/entities.ts +31 -17
  36. package/src/managers/locations.ts +2 -20
  37. package/src/nft/atomicdata.ts +125 -0
  38. package/src/nft/description.ts +41 -7
  39. package/src/nft/index.ts +1 -0
  40. package/src/resolution/resolve-item.ts +17 -9
  41. package/src/scheduling/accessor.ts +4 -0
  42. package/src/scheduling/projection.ts +8 -0
  43. package/src/scheduling/schedule.ts +15 -1
  44. package/src/scheduling/task-cargo.ts +47 -0
  45. package/src/subscriptions/connection.ts +50 -2
  46. package/src/subscriptions/manager.ts +81 -2
  47. package/src/travel/travel.ts +61 -2
  48. package/src/types/entity-traits.ts +64 -1
  49. package/src/types.ts +11 -1
  50. package/src/utils/cargo.ts +27 -0
  51. package/src/utils/system.ts +25 -24
@@ -8,7 +8,6 @@ export interface StatMapping {
8
8
  stat: string
9
9
  capability: string
10
10
  attribute: string
11
- rationale: string
12
11
  }
13
12
 
14
13
  export const capabilityNames: string[] = [
@@ -27,6 +26,11 @@ export const capabilityNames: string[] = [
27
26
  export const capabilityAttributes: CapabilityAttribute[] = [
28
27
  {capability: 'Hull', attribute: 'mass', description: 'Total mass of the hull'},
29
28
  {capability: 'Storage', attribute: 'capacity', description: 'Maximum mass that can be stored'},
29
+ {
30
+ capability: 'Storage',
31
+ attribute: 'bonus',
32
+ description: 'Capacity bonus added by an installed Storage module',
33
+ },
30
34
  {capability: 'Movement', attribute: 'thrust', description: 'Propulsion force'},
31
35
  {capability: 'Movement', attribute: 'drain', description: 'Energy consumed per movement'},
32
36
  {capability: 'Energy', attribute: 'capacity', description: 'Maximum energy storage'},
@@ -65,323 +69,6 @@ export const capabilityAttributes: CapabilityAttribute[] = [
65
69
  },
66
70
  ]
67
71
 
68
- export const statMappings: StatMapping[] = [
69
- {
70
- stat: 'Strength',
71
- capability: 'Gathering',
72
- attribute: 'yield',
73
- rationale: 'Raw mechanical force drives faster gathering',
74
- },
75
- {
76
- stat: 'Strength',
77
- capability: 'Storage',
78
- attribute: 'capacity',
79
- rationale: 'Stronger walls hold more capacity per mass',
80
- },
81
- {
82
- stat: 'Strength',
83
- capability: 'Launch',
84
- attribute: 'capacity',
85
- rationale: 'Stronger housing handles larger launch loads',
86
- },
87
- {
88
- stat: 'Tolerance',
89
- capability: 'Movement',
90
- attribute: 'thrust',
91
- rationale: 'Engine components that tolerate more can push harder',
92
- },
93
- {
94
- stat: 'Tolerance',
95
- capability: 'Energy',
96
- attribute: 'recharge',
97
- rationale: 'Generator housing withstands stress for faster recharge',
98
- },
99
- {
100
- stat: 'Tolerance',
101
- capability: 'Gathering',
102
- attribute: 'depth',
103
- rationale: 'Housing withstands pressure/heat at extreme depths',
104
- },
105
- {
106
- stat: 'Tolerance',
107
- capability: 'Warp',
108
- attribute: 'range',
109
- rationale: 'Warp drive housing withstands extreme forces',
110
- },
111
- {
112
- stat: 'Density',
113
- capability: 'Hull',
114
- attribute: 'mass',
115
- rationale: 'Lighter metal = lighter hull',
116
- },
117
- {
118
- stat: 'Density',
119
- capability: 'Loader',
120
- attribute: 'mass',
121
- rationale: 'Lighter metal = lighter loader units',
122
- },
123
- {
124
- stat: 'Density',
125
- capability: 'Movement',
126
- attribute: 'drain',
127
- rationale: 'Lighter components require less energy to move',
128
- },
129
- {
130
- stat: 'Conductivity',
131
- capability: 'Movement',
132
- attribute: 'drain',
133
- rationale: 'Efficient energy transfer reduces movement energy cost',
134
- },
135
- {
136
- stat: 'Conductivity',
137
- capability: 'Gathering',
138
- attribute: 'drain',
139
- rationale: 'Efficient energy transfer reduces gathering energy cost',
140
- },
141
- {
142
- stat: 'Conductivity',
143
- capability: 'Crafter',
144
- attribute: 'drain',
145
- rationale: 'Efficient energy transfer reduces crafting energy cost',
146
- },
147
- {
148
- stat: 'Conductivity',
149
- capability: 'Energy',
150
- attribute: 'recharge',
151
- rationale: 'Better conductivity speeds energy flow during recharge',
152
- },
153
- {
154
- stat: 'Ductility',
155
- capability: 'Crafter',
156
- attribute: 'quality',
157
- rationale: 'Precise shaping enables tighter crafting tolerances',
158
- },
159
- {
160
- stat: 'Ductility',
161
- capability: 'Gathering',
162
- attribute: 'yield',
163
- rationale: 'Precisely shaped conduit components gather faster',
164
- },
165
- {
166
- stat: 'Ductility',
167
- capability: 'Storage',
168
- attribute: 'capacity',
169
- rationale: 'Precision-formed container walls maximize volume',
170
- },
171
- {
172
- stat: 'Ductility',
173
- capability: 'Loader',
174
- attribute: 'mass',
175
- rationale: 'Precision-formed precious metal reduces loader unit mass',
176
- },
177
- {
178
- stat: 'Reflectivity',
179
- capability: 'Gathering',
180
- attribute: 'depth',
181
- rationale: 'Reflective heat shielding protects equipment at depth',
182
- },
183
- {
184
- stat: 'Reflectivity',
185
- capability: 'Launch',
186
- attribute: 'range',
187
- rationale: 'Reflective surfaces focus electromagnetic launch energy',
188
- },
189
- {
190
- stat: 'Volatility',
191
- capability: 'Gathering',
192
- attribute: 'yield',
193
- rationale: 'Energy release powers faster gathering',
194
- },
195
- {
196
- stat: 'Volatility',
197
- capability: 'Movement',
198
- attribute: 'thrust',
199
- rationale: 'Energy release drives propulsion force',
200
- },
201
- {
202
- stat: 'Volatility',
203
- capability: 'Loader',
204
- attribute: 'thrust',
205
- rationale: 'Energy release powers loader motors',
206
- },
207
- {
208
- stat: 'Volatility',
209
- capability: 'Launch',
210
- attribute: 'capacity',
211
- rationale: 'Energy release enables launching heavier payloads',
212
- },
213
- {
214
- stat: 'Reactivity',
215
- capability: 'Crafter',
216
- attribute: 'speed',
217
- rationale: 'Reactive gases accelerate chemical/thermal processing',
218
- },
219
- {
220
- stat: 'Reactivity',
221
- capability: 'Gathering',
222
- attribute: 'speed',
223
- rationale: 'Reactive gases manage heat/friction during gathering',
224
- },
225
- {
226
- stat: 'Reactivity',
227
- capability: 'Launch',
228
- attribute: 'drain',
229
- rationale: 'Reactive gas medium reduces electromagnetic resistance',
230
- },
231
- {
232
- stat: 'Thermal',
233
- capability: 'Crafter',
234
- attribute: 'quality',
235
- rationale: 'Precise thermal control during fabrication',
236
- },
237
- {
238
- stat: 'Thermal',
239
- capability: 'Gathering',
240
- attribute: 'drain',
241
- rationale: 'Thermal management reduces energy waste during gathering',
242
- },
243
- {
244
- stat: 'Thermal',
245
- capability: 'Energy',
246
- attribute: 'capacity',
247
- rationale: 'Thermal management enables denser energy storage',
248
- },
249
- {
250
- stat: 'Resonance',
251
- capability: 'Energy',
252
- attribute: 'capacity',
253
- rationale: 'Resonating crystals store energy in fields',
254
- },
255
- {
256
- stat: 'Resonance',
257
- capability: 'Warp',
258
- attribute: 'range',
259
- rationale: 'Resonant crystals amplify warp field projection',
260
- },
261
- {
262
- stat: 'Resonance',
263
- capability: 'Launch',
264
- attribute: 'range',
265
- rationale: 'Resonant crystals focus electromagnetic launch field',
266
- },
267
- {
268
- stat: 'Resonance',
269
- capability: 'Launch',
270
- attribute: 'capacity',
271
- rationale: 'Stronger resonant field launches heavier payloads',
272
- },
273
- {
274
- stat: 'Hardness',
275
- capability: 'Crafter',
276
- attribute: 'speed',
277
- rationale: 'Hard tooling surfaces cut and shape materials faster',
278
- },
279
- {
280
- stat: 'Hardness',
281
- capability: 'Launch',
282
- attribute: 'drain',
283
- rationale: 'Hard rail surfaces reduce friction, less energy wasted',
284
- },
285
- {
286
- stat: 'Clarity',
287
- capability: 'Energy',
288
- attribute: 'recharge',
289
- rationale: 'Flawless crystals enable smoother energy flow during recharge',
290
- },
291
- {
292
- stat: 'Clarity',
293
- capability: 'Crafter',
294
- attribute: 'quality',
295
- rationale: 'Precision optics for calibration during fabrication',
296
- },
297
- {
298
- stat: 'Clarity',
299
- capability: 'Crafter',
300
- attribute: 'drain',
301
- rationale: 'Precision computing optimizes energy routing in factory',
302
- },
303
- {
304
- stat: 'Plasticity',
305
- capability: 'Crafter',
306
- attribute: 'speed',
307
- rationale: 'Easily reshaped materials speed up processing',
308
- },
309
- {
310
- stat: 'Plasticity',
311
- capability: 'Movement',
312
- attribute: 'thrust',
313
- rationale: 'Flexible polymer seals reduce friction in propulsion',
314
- },
315
- {
316
- stat: 'Plasticity',
317
- capability: 'Loader',
318
- attribute: 'thrust',
319
- rationale: 'Flexible joints improve loader force transfer',
320
- },
321
- {
322
- stat: 'Insulation',
323
- capability: 'Movement',
324
- attribute: 'drain',
325
- rationale: 'Better insulation reduces energy loss during movement',
326
- },
327
- {
328
- stat: 'Insulation',
329
- capability: 'Gathering',
330
- attribute: 'drain',
331
- rationale: 'Better insulation reduces energy loss during gathering',
332
- },
333
- {
334
- stat: 'Insulation',
335
- capability: 'Crafter',
336
- attribute: 'drain',
337
- rationale: 'Better insulation reduces energy loss during crafting',
338
- },
339
- {
340
- stat: 'Insulation',
341
- capability: 'Launch',
342
- attribute: 'drain',
343
- rationale: 'Better insulation reduces energy loss during launch',
344
- },
345
- {
346
- stat: 'Purity',
347
- capability: 'Storage',
348
- attribute: 'capacity',
349
- rationale: 'Purer composites make better containers',
350
- },
351
- {
352
- stat: 'Purity',
353
- capability: 'Gathering',
354
- attribute: 'speed',
355
- rationale: 'Purer bio-lubricants reduce friction during gathering',
356
- },
357
- {
358
- stat: 'Purity',
359
- capability: 'Energy',
360
- attribute: 'capacity',
361
- rationale: 'Purer organic electrolytes store more charge',
362
- },
363
- {
364
- stat: 'Resonance',
365
- capability: 'Hauler',
366
- attribute: 'capacity',
367
- rationale:
368
- 'Resonant field strength determines how many targets the haul beam can lock onto simultaneously.',
369
- },
370
- {
371
- stat: 'Conductivity',
372
- capability: 'Hauler',
373
- attribute: 'efficiency',
374
- rationale: 'Energy-transfer efficiency reduces the thrust penalty from each hauled target.',
375
- },
376
- {
377
- stat: 'Clarity',
378
- capability: 'Hauler',
379
- attribute: 'drain',
380
- rationale:
381
- 'Clarity-focused energy routing reduces per-target drain during haul-beam operation.',
382
- },
383
- ]
384
-
385
72
  const invertedAttributes = new Set(['drain', 'mass'])
386
73
 
387
74
  export function isInvertedAttribute(attribute: string): boolean {
@@ -394,15 +81,3 @@ export function getCapabilityAttributes(capability?: string): CapabilityAttribut
394
81
  }
395
82
  return capabilityAttributes
396
83
  }
397
-
398
- export function getStatMappings(): StatMapping[] {
399
- return statMappings
400
- }
401
-
402
- export function getStatMappingsForStat(stat: string): StatMapping[] {
403
- return statMappings.filter((m) => m.stat === stat)
404
- }
405
-
406
- export function getStatMappingsForCapability(capability: string): StatMapping[] {
407
- return statMappings.filter((m) => m.capability === capability)
408
- }
@@ -0,0 +1,70 @@
1
+ export interface SlotConsumer {
2
+ capability: string
3
+ attribute: string
4
+ }
5
+
6
+ export type SlotConsumerKind =
7
+ | 'engine'
8
+ | 'generator'
9
+ | 'gatherer'
10
+ | 'loader'
11
+ | 'crafter'
12
+ | 'storage'
13
+ | 'hauler'
14
+ | 'warp'
15
+ | 'ship-t1'
16
+ | 'container-t1'
17
+ | 'warehouse-t1'
18
+ | 'extractor-t1'
19
+ | 'container-t2'
20
+
21
+ const ENTITY_HULL_SLOTS: Record<number, SlotConsumer> = {
22
+ 0: {capability: 'Storage', attribute: 'capacity'},
23
+ 1: {capability: 'Hull', attribute: 'mass'},
24
+ 2: {capability: 'Storage', attribute: 'capacity'},
25
+ 3: {capability: 'Storage', attribute: 'capacity'},
26
+ }
27
+
28
+ export const SLOT_FORMULAS: Record<SlotConsumerKind, Record<number, SlotConsumer>> = {
29
+ engine: {
30
+ 0: {capability: 'Movement', attribute: 'thrust'},
31
+ 1: {capability: 'Movement', attribute: 'drain'},
32
+ },
33
+ generator: {
34
+ 0: {capability: 'Energy', attribute: 'capacity'},
35
+ 1: {capability: 'Energy', attribute: 'recharge'},
36
+ },
37
+ gatherer: {
38
+ 0: {capability: 'Gathering', attribute: 'yield'},
39
+ 1: {capability: 'Gathering', attribute: 'depth'},
40
+ 3: {capability: 'Gathering', attribute: 'drain'},
41
+ 4: {capability: 'Gathering', attribute: 'speed'},
42
+ },
43
+ loader: {
44
+ 0: {capability: 'Loader', attribute: 'mass'},
45
+ 1: {capability: 'Loader', attribute: 'thrust'},
46
+ },
47
+ crafter: {
48
+ 0: {capability: 'Crafter', attribute: 'speed'},
49
+ 1: {capability: 'Crafter', attribute: 'drain'},
50
+ },
51
+ storage: {
52
+ 0: {capability: 'Storage', attribute: 'bonus'},
53
+ 1: {capability: 'Storage', attribute: 'bonus'},
54
+ 2: {capability: 'Storage', attribute: 'bonus'},
55
+ 3: {capability: 'Storage', attribute: 'bonus'},
56
+ },
57
+ hauler: {
58
+ 0: {capability: 'Hauler', attribute: 'capacity'},
59
+ 1: {capability: 'Hauler', attribute: 'efficiency'},
60
+ 2: {capability: 'Hauler', attribute: 'drain'},
61
+ },
62
+ warp: {
63
+ 0: {capability: 'Warp', attribute: 'range'},
64
+ },
65
+ 'ship-t1': ENTITY_HULL_SLOTS,
66
+ 'container-t1': ENTITY_HULL_SLOTS,
67
+ 'warehouse-t1': ENTITY_HULL_SLOTS,
68
+ 'extractor-t1': ENTITY_HULL_SLOTS,
69
+ 'container-t2': ENTITY_HULL_SLOTS,
70
+ }
@@ -1,6 +1,5 @@
1
1
  import {UInt16, type UInt16Type} from '@wharfkit/antelope'
2
2
  import items from './items.json'
3
- import {tierLabels} from './colors'
4
3
  import {itemMetadata} from './metadata'
5
4
  import {
6
5
  CATEGORY_LABELS,
@@ -115,10 +114,6 @@ export function categoryLabel(cat: ResourceCategory): string {
115
114
  return CATEGORY_LABELS[cat]
116
115
  }
117
116
 
118
- export function tierLabel(tier: number): string {
119
- return tierLabels[tier] ?? `T${tier}`
120
- }
121
-
122
117
  // Chain rescat enum order from server::getrescats.
123
118
  // IMPORTANT: gas=1, crystal=4 — does NOT match the player-facing T-prefix
124
119
  // order (ore=100, crystal=200, gas=300, regolith=400, biomass=500).
@@ -21,22 +21,6 @@ export const tierColors: Record<number, string> = {
21
21
  10: '#ffffff',
22
22
  }
23
23
 
24
- // Rarity-tier names (badge labels). Kept disjoint from TIER_ADJECTIVES in
25
- // types.ts (resource descriptors like "Pristine Ore") so the two vocabularies
26
- // never collide at any tier.
27
- export const tierLabels: Record<number, string> = {
28
- 1: 'Common',
29
- 2: 'Uncommon',
30
- 3: 'Rare',
31
- 4: 'Epic',
32
- 5: 'Legendary',
33
- 6: 'Mythic',
34
- 7: 'Divine',
35
- 8: 'Celestial',
36
- 9: 'Eternal',
37
- 10: 'Transcendent',
38
- }
39
-
40
24
  export const categoryIcons: Record<ResourceCategory, string> = {
41
25
  ore: '⬡',
42
26
  crystal: '◈',
@@ -75,6 +59,8 @@ export const itemAbbreviations: Record<number, string> = {
75
59
  10103: 'LD',
76
60
  10104: 'MF',
77
61
  10105: 'ST',
62
+ 10106: 'HL',
63
+ 10107: 'WP',
78
64
  10200: 'CT',
79
65
  10201: 'SH',
80
66
  10202: 'WH',
@@ -7,19 +7,24 @@
7
7
  "entityItemId": 10201,
8
8
  "slots": [
9
9
  {
10
- "type": "any"
10
+ "type": "any",
11
+ "outputPct": 100
11
12
  },
12
13
  {
13
- "type": "any"
14
+ "type": "any",
15
+ "outputPct": 100
14
16
  },
15
17
  {
16
- "type": "any"
18
+ "type": "any",
19
+ "outputPct": 100
17
20
  },
18
21
  {
19
- "type": "any"
22
+ "type": "any",
23
+ "outputPct": 100
20
24
  },
21
25
  {
22
- "type": "any"
26
+ "type": "any",
27
+ "outputPct": 100
23
28
  }
24
29
  ]
25
30
  },
@@ -27,19 +32,37 @@
27
32
  "entityItemId": 10202,
28
33
  "slots": [
29
34
  {
30
- "type": "loader"
35
+ "type": "loader",
36
+ "outputPct": 100
31
37
  },
32
38
  {
33
- "type": "storage"
39
+ "type": "storage",
40
+ "outputPct": 100
34
41
  },
35
42
  {
36
- "type": "storage"
43
+ "type": "storage",
44
+ "outputPct": 100
37
45
  },
38
46
  {
39
- "type": "storage"
47
+ "type": "storage",
48
+ "outputPct": 100
40
49
  },
41
50
  {
42
- "type": "storage"
51
+ "type": "storage",
52
+ "outputPct": 100
53
+ }
54
+ ]
55
+ },
56
+ {
57
+ "entityItemId": 10203,
58
+ "slots": [
59
+ {
60
+ "type": "generator",
61
+ "outputPct": 100
62
+ },
63
+ {
64
+ "type": "gatherer",
65
+ "outputPct": 100
43
66
  }
44
67
  ]
45
68
  },
@@ -1,4 +1,4 @@
1
- // Synced from game/build/catalog via `make sync-catalog` — do not edit.
1
+ // Generated by scripts/build-catalog.ts — do not edit.
2
2
 
3
3
  export const ITEM_ORE_T1 = 101
4
4
  export const ITEM_ORE_T2 = 102
@@ -67,9 +67,11 @@ export const ITEM_LOADER_T1 = 10103
67
67
  export const ITEM_CRAFTER_T1 = 10104
68
68
  export const ITEM_STORAGE_T1 = 10105
69
69
  export const ITEM_HAULER_T1 = 10106
70
+ export const ITEM_WARP_T1 = 10107
70
71
  export const ITEM_CONTAINER_T1_PACKED = 10200
71
72
  export const ITEM_SHIP_T1_PACKED = 10201
72
73
  export const ITEM_WAREHOUSE_T1_PACKED = 10202
74
+ export const ITEM_EXTRACTOR_T1_PACKED = 10203
73
75
  export const ITEM_HULL_PLATES_T2 = 20001
74
76
  export const ITEM_CARGO_LINING_T2 = 20002
75
77
  export const ITEM_CONTAINER_T2_PACKED = 20200