@shipload/sdk 1.0.0-next.19 → 1.0.0-next.20

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.
@@ -1,12 +1,11 @@
1
1
  [
2
2
  {
3
3
  "outputItemId": 10001,
4
- "outputMass": 420000,
4
+ "outputMass": 4000,
5
5
  "inputs": [
6
6
  {
7
- "category": "ore",
8
- "tier": 1,
9
- "quantity": 20
7
+ "itemId": 101,
8
+ "quantity": 10
10
9
  }
11
10
  ],
12
11
  "statSlots": [
@@ -31,17 +30,15 @@
31
30
  },
32
31
  {
33
32
  "outputItemId": 10002,
34
- "outputMass": 600000,
33
+ "outputMass": 6000,
35
34
  "inputs": [
36
35
  {
37
- "category": "regolith",
38
- "tier": 1,
39
- "quantity": 30
36
+ "itemId": 401,
37
+ "quantity": 6
40
38
  },
41
39
  {
42
- "category": "biomass",
43
- "tier": 1,
44
- "quantity": 20
40
+ "itemId": 501,
41
+ "quantity": 9
45
42
  }
46
43
  ],
47
44
  "statSlots": [
@@ -66,12 +63,11 @@
66
63
  },
67
64
  {
68
65
  "outputItemId": 10003,
69
- "outputMass": 390000,
66
+ "outputMass": 4000,
70
67
  "inputs": [
71
68
  {
72
- "category": "gas",
73
- "tier": 1,
74
- "quantity": 65
69
+ "itemId": 301,
70
+ "quantity": 10
75
71
  }
76
72
  ],
77
73
  "statSlots": [
@@ -96,17 +92,15 @@
96
92
  },
97
93
  {
98
94
  "outputItemId": 10004,
99
- "outputMass": 600000,
95
+ "outputMass": 6000,
100
96
  "inputs": [
101
97
  {
102
- "category": "crystal",
103
- "tier": 1,
104
- "quantity": 25
98
+ "itemId": 201,
99
+ "quantity": 6
105
100
  },
106
101
  {
107
- "category": "biomass",
108
- "tier": 1,
109
- "quantity": 15
102
+ "itemId": 501,
103
+ "quantity": 9
110
104
  }
111
105
  ],
112
106
  "statSlots": [
@@ -131,17 +125,15 @@
131
125
  },
132
126
  {
133
127
  "outputItemId": 10005,
134
- "outputMass": 600000,
128
+ "outputMass": 6000,
135
129
  "inputs": [
136
130
  {
137
- "category": "ore",
138
- "tier": 1,
139
- "quantity": 20
131
+ "itemId": 101,
132
+ "quantity": 6
140
133
  },
141
134
  {
142
- "category": "gas",
143
- "tier": 1,
144
- "quantity": 30
135
+ "itemId": 301,
136
+ "quantity": 9
145
137
  }
146
138
  ],
147
139
  "statSlots": [
@@ -166,12 +158,11 @@
166
158
  },
167
159
  {
168
160
  "outputItemId": 10006,
169
- "outputMass": 420000,
161
+ "outputMass": 4000,
170
162
  "inputs": [
171
163
  {
172
- "category": "crystal",
173
- "tier": 1,
174
- "quantity": 30
164
+ "itemId": 201,
165
+ "quantity": 10
175
166
  }
176
167
  ],
177
168
  "statSlots": [
@@ -196,12 +187,11 @@
196
187
  },
197
188
  {
198
189
  "outputItemId": 10007,
199
- "outputMass": 420000,
190
+ "outputMass": 4000,
200
191
  "inputs": [
201
192
  {
202
- "category": "biomass",
203
- "tier": 1,
204
- "quantity": 25
193
+ "itemId": 501,
194
+ "quantity": 10
205
195
  }
206
196
  ],
207
197
  "statSlots": [
@@ -226,12 +216,11 @@
226
216
  },
227
217
  {
228
218
  "outputItemId": 10008,
229
- "outputMass": 400000,
219
+ "outputMass": 4000,
230
220
  "inputs": [
231
221
  {
232
- "category": "regolith",
233
- "tier": 1,
234
- "quantity": 45
222
+ "itemId": 401,
223
+ "quantity": 10
235
224
  }
236
225
  ],
237
226
  "statSlots": [
@@ -256,17 +245,15 @@
256
245
  },
257
246
  {
258
247
  "outputItemId": 10009,
259
- "outputMass": 590000,
248
+ "outputMass": 6000,
260
249
  "inputs": [
261
250
  {
262
- "category": "gas",
263
- "tier": 1,
264
- "quantity": 40
251
+ "itemId": 301,
252
+ "quantity": 6
265
253
  },
266
254
  {
267
- "category": "regolith",
268
- "tier": 1,
269
- "quantity": 40
255
+ "itemId": 401,
256
+ "quantity": 9
270
257
  }
271
258
  ],
272
259
  "statSlots": [
@@ -291,17 +278,15 @@
291
278
  },
292
279
  {
293
280
  "outputItemId": 10010,
294
- "outputMass": 590000,
281
+ "outputMass": 6000,
295
282
  "inputs": [
296
283
  {
297
- "category": "crystal",
298
- "tier": 1,
299
- "quantity": 20
284
+ "itemId": 201,
285
+ "quantity": 6
300
286
  },
301
287
  {
302
- "category": "ore",
303
- "tier": 1,
304
- "quantity": 15
288
+ "itemId": 101,
289
+ "quantity": 9
305
290
  }
306
291
  ],
307
292
  "statSlots": [
@@ -326,11 +311,11 @@
326
311
  },
327
312
  {
328
313
  "outputItemId": 10100,
329
- "outputMass": 940000,
314
+ "outputMass": 900000,
330
315
  "inputs": [
331
316
  {
332
317
  "itemId": 10003,
333
- "quantity": 6
318
+ "quantity": 600
334
319
  }
335
320
  ],
336
321
  "statSlots": [
@@ -355,11 +340,11 @@
355
340
  },
356
341
  {
357
342
  "outputItemId": 10101,
358
- "outputMass": 1440000,
343
+ "outputMass": 1400000,
359
344
  "inputs": [
360
345
  {
361
346
  "itemId": 10004,
362
- "quantity": 6
347
+ "quantity": 600
363
348
  }
364
349
  ],
365
350
  "statSlots": [
@@ -384,15 +369,15 @@
384
369
  },
385
370
  {
386
371
  "outputItemId": 10102,
387
- "outputMass": 1220000,
372
+ "outputMass": 1200000,
388
373
  "inputs": [
389
374
  {
390
375
  "itemId": 10005,
391
- "quantity": 3
376
+ "quantity": 300
392
377
  },
393
378
  {
394
379
  "itemId": 10006,
395
- "quantity": 3
380
+ "quantity": 300
396
381
  }
397
382
  ],
398
383
  "statSlots": [
@@ -433,11 +418,11 @@
433
418
  },
434
419
  {
435
420
  "outputItemId": 10103,
436
- "outputMass": 1010000,
421
+ "outputMass": 1000000,
437
422
  "inputs": [
438
423
  {
439
424
  "itemId": 10007,
440
- "quantity": 6
425
+ "quantity": 600
441
426
  }
442
427
  ],
443
428
  "statSlots": [
@@ -462,15 +447,15 @@
462
447
  },
463
448
  {
464
449
  "outputItemId": 10104,
465
- "outputMass": 1190000,
450
+ "outputMass": 1200000,
466
451
  "inputs": [
467
452
  {
468
453
  "itemId": 10008,
469
- "quantity": 3
454
+ "quantity": 300
470
455
  },
471
456
  {
472
457
  "itemId": 10009,
473
- "quantity": 3
458
+ "quantity": 300
474
459
  }
475
460
  ],
476
461
  "statSlots": [
@@ -495,15 +480,15 @@
495
480
  },
496
481
  {
497
482
  "outputItemId": 10105,
498
- "outputMass": 1220000,
483
+ "outputMass": 1200000,
499
484
  "inputs": [
500
485
  {
501
486
  "itemId": 10001,
502
- "quantity": 3
487
+ "quantity": 300
503
488
  },
504
489
  {
505
490
  "itemId": 10002,
506
- "quantity": 3
491
+ "quantity": 300
507
492
  }
508
493
  ],
509
494
  "statSlots": [
@@ -544,15 +529,15 @@
544
529
  },
545
530
  {
546
531
  "outputItemId": 10106,
547
- "outputMass": 1430000,
532
+ "outputMass": 1400000,
548
533
  "inputs": [
549
534
  {
550
535
  "itemId": 10004,
551
- "quantity": 3
536
+ "quantity": 300
552
537
  },
553
538
  {
554
539
  "itemId": 10010,
555
- "quantity": 3
540
+ "quantity": 300
556
541
  }
557
542
  ],
558
543
  "statSlots": [
@@ -585,15 +570,15 @@
585
570
  },
586
571
  {
587
572
  "outputItemId": 10107,
588
- "outputMass": 1420000,
573
+ "outputMass": 1400000,
589
574
  "inputs": [
590
575
  {
591
576
  "itemId": 10010,
592
- "quantity": 3
577
+ "quantity": 300
593
578
  },
594
579
  {
595
580
  "itemId": 10009,
596
- "quantity": 3
581
+ "quantity": 300
597
582
  }
598
583
  ],
599
584
  "statSlots": [
@@ -617,15 +602,15 @@
617
602
  },
618
603
  {
619
604
  "outputItemId": 10108,
620
- "outputMass": 970000,
605
+ "outputMass": 1000000,
621
606
  "inputs": [
622
607
  {
623
608
  "itemId": 10003,
624
- "quantity": 3
609
+ "quantity": 300
625
610
  },
626
611
  {
627
612
  "itemId": 10007,
628
- "quantity": 3
613
+ "quantity": 300
629
614
  }
630
615
  ],
631
616
  "statSlots": [
@@ -666,15 +651,15 @@
666
651
  },
667
652
  {
668
653
  "outputItemId": 10200,
669
- "outputMass": 1490000,
654
+ "outputMass": 1500000,
670
655
  "inputs": [
671
656
  {
672
657
  "itemId": 10001,
673
- "quantity": 6
658
+ "quantity": 600
674
659
  },
675
660
  {
676
661
  "itemId": 10002,
677
- "quantity": 2
662
+ "quantity": 200
678
663
  }
679
664
  ],
680
665
  "statSlots": [
@@ -719,11 +704,11 @@
719
704
  "inputs": [
720
705
  {
721
706
  "itemId": 10001,
722
- "quantity": 8
707
+ "quantity": 800
723
708
  },
724
709
  {
725
710
  "itemId": 10002,
726
- "quantity": 4
711
+ "quantity": 400
727
712
  }
728
713
  ],
729
714
  "statSlots": [
@@ -764,15 +749,15 @@
764
749
  },
765
750
  {
766
751
  "outputItemId": 10202,
767
- "outputMass": 5760000,
752
+ "outputMass": 5800000,
768
753
  "inputs": [
769
754
  {
770
755
  "itemId": 10001,
771
- "quantity": 20
756
+ "quantity": 2000
772
757
  },
773
758
  {
774
759
  "itemId": 10002,
775
- "quantity": 10
760
+ "quantity": 1000
776
761
  }
777
762
  ],
778
763
  "statSlots": [
@@ -813,15 +798,15 @@
813
798
  },
814
799
  {
815
800
  "outputItemId": 10203,
816
- "outputMass": 4440000,
801
+ "outputMass": 4400000,
817
802
  "inputs": [
818
803
  {
819
804
  "itemId": 10001,
820
- "quantity": 15
805
+ "quantity": 1500
821
806
  },
822
807
  {
823
808
  "itemId": 10002,
824
- "quantity": 8
809
+ "quantity": 800
825
810
  }
826
811
  ],
827
812
  "statSlots": [
@@ -862,23 +847,23 @@
862
847
  },
863
848
  {
864
849
  "outputItemId": 10204,
865
- "outputMass": 5540000,
850
+ "outputMass": 5500000,
866
851
  "inputs": [
867
852
  {
868
853
  "itemId": 10001,
869
- "quantity": 15
854
+ "quantity": 1500
870
855
  },
871
856
  {
872
857
  "itemId": 10002,
873
- "quantity": 6
858
+ "quantity": 600
874
859
  },
875
860
  {
876
861
  "itemId": 10008,
877
- "quantity": 4
862
+ "quantity": 400
878
863
  },
879
864
  {
880
865
  "itemId": 10009,
881
- "quantity": 4
866
+ "quantity": 400
882
867
  }
883
868
  ],
884
869
  "statSlots": [
@@ -919,15 +904,14 @@
919
904
  },
920
905
  {
921
906
  "outputItemId": 20001,
922
- "outputMass": 50000,
907
+ "outputMass": 500,
923
908
  "inputs": [
924
909
  {
925
910
  "itemId": 10001,
926
- "quantity": 2
911
+ "quantity": 200
927
912
  },
928
913
  {
929
- "category": "ore",
930
- "tier": 2,
914
+ "itemId": 102,
931
915
  "quantity": 15
932
916
  }
933
917
  ],
@@ -964,20 +948,18 @@
964
948
  },
965
949
  {
966
950
  "outputItemId": 20002,
967
- "outputMass": 30000,
951
+ "outputMass": 300,
968
952
  "inputs": [
969
953
  {
970
954
  "itemId": 10002,
971
- "quantity": 2
955
+ "quantity": 200
972
956
  },
973
957
  {
974
- "category": "regolith",
975
- "tier": 2,
958
+ "itemId": 402,
976
959
  "quantity": 10
977
960
  },
978
961
  {
979
- "category": "biomass",
980
- "tier": 2,
962
+ "itemId": 502,
981
963
  "quantity": 20
982
964
  }
983
965
  ],
@@ -1019,11 +1001,11 @@
1019
1001
  "inputs": [
1020
1002
  {
1021
1003
  "itemId": 20001,
1022
- "quantity": 6
1004
+ "quantity": 600
1023
1005
  },
1024
1006
  {
1025
1007
  "itemId": 20002,
1026
- "quantity": 2
1008
+ "quantity": 200
1027
1009
  }
1028
1010
  ],
1029
1011
  "statSlots": [
@@ -10,7 +10,7 @@ export function computeShipHullCapabilities(stats: Record<string, number>): {
10
10
  const exponent = statSum / 2997.0
11
11
  return {
12
12
  hullmass: computeBaseHullmass(stats),
13
- capacity: Math.floor(5000000 * 10 ** exponent),
13
+ capacity: Math.floor(5000000 * 6 ** exponent),
14
14
  }
15
15
  }
16
16
 
@@ -212,7 +212,7 @@ export function computeWarehouseHullCapabilities(stats: Record<string, number>):
212
212
  const exponent = statSum / 2997.0
213
213
  return {
214
214
  hullmass: computeBaseHullmass(stats),
215
- capacity: Math.floor(100000000 * 10 ** exponent),
215
+ capacity: Math.floor(100000000 * 6 ** exponent),
216
216
  }
217
217
  }
218
218
 
@@ -391,7 +391,7 @@ export function computeContainerCapabilities(stats: Record<string, number>): {
391
391
  const exponent = statSum / 2997.0
392
392
  return {
393
393
  hullmass: computeBaseHullmass(stats),
394
- capacity: Math.floor(20000000 * 10 ** exponent),
394
+ capacity: Math.floor(22000000 * 6 ** exponent),
395
395
  }
396
396
  }
397
397
 
@@ -407,8 +407,8 @@ export function computeContainerT2Capabilities(stats: Record<string, number>): {
407
407
  const hullmass = 70000 - 50 * density
408
408
 
409
409
  const statSum = strength + hardness + saturation
410
- const exponent = statSum / 2500
411
- const capacity = Math.floor(40000000 * 10 ** exponent)
410
+ const exponent = statSum / 2947
411
+ const capacity = Math.floor(24000000 * 6 ** exponent)
412
412
 
413
413
  return {hullmass, capacity}
414
414
  }
@@ -1,11 +1,7 @@
1
1
  import {SLOT_FORMULAS, type SlotConsumerKind} from '../data/capability-formulas'
2
2
  import {getStatDefinitions, type StatDefinition} from './stats'
3
- import {
4
- getRecipe,
5
- type Recipe,
6
- type RecipeInput,
7
- type RecipeInputCategory,
8
- } from '../data/recipes-runtime'
3
+ import {getRecipe, type Recipe} from '../data/recipes-runtime'
4
+ import {getItem} from '../data/catalog'
9
5
  import {
10
6
  ITEM_ENGINE_T1,
11
7
  ITEM_EXTRACTOR_T1_PACKED,
@@ -41,10 +37,6 @@ export const KIND_TO_ITEM_ID: Record<SlotConsumerKind, number> = {
41
37
  'container-t2': ITEM_CONTAINER_T2_PACKED,
42
38
  }
43
39
 
44
- function isCategoryInput(input: RecipeInput): input is RecipeInputCategory {
45
- return 'category' in input
46
- }
47
-
48
40
  /**
49
41
  * Walk a recipe's slot source down to the raw category stat that ultimately
50
42
  * lands in that slot. Returns the StatDefinition or undefined if the trace
@@ -60,8 +52,9 @@ function traceToRawCategoryStat(
60
52
  ): StatDefinition | undefined {
61
53
  const input = recipe.inputs[source.inputIndex]
62
54
  if (!input) return undefined
63
- if (isCategoryInput(input)) {
64
- const defs = getStatDefinitions(input.category)
55
+ const inputItem = getItem(input.itemId)
56
+ if (inputItem.type === 'resource' && inputItem.category) {
57
+ const defs = getStatDefinitions(inputItem.category)
65
58
  return defs[source.statIndex]
66
59
  }
67
60
  if (visited.has(input.itemId)) return undefined
@@ -1,6 +1,6 @@
1
1
  import {UInt64} from '@wharfkit/antelope'
2
2
  import type {ResourceCategory} from '../types'
3
- import {findItemByCategoryAndTier, getRecipe, type Recipe} from '../data/recipes-runtime'
3
+ import {getRecipe, type Recipe} from '../data/recipes-runtime'
4
4
  import {getItem} from '../data/catalog'
5
5
  import {getStatDefinitions} from './stats'
6
6
  import {deriveResourceStats} from './stratum'
@@ -58,11 +58,8 @@ function keyForStatSlot(
58
58
  function keyForRecipeInputStat(recipe: Recipe, inputIndex: number, statIndex: number): string {
59
59
  const input = recipe.inputs[inputIndex]
60
60
  if (!input) return ''
61
- if ('category' in input) {
62
- const defs = getStatDefinitions(input.category)
63
- return defs[statIndex]?.key ?? ''
64
- }
65
- // itemId-typed input — its stats follow that item's own statSlots layout.
61
+ // Every input names an item by id; its stats follow that item's own layout
62
+ // (resource stat definitions for resources, statSlots for crafted items).
66
63
  const innerKeys = getItemStatKeys(input.itemId)
67
64
  return innerKeys[statIndex] ?? ''
68
65
  }
@@ -117,10 +114,11 @@ export function computeComponentStats(
117
114
  const src = slot.sources[0]
118
115
  const key = keyForStatSlot(recipe, slot)
119
116
  const input = src ? recipe.inputs[src.inputIndex] : undefined
120
- if (!input || !('category' in input)) {
117
+ const inputItem = input ? getItem(input.itemId) : undefined
118
+ if (!inputItem || inputItem.type !== 'resource' || !inputItem.category) {
121
119
  return {key, value: Math.max(1, Math.min(999, 0))}
122
120
  }
123
- const matching = categoryStacks.find((cs) => cs.category === input.category)
121
+ const matching = categoryStacks.find((cs) => cs.category === inputItem.category)
124
122
  const value = matching ? blendStacks(matching.stacks, key) : 0
125
123
  return {key, value: Math.max(1, Math.min(999, value))}
126
124
  })
@@ -147,7 +145,7 @@ export function computeEntityStats(
147
145
  const key = keyForStatSlot(recipe, slot)
148
146
  if (!src) return {key, value: 1}
149
147
  const input = recipe.inputs[src.inputIndex]
150
- if (!input || 'category' in input) {
148
+ if (!input) {
151
149
  return {key, value: 1}
152
150
  }
153
151
  const blended = blendedByComponent[input.itemId] ?? {}
@@ -185,12 +183,7 @@ export function computeInputMass(itemId: number): number {
185
183
 
186
184
  let total = 0
187
185
  for (const input of recipe.inputs) {
188
- if ('itemId' in input) {
189
- total += getItem(input.itemId).mass * input.quantity
190
- } else {
191
- const item = findItemByCategoryAndTier(input.category, input.tier)
192
- total += item.mass * input.quantity
193
- }
186
+ total += getItem(input.itemId).mass * input.quantity
194
187
  }
195
188
  return total
196
189
  }
@@ -305,10 +298,13 @@ export function computeCraftedOutputStats(
305
298
  const key = keyForRecipeInputStat(recipe, src.inputIndex, src.statIndex)
306
299
  const input = recipe.inputs[src.inputIndex]
307
300
  let value = 0
308
- if (input && 'category' in input) {
309
- value = blendStacks(decodedByCategory[input.category] ?? [], key)
310
- } else if (input) {
311
- value = blendedByItem[input.itemId]?.[key] ?? 0
301
+ if (input) {
302
+ const inputItem = getItem(input.itemId)
303
+ if (inputItem.type === 'resource' && inputItem.category) {
304
+ value = blendStacks(decodedByCategory[inputItem.category] ?? [], key)
305
+ } else {
306
+ value = blendedByItem[input.itemId]?.[key] ?? 0
307
+ }
312
308
  }
313
309
  out.push(Math.max(1, Math.min(999, value)))
314
310
  } else {
@@ -319,10 +315,13 @@ export function computeCraftedOutputStats(
319
315
  const input = recipe.inputs[src.inputIndex]
320
316
  const weight = recipe.blendWeights[src.inputIndex] ?? 1
321
317
  let value = 0
322
- if (input && 'category' in input) {
323
- value = blendStacks(decodedByCategory[input.category] ?? [], key)
324
- } else if (input) {
325
- value = blendedByItem[input.itemId]?.[key] ?? 0
318
+ if (input) {
319
+ const inputItem = getItem(input.itemId)
320
+ if (inputItem.type === 'resource' && inputItem.category) {
321
+ value = blendStacks(decodedByCategory[inputItem.category] ?? [], key)
322
+ } else {
323
+ value = blendedByItem[input.itemId]?.[key] ?? 0
324
+ }
326
325
  }
327
326
  weightedSum += value * weight
328
327
  totalWeight += weight