@shipload/sdk 0.7.1 → 1.0.0-next.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 (94) hide show
  1. package/lib/shipload.d.ts +2730 -287
  2. package/lib/shipload.js +10862 -2229
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +10434 -2171
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +11 -20
  7. package/src/capabilities/crafting.ts +22 -0
  8. package/src/capabilities/gathering.ts +36 -0
  9. package/src/capabilities/guards.ts +38 -0
  10. package/src/capabilities/hauling.ts +22 -0
  11. package/src/capabilities/index.ts +8 -0
  12. package/src/capabilities/loading.ts +8 -0
  13. package/src/capabilities/modules.ts +86 -0
  14. package/src/capabilities/movement.ts +29 -0
  15. package/src/capabilities/storage.ts +159 -0
  16. package/src/contracts/server.ts +1389 -285
  17. package/src/data/capabilities.ts +408 -0
  18. package/src/data/catalog.ts +135 -0
  19. package/src/data/categories.ts +55 -0
  20. package/src/data/colors.ts +84 -0
  21. package/src/data/entities.json +50 -0
  22. package/src/data/item-ids.ts +75 -0
  23. package/src/data/items.json +252 -0
  24. package/src/data/locations.ts +53 -0
  25. package/src/data/metadata.ts +208 -0
  26. package/src/data/nebula-adjectives.json +211 -0
  27. package/src/data/nebula-nouns.json +151 -0
  28. package/src/data/recipes-runtime.ts +65 -0
  29. package/src/data/recipes.json +878 -0
  30. package/src/data/syllables.json +1790 -0
  31. package/src/data/tiers.ts +45 -0
  32. package/src/derivation/crafting.ts +350 -0
  33. package/src/derivation/index.ts +32 -0
  34. package/src/derivation/location-size.ts +15 -0
  35. package/src/derivation/resources.ts +112 -0
  36. package/src/derivation/stats.ts +146 -0
  37. package/src/derivation/strata.ts +43 -0
  38. package/src/derivation/stratum.ts +134 -0
  39. package/src/derivation/tiers.ts +54 -0
  40. package/src/entities/cargo-utils.ts +84 -0
  41. package/src/entities/container.ts +108 -0
  42. package/src/entities/entity-inventory.ts +39 -0
  43. package/src/entities/gamestate.ts +152 -0
  44. package/src/entities/inventory-accessor.ts +42 -0
  45. package/src/entities/location.ts +60 -0
  46. package/src/entities/makers.ts +196 -0
  47. package/src/entities/player.ts +15 -0
  48. package/src/entities/ship-deploy.ts +258 -0
  49. package/src/entities/ship.ts +204 -0
  50. package/src/entities/warehouse.ts +119 -0
  51. package/src/errors.ts +100 -9
  52. package/src/format.ts +12 -0
  53. package/src/index-module.ts +317 -7
  54. package/src/managers/actions.ts +250 -0
  55. package/src/managers/base.ts +25 -0
  56. package/src/managers/context.ts +114 -0
  57. package/src/managers/entities.ts +103 -0
  58. package/src/managers/epochs.ts +47 -0
  59. package/src/managers/index.ts +9 -0
  60. package/src/managers/locations.ts +68 -0
  61. package/src/managers/players.ts +13 -0
  62. package/src/nft/description.ts +176 -0
  63. package/src/nft/deserializers.ts +83 -0
  64. package/src/nft/index.ts +2 -0
  65. package/src/resolution/describe-module.ts +166 -0
  66. package/src/resolution/display-name.ts +39 -0
  67. package/src/resolution/resolve-item.ts +358 -0
  68. package/src/scheduling/accessor.ts +82 -0
  69. package/src/{epoch.ts → scheduling/epoch.ts} +1 -1
  70. package/src/scheduling/projection.ts +463 -0
  71. package/src/scheduling/schedule.ts +179 -0
  72. package/src/shipload.ts +47 -160
  73. package/src/subscriptions/connection.ts +154 -0
  74. package/src/subscriptions/debug.ts +17 -0
  75. package/src/subscriptions/index.ts +5 -0
  76. package/src/subscriptions/manager.ts +240 -0
  77. package/src/subscriptions/mappers.ts +28 -0
  78. package/src/subscriptions/types.ts +143 -0
  79. package/src/travel/travel.ts +500 -0
  80. package/src/types/capabilities.ts +76 -0
  81. package/src/types/entity-traits.ts +69 -0
  82. package/src/types/entity.ts +39 -0
  83. package/src/types/index.ts +3 -0
  84. package/src/types.ts +140 -35
  85. package/src/{hash.ts → utils/hash.ts} +2 -2
  86. package/src/utils/system.ts +168 -0
  87. package/src/goods.ts +0 -124
  88. package/src/market.ts +0 -214
  89. package/src/rolls.ts +0 -8
  90. package/src/ship.ts +0 -36
  91. package/src/state.ts +0 -0
  92. package/src/syllables.ts +0 -1184
  93. package/src/system.ts +0 -37
  94. package/src/travel.ts +0 -259
package/lib/shipload.d.ts CHANGED
@@ -1,6 +1,8 @@
1
- import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, Int64, UInt16, TimePoint, UInt8, Float64, Int64Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
1
+ import * as _wharfkit_antelope from '@wharfkit/antelope';
2
+ import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt8, Int64, UInt16, TimePoint, Bytes, Int32, UInt16Type, UInt8Type, TimePointType, Int64Type, Int32Type, Checksum512, APIClient } from '@wharfkit/antelope';
3
+ import * as _wharfkit_contract from '@wharfkit/contract';
2
4
  import { Contract as Contract$2, PartialBy, ContractArgs, ActionOptions, Table } from '@wharfkit/contract';
3
- import { ChainDefinition } from '@wharfkit/session';
5
+ import { ChainDefinition } from '@wharfkit/common';
4
6
 
5
7
  declare const abiBlob$1: Blob;
6
8
  declare const abi$1: ABI;
@@ -156,29 +158,74 @@ declare namespace platform {
156
158
  declare const abiBlob: Blob;
157
159
  declare const abi: ABI;
158
160
  declare namespace Types {
161
+ class addmodule extends Struct {
162
+ entity_type: Name;
163
+ entity_id: UInt64;
164
+ module_index: UInt8;
165
+ module_cargo_id: UInt64;
166
+ target_cargo_id: UInt64;
167
+ }
168
+ class addnexus extends Struct {
169
+ nexus_name: string;
170
+ x: Int64;
171
+ y: Int64;
172
+ }
159
173
  class advance extends Struct {
160
174
  reveal: string;
161
175
  commit: Checksum256;
162
176
  }
163
- class arrive extends Struct {
177
+ class packed_module extends Struct {
178
+ item_id: UInt16;
179
+ stats: UInt64;
180
+ }
181
+ class module_entry extends Struct {
182
+ type: UInt8;
183
+ installed?: packed_module;
184
+ }
185
+ class cargo_item extends Struct {
186
+ item_id: UInt16;
187
+ quantity: UInt32;
188
+ stats: UInt64;
189
+ modules: module_entry[];
190
+ }
191
+ class blend extends Struct {
192
+ entity_type: Name;
164
193
  id: UInt64;
194
+ inputs: cargo_item[];
165
195
  }
166
- class buygoods extends Struct {
167
- ship_id: UInt64;
168
- good_id: UInt64;
169
- quantity: UInt64;
196
+ class cancel extends Struct {
197
+ entity_type: Name;
198
+ id: UInt64;
199
+ count: UInt64;
170
200
  }
171
- class buyship extends Struct {
172
- account: Name;
173
- name: string;
201
+ class entity_ref extends Struct {
202
+ entity_type: Name;
203
+ entity_id: UInt64;
204
+ }
205
+ class cancel_results extends Struct {
206
+ entity_id: UInt64;
207
+ entity_type: Name;
208
+ cancelled_count: UInt8;
209
+ schedule_started?: TimePoint;
210
+ entitygroup?: UInt64;
211
+ group_members?: entity_ref[];
174
212
  }
175
213
  class cargo_row extends Struct {
176
214
  id: UInt64;
177
- ship_id: UInt64;
178
- good_id: UInt64;
179
- paid: UInt64;
180
- owned: UInt32;
181
- loaded: UInt32;
215
+ entity_id: UInt64;
216
+ item_id: UInt64;
217
+ quantity: UInt64;
218
+ stats: UInt64;
219
+ modules: module_entry[];
220
+ }
221
+ class claimstarter extends Struct {
222
+ account: Name;
223
+ x: Int64;
224
+ y: Int64;
225
+ }
226
+ class cleanrsvp extends Struct {
227
+ epoch: UInt64;
228
+ max_rows: UInt64;
182
229
  }
183
230
  class cleartable extends Struct {
184
231
  table_name: Name;
@@ -188,17 +235,259 @@ declare namespace Types {
188
235
  class commit extends Struct {
189
236
  commit: Checksum256;
190
237
  }
238
+ class entity_defaults extends Struct {
239
+ warehouse_z: UInt16;
240
+ container_z: UInt16;
241
+ }
242
+ class item_def extends Struct {
243
+ id: UInt16;
244
+ mass: UInt32;
245
+ type: UInt8;
246
+ subtype: UInt8;
247
+ tier: UInt8;
248
+ }
249
+ class game_config extends Struct {
250
+ version: UInt32;
251
+ defaults: entity_defaults;
252
+ items: item_def[];
253
+ }
254
+ class configlog extends Struct {
255
+ config: game_config;
256
+ }
191
257
  class coordinates extends Struct {
192
258
  x: Int64;
193
259
  y: Int64;
260
+ z?: UInt16;
261
+ }
262
+ class task extends Struct {
263
+ type: UInt8;
264
+ duration: UInt32;
265
+ cancelable: UInt8;
266
+ coordinates?: coordinates;
267
+ cargo: cargo_item[];
268
+ entitytarget?: entity_ref;
269
+ entitygroup?: UInt64;
270
+ energy_cost?: UInt16;
271
+ }
272
+ class schedule extends Struct {
273
+ started: TimePoint;
274
+ tasks: task[];
275
+ }
276
+ class container_row extends Struct {
277
+ id: UInt64;
278
+ owner: Name;
279
+ name: string;
280
+ coordinates: coordinates;
281
+ hullmass: UInt32;
282
+ capacity: UInt32;
283
+ cargomass: UInt32;
284
+ schedule?: schedule;
285
+ }
286
+ class craft extends Struct {
287
+ entity_type: Name;
288
+ id: UInt64;
289
+ recipe_id: UInt16;
290
+ quantity: UInt32;
291
+ inputs: cargo_item[];
292
+ }
293
+ class crafter_stats extends Struct {
294
+ speed: UInt16;
295
+ drain: UInt16;
296
+ }
297
+ class createentity extends Struct {
298
+ owner: Name;
299
+ entity_type: Name;
300
+ entity_name: string;
301
+ x: Int64;
302
+ y: Int64;
303
+ }
304
+ class deploy extends Struct {
305
+ entity_type: Name;
306
+ id: UInt64;
307
+ packed_item_id: UInt16;
308
+ stats: UInt64;
309
+ }
310
+ class descentity extends Struct {
311
+ item_id: UInt16;
312
+ hull_stats: UInt64;
313
+ module_items: UInt16[];
314
+ module_stats: UInt64[];
194
315
  }
195
316
  class enable extends Struct {
196
317
  enabled: boolean;
197
318
  }
198
- class good_price extends Struct {
199
- id: UInt16;
200
- price: UInt64;
201
- supply: UInt64;
319
+ class energy_stats extends Struct {
320
+ capacity: UInt16;
321
+ recharge: UInt16;
322
+ }
323
+ class entity_current_state extends Struct {
324
+ coordinates: coordinates;
325
+ energy: UInt16;
326
+ }
327
+ class loader_stats extends Struct {
328
+ mass: UInt32;
329
+ thrust: UInt16;
330
+ quantity: UInt8;
331
+ }
332
+ class movement_stats extends Struct {
333
+ thrust: UInt32;
334
+ drain: UInt16;
335
+ }
336
+ class gatherer_stats extends Struct {
337
+ yield: UInt16;
338
+ drain: UInt16;
339
+ depth: UInt16;
340
+ speed: UInt16;
341
+ }
342
+ class hauler_stats extends Struct {
343
+ capacity: UInt8;
344
+ efficiency: UInt16;
345
+ drain: UInt16;
346
+ }
347
+ class warp_stats extends Struct {
348
+ range: UInt32;
349
+ }
350
+ class entity_info extends Struct {
351
+ type: Name;
352
+ id: UInt64;
353
+ owner: Name;
354
+ entity_name: string;
355
+ coordinates: coordinates;
356
+ cargomass: UInt32;
357
+ cargo: cargo_item[];
358
+ loaders?: loader_stats;
359
+ modules: module_entry[];
360
+ energy?: UInt16;
361
+ hullmass?: UInt32;
362
+ engines?: movement_stats;
363
+ generator?: energy_stats;
364
+ capacity?: UInt32;
365
+ gatherer?: gatherer_stats;
366
+ hauler?: hauler_stats;
367
+ warp?: warp_stats;
368
+ crafter?: crafter_stats;
369
+ is_idle: boolean;
370
+ current_task?: task;
371
+ current_task_elapsed: UInt32;
372
+ current_task_remaining: UInt32;
373
+ pending_tasks: task[];
374
+ idle_at?: TimePoint;
375
+ schedule?: schedule;
376
+ }
377
+ class slot_def extends Struct {
378
+ type: UInt8;
379
+ }
380
+ class entity_layout extends Struct {
381
+ entity_item_id: UInt16;
382
+ slots: slot_def[];
383
+ }
384
+ class entity_layouts_result extends Struct {
385
+ entities: entity_layout[];
386
+ }
387
+ class entity_summary extends Struct {
388
+ type: Name;
389
+ id: UInt64;
390
+ owner: Name;
391
+ entity_name: string;
392
+ coordinates: coordinates;
393
+ is_idle: boolean;
394
+ resolved_count: UInt32;
395
+ pending_count: UInt32;
396
+ }
397
+ class entity_task_info extends Struct {
398
+ entity_id: UInt64;
399
+ entity_type: Name;
400
+ task_count: UInt8;
401
+ schedule_started: TimePoint;
402
+ }
403
+ class entitygroup_row extends Struct {
404
+ id: UInt64;
405
+ participants: entity_ref[];
406
+ }
407
+ class enum_member extends Struct {
408
+ value: UInt8;
409
+ name: string;
410
+ }
411
+ class enum_result extends Struct {
412
+ members: enum_member[];
413
+ }
414
+ class gather extends Struct {
415
+ source: entity_ref;
416
+ destination: entity_ref;
417
+ stratum: UInt16;
418
+ quantity: UInt32;
419
+ }
420
+ class getconfig extends Struct {
421
+ }
422
+ class getentities extends Struct {
423
+ owner: Name;
424
+ entity_type?: Name;
425
+ }
426
+ class getentity extends Struct {
427
+ entity_type: Name;
428
+ entity_id: UInt64;
429
+ }
430
+ class getitemdata extends Struct {
431
+ }
432
+ class getitemids extends Struct {
433
+ }
434
+ class getitems extends Struct {
435
+ }
436
+ class getitemtypes extends Struct {
437
+ }
438
+ class getlocation extends Struct {
439
+ x: Int64;
440
+ y: Int64;
441
+ }
442
+ class getlocdata extends Struct {
443
+ x: Int64;
444
+ y: Int64;
445
+ }
446
+ class getmodtypes extends Struct {
447
+ }
448
+ class getmodules extends Struct {
449
+ }
450
+ class getnearby extends Struct {
451
+ entity_type: Name;
452
+ entity_id: UInt64;
453
+ recharge: boolean;
454
+ }
455
+ class getnftinfo extends Struct {
456
+ }
457
+ class getplayer extends Struct {
458
+ account: Name;
459
+ }
460
+ class getrecipe extends Struct {
461
+ output_item_id: UInt16;
462
+ }
463
+ class getrecipes extends Struct {
464
+ lower_bound: UInt16;
465
+ limit: UInt8;
466
+ }
467
+ class getrescats extends Struct {
468
+ }
469
+ class getreserves extends Struct {
470
+ x: Int64;
471
+ y: Int64;
472
+ }
473
+ class getresources extends Struct {
474
+ }
475
+ class getslots extends Struct {
476
+ }
477
+ class getstratum extends Struct {
478
+ x: Int64;
479
+ y: Int64;
480
+ stratum: UInt16;
481
+ }
482
+ class getsummaries extends Struct {
483
+ owner: Name;
484
+ entity_type?: Name;
485
+ }
486
+ class grouptravel extends Struct {
487
+ entities: entity_ref[];
488
+ x: Int64;
489
+ y: Int64;
490
+ recharge: boolean;
202
491
  }
203
492
  class hash extends Struct {
204
493
  value: string;
@@ -209,189 +498,458 @@ declare namespace Types {
209
498
  class init extends Struct {
210
499
  seed: Checksum256;
211
500
  }
212
- class jettison extends Struct {
213
- ship_id: UInt64;
214
- good_id: UInt16;
215
- quantity: UInt64;
501
+ class item_id_pair extends Struct {
502
+ id: UInt16;
503
+ name: string;
504
+ }
505
+ class item_ids_result extends Struct {
506
+ items: item_id_pair[];
507
+ }
508
+ class recipe_input extends Struct {
509
+ item_id: UInt16;
510
+ category: UInt8;
511
+ tier: UInt8;
512
+ quantity: UInt32;
513
+ }
514
+ class stat_source extends Struct {
515
+ input_index: UInt8;
516
+ input_stat_index: UInt8;
517
+ }
518
+ class stat_slot_response extends Struct {
519
+ sources: stat_source[];
520
+ }
521
+ class recipe_item_info extends Struct {
522
+ id: UInt16;
523
+ mass: UInt32;
524
+ }
525
+ class recipe_response extends Struct {
526
+ output_item_id: UInt16;
527
+ output_mass: UInt32;
528
+ inputs: recipe_input[];
529
+ stat_slots: stat_slot_response[];
530
+ blend_weights: Bytes;
531
+ output_item: recipe_item_info;
532
+ input_items: recipe_item_info[];
533
+ }
534
+ class recipes_result extends Struct {
535
+ recipes: recipe_response[];
536
+ }
537
+ class itemdata_result extends Struct {
538
+ items: item_def[];
539
+ recipes: recipes_result;
540
+ }
541
+ class items_info extends Struct {
542
+ items: item_def[];
216
543
  }
217
544
  class join extends Struct {
218
545
  account: Name;
219
546
  }
220
- class loader_stats extends Struct {
221
- mass: UInt32;
222
- quantity: UInt16;
223
- thrust: UInt32;
547
+ class location_static extends Struct {
548
+ coords: coordinates;
549
+ type: UInt8;
550
+ subtype: UInt8;
551
+ seed0: UInt8;
552
+ seed1: UInt8;
553
+ }
554
+ class location_epoch extends Struct {
555
+ active: boolean;
556
+ seed0: UInt8;
557
+ seed1: UInt8;
558
+ }
559
+ class location_derived extends Struct {
560
+ static_props: location_static;
561
+ epoch_props: location_epoch;
562
+ size: UInt16;
563
+ }
564
+ class location_info extends Struct {
565
+ coords: coordinates;
566
+ is_system: boolean;
224
567
  }
225
568
  class location_row extends Struct {
226
569
  id: UInt64;
570
+ owner: Name;
227
571
  coordinates: coordinates;
228
- epoch: UInt64;
229
- good_id: UInt16;
230
- supply: UInt16;
572
+ cargomass: UInt32;
573
+ cargo: cargo_item[];
574
+ schedule?: schedule;
231
575
  }
232
- class marketprice extends Struct {
233
- location: coordinates;
234
- good_id: UInt16;
576
+ class module_info extends Struct {
577
+ id: UInt16;
578
+ mass: UInt32;
579
+ module_type: UInt8;
580
+ tier: UInt8;
235
581
  }
236
- class marketprices extends Struct {
237
- location: coordinates;
582
+ class modules_result extends Struct {
583
+ modules: module_info[];
238
584
  }
239
- class payloan extends Struct {
240
- account: Name;
241
- amount: UInt64;
585
+ class nearby_system extends Struct {
586
+ distance: UInt64;
587
+ energy_cost: UInt64;
588
+ flight_time: UInt32;
589
+ location: location_info;
590
+ }
591
+ class nearby_info extends Struct {
592
+ can_travel: boolean;
593
+ current: entity_current_state;
594
+ projected: entity_current_state;
595
+ max_energy: UInt16;
596
+ systems: nearby_system[];
597
+ }
598
+ class nexus_row extends Struct {
599
+ id: UInt64;
600
+ owner: Name;
601
+ name: string;
602
+ coordinates: coordinates;
603
+ }
604
+ class schema_field extends Struct {
605
+ name: string;
606
+ field_type: string;
607
+ }
608
+ class nft_schema_def extends Struct {
609
+ schema_name: Name;
610
+ fields: schema_field[];
611
+ }
612
+ class nft_template_def extends Struct {
613
+ item_id: UInt16;
614
+ schema_name: Name;
615
+ }
616
+ class nftconfig_row extends Struct {
617
+ item_id: UInt16;
618
+ template_id: Int32;
619
+ schema_name: Name;
620
+ }
621
+ class nftinfo_result extends Struct {
622
+ schemas: nft_schema_def[];
623
+ templates: nft_template_def[];
624
+ }
625
+ class task_event extends Struct {
626
+ event_type: UInt8;
627
+ owner: Name;
628
+ entity_type: Name;
629
+ entity_id: UInt64;
630
+ task_index: UInt8;
631
+ task: task;
632
+ starts_at: TimePoint;
633
+ completes_at: TimePoint;
634
+ new_energy?: UInt16;
635
+ }
636
+ class notify extends Struct {
637
+ event: task_event;
638
+ }
639
+ class player_info extends Struct {
640
+ owner: Name;
641
+ is_player: boolean;
642
+ company_name: string;
643
+ ship_count: UInt64;
644
+ warehouse_count: UInt64;
645
+ container_count: UInt64;
242
646
  }
243
647
  class player_row extends Struct {
244
648
  owner: Name;
245
- balance: UInt64;
246
- debt: UInt64;
247
- networth: Int64;
649
+ }
650
+ class recharge extends Struct {
651
+ entity_type: Name;
652
+ id: UInt64;
653
+ }
654
+ class reserve_row extends Struct {
655
+ id: UInt64;
656
+ coord_id: UInt64;
657
+ stratum: UInt16;
658
+ remaining: UInt32;
659
+ }
660
+ class resolve extends Struct {
661
+ entity_type: Name;
662
+ id: UInt64;
663
+ count?: UInt64;
664
+ }
665
+ class resolve_results extends Struct {
666
+ entity_id: UInt64;
667
+ entity_type: Name;
668
+ resolved_count: UInt8;
669
+ new_schedule_started?: TimePoint;
670
+ entitygroup?: UInt64;
671
+ group_members?: entity_ref[];
672
+ }
673
+ class resource_info extends Struct {
674
+ id: UInt16;
675
+ mass: UInt32;
676
+ category: UInt8;
677
+ tier: UInt8;
678
+ }
679
+ class resource_stats extends Struct {
680
+ stat1: UInt16;
681
+ stat2: UInt16;
682
+ stat3: UInt16;
683
+ }
684
+ class resources_result extends Struct {
685
+ resources: resource_info[];
686
+ }
687
+ class rmmodule extends Struct {
688
+ entity_type: Name;
689
+ entity_id: UInt64;
690
+ module_index: UInt8;
691
+ target_cargo_id: UInt64;
692
+ }
693
+ class rmnftcfg extends Struct {
694
+ item_id: UInt16;
248
695
  }
249
696
  class salt extends Struct {
250
697
  salt: UInt64;
251
698
  }
252
- class sellgoods extends Struct {
253
- ship_id: UInt64;
254
- good_id: UInt64;
255
- quantity: UInt64;
256
- }
257
699
  class sequence_row extends Struct {
258
700
  key: Name;
259
701
  value: UInt64;
260
702
  }
261
- class ship_state extends Struct {
262
- energy: UInt32;
263
- }
264
- class ship_stats extends Struct {
265
- capacity: UInt32;
266
- drain: UInt32;
267
- mass: UInt64;
268
- maxmass: UInt64;
269
- orbit: UInt16;
270
- recharge: UInt32;
271
- thrust: UInt64;
272
- }
273
- class travel_plan extends Struct {
274
- departure: TimePoint;
275
- destination: coordinates;
276
- distance: UInt64;
277
- flighttime: UInt32;
278
- loadtime: UInt32;
279
- rechargetime: UInt32;
280
- masspenalty: UInt32;
281
- mass: UInt64;
282
- energyusage: UInt32;
703
+ class setnftcfg extends Struct {
704
+ item_id: UInt16;
705
+ template_id: Int32;
706
+ schema_name: Name;
283
707
  }
284
708
  class ship_row extends Struct {
285
709
  id: UInt64;
286
710
  owner: Name;
287
711
  name: string;
288
- location: coordinates;
289
- skin: UInt8;
290
- tier: UInt8;
291
- state: ship_state;
292
- stats: ship_stats;
293
- loaders: loader_stats;
294
- travelplan?: travel_plan;
712
+ stats: UInt64;
713
+ coordinates: coordinates;
714
+ hullmass?: UInt32;
715
+ capacity?: UInt32;
716
+ energy?: UInt16;
717
+ cargomass: UInt32;
718
+ engines?: movement_stats;
719
+ generator?: energy_stats;
720
+ loaders?: loader_stats;
721
+ gatherer?: gatherer_stats;
722
+ warp?: warp_stats;
723
+ crafter?: crafter_stats;
724
+ hauler?: hauler_stats;
725
+ modules: module_entry[];
726
+ schedule?: schedule;
727
+ }
728
+ class spawncargo extends Struct {
729
+ entity_id: UInt64;
730
+ item_id: UInt64;
731
+ quantity: UInt64;
732
+ }
733
+ class spawnpacked extends Struct {
734
+ entity_id: UInt64;
735
+ item_id: UInt16;
736
+ hull_stats: UInt64;
737
+ installed: packed_module[];
738
+ }
739
+ class spawnseeded extends Struct {
740
+ entity_id: UInt64;
741
+ item_id: UInt64;
742
+ quantity: UInt64;
743
+ stats: UInt64;
295
744
  }
296
745
  class state_row extends Struct {
297
746
  enabled: boolean;
298
- epoch: UInt64;
747
+ epoch: UInt32;
299
748
  salt: UInt64;
300
749
  ships: UInt32;
301
750
  seed: Checksum256;
302
751
  commit: Checksum256;
303
752
  }
304
- class takeloan extends Struct {
305
- account: Name;
306
- amount: UInt64;
753
+ class stratum_info extends Struct {
754
+ item_id: UInt16;
755
+ seed: UInt64;
756
+ richness: UInt16;
757
+ reserve: UInt32;
758
+ reserve_max: UInt32;
759
+ }
760
+ class stratum_data extends Struct {
761
+ stratum: stratum_info;
762
+ stats: resource_stats;
763
+ }
764
+ class stratum_remaining extends Struct {
765
+ stratum: UInt16;
766
+ remaining: UInt32;
767
+ }
768
+ class task_results extends Struct {
769
+ entities: entity_task_info[];
770
+ }
771
+ class transfer extends Struct {
772
+ source_type: Name;
773
+ source_id: UInt64;
774
+ dest_type: Name;
775
+ dest_id: UInt64;
776
+ item_id: UInt16;
777
+ stats: UInt64;
778
+ quantity: UInt32;
307
779
  }
308
780
  class travel extends Struct {
781
+ entity_type: Name;
309
782
  id: UInt64;
310
- destination: coordinates;
783
+ x: Int64;
784
+ y: Int64;
311
785
  recharge: boolean;
312
786
  }
313
- class travel_summary extends Struct {
314
- stats: ship_stats;
315
- loaders: loader_stats;
316
- origin: coordinates;
317
- destination: coordinates;
318
- distance: UInt64;
319
- totalmass: UInt64;
320
- acceleration: Float64;
321
- flighttime: UInt32;
322
- energyusage: UInt32;
323
- rechargetime: UInt32;
324
- masspenalty: UInt32;
325
- loadtime: UInt64;
326
- time: UInt64;
327
- }
328
- class travelplan extends Struct {
787
+ class types_row extends Struct {
329
788
  id: UInt64;
330
- origin: coordinates;
331
- destination: coordinates;
332
- recharge: boolean;
789
+ entity_summary_type: entity_summary;
790
+ game_config_type: game_config;
791
+ stratum_remaining_type: stratum_remaining;
333
792
  }
334
- class traveltime extends Struct {
793
+ class warehouse_row extends Struct {
335
794
  id: UInt64;
336
- destination: coordinates;
337
- }
338
- class updatecredit extends Struct {
339
- account: Name;
340
- amount: Int64;
341
- }
342
- class updatedebt extends Struct {
343
- account: Name;
344
- amount: Int64;
345
- }
346
- class upgradeship extends Struct {
347
- account: Name;
795
+ owner: Name;
796
+ name: string;
797
+ stats: UInt64;
798
+ coordinates: coordinates;
799
+ hullmass?: UInt32;
800
+ capacity?: UInt32;
801
+ cargomass: UInt32;
802
+ loaders?: loader_stats;
803
+ modules: module_entry[];
804
+ schedule?: schedule;
805
+ }
806
+ class warp extends Struct {
807
+ entity_type: Name;
348
808
  id: UInt64;
809
+ x: Int64;
810
+ y: Int64;
349
811
  }
350
812
  class wipe extends Struct {
351
813
  }
352
814
  class wipesequence extends Struct {
353
815
  }
816
+ class wrap extends Struct {
817
+ owner: Name;
818
+ entity_type: Name;
819
+ entity_id: UInt64;
820
+ cargo_id: UInt64;
821
+ quantity: UInt64;
822
+ }
354
823
  }
355
824
  declare const TableMap: {
356
825
  cargo: typeof Types.cargo_row;
826
+ container: typeof Types.container_row;
827
+ entitygroup: typeof Types.entitygroup_row;
357
828
  location: typeof Types.location_row;
829
+ nexus: typeof Types.nexus_row;
830
+ nftconfig: typeof Types.nftconfig_row;
358
831
  player: typeof Types.player_row;
832
+ reserve: typeof Types.reserve_row;
359
833
  sequence: typeof Types.sequence_row;
360
834
  ship: typeof Types.ship_row;
361
835
  state: typeof Types.state_row;
836
+ types: typeof Types.types_row;
837
+ warehouse: typeof Types.warehouse_row;
362
838
  };
363
839
  interface TableTypes {
364
840
  cargo: Types.cargo_row;
841
+ container: Types.container_row;
842
+ entitygroup: Types.entitygroup_row;
365
843
  location: Types.location_row;
844
+ nexus: Types.nexus_row;
845
+ nftconfig: Types.nftconfig_row;
366
846
  player: Types.player_row;
847
+ reserve: Types.reserve_row;
367
848
  sequence: Types.sequence_row;
368
849
  ship: Types.ship_row;
369
850
  state: Types.state_row;
851
+ types: Types.types_row;
852
+ warehouse: Types.warehouse_row;
370
853
  }
371
854
  type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any;
372
855
  type TableNames = keyof TableTypes;
373
856
  declare namespace ActionParams {
374
857
  namespace Type {
858
+ interface cargo_item {
859
+ item_id: UInt16Type;
860
+ quantity: UInt32Type;
861
+ stats: UInt64Type;
862
+ modules: Type.module_entry[];
863
+ }
864
+ interface module_entry {
865
+ type: UInt8Type;
866
+ installed?: Type.packed_module;
867
+ }
868
+ interface packed_module {
869
+ item_id: UInt16Type;
870
+ stats: UInt64Type;
871
+ }
872
+ interface game_config {
873
+ version: UInt32Type;
874
+ defaults: Type.entity_defaults;
875
+ items: Type.item_def[];
876
+ }
877
+ interface entity_defaults {
878
+ warehouse_z: UInt16Type;
879
+ container_z: UInt16Type;
880
+ }
881
+ interface item_def {
882
+ id: UInt16Type;
883
+ mass: UInt32Type;
884
+ type: UInt8Type;
885
+ subtype: UInt8Type;
886
+ tier: UInt8Type;
887
+ }
888
+ interface entity_ref {
889
+ entity_type: NameType;
890
+ entity_id: UInt64Type;
891
+ }
892
+ interface task_event {
893
+ event_type: UInt8Type;
894
+ owner: NameType;
895
+ entity_type: NameType;
896
+ entity_id: UInt64Type;
897
+ task_index: UInt8Type;
898
+ task: Type.task;
899
+ starts_at: TimePointType;
900
+ completes_at: TimePointType;
901
+ new_energy?: UInt16Type;
902
+ }
903
+ interface task {
904
+ type: UInt8Type;
905
+ duration: UInt32Type;
906
+ cancelable: UInt8Type;
907
+ coordinates?: Type.coordinates;
908
+ cargo: Type.cargo_item[];
909
+ entitytarget?: Type.entity_ref;
910
+ entitygroup?: UInt64Type;
911
+ energy_cost?: UInt16Type;
912
+ }
375
913
  interface coordinates {
376
914
  x: Int64Type;
377
915
  y: Int64Type;
916
+ z?: UInt16Type;
378
917
  }
379
918
  }
919
+ interface addmodule {
920
+ entity_type: NameType;
921
+ entity_id: UInt64Type;
922
+ module_index: UInt8Type;
923
+ module_cargo_id: UInt64Type;
924
+ target_cargo_id: UInt64Type;
925
+ }
926
+ interface addnexus {
927
+ nexus_name: string;
928
+ x: Int64Type;
929
+ y: Int64Type;
930
+ }
380
931
  interface advance {
381
932
  reveal: string;
382
933
  commit: Checksum256Type;
383
934
  }
384
- interface arrive {
935
+ interface blend {
936
+ entity_type: NameType;
385
937
  id: UInt64Type;
938
+ inputs: Type.cargo_item[];
386
939
  }
387
- interface buygoods {
388
- ship_id: UInt64Type;
389
- good_id: UInt64Type;
390
- quantity: UInt64Type;
940
+ interface cancel {
941
+ entity_type: NameType;
942
+ id: UInt64Type;
943
+ count: UInt64Type;
391
944
  }
392
- interface buyship {
945
+ interface claimstarter {
393
946
  account: NameType;
394
- name: string;
947
+ x: Int64Type;
948
+ y: Int64Type;
949
+ }
950
+ interface cleanrsvp {
951
+ epoch: UInt64Type;
952
+ max_rows: UInt64Type;
395
953
  }
396
954
  interface cleartable {
397
955
  table_name: NameType;
@@ -401,9 +959,116 @@ declare namespace ActionParams {
401
959
  interface commit {
402
960
  commit: Checksum256Type;
403
961
  }
962
+ interface configlog {
963
+ config: Type.game_config;
964
+ }
965
+ interface craft {
966
+ entity_type: NameType;
967
+ id: UInt64Type;
968
+ recipe_id: UInt16Type;
969
+ quantity: UInt32Type;
970
+ inputs: Type.cargo_item[];
971
+ }
972
+ interface createentity {
973
+ owner: NameType;
974
+ entity_type: NameType;
975
+ entity_name: string;
976
+ x: Int64Type;
977
+ y: Int64Type;
978
+ }
979
+ interface deploy {
980
+ entity_type: NameType;
981
+ id: UInt64Type;
982
+ packed_item_id: UInt16Type;
983
+ stats: UInt64Type;
984
+ }
985
+ interface descentity {
986
+ item_id: UInt16Type;
987
+ hull_stats: UInt64Type;
988
+ module_items: UInt16Type[];
989
+ module_stats: UInt64Type[];
990
+ }
404
991
  interface enable {
405
992
  enabled: boolean;
406
993
  }
994
+ interface gather {
995
+ source: Type.entity_ref;
996
+ destination: Type.entity_ref;
997
+ stratum: UInt16Type;
998
+ quantity: UInt32Type;
999
+ }
1000
+ interface getconfig {
1001
+ }
1002
+ interface getentities {
1003
+ owner: NameType;
1004
+ entity_type?: NameType;
1005
+ }
1006
+ interface getentity {
1007
+ entity_type: NameType;
1008
+ entity_id: UInt64Type;
1009
+ }
1010
+ interface getitemdata {
1011
+ }
1012
+ interface getitemids {
1013
+ }
1014
+ interface getitems {
1015
+ }
1016
+ interface getitemtypes {
1017
+ }
1018
+ interface getlocation {
1019
+ x: Int64Type;
1020
+ y: Int64Type;
1021
+ }
1022
+ interface getlocdata {
1023
+ x: Int64Type;
1024
+ y: Int64Type;
1025
+ }
1026
+ interface getmodtypes {
1027
+ }
1028
+ interface getmodules {
1029
+ }
1030
+ interface getnearby {
1031
+ entity_type: NameType;
1032
+ entity_id: UInt64Type;
1033
+ recharge: boolean;
1034
+ }
1035
+ interface getnftinfo {
1036
+ }
1037
+ interface getplayer {
1038
+ account: NameType;
1039
+ }
1040
+ interface getrecipe {
1041
+ output_item_id: UInt16Type;
1042
+ }
1043
+ interface getrecipes {
1044
+ lower_bound: UInt16Type;
1045
+ limit: UInt8Type;
1046
+ }
1047
+ interface getrescats {
1048
+ }
1049
+ interface getreserves {
1050
+ x: Int64Type;
1051
+ y: Int64Type;
1052
+ }
1053
+ interface getresources {
1054
+ }
1055
+ interface getslots {
1056
+ }
1057
+ interface getstratum {
1058
+ x: Int64Type;
1059
+ y: Int64Type;
1060
+ stratum: UInt16Type;
1061
+ }
1062
+ interface getsummaries {
1063
+ owner: NameType;
1064
+ entity_type?: NameType;
1065
+ }
1066
+ interface grouptravel {
1067
+ entities: Type.entity_ref[];
1068
+ x: Int64Type;
1069
+ y: Int64Type;
1070
+ recharge: boolean;
1071
+ }
407
1072
  interface hash {
408
1073
  value: string;
409
1074
  }
@@ -413,105 +1078,188 @@ declare namespace ActionParams {
413
1078
  interface init {
414
1079
  seed: Checksum256Type;
415
1080
  }
416
- interface jettison {
417
- ship_id: UInt64Type;
418
- good_id: UInt16Type;
419
- quantity: UInt64Type;
420
- }
421
1081
  interface join {
422
1082
  account: NameType;
423
1083
  }
424
- interface marketprice {
425
- location: Type.coordinates;
426
- good_id: UInt16Type;
1084
+ interface notify {
1085
+ event: Type.task_event;
1086
+ }
1087
+ interface recharge {
1088
+ entity_type: NameType;
1089
+ id: UInt64Type;
1090
+ }
1091
+ interface resolve {
1092
+ entity_type: NameType;
1093
+ id: UInt64Type;
1094
+ count?: UInt64Type;
427
1095
  }
428
- interface marketprices {
429
- location: Type.coordinates;
1096
+ interface rmmodule {
1097
+ entity_type: NameType;
1098
+ entity_id: UInt64Type;
1099
+ module_index: UInt8Type;
1100
+ target_cargo_id: UInt64Type;
430
1101
  }
431
- interface payloan {
432
- account: NameType;
433
- amount: UInt64Type;
1102
+ interface rmnftcfg {
1103
+ item_id: UInt16Type;
434
1104
  }
435
1105
  interface salt {
436
1106
  salt: UInt64Type;
437
1107
  }
438
- interface sellgoods {
439
- ship_id: UInt64Type;
440
- good_id: UInt64Type;
1108
+ interface setnftcfg {
1109
+ item_id: UInt16Type;
1110
+ template_id: Int32Type;
1111
+ schema_name: NameType;
1112
+ }
1113
+ interface spawncargo {
1114
+ entity_id: UInt64Type;
1115
+ item_id: UInt64Type;
441
1116
  quantity: UInt64Type;
442
1117
  }
443
- interface takeloan {
444
- account: NameType;
445
- amount: UInt64Type;
1118
+ interface spawnpacked {
1119
+ entity_id: UInt64Type;
1120
+ item_id: UInt16Type;
1121
+ hull_stats: UInt64Type;
1122
+ installed: Type.packed_module[];
446
1123
  }
447
- interface travel {
448
- id: UInt64Type;
449
- destination: Type.coordinates;
450
- recharge: boolean;
1124
+ interface spawnseeded {
1125
+ entity_id: UInt64Type;
1126
+ item_id: UInt64Type;
1127
+ quantity: UInt64Type;
1128
+ stats: UInt64Type;
451
1129
  }
452
- interface travelplan {
453
- id: UInt64Type;
454
- origin: Type.coordinates;
455
- destination: Type.coordinates;
456
- recharge: boolean;
1130
+ interface transfer {
1131
+ source_type: NameType;
1132
+ source_id: UInt64Type;
1133
+ dest_type: NameType;
1134
+ dest_id: UInt64Type;
1135
+ item_id: UInt16Type;
1136
+ stats: UInt64Type;
1137
+ quantity: UInt32Type;
457
1138
  }
458
- interface traveltime {
1139
+ interface travel {
1140
+ entity_type: NameType;
459
1141
  id: UInt64Type;
460
- destination: Type.coordinates;
461
- }
462
- interface updatecredit {
463
- account: NameType;
464
- amount: Int64Type;
465
- }
466
- interface updatedebt {
467
- account: NameType;
468
- amount: Int64Type;
1142
+ x: Int64Type;
1143
+ y: Int64Type;
1144
+ recharge: boolean;
469
1145
  }
470
- interface upgradeship {
471
- account: NameType;
1146
+ interface warp {
1147
+ entity_type: NameType;
472
1148
  id: UInt64Type;
1149
+ x: Int64Type;
1150
+ y: Int64Type;
473
1151
  }
474
1152
  interface wipe {
475
1153
  }
476
1154
  interface wipesequence {
477
1155
  }
1156
+ interface wrap {
1157
+ owner: NameType;
1158
+ entity_type: NameType;
1159
+ entity_id: UInt64Type;
1160
+ cargo_id: UInt64Type;
1161
+ quantity: UInt64Type;
1162
+ }
478
1163
  }
479
1164
  interface ActionNameParams {
1165
+ addmodule: ActionParams.addmodule;
1166
+ addnexus: ActionParams.addnexus;
480
1167
  advance: ActionParams.advance;
481
- arrive: ActionParams.arrive;
482
- buygoods: ActionParams.buygoods;
483
- buyship: ActionParams.buyship;
1168
+ blend: ActionParams.blend;
1169
+ cancel: ActionParams.cancel;
1170
+ claimstarter: ActionParams.claimstarter;
1171
+ cleanrsvp: ActionParams.cleanrsvp;
484
1172
  cleartable: ActionParams.cleartable;
485
1173
  commit: ActionParams.commit;
1174
+ configlog: ActionParams.configlog;
1175
+ craft: ActionParams.craft;
1176
+ createentity: ActionParams.createentity;
1177
+ deploy: ActionParams.deploy;
1178
+ descentity: ActionParams.descentity;
486
1179
  enable: ActionParams.enable;
1180
+ gather: ActionParams.gather;
1181
+ getconfig: ActionParams.getconfig;
1182
+ getentities: ActionParams.getentities;
1183
+ getentity: ActionParams.getentity;
1184
+ getitemdata: ActionParams.getitemdata;
1185
+ getitemids: ActionParams.getitemids;
1186
+ getitems: ActionParams.getitems;
1187
+ getitemtypes: ActionParams.getitemtypes;
1188
+ getlocation: ActionParams.getlocation;
1189
+ getlocdata: ActionParams.getlocdata;
1190
+ getmodtypes: ActionParams.getmodtypes;
1191
+ getmodules: ActionParams.getmodules;
1192
+ getnearby: ActionParams.getnearby;
1193
+ getnftinfo: ActionParams.getnftinfo;
1194
+ getplayer: ActionParams.getplayer;
1195
+ getrecipe: ActionParams.getrecipe;
1196
+ getrecipes: ActionParams.getrecipes;
1197
+ getrescats: ActionParams.getrescats;
1198
+ getreserves: ActionParams.getreserves;
1199
+ getresources: ActionParams.getresources;
1200
+ getslots: ActionParams.getslots;
1201
+ getstratum: ActionParams.getstratum;
1202
+ getsummaries: ActionParams.getsummaries;
1203
+ grouptravel: ActionParams.grouptravel;
487
1204
  hash: ActionParams.hash;
488
1205
  hash512: ActionParams.hash512;
489
1206
  init: ActionParams.init;
490
- jettison: ActionParams.jettison;
491
1207
  join: ActionParams.join;
492
- marketprice: ActionParams.marketprice;
493
- marketprices: ActionParams.marketprices;
494
- payloan: ActionParams.payloan;
1208
+ notify: ActionParams.notify;
1209
+ recharge: ActionParams.recharge;
1210
+ resolve: ActionParams.resolve;
1211
+ rmmodule: ActionParams.rmmodule;
1212
+ rmnftcfg: ActionParams.rmnftcfg;
495
1213
  salt: ActionParams.salt;
496
- sellgoods: ActionParams.sellgoods;
497
- takeloan: ActionParams.takeloan;
1214
+ setnftcfg: ActionParams.setnftcfg;
1215
+ spawncargo: ActionParams.spawncargo;
1216
+ spawnpacked: ActionParams.spawnpacked;
1217
+ spawnseeded: ActionParams.spawnseeded;
1218
+ transfer: ActionParams.transfer;
498
1219
  travel: ActionParams.travel;
499
- travelplan: ActionParams.travelplan;
500
- traveltime: ActionParams.traveltime;
501
- updatecredit: ActionParams.updatecredit;
502
- updatedebt: ActionParams.updatedebt;
503
- upgradeship: ActionParams.upgradeship;
1220
+ warp: ActionParams.warp;
504
1221
  wipe: ActionParams.wipe;
505
1222
  wipesequence: ActionParams.wipesequence;
1223
+ wrap: ActionParams.wrap;
506
1224
  }
507
1225
  type ActionNames = keyof ActionNameParams;
508
1226
  interface ActionReturnValues {
1227
+ cancel: Types.cancel_results;
1228
+ craft: Types.task_results;
1229
+ deploy: Types.task_results;
1230
+ descentity: string;
1231
+ gather: Types.task_results;
1232
+ getconfig: Types.game_config;
1233
+ getentities: Types.entity_info[];
1234
+ getentity: Types.entity_info;
1235
+ getitemdata: Types.itemdata_result;
1236
+ getitemids: Types.item_ids_result;
1237
+ getitems: Types.items_info;
1238
+ getitemtypes: Types.enum_result;
1239
+ getlocation: Types.location_info;
1240
+ getlocdata: Types.location_derived;
1241
+ getmodtypes: Types.enum_result;
1242
+ getmodules: Types.modules_result;
1243
+ getnearby: Types.nearby_info;
1244
+ getnftinfo: Types.nftinfo_result;
1245
+ getplayer: Types.player_info;
1246
+ getrecipe: Types.recipes_result;
1247
+ getrecipes: Types.recipes_result;
1248
+ getrescats: Types.enum_result;
1249
+ getreserves: Types.stratum_remaining[];
1250
+ getresources: Types.resources_result;
1251
+ getslots: Types.entity_layouts_result;
1252
+ getstratum: Types.stratum_data;
1253
+ getsummaries: Types.entity_summary[];
1254
+ grouptravel: Types.task_results;
509
1255
  hash: Checksum256;
510
1256
  hash512: Checksum512;
511
- marketprice: Types.good_price;
512
- marketprices: Types.good_price[];
513
- travelplan: Types.travel_plan;
514
- traveltime: Types.travel_summary;
1257
+ recharge: Types.task_results;
1258
+ resolve: Types.resolve_results;
1259
+ transfer: Types.task_results;
1260
+ travel: Types.task_results;
1261
+ warp: Types.task_results;
1262
+ wrap: Types.task_results;
515
1263
  }
516
1264
  type ActionReturnNames = keyof ActionReturnValues;
517
1265
  declare class Contract extends Contract$2 {
@@ -553,6 +1301,289 @@ declare namespace server {
553
1301
  };
554
1302
  }
555
1303
 
1304
+ declare const COMPANY_NOT_FOUND = "Cannot find company for given account.";
1305
+ declare const COMMIT_ALREADY_SET = "Commit has already been set.";
1306
+ declare const COMMIT_CANNOT_MATCH = "Next commit cannot match current commit.";
1307
+ declare const COMMIT_NOT_SET = "Commit has not been set.";
1308
+ declare const EPOCH_NON_ZERO = "Epoch must be greater than zero.";
1309
+ declare const EPOCH_NOT_READY = "Current epoch is not ready to advance";
1310
+ declare const ERROR_SYSTEM_ALREADY_INITIALIZED = "This game has already been initialized.";
1311
+ declare const ERROR_SYSTEM_DISABLED = "This game is currently disabled.";
1312
+ declare const ERROR_SYSTEM_NOT_INITIALIZED = "This game has not been initialized.";
1313
+ declare const GAME_NOT_FOUND = "Cannot find game for given account name.";
1314
+ declare const GAME_SEED_NOT_SET = "This game has not initialized an epoch seed value.";
1315
+ declare const ITEM_DOES_NOT_EXIST = "Item does not exist.";
1316
+ declare const INVALID_AMOUNT = "Invalid amount.";
1317
+ declare const REQUIRES_MORE_THAN_ONE = "A value greater than one is required.";
1318
+ declare const REQUIRES_POSITIVE_VALUE = "Value must be greater than zero.";
1319
+ declare const PLAYER_ALREADY_JOINED = "Player has already joined the game.";
1320
+ declare const PLAYER_NOT_JOINED = "Player has not joined the game.";
1321
+ declare const PLAYER_NOT_FOUND = "Cannot find player for given account name.";
1322
+ declare const STARTER_ALREADY_CLAIMED = "Starter ship already claimed; destroy existing ships to re-claim.";
1323
+ declare const SHIP_ALREADY_THERE = "Ship cannot travel to the location its already at.";
1324
+ declare const SHIP_ALREADY_TRAVELING = "Ship is already traveling.";
1325
+ declare const SHIP_CANNOT_BUY_TRAVELING = "Ship cannot buy goods while traveling.";
1326
+ declare const SHIP_CANNOT_UPDATE_TRAVELING = "Ship cannot be updated while traveling.";
1327
+ declare const SHIP_INVALID_DESTINATION = "Ship cannot travel, no system at specified destination.";
1328
+ declare const SHIP_INVALID_TRAVEL_DURATION = "This trip cannot be made as it would exceed the maximum travel duration.";
1329
+ declare const SHIP_NOT_ARRIVED = "Ship has not yet arrived at its destination.";
1330
+ declare const SHIP_NOT_ENOUGH_ENERGY = "Ship does not have enough energy to travel to the destination.";
1331
+ declare const SHIP_NOT_ENOUGH_ENERGY_CAPACITY = "Ship does not have enough energy capacity to travel.";
1332
+ declare const SHIP_NOT_FOUND = "Cannot find ship for given account.";
1333
+ declare const SHIP_NOT_OWNED = "Ship is not owned by this account.";
1334
+ declare const NO_SCHEDULE = "No scheduled tasks.";
1335
+ declare const SHIP_NOT_IDLE = "Ship must be idle (no active schedule) for this action.";
1336
+ declare const SHIP_NO_COMPLETED_TASKS = "No completed tasks to resolve.";
1337
+ declare const RESOLVE_COUNT_EXCEEDS_COMPLETED = "Requested resolve count exceeds completed tasks.";
1338
+ declare const SHIP_CANNOT_CANCEL_TASK = "Cannot cancel task that is immutable or in progress.";
1339
+ declare const SHIP_NO_TASKS_TO_CANCEL = "No tasks to cancel.";
1340
+ declare const SHIP_INVALID_CARGO = "Invalid cargo specified for load/unload.";
1341
+ declare const SHIP_CARGO_NOT_OWNED = "Cannot load cargo that is not owned.";
1342
+ declare const SHIP_CARGO_NOT_LOADED = "Cannot unload cargo that is not loaded.";
1343
+ declare const SHIP_CAPACITY_EXCEEDED = "Ship cargo capacity would be exceeded.";
1344
+ declare const ENTITY_CAPACITY_EXCEEDED = "Entity cargo capacity would be exceeded.";
1345
+ declare const WAREHOUSE_NOT_FOUND = "Cannot find warehouse for given id.";
1346
+ declare const WAREHOUSE_ALREADY_AT_LOCATION = "Warehouse already exists at this location.";
1347
+ declare const WAREHOUSE_CAPACITY_EXCEEDED = "Warehouse capacity would be exceeded.";
1348
+ declare const CONTAINER_NOT_FOUND = "Cannot find container for given id.";
1349
+ declare const CONTAINER_CAPACITY_EXCEEDED = "Container capacity would be exceeded.";
1350
+ declare const DESTINATION_CAPACITY_EXCEEDED = "Destination entity does not have enough capacity for the gather.";
1351
+ declare const CANCEL_PAIRED_HAS_PENDING = "Cannot cancel transfer, paired entity has pending tasks.";
1352
+ declare const GROUP_EMPTY = "Group travel requires at least one entity.";
1353
+ declare const GROUP_NO_THRUST = "Group travel requires at least one entity with engines.";
1354
+ declare const GROUP_NOT_SAME_LOCATION = "All entities must be at the same location for group travel.";
1355
+ declare const GROUP_NOT_SAME_OWNER = "All entities must have the same owner for group travel.";
1356
+ declare const GROUP_ENTITY_NOT_MOVABLE = "Entity cannot participate in group travel.";
1357
+ declare const GROUP_NOT_FOUND = "Entity group not found.";
1358
+ declare const GROUP_DUPLICATE_ENTITY = "Duplicate entity in group.";
1359
+ declare const GROUP_HAUL_CAPACITY_EXCEEDED = "Group travel requires sufficient hauler capacity for all non-self-propelled entities.";
1360
+ declare const CANCEL_CONTAINS_GROUPED_TASK = "Cannot cancel range containing grouped task - cancel non-grouped tasks first.";
1361
+ declare const WARP_NO_CAPABILITY = "Entity does not have warp capability.";
1362
+ declare const WARP_HAS_SCHEDULE = "Entity must be idle to warp.";
1363
+ declare const WARP_HAS_CARGO = "Entity must have no cargo to warp.";
1364
+ declare const WARP_NOT_FULL_ENERGY = "Entity must have full energy to warp.";
1365
+ declare const WARP_OUT_OF_RANGE = "Destination exceeds warp range.";
1366
+ declare const ENTITY_NO_CRAFTER = "Entity does not have crafting capability.";
1367
+ declare const RECIPE_NOT_FOUND = "Recipe does not exist.";
1368
+ declare const RECIPE_INPUTS_INSUFFICIENT = "Insufficient inputs for recipe.";
1369
+ declare const RECIPE_INPUTS_INVALID = "Input cargo does not match recipe requirements.";
1370
+ declare const RECIPE_INPUTS_EXCESS = "Provided inputs exceed recipe requirements.";
1371
+ declare const RECIPE_INPUTS_MIXED = "All stacks for a recipe input must be the same resource.";
1372
+ declare const ITEM_NOT_DEPLOYABLE = "Item cannot be deployed as an entity.";
1373
+ declare const DEPLOY_ENTITY_HAS_SCHEDULE = "Entity must be idle to deploy.";
1374
+ declare const BLEND_INPUTS_MUST_MATCH = "All blend inputs must be the same item.";
1375
+ declare const GATHER_NOT_ENOUGH_ENERGY = "Gather requires more energy than entity has.";
1376
+ declare const GATHER_EXCEEDS_ENERGY_CAPACITY = "Gather drain exceeds entity's energy capacity.";
1377
+ declare const CRAFT_NOT_ENOUGH_ENERGY = "Craft requires more energy than entity has.";
1378
+ declare const CRAFT_EXCEEDS_ENERGY_CAPACITY = "Craft drain exceeds entity's energy capacity.";
1379
+ declare const BLEND_REQUIRES_MULTIPLE = "Blend requires at least two input stacks.";
1380
+ declare const BLEND_STAT_LESS_NOT_SUPPORTED = "Stat-less items cannot be blended.";
1381
+ declare const MODULE_SLOT_INVALID = "Module slot index is invalid.";
1382
+ declare const MODULE_SLOT_OCCUPIED = "Module slot is already occupied.";
1383
+ declare const MODULE_SLOT_EMPTY = "Module slot is empty.";
1384
+ declare const MODULE_TYPE_MISMATCH = "Module type not allowed in this slot.";
1385
+ declare const MODULE_CARGO_NOT_FOUND = "Module cargo not found.";
1386
+ declare const MODULE_NOT_MODULE = "Item is not a module.";
1387
+ declare const MODULE_ENTITY_BUSY = "Entity must be idle to modify modules.";
1388
+ declare const ITEM_NOT_PACKED_ENTITY = "Item is not a packed entity.";
1389
+ declare const ITEM_NOT_AVAILABLE_AT_LOCATION = "Item is not tradeable at ship location.";
1390
+ declare const INSUFFICIENT_BALANCE = "Insufficient balance.";
1391
+ declare const INSUFFICIENT_ITEM_QUANTITY = "Insufficient quantity in cargo.";
1392
+ declare const INSUFFICIENT_ITEM_SUPPLY = "Insufficient supply of item at location.";
1393
+
1394
+ declare const PRECISION = 10000;
1395
+ declare const CRAFT_ENERGY_DIVISOR = 150000;
1396
+ declare const WAREHOUSE_Z = 500;
1397
+ declare const CONTAINER_Z = 300;
1398
+ declare const TRAVEL_MAX_DURATION = 86400;
1399
+ declare const MIN_ORBITAL_ALTITUDE = 800;
1400
+ declare const MAX_ORBITAL_ALTITUDE = 3000;
1401
+ declare const BASE_ORBITAL_MASS = 100000;
1402
+ interface ShipLike {
1403
+ coordinates: Types.coordinates;
1404
+ hullmass?: UInt32;
1405
+ energy?: UInt16;
1406
+ engines?: Types.movement_stats;
1407
+ generator?: Types.energy_stats;
1408
+ loaders?: Types.loader_stats;
1409
+ hauler?: Types.hauler_stats;
1410
+ capacity?: UInt32;
1411
+ }
1412
+ interface CargoMassInfo {
1413
+ item_id: UInt16Type;
1414
+ quantity: UInt32Type;
1415
+ }
1416
+ declare enum TaskType {
1417
+ IDLE = 0,
1418
+ TRAVEL = 1,
1419
+ RECHARGE = 2,
1420
+ LOAD = 3,
1421
+ UNLOAD = 4,
1422
+ GATHER = 5,
1423
+ WARP = 6,
1424
+ CRAFT = 7,
1425
+ DEPLOY = 8,
1426
+ WRAP = 9,
1427
+ UNWRAP = 10
1428
+ }
1429
+ declare enum LocationType {
1430
+ EMPTY = 0,
1431
+ PLANET = 1,
1432
+ ASTEROID = 2,
1433
+ NEBULA = 3
1434
+ }
1435
+ declare enum TaskCancelable {
1436
+ NEVER = 0,
1437
+ BEFORE_START = 1,
1438
+ ALWAYS = 2
1439
+ }
1440
+ declare const EntityType$1: {
1441
+ readonly SHIP: Name;
1442
+ readonly WAREHOUSE: Name;
1443
+ readonly CONTAINER: Name;
1444
+ };
1445
+ type EntityTypeName = (typeof EntityType$1)[keyof typeof EntityType$1];
1446
+ type CoordinatesType = Coordinates | Types.coordinates | {
1447
+ x: Int64Type;
1448
+ y: Int64Type;
1449
+ };
1450
+ declare class Coordinates extends Types.coordinates {
1451
+ static from(value: CoordinatesType): Coordinates;
1452
+ equals(other: CoordinatesType): boolean;
1453
+ toLocationId(): UInt64;
1454
+ }
1455
+ declare function coordsToLocationId(coords: CoordinatesType): UInt64;
1456
+ interface Distance {
1457
+ origin: ActionParams.Type.coordinates;
1458
+ destination: ActionParams.Type.coordinates;
1459
+ distance: UInt16;
1460
+ }
1461
+ type ItemType = 'resource' | 'component' | 'module' | 'entity';
1462
+ type ResourceCategory = 'ore' | 'crystal' | 'gas' | 'regolith' | 'biomass';
1463
+ type ModuleType = 'any' | 'engine' | 'generator' | 'gatherer' | 'loader' | 'warp' | 'crafter' | 'launcher' | 'storage' | 'hauler';
1464
+ declare const TIER_ADJECTIVES: Record<number, string>;
1465
+ declare const CATEGORY_LABELS: Record<ResourceCategory, string>;
1466
+ interface Item {
1467
+ id: number;
1468
+ name: string;
1469
+ description: string;
1470
+ color: string;
1471
+ mass: number;
1472
+ type: ItemType;
1473
+ tier: number;
1474
+ category?: ResourceCategory;
1475
+ moduleType?: ModuleType;
1476
+ }
1477
+ declare function formatTier(tier: number): string;
1478
+
1479
+ declare const ITEM_ORE_T1 = 101;
1480
+ declare const ITEM_ORE_T2 = 102;
1481
+ declare const ITEM_ORE_T3 = 103;
1482
+ declare const ITEM_ORE_T4 = 104;
1483
+ declare const ITEM_ORE_T5 = 105;
1484
+ declare const ITEM_ORE_T6 = 106;
1485
+ declare const ITEM_ORE_T7 = 107;
1486
+ declare const ITEM_ORE_T8 = 108;
1487
+ declare const ITEM_ORE_T9 = 109;
1488
+ declare const ITEM_ORE_T10 = 110;
1489
+ declare const ITEM_CRYSTAL_T1 = 201;
1490
+ declare const ITEM_CRYSTAL_T2 = 202;
1491
+ declare const ITEM_CRYSTAL_T3 = 203;
1492
+ declare const ITEM_CRYSTAL_T4 = 204;
1493
+ declare const ITEM_CRYSTAL_T5 = 205;
1494
+ declare const ITEM_CRYSTAL_T6 = 206;
1495
+ declare const ITEM_CRYSTAL_T7 = 207;
1496
+ declare const ITEM_CRYSTAL_T8 = 208;
1497
+ declare const ITEM_CRYSTAL_T9 = 209;
1498
+ declare const ITEM_CRYSTAL_T10 = 210;
1499
+ declare const ITEM_GAS_T1 = 301;
1500
+ declare const ITEM_GAS_T2 = 302;
1501
+ declare const ITEM_GAS_T3 = 303;
1502
+ declare const ITEM_GAS_T4 = 304;
1503
+ declare const ITEM_GAS_T5 = 305;
1504
+ declare const ITEM_GAS_T6 = 306;
1505
+ declare const ITEM_GAS_T7 = 307;
1506
+ declare const ITEM_GAS_T8 = 308;
1507
+ declare const ITEM_GAS_T9 = 309;
1508
+ declare const ITEM_GAS_T10 = 310;
1509
+ declare const ITEM_REGOLITH_T1 = 401;
1510
+ declare const ITEM_REGOLITH_T2 = 402;
1511
+ declare const ITEM_REGOLITH_T3 = 403;
1512
+ declare const ITEM_REGOLITH_T4 = 404;
1513
+ declare const ITEM_REGOLITH_T5 = 405;
1514
+ declare const ITEM_REGOLITH_T6 = 406;
1515
+ declare const ITEM_REGOLITH_T7 = 407;
1516
+ declare const ITEM_REGOLITH_T8 = 408;
1517
+ declare const ITEM_REGOLITH_T9 = 409;
1518
+ declare const ITEM_REGOLITH_T10 = 410;
1519
+ declare const ITEM_BIOMASS_T1 = 501;
1520
+ declare const ITEM_BIOMASS_T2 = 502;
1521
+ declare const ITEM_BIOMASS_T3 = 503;
1522
+ declare const ITEM_BIOMASS_T4 = 504;
1523
+ declare const ITEM_BIOMASS_T5 = 505;
1524
+ declare const ITEM_BIOMASS_T6 = 506;
1525
+ declare const ITEM_BIOMASS_T7 = 507;
1526
+ declare const ITEM_BIOMASS_T8 = 508;
1527
+ declare const ITEM_BIOMASS_T9 = 509;
1528
+ declare const ITEM_BIOMASS_T10 = 510;
1529
+ declare const ITEM_HULL_PLATES = 10001;
1530
+ declare const ITEM_CARGO_LINING = 10002;
1531
+ declare const ITEM_THRUSTER_CORE = 10003;
1532
+ declare const ITEM_POWER_CELL = 10004;
1533
+ declare const ITEM_MATTER_CONDUIT = 10005;
1534
+ declare const ITEM_SURVEY_PROBE = 10006;
1535
+ declare const ITEM_CARGO_ARM = 10007;
1536
+ declare const ITEM_TOOL_BIT = 10008;
1537
+ declare const ITEM_REACTION_CHAMBER = 10009;
1538
+ declare const ITEM_FOCUSING_ARRAY = 10010;
1539
+ declare const ITEM_ENGINE_T1 = 10100;
1540
+ declare const ITEM_GENERATOR_T1 = 10101;
1541
+ declare const ITEM_GATHERER_T1 = 10102;
1542
+ declare const ITEM_LOADER_T1 = 10103;
1543
+ declare const ITEM_CRAFTER_T1 = 10104;
1544
+ declare const ITEM_STORAGE_T1 = 10105;
1545
+ declare const ITEM_HAULER_T1 = 10106;
1546
+ declare const ITEM_CONTAINER_T1_PACKED = 10200;
1547
+ declare const ITEM_SHIP_T1_PACKED = 10201;
1548
+ declare const ITEM_WAREHOUSE_T1_PACKED = 10202;
1549
+ declare const ITEM_HULL_PLATES_T2 = 20001;
1550
+ declare const ITEM_CARGO_LINING_T2 = 20002;
1551
+ declare const ITEM_CONTAINER_T2_PACKED = 20200;
1552
+
1553
+ interface RecipeInputItemId {
1554
+ itemId: number;
1555
+ quantity: number;
1556
+ }
1557
+ interface RecipeInputCategory {
1558
+ category: ResourceCategory;
1559
+ tier: number;
1560
+ quantity: number;
1561
+ }
1562
+ type RecipeInput = RecipeInputItemId | RecipeInputCategory;
1563
+ interface StatSlot {
1564
+ sources: {
1565
+ inputIndex: number;
1566
+ statIndex: number;
1567
+ }[];
1568
+ }
1569
+ interface Recipe {
1570
+ outputItemId: number;
1571
+ outputMass: number;
1572
+ inputs: RecipeInput[];
1573
+ statSlots: StatSlot[];
1574
+ blendWeights: number[];
1575
+ }
1576
+ interface EntitySlot {
1577
+ type: ModuleType;
1578
+ }
1579
+ interface EntityLayout {
1580
+ entityItemId: number;
1581
+ slots: EntitySlot[];
1582
+ }
1583
+ declare function getRecipe(outputItemId: number): Recipe | undefined;
1584
+ declare function getEntityLayout(entityItemId: number): EntityLayout | undefined;
1585
+ declare function findItemByCategoryAndTier(category: ResourceCategory, tier: number): Item;
1586
+
556
1587
  interface EpochInfo {
557
1588
  epoch: UInt64;
558
1589
  start: Date;
@@ -561,142 +1592,1554 @@ interface EpochInfo {
561
1592
  declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
562
1593
  declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
563
1594
 
564
- declare const ERROR_SYSTEM_NOT_INITIALIZED = "System not initialized";
565
- declare const GOOD_DOES_NOT_EXIST = "Good does not exist";
566
- declare const GOOD_NOT_AVAILABLE_AT_LOCATION = "Good not available at location";
567
- declare const PLAYER_NOT_FOUND = "Player not found";
568
- declare const SHIP_NOT_FOUND = "Ship not found";
569
- declare const SHIP_CANNOT_BUY_TRAVELING = "Ship cannot buy while traveling";
570
- declare const INSUFFICIENT_BALANCE = "Insufficient balance";
571
- declare const INSUFFICIENT_GOOD_QUANTITY = "Insufficient good quantity";
572
- declare const REQUIRES_MORE_THAN_ONE = "Requires more than one";
1595
+ /**
1596
+ * GameState class extends the state_row from the server contract
1597
+ * with helper methods for epoch management and system generation
1598
+ */
1599
+ declare class GameState extends Types.state_row {
1600
+ private _game?;
1601
+ /**
1602
+ * Create a GameState instance from a state_row
1603
+ */
1604
+ static from(state: Types.state_row, game?: Types$1.game_row): GameState;
1605
+ /**
1606
+ * Set the game configuration (needed for epoch calculations)
1607
+ */
1608
+ setGame(game: Types$1.game_row): void;
1609
+ /**
1610
+ * Get the current epoch number from the state
1611
+ */
1612
+ get currentEpoch(): UInt64;
1613
+ /**
1614
+ * Get the epoch seed (used for market pricing and system generation)
1615
+ */
1616
+ get epochSeed(): Checksum256;
1617
+ /**
1618
+ * Get the game seed (from game config, if available)
1619
+ */
1620
+ get gameSeed(): Checksum256 | undefined;
1621
+ /**
1622
+ * Check if the game is currently enabled
1623
+ */
1624
+ get isEnabled(): boolean;
1625
+ /**
1626
+ * Get the total number of ships in the game
1627
+ */
1628
+ get shipCount(): number;
1629
+ /**
1630
+ * Get the current salt value (used for random number generation)
1631
+ */
1632
+ get currentSalt(): UInt64;
1633
+ /**
1634
+ * Get the commit hash for the next epoch
1635
+ */
1636
+ get nextEpochCommit(): Checksum256;
1637
+ /**
1638
+ * Calculate the current epoch from game config (if game is set)
1639
+ * This might differ from state.epoch if the blockchain hasn't advanced yet
1640
+ */
1641
+ get calculatedCurrentEpoch(): UInt64 | undefined;
1642
+ /**
1643
+ * Get epoch info (start/end times) for the current epoch
1644
+ */
1645
+ get currentEpochInfo(): EpochInfo | undefined;
1646
+ /**
1647
+ * Get epoch info for a specific epoch number
1648
+ */
1649
+ getEpochInfo(epoch: UInt64): EpochInfo | undefined;
1650
+ /**
1651
+ * Check if a system exists at given coordinates
1652
+ * Requires game seed from game config
1653
+ */
1654
+ hasSystemAt(x: number, y: number): boolean;
1655
+ /**
1656
+ * Check if a system exists at coordinates object
1657
+ */
1658
+ hasSystemAtCoords(coords: Types.coordinates): boolean;
1659
+ /**
1660
+ * Get a summary of the game state
1661
+ */
1662
+ get summary(): {
1663
+ enabled: boolean;
1664
+ epoch: string;
1665
+ ships: number;
1666
+ hasSeed: boolean;
1667
+ hasCommit: boolean;
1668
+ };
1669
+ }
573
1670
 
574
- declare const PRECISION = 10000;
575
- declare const TRAVEL_MAXMASS_PENALTY = 5;
576
- interface CameraPosition extends ActionParams.Type.coordinates {
577
- z: number;
1671
+ interface PlayerStateInput {
1672
+ owner: NameType;
578
1673
  }
579
- interface Dimensions {
580
- width: number;
581
- height: number;
1674
+ declare class Player extends Types.player_row {
1675
+ static fromState(state: PlayerStateInput): Player;
582
1676
  }
583
- interface Distance {
584
- origin: ActionParams.Type.coordinates;
585
- destination: ActionParams.Type.coordinates;
586
- distance: UInt16;
1677
+
1678
+ declare class PlayersManager extends BaseManager {
1679
+ getPlayer(account: NameType): Promise<Player | undefined>;
1680
+ }
1681
+
1682
+ interface StratumInfo {
1683
+ itemId: number;
1684
+ seed: bigint;
1685
+ richness: number;
1686
+ reserve: number;
1687
+ }
1688
+ interface ResourceStats {
1689
+ stat1: number;
1690
+ stat2: number;
1691
+ stat3: number;
1692
+ }
1693
+ declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
1694
+ /**
1695
+ * Derives the three stat values for a raw resource from a deposit's
1696
+ * entropy seed (hash-based, weibull-transformed).
1697
+ *
1698
+ * **Use only on deposit seeds** — the bigint returned by `deriveStratum`
1699
+ * or carried on a `MassDeposit`. Do NOT call this on a cargo item's
1700
+ * `stats` field; cargo stats are bit-packed and must be read via
1701
+ * `decodeStat` (or `decodeStackStats` for category-mapped output).
1702
+ *
1703
+ * Passing a cargo `stats` value here produces meaningless output
1704
+ * (hash of the packed bits, unrelated to the actual stats).
1705
+ */
1706
+ declare function deriveResourceStats(seed: bigint): ResourceStats;
1707
+
1708
+ interface DerivedStratum {
1709
+ index: number;
1710
+ itemId: number;
1711
+ seed: bigint;
1712
+ richness: number;
1713
+ reserve: number;
1714
+ stats: ResourceStats;
1715
+ }
1716
+ declare function deriveStrata(coords: CoordinatesType, gameSeed: Checksum256Type, epochSeed: Checksum256Type): DerivedStratum[];
1717
+
1718
+ declare function deriveLocationSize(loc: Types.location_static): number;
1719
+
1720
+ declare const DEPTH_THRESHOLD_T1 = 0;
1721
+ declare const DEPTH_THRESHOLD_T2 = 2000;
1722
+ declare const DEPTH_THRESHOLD_T3 = 10000;
1723
+ declare const DEPTH_THRESHOLD_T4 = 30000;
1724
+ declare const DEPTH_THRESHOLD_T5 = 55000;
1725
+ declare const LOCATION_MIN_DEPTH = 500;
1726
+ declare const LOCATION_MAX_DEPTH = 65535;
1727
+ declare const PLANET_SUBTYPE_GAS_GIANT = 0;
1728
+ declare const PLANET_SUBTYPE_ROCKY = 1;
1729
+ declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
1730
+ declare const PLANET_SUBTYPE_ICY = 3;
1731
+ declare const PLANET_SUBTYPE_OCEAN = 4;
1732
+ declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
1733
+ declare function getDepthThreshold(tier: number): number;
1734
+ declare function getResourceTier(itemId: number): number;
1735
+ declare function getResourceWeight(itemId: number, stratum: number): number;
1736
+ declare function getLocationCandidates(locationType: number, subtype: number): number[];
1737
+ declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
1738
+
1739
+ type ReserveTier = 'small' | 'medium' | 'large' | 'massive' | 'motherlode';
1740
+ interface TierRange {
1741
+ min: number;
1742
+ max: number;
1743
+ }
1744
+ declare const RESERVE_TIERS: Record<ReserveTier, TierRange>;
1745
+ declare const TIER_ROLL_MAX = 65536;
1746
+ declare function rollTier(tierRoll: number, stratum: number): ReserveTier;
1747
+ declare function rollWithinTier(withinRoll: number, range: TierRange): number;
1748
+
1749
+ interface StatDefinition {
1750
+ key: string;
1751
+ label: string;
1752
+ abbreviation: string;
1753
+ purpose: string;
1754
+ inverted?: boolean;
1755
+ }
1756
+ declare function getStatDefinitions(category: ResourceCategory): StatDefinition[];
1757
+ declare function getStatName(category: ResourceCategory, index: 0 | 1 | 2): StatDefinition;
1758
+ interface NamedStats {
1759
+ definitions: StatDefinition[];
1760
+ values: [number, number, number];
1761
+ }
1762
+ declare function resolveStats(category: ResourceCategory, stats: {
1763
+ stat1: number;
1764
+ stat2: number;
1765
+ stat3: number;
1766
+ }): NamedStats;
1767
+
1768
+ interface StackInput {
1769
+ quantity: number;
1770
+ stats: Record<string, number>;
1771
+ }
1772
+ interface CategoryStacks {
1773
+ category: ResourceCategory;
1774
+ stacks: StackInput[];
1775
+ }
1776
+ declare function encodeStats(values: number[]): bigint;
1777
+ declare function decodeStat(stats: bigint, index: number): number;
1778
+ declare function decodeStats(stats: bigint, count: number): number[];
1779
+ declare function decodeCraftedItemStats(itemId: number, stats: bigint): Record<string, number>;
1780
+ declare function blendStacks(stacks: StackInput[], statKey: string): number;
1781
+ declare function blendComponentStacks(stacks: {
1782
+ quantity: number;
1783
+ stats: Record<string, number>;
1784
+ }[]): Record<string, number>;
1785
+ declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
1786
+ key: string;
1787
+ value: number;
1788
+ }[];
1789
+ declare function computeEntityStats(entityItemIdOrLegacyId: number | string, componentStacks: Record<number, {
1790
+ quantity: number;
1791
+ stats: Record<string, number>;
1792
+ }[]>): {
1793
+ key: string;
1794
+ value: number;
1795
+ }[];
1796
+ declare function computeInputMass(itemId: number): number;
1797
+ declare function blendCrossGroup(sources: {
1798
+ value: number;
1799
+ weight: number;
1800
+ }[]): number;
1801
+ declare function blendCargoStacks(itemId: number, stacks: {
1802
+ quantity: number;
1803
+ stats: UInt64;
1804
+ }[]): UInt64;
1805
+ interface RecipeSlotInput {
1806
+ itemId: number;
1807
+ category: ResourceCategory | undefined;
1808
+ stacks: {
1809
+ quantity: number;
1810
+ stats: bigint;
1811
+ }[];
1812
+ }
1813
+ declare function computeCraftedOutputStats(outputItemId: number, slotInputs: RecipeSlotInput[]): UInt64;
1814
+ /**
1815
+ * Mirrors the contract's gather-time transform. Takes a deposit's entropy
1816
+ * seed (bigint from deriveStratum), derives stats via weibull hashing, and
1817
+ * returns a UInt64 whose bit-packed form matches what the contract writes
1818
+ * to cargo_item.stats on gather.
1819
+ *
1820
+ * Use this whenever off-chain code simulates a gather (testmap, player
1821
+ * scanners that project cargo outcomes) and needs a value that matches
1822
+ * what on-chain cargo would carry.
1823
+ */
1824
+ declare function encodeGatheredCargoStats(depositSeed: bigint): UInt64;
1825
+
1826
+ interface LocationStratum extends DerivedStratum {
1827
+ reserveMax: number;
1828
+ }
1829
+ declare class LocationsManager extends BaseManager {
1830
+ hasSystem(location: CoordinatesType): Promise<boolean>;
1831
+ findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
1832
+ getStrata(coords: CoordinatesType): Promise<LocationStratum[]>;
1833
+ getLocationEntity(id: UInt64Type): Promise<Types.location_row | undefined>;
1834
+ getLocationEntityAt(coords: CoordinatesType): Promise<Types.location_row | undefined>;
1835
+ getAllLocationEntities(): Promise<Types.location_row[]>;
1836
+ }
1837
+
1838
+ declare class EpochsManager extends BaseManager {
1839
+ getCurrentHeight(): Promise<UInt64>;
1840
+ getCurrent(): Promise<EpochInfo>;
1841
+ getByHeight(height: UInt64Type): Promise<EpochInfo>;
1842
+ getTimeRemaining(): Promise<number>;
1843
+ getProgress(): Promise<number>;
1844
+ fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
1845
+ }
1846
+
1847
+ type EntityRefInput = {
1848
+ entityType: EntityTypeName;
1849
+ entityId: UInt64Type;
1850
+ };
1851
+ declare class ActionsManager extends BaseManager {
1852
+ travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
1853
+ grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
1854
+ resolve(entityId: UInt64Type, entityType?: EntityTypeName, count?: UInt64Type): Action;
1855
+ cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
1856
+ recharge(entityId: UInt64Type, entityType?: EntityTypeName): Action;
1857
+ transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, itemId: UInt64Type, stats: UInt64Type, quantity: UInt64Type): Action;
1858
+ foundCompany(account: NameType, name: string): Action;
1859
+ join(account: NameType): Action;
1860
+ gather(source: EntityRefInput, destination: EntityRefInput, stratum: UInt16Type, quantity: UInt32Type): Action;
1861
+ warp(entityId: UInt64Type, destination: CoordinatesType, entityType?: EntityTypeName): Action;
1862
+ craft(entityType: EntityTypeName, entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
1863
+ blend(entityType: EntityTypeName, entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
1864
+ deploy(entityType: EntityTypeName, entityId: UInt64Type, packedItemId: number, stats: bigint): Action;
1865
+ addmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, moduleCargoId: UInt64Type, targetCargoId?: UInt64Type): Action;
1866
+ rmmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, targetCargoId?: UInt64Type): Action;
1867
+ wrap(owner: NameType, entityType: EntityTypeName, entityId: UInt64Type, cargoId: UInt64Type, quantity: UInt64Type): Action;
1868
+ joinGame(account: NameType, companyName: string): Action[];
1869
+ }
1870
+
1871
+ type EntityInfo = Types.entity_info;
1872
+ interface BoundingBox {
1873
+ min_x: number;
1874
+ min_y: number;
1875
+ max_x: number;
1876
+ max_y: number;
1877
+ }
1878
+ interface WireCoordinates {
1879
+ x: number;
1880
+ y: number;
1881
+ z?: number;
1882
+ }
1883
+ type SubscribeMessage = {
1884
+ type: 'subscribe';
1885
+ sub_id: string;
1886
+ bounds?: BoundingBox;
1887
+ owner?: string;
1888
+ prioritize_owner?: string;
1889
+ };
1890
+ type UpdateBoundsMessage = {
1891
+ type: 'update_bounds';
1892
+ sub_id: string;
1893
+ bounds: BoundingBox;
1894
+ };
1895
+ type UnsubscribeMessage = {
1896
+ type: 'unsubscribe';
1897
+ sub_id: string;
1898
+ };
1899
+ type SubscribeEntityMessage = {
1900
+ type: 'subscribe_entity';
1901
+ sub_id: string;
1902
+ entity_type: 'ship' | 'warehouse' | 'container';
1903
+ entity_id: string;
1904
+ };
1905
+ type UnsubscribeEntityMessage = {
1906
+ type: 'unsubscribe_entity';
1907
+ sub_id: string;
1908
+ };
1909
+ type SubscribeEventsMessage = {
1910
+ type: 'subscribe_events';
1911
+ sub_id: string;
1912
+ event_filter?: Record<string, unknown>;
1913
+ };
1914
+ type UnsubscribeEventsMessage = {
1915
+ type: 'unsubscribe_events';
1916
+ sub_id: string;
1917
+ };
1918
+ type PingMessage = {
1919
+ type: 'ping';
1920
+ };
1921
+ type ClientMessage = SubscribeMessage | UpdateBoundsMessage | UnsubscribeMessage | SubscribeEntityMessage | UnsubscribeEntityMessage | SubscribeEventsMessage | UnsubscribeEventsMessage | PingMessage;
1922
+ type AckMessage = {
1923
+ type: 'subscribed' | 'unsubscribed' | 'bounds_updated';
1924
+ sub_id: string;
1925
+ };
1926
+ type WireEntity = Record<string, unknown> & {
1927
+ type: number;
1928
+ type_name: 'ship' | 'warehouse' | 'container';
1929
+ id: string | number;
1930
+ owner: string;
1931
+ coordinates: WireCoordinates;
1932
+ };
1933
+ type SnapshotMessage = {
1934
+ type: 'snapshot';
1935
+ sub_id: string;
1936
+ seq: number;
1937
+ entities: WireEntity[];
1938
+ truncated?: boolean;
1939
+ };
1940
+ type UpdateMessage = {
1941
+ type: 'update';
1942
+ sub_ids: string[];
1943
+ entity_id: number;
1944
+ entity: WireEntity;
1945
+ seq: number;
1946
+ };
1947
+ type BoundsDeltaMessage = {
1948
+ type: 'bounds_delta';
1949
+ sub_id: string;
1950
+ entered: WireEntity[];
1951
+ exited: number[];
1952
+ seq: number;
1953
+ truncated?: boolean;
1954
+ };
1955
+ type EventMessage = {
1956
+ type: 'event';
1957
+ sub_id: string;
1958
+ catchup: boolean;
1959
+ events: Array<Record<string, unknown>>;
1960
+ seq?: number;
1961
+ };
1962
+ type EventCatchupCompleteMessage = {
1963
+ type: 'event_catchup_complete';
1964
+ sub_id: string;
1965
+ };
1966
+ type PongMessage = {
1967
+ type: 'pong';
1968
+ };
1969
+ type ErrorMessage = {
1970
+ type: 'error';
1971
+ error: string;
1972
+ sub_id?: string;
1973
+ };
1974
+ type ServerMessage = AckMessage | SnapshotMessage | UpdateMessage | BoundsDeltaMessage | EventMessage | EventCatchupCompleteMessage | PongMessage | ErrorMessage;
1975
+
1976
+ interface MovementCapability {
1977
+ engines: Types.movement_stats;
1978
+ generator: Types.energy_stats;
1979
+ }
1980
+ interface EnergyCapability {
1981
+ energy: UInt16;
1982
+ }
1983
+ interface StorageCapability {
1984
+ capacity: UInt32;
1985
+ cargomass: UInt32;
1986
+ cargo: Types.cargo_item[];
1987
+ }
1988
+ interface LoaderCapability {
1989
+ loaders: Types.loader_stats;
1990
+ }
1991
+ interface GathererCapability {
1992
+ gatherer: Types.gatherer_stats;
1993
+ }
1994
+ interface MassCapability {
1995
+ hullmass: UInt32;
1996
+ }
1997
+ interface ScheduleCapability {
1998
+ schedule?: Types.schedule;
1999
+ }
2000
+ interface EntityCapabilities {
2001
+ hullmass?: UInt32;
2002
+ capacity?: UInt32;
2003
+ engines?: Types.movement_stats;
2004
+ generator?: Types.energy_stats;
2005
+ loaders?: Types.loader_stats;
2006
+ gatherer?: Types.gatherer_stats;
2007
+ crafter?: Types.crafter_stats;
2008
+ hauler?: Types.hauler_stats;
2009
+ }
2010
+ interface EntityState {
2011
+ owner: Name;
2012
+ location: Types.coordinates;
2013
+ energy?: UInt16;
2014
+ cargomass: UInt32;
2015
+ cargo: Types.cargo_item[];
2016
+ }
2017
+ declare function capsHasMovement(caps: EntityCapabilities): boolean;
2018
+ declare function capsHasStorage(caps: EntityCapabilities): boolean;
2019
+ declare function capsHasLoaders(caps: EntityCapabilities): boolean;
2020
+ declare function capsHasGatherer(caps: EntityCapabilities): boolean;
2021
+ declare function capsHasMass(caps: EntityCapabilities): boolean;
2022
+ declare function capsHasHauler(caps: EntityCapabilities): boolean;
2023
+
2024
+ interface HasCargo {
2025
+ cargo: Types.cargo_item[];
2026
+ }
2027
+ interface HasCapacity {
2028
+ capacity: UInt32;
2029
+ }
2030
+ interface HasCargomass {
2031
+ cargomass: UInt32;
2032
+ }
2033
+ interface MassInput {
2034
+ item_id: UInt16;
2035
+ quantity: UInt32;
2036
+ modules: Types.module_entry[];
2037
+ }
2038
+ declare function calcCargoItemMass(item: MassInput): UInt64;
2039
+ declare function calcCargoMass(entity: HasCargo): UInt64;
2040
+ declare function calcStacksMass(stacks: CargoStack[]): UInt64;
2041
+ declare function availableCapacity$1(entity: StorageCapability): UInt64;
2042
+ declare function availableCapacityFromMass(capacity: UInt64Type, cargoMass: UInt64Type): UInt64;
2043
+ declare function hasSpace$1(entity: StorageCapability, goodMass: UInt64, quantity: number): boolean;
2044
+ declare function hasSpaceForMass(capacity: UInt64Type, currentMass: UInt64Type, additionalMass: UInt64Type): boolean;
2045
+ declare function isFull$1(entity: HasCapacity & HasCargomass): boolean;
2046
+ declare function isFullFromMass(capacity: UInt64Type, cargoMass: UInt64Type): boolean;
2047
+ interface CargoStack {
2048
+ item_id: UInt16;
2049
+ quantity: UInt32;
2050
+ stats: UInt64;
2051
+ modules: Types.module_entry[];
2052
+ }
2053
+ declare function cargoItemToStack(item: Types.cargo_item): CargoStack;
2054
+ declare function stackToCargoItem(stack: CargoStack): Types.cargo_item;
2055
+ declare function stackKey(s: CargoStack): string;
2056
+ declare function stacksEqual(a: CargoStack, b: CargoStack): boolean;
2057
+ declare function mergeStacks(stacks: CargoStack[], add: CargoStack): CargoStack[];
2058
+ declare function removeFromStacks(stacks: CargoStack[], remove: CargoStack): CargoStack[];
2059
+
2060
+ type Schedule = Types.schedule;
2061
+ type Task$1 = Types.task;
2062
+ interface ScheduleData {
2063
+ schedule?: Schedule;
2064
+ }
2065
+ interface Scheduleable extends ScheduleData {
2066
+ hasSchedule: boolean;
2067
+ isIdle: boolean;
2068
+ tasks: Task$1[];
2069
+ scheduleDuration(): number;
2070
+ scheduleElapsed(now: Date): number;
2071
+ scheduleRemaining(now: Date): number;
2072
+ scheduleComplete(now: Date): boolean;
2073
+ currentTaskIndex(now: Date): number;
2074
+ currentTask(now: Date): Task$1 | undefined;
2075
+ currentTaskType(now: Date): TaskType | undefined;
2076
+ getTaskStartTime(index: number): number;
2077
+ getTaskElapsed(index: number, now: Date): number;
2078
+ getTaskRemaining(index: number, now: Date): number;
2079
+ isTaskComplete(index: number, now: Date): boolean;
2080
+ isTaskInProgress(index: number, now: Date): boolean;
2081
+ currentTaskProgress(now: Date): number;
2082
+ scheduleProgress(now: Date): number;
2083
+ }
2084
+ declare function hasSchedule$1(entity: ScheduleData): boolean;
2085
+ declare function isIdle(entity: ScheduleData): boolean;
2086
+ declare function getTasks(entity: ScheduleData): Task$1[];
2087
+ declare function scheduleDuration(entity: ScheduleData): number;
2088
+ declare function scheduleElapsed(entity: ScheduleData, now: Date): number;
2089
+ declare function scheduleRemaining(entity: ScheduleData, now: Date): number;
2090
+ declare function scheduleComplete(entity: ScheduleData, now: Date): boolean;
2091
+ declare function currentTaskIndex(entity: ScheduleData, now: Date): number;
2092
+ declare function currentTask(entity: ScheduleData, now: Date): Task$1 | undefined;
2093
+ declare function currentTaskType(entity: ScheduleData, now: Date): TaskType | undefined;
2094
+ declare function getTaskStartTime(entity: ScheduleData, index: number): number;
2095
+ declare function getTaskElapsed(entity: ScheduleData, index: number, now: Date): number;
2096
+ declare function getTaskRemaining(entity: ScheduleData, index: number, now: Date): number;
2097
+ declare function isTaskComplete(entity: ScheduleData, index: number, now: Date): boolean;
2098
+ declare function isTaskInProgress(entity: ScheduleData, index: number, now: Date): boolean;
2099
+ declare function currentTaskProgress(entity: ScheduleData, now: Date): number;
2100
+ declare function scheduleProgress(entity: ScheduleData, now: Date): number;
2101
+ declare function isTaskType(entity: ScheduleData, taskType: TaskType, now: Date): boolean;
2102
+ declare function isInFlight(entity: ScheduleData, now: Date): boolean;
2103
+ declare function isRecharging(entity: ScheduleData, now: Date): boolean;
2104
+ declare function isLoading(entity: ScheduleData, now: Date): boolean;
2105
+ declare function isUnloading(entity: ScheduleData, now: Date): boolean;
2106
+ declare function isGathering(entity: ScheduleData, now: Date): boolean;
2107
+
2108
+ type schedule_ScheduleData = ScheduleData;
2109
+ type schedule_Scheduleable = Scheduleable;
2110
+ declare const schedule_isIdle: typeof isIdle;
2111
+ declare const schedule_getTasks: typeof getTasks;
2112
+ declare const schedule_scheduleDuration: typeof scheduleDuration;
2113
+ declare const schedule_scheduleElapsed: typeof scheduleElapsed;
2114
+ declare const schedule_scheduleRemaining: typeof scheduleRemaining;
2115
+ declare const schedule_scheduleComplete: typeof scheduleComplete;
2116
+ declare const schedule_currentTaskIndex: typeof currentTaskIndex;
2117
+ declare const schedule_currentTask: typeof currentTask;
2118
+ declare const schedule_currentTaskType: typeof currentTaskType;
2119
+ declare const schedule_getTaskStartTime: typeof getTaskStartTime;
2120
+ declare const schedule_getTaskElapsed: typeof getTaskElapsed;
2121
+ declare const schedule_getTaskRemaining: typeof getTaskRemaining;
2122
+ declare const schedule_isTaskComplete: typeof isTaskComplete;
2123
+ declare const schedule_isTaskInProgress: typeof isTaskInProgress;
2124
+ declare const schedule_currentTaskProgress: typeof currentTaskProgress;
2125
+ declare const schedule_scheduleProgress: typeof scheduleProgress;
2126
+ declare const schedule_isTaskType: typeof isTaskType;
2127
+ declare const schedule_isInFlight: typeof isInFlight;
2128
+ declare const schedule_isRecharging: typeof isRecharging;
2129
+ declare const schedule_isLoading: typeof isLoading;
2130
+ declare const schedule_isUnloading: typeof isUnloading;
2131
+ declare const schedule_isGathering: typeof isGathering;
2132
+ declare namespace schedule {
2133
+ export {
2134
+ schedule_ScheduleData as ScheduleData,
2135
+ schedule_Scheduleable as Scheduleable,
2136
+ hasSchedule$1 as hasSchedule,
2137
+ schedule_isIdle as isIdle,
2138
+ schedule_getTasks as getTasks,
2139
+ schedule_scheduleDuration as scheduleDuration,
2140
+ schedule_scheduleElapsed as scheduleElapsed,
2141
+ schedule_scheduleRemaining as scheduleRemaining,
2142
+ schedule_scheduleComplete as scheduleComplete,
2143
+ schedule_currentTaskIndex as currentTaskIndex,
2144
+ schedule_currentTask as currentTask,
2145
+ schedule_currentTaskType as currentTaskType,
2146
+ schedule_getTaskStartTime as getTaskStartTime,
2147
+ schedule_getTaskElapsed as getTaskElapsed,
2148
+ schedule_getTaskRemaining as getTaskRemaining,
2149
+ schedule_isTaskComplete as isTaskComplete,
2150
+ schedule_isTaskInProgress as isTaskInProgress,
2151
+ schedule_currentTaskProgress as currentTaskProgress,
2152
+ schedule_scheduleProgress as scheduleProgress,
2153
+ schedule_isTaskType as isTaskType,
2154
+ schedule_isInFlight as isInFlight,
2155
+ schedule_isRecharging as isRecharging,
2156
+ schedule_isLoading as isLoading,
2157
+ schedule_isUnloading as isUnloading,
2158
+ schedule_isGathering as isGathering,
2159
+ };
2160
+ }
2161
+
2162
+ interface ProjectedEntity {
2163
+ location: Coordinates;
2164
+ energy: UInt16;
2165
+ cargo: CargoStack[];
2166
+ shipMass: UInt32;
2167
+ capacity?: UInt64;
2168
+ engines?: Types.movement_stats;
2169
+ loaders?: Types.loader_stats;
2170
+ generator?: Types.energy_stats;
2171
+ hauler?: Types.hauler_stats;
2172
+ readonly cargoMass: UInt64;
2173
+ readonly totalMass: UInt64;
2174
+ hasMovement(): boolean;
2175
+ hasStorage(): boolean;
2176
+ hasLoaders(): boolean;
2177
+ capabilities(): EntityCapabilities;
2178
+ state(): EntityState;
2179
+ }
2180
+ interface Projectable extends ScheduleData {
2181
+ coordinates: Coordinates | Types.coordinates;
2182
+ energy?: UInt16;
2183
+ hullmass?: UInt32;
2184
+ generator?: Types.energy_stats;
2185
+ engines?: Types.movement_stats;
2186
+ loaders?: Types.loader_stats;
2187
+ hauler?: Types.hauler_stats;
2188
+ capacity?: UInt32;
2189
+ cargo: Types.cargo_item[];
2190
+ cargomass: UInt32;
2191
+ owner?: Name;
2192
+ }
2193
+ declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
2194
+ interface ProjectionOptions {
2195
+ upToTaskIndex?: number;
2196
+ }
2197
+ declare function projectEntity(entity: Projectable, options?: ProjectionOptions): ProjectedEntity;
2198
+ interface ProjectableSnapshot extends Projectable {
2199
+ current_task?: Types.task;
2200
+ pending_tasks?: Types.task[];
2201
+ }
2202
+ declare function projectFromCurrentState(snapshot: ProjectableSnapshot): ProjectedEntity;
2203
+ declare function validateSchedule(entity: Projectable): void;
2204
+ declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
2205
+ declare function projectFromCurrentStateAt(snapshot: ProjectableSnapshot, now: Date): ProjectedEntity;
2206
+
2207
+ declare class Location {
2208
+ readonly coordinates: Coordinates;
2209
+ private _gameSeed?;
2210
+ private _hasSystem?;
2211
+ private _epoch?;
2212
+ constructor(coordinates: CoordinatesType);
2213
+ static from(coordinates: CoordinatesType): Location;
2214
+ hasSystemAt(gameSeed: Checksum256Type): boolean;
2215
+ getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
2216
+ isGatherableAt(gameSeed: Checksum256Type): boolean;
2217
+ findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
2218
+ equals(other: CoordinatesType | Location): boolean;
2219
+ get epoch(): UInt64 | undefined;
2220
+ clearCache(): void;
2221
+ }
2222
+ declare function toLocation(coords: CoordinatesType | Location): Location;
2223
+
2224
+ type Task = Types.task;
2225
+ declare class ScheduleAccessor {
2226
+ private entity;
2227
+ constructor(entity: ScheduleData);
2228
+ get hasSchedule(): boolean;
2229
+ get isIdle(): boolean;
2230
+ get tasks(): Task[];
2231
+ duration(): number;
2232
+ elapsed(now: Date): number;
2233
+ remaining(now: Date): number;
2234
+ complete(now: Date): boolean;
2235
+ currentTaskIndex(now: Date): number;
2236
+ currentTask(now: Date): Task | undefined;
2237
+ currentTaskType(now: Date): TaskType | undefined;
2238
+ taskStartTime(index: number): number;
2239
+ taskElapsed(index: number, now: Date): number;
2240
+ taskRemaining(index: number, now: Date): number;
2241
+ taskComplete(index: number, now: Date): boolean;
2242
+ taskInProgress(index: number, now: Date): boolean;
2243
+ currentTaskProgress(now: Date): number;
2244
+ progress(now: Date): number;
2245
+ }
2246
+ declare function createScheduleAccessor(entity: ScheduleData): ScheduleAccessor;
2247
+
2248
+ declare class EntityInventory extends Types.cargo_item {
2249
+ private _item?;
2250
+ get item(): Item;
2251
+ get good(): Item;
2252
+ get name(): string;
2253
+ get unitMass(): UInt32;
2254
+ get totalMass(): UInt64;
2255
+ get hasCargo(): boolean;
2256
+ get isEmpty(): boolean;
2257
+ }
2258
+
2259
+ declare class InventoryAccessor {
2260
+ private readonly entity;
2261
+ private _items?;
2262
+ constructor(entity: HasCargo);
2263
+ get items(): EntityInventory[];
2264
+ get totalMass(): UInt64;
2265
+ forItem(goodId: UInt64Type): EntityInventory | undefined;
2266
+ get sellable(): EntityInventory[];
2267
+ get hasSellable(): boolean;
2268
+ get sellableCount(): number;
2269
+ }
2270
+ declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
2271
+
2272
+ interface PackedModuleInput {
2273
+ itemId: UInt16Type;
2274
+ stats: UInt64Type;
587
2275
  }
588
- declare class Good extends Struct {
589
- id: UInt16;
2276
+ interface ShipStateInput {
2277
+ id: UInt64Type;
2278
+ owner: string;
590
2279
  name: string;
591
- description: string;
592
- base_price: UInt64;
593
- mass: UInt64;
2280
+ coordinates: CoordinatesType | {
2281
+ x: number;
2282
+ y: number;
2283
+ z?: number;
2284
+ };
2285
+ hullmass?: number;
2286
+ capacity?: number;
2287
+ energy?: number;
2288
+ modules?: PackedModuleInput[];
2289
+ schedule?: Types.schedule;
2290
+ cargo?: Types.cargo_item[];
2291
+ }
2292
+ declare class Ship extends Types.entity_info {
2293
+ private _sched?;
2294
+ private _inv?;
2295
+ get name(): string;
2296
+ get inv(): InventoryAccessor;
2297
+ get inventory(): EntityInventory[];
2298
+ get sched(): ScheduleAccessor;
2299
+ get maxDistance(): UInt32;
2300
+ get isIdle(): boolean;
2301
+ getFlightOrigin(flightTaskIndex: number): Coordinates;
2302
+ destinationLocation(): Coordinates | undefined;
2303
+ positionAt(now: Date): Coordinates;
2304
+ isInFlight(now: Date): boolean;
2305
+ isRecharging(now: Date): boolean;
2306
+ isLoading(now: Date): boolean;
2307
+ isUnloading(now: Date): boolean;
2308
+ isGathering(now: Date): boolean;
2309
+ get hasEngines(): boolean;
2310
+ get hasGenerator(): boolean;
2311
+ get hasGatherer(): boolean;
2312
+ get hasWarp(): boolean;
2313
+ project(): ProjectedEntity;
2314
+ projectAt(now: Date): ProjectedEntity;
2315
+ get location(): Location;
2316
+ get totalCargoMass(): UInt64;
2317
+ get totalMass(): UInt64;
2318
+ get maxCapacity(): UInt64;
2319
+ hasSpace(goodMass: UInt64, quantity: number): boolean;
2320
+ get availableCapacity(): UInt64;
2321
+ getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
2322
+ get sellableCargo(): EntityInventory[];
2323
+ get hasSellableCargo(): boolean;
2324
+ get sellableGoodsCount(): number;
2325
+ get isFull(): boolean;
2326
+ get energyPercent(): number;
2327
+ get needsRecharge(): boolean;
2328
+ hasEnergyFor(distance: UInt64): boolean;
594
2329
  }
595
- interface GoodType {
596
- id: UInt16Type;
2330
+
2331
+ interface WarehouseStateInput {
2332
+ id: UInt64Type;
2333
+ owner: string;
597
2334
  name: string;
598
- description: string;
599
- base_price: UInt64Type;
600
- mass: UInt64Type;
2335
+ coordinates: CoordinatesType | {
2336
+ x: number;
2337
+ y: number;
2338
+ z?: number;
2339
+ };
2340
+ hullmass?: number;
2341
+ capacity: number;
2342
+ modules?: PackedModuleInput[];
2343
+ schedule?: Types.schedule;
2344
+ cargo?: Types.cargo_item[];
2345
+ }
2346
+ declare class Warehouse extends Types.entity_info {
2347
+ private _sched?;
2348
+ private _inv?;
2349
+ get name(): string;
2350
+ get inv(): InventoryAccessor;
2351
+ get inventory(): EntityInventory[];
2352
+ get sched(): ScheduleAccessor;
2353
+ get isIdle(): boolean;
2354
+ isLoading(now: Date): boolean;
2355
+ isUnloading(now: Date): boolean;
2356
+ get location(): Location;
2357
+ get totalCargoMass(): UInt64;
2358
+ get maxCapacity(): UInt64;
2359
+ get availableCapacity(): UInt64;
2360
+ hasSpace(goodMass: UInt64, quantity: number): boolean;
2361
+ get isFull(): boolean;
2362
+ getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
2363
+ get orbitalAltitude(): number;
2364
+ get totalMass(): UInt64;
601
2365
  }
602
- declare class GoodPrice extends Struct {
603
- id: UInt16;
604
- good: Good;
605
- price: UInt64;
606
- supply: UInt64;
2366
+ declare function computeWarehouseCapabilities(modules: {
2367
+ itemId: number;
2368
+ stats: bigint;
2369
+ }[]): {
2370
+ loaders?: {
2371
+ mass: number;
2372
+ thrust: number;
2373
+ quantity: number;
2374
+ };
2375
+ };
2376
+
2377
+ interface ContainerStateInput {
2378
+ id: UInt64Type;
2379
+ owner: string;
2380
+ name: string;
2381
+ coordinates: CoordinatesType | {
2382
+ x: number;
2383
+ y: number;
2384
+ z?: number;
2385
+ };
2386
+ hullmass: number;
2387
+ capacity: number;
2388
+ cargomass?: number;
2389
+ cargo?: Types.cargo_item[];
2390
+ schedule?: Types.schedule;
607
2391
  }
608
- interface Coordinates extends ActionParams.Type.coordinates {
2392
+ declare class Container extends Types.entity_info {
2393
+ private _sched?;
2394
+ get name(): string;
2395
+ get sched(): ScheduleAccessor;
2396
+ get isIdle(): boolean;
2397
+ isLoading(now: Date): boolean;
2398
+ isUnloading(now: Date): boolean;
2399
+ get location(): Location;
2400
+ get totalMass(): UInt64;
2401
+ get maxCapacity(): UInt64;
2402
+ get availableCapacity(): UInt64;
2403
+ hasSpace(additionalMass: UInt64): boolean;
2404
+ get isFull(): boolean;
2405
+ get orbitalAltitude(): number;
609
2406
  }
2407
+ declare function computeContainerCapabilities(stats: Record<string, number>): {
2408
+ hullmass: number;
2409
+ capacity: number;
2410
+ };
2411
+ declare function computeContainerT2Capabilities(stats: Record<string, number>): {
2412
+ hullmass: number;
2413
+ capacity: number;
2414
+ };
610
2415
 
611
- declare const goodIds: any[];
612
- declare function getGood(good_id: UInt16Type): Good;
613
- declare function getGoods(): Good[];
2416
+ type SubscriptionEntityType = 'ship' | 'warehouse' | 'container';
2417
+ type EntityInstance = Ship | Warehouse | Container;
2418
+ interface SubscriptionsOptions {
2419
+ url: string;
2420
+ }
2421
+ interface BoundsSubscriptionHandle {
2422
+ readonly subId: string;
2423
+ unsubscribe(): void;
2424
+ updateBounds(bounds: BoundingBox): void;
2425
+ current: Map<number, EntityInstance>;
2426
+ }
2427
+ interface EntitySubscriptionHandle {
2428
+ readonly subId: string;
2429
+ readonly entityType: SubscriptionEntityType;
2430
+ readonly entityId: string;
2431
+ unsubscribe(): void;
2432
+ current: EntityInstance | null;
2433
+ }
2434
+ declare class SubscriptionsManager {
2435
+ private readonly conn;
2436
+ private readonly entitySubs;
2437
+ private readonly boundsSubs;
2438
+ private subCounter;
2439
+ constructor(opts: SubscriptionsOptions);
2440
+ close(): void;
2441
+ private generateSubID;
2442
+ private sendMessage;
2443
+ subscribeEntity(type: SubscriptionEntityType, id: string, onUpdate: (e: EntityInstance) => void): EntitySubscriptionHandle;
2444
+ private unsubscribeEntity;
2445
+ subscribeBounds(bounds: BoundingBox, handlers: {
2446
+ onSnapshot?: (entities: EntityInstance[]) => void;
2447
+ onUpdate?: (entity: EntityInstance) => void;
2448
+ onBoundsDelta?: (entered: EntityInstance[], exited: number[]) => void;
2449
+ owner?: string;
2450
+ prioritizeOwner?: string;
2451
+ }): BoundsSubscriptionHandle;
2452
+ private unsubscribeBounds;
2453
+ private updateBounds;
2454
+ private onMessage;
2455
+ private parseEntity;
2456
+ private handleSnapshot;
2457
+ private handleUpdate;
2458
+ private handleBoundsDelta;
2459
+ private handleError;
2460
+ }
614
2461
 
615
- declare function hash(seed: Checksum256Type, string: string): Checksum512;
616
- declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2462
+ declare class GameContext {
2463
+ readonly client: APIClient;
2464
+ readonly server: Contract$2;
2465
+ readonly platform: Contract$2;
2466
+ private _entities?;
2467
+ private _players?;
2468
+ private _locations?;
2469
+ private _epochs?;
2470
+ private _actions?;
2471
+ private _subscriptions?;
2472
+ private _subscriptionsUrl?;
2473
+ private _gameCache?;
2474
+ private _stateCache?;
2475
+ constructor(client: APIClient, server: Contract$2, platform: Contract$2);
2476
+ get entities(): EntitiesManager;
2477
+ get players(): PlayersManager;
2478
+ get locations(): LocationsManager;
2479
+ get epochs(): EpochsManager;
2480
+ get actions(): ActionsManager;
2481
+ setSubscriptionsUrl(url: string): void;
2482
+ get subscriptions(): SubscriptionsManager;
2483
+ getGame(reload?: boolean): Promise<Types$1.game_row>;
2484
+ getState(reload?: boolean): Promise<GameState>;
2485
+ get cachedGame(): Types$1.game_row | undefined;
2486
+ get cachedState(): GameState | undefined;
2487
+ }
617
2488
 
618
- declare function getSystemName(gameSeed: Checksum256, location: Coordinates): string;
619
- declare function hasSystem(gameSeed: Checksum256, coordinates: ActionParams.Type.coordinates): boolean;
620
-
621
- declare enum Rarities {
622
- legendary = "LEGENDARY",
623
- epic = "EPIC",
624
- rare = "RARE",
625
- uncommon = "UNCOMMON",
626
- common = "COMMON",
627
- trash = "TRASH"
628
- }
629
- interface Rarity {
630
- rarity: Rarities;
631
- minMultiplier: number;
632
- maxMultiplier: number;
633
- }
634
- declare function generateLocationSeed(epochSeed: Checksum256Type, location: Coordinates, entitySalt: string): string;
635
- declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): Rarity;
636
- declare function getRarityMultiplier(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): number;
637
- declare function getLocationMultiplier(gameSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): number;
638
- declare function getSupply(gameSeed: Checksum256Type, state: Types.state_row, location: Coordinates, good_id: UInt16Type): number;
639
- declare function marketprice(location: ActionParams.Type.coordinates, good_id: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice;
640
- declare function marketprices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice[];
641
-
642
- declare class Ship extends Types.ship_row {
643
- get maxDistance(): UInt32;
644
- get traveling(): boolean;
645
- get arrived(): boolean;
646
- get eta(): number;
2489
+ declare abstract class BaseManager {
2490
+ protected readonly context: GameContext;
2491
+ constructor(context: GameContext);
2492
+ protected get client(): _wharfkit_antelope.APIClient;
2493
+ protected get server(): _wharfkit_contract.Contract;
2494
+ protected get platform(): _wharfkit_contract.Contract;
2495
+ protected getGame(): Promise<Types$1.game_row>;
2496
+ protected getState(): Promise<GameState>;
647
2497
  }
648
2498
 
649
- declare function travelplanDuration(travelplan: Types.travel_plan): UInt64;
650
- declare function distanceTraveled(ship: Types.ship_row, current?: Date): number;
651
- declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
652
- declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
653
- declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
654
- declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
655
- declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
656
- declare function travelplan(game: Types$1.game_row, ship: Types.ship_row, cargos: Types.cargo_row[], origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, recharge: boolean, alwaysValid?: boolean): Types.travel_plan;
657
- declare function calc_mass_penalty(ship: Types.ship_row, mass: UInt64Type): UInt32;
658
- declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
659
- declare function calc_ship_rechargetime(ship: Types.ship_row): UInt32;
660
- declare function calc_ship_loadtime(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt32;
661
- declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
662
- declare function calc_loader_flighttime(ship: Types.ship_row, mass: UInt64): UInt32;
663
- declare function calc_loader_acceleration(ship: Types.ship_row, mass: UInt64): number;
664
- declare function calc_ship_flighttime(ship: Types.ship_row, mass: UInt64, distance: UInt64): UInt32;
665
- declare function calc_ship_acceleration(ship: Types.ship_row, mass: UInt64): number;
666
- declare function calc_acceleration(thrust: number, mass: number): number;
667
- declare function calc_ship_mass(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt64;
668
- declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
2499
+ type EntityType = 'ship' | 'warehouse' | 'container' | 'location';
2500
+ declare class EntitiesManager extends BaseManager {
2501
+ getEntity(type: EntityType, id: UInt64Type): Promise<Ship | Warehouse | Container>;
2502
+ getEntities(owner: NameType | Types.player_row, type?: EntityType): Promise<(Ship | Warehouse | Container)[]>;
2503
+ getSummaries(owner: NameType | Types.player_row, type?: EntityType): Promise<Types.entity_summary[]>;
2504
+ getShip(id: UInt64Type): Promise<Ship>;
2505
+ getWarehouse(id: UInt64Type): Promise<Warehouse>;
2506
+ getContainer(id: UInt64Type): Promise<Container>;
2507
+ getShips(owner: NameType | Types.player_row): Promise<Ship[]>;
2508
+ getWarehouses(owner: NameType | Types.player_row): Promise<Warehouse[]>;
2509
+ getContainers(owner: NameType | Types.player_row): Promise<Container[]>;
2510
+ getShipSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2511
+ getWarehouseSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2512
+ getContainerSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2513
+ private wrapEntity;
2514
+ private resolveOwner;
2515
+ }
669
2516
 
670
2517
  interface ShiploadOptions {
671
2518
  platformContractName?: string;
672
2519
  serverContractName?: string;
673
2520
  client?: APIClient;
2521
+ subscriptionsUrl?: string;
674
2522
  }
675
2523
  interface ShiploadConstructorOptions extends ShiploadOptions {
676
2524
  platformContract?: Contract$2;
677
2525
  serverContract?: Contract$2;
678
2526
  }
679
2527
  declare class Shipload {
680
- client: APIClient;
681
- server: Contract$2;
682
- platform: Contract$2;
683
- game: Types$1.game_row | undefined;
2528
+ private readonly _context;
684
2529
  constructor(chain: ChainDefinition, constructorOptions?: ShiploadConstructorOptions);
685
2530
  static load(chain: ChainDefinition, shiploadOptions?: ShiploadOptions): Promise<Shipload>;
2531
+ get client(): APIClient;
2532
+ get server(): Contract$2;
2533
+ get platform(): Contract$2;
2534
+ get entities(): EntitiesManager;
2535
+ get players(): PlayersManager;
2536
+ get locations(): LocationsManager;
2537
+ get epochs(): EpochsManager;
2538
+ get actions(): ActionsManager;
2539
+ get subscriptions(): SubscriptionsManager;
686
2540
  getGame(reload?: boolean): Promise<Types$1.game_row>;
687
- getState(): Promise<Types.state_row>;
688
- getShip(ship_id: UInt64Type): Promise<Ship>;
689
- getShips(player: NameType | Types.player_row): Promise<Ship[]>;
690
- marketprice(location: ActionParams.Type.coordinates, good_id: number): Promise<GoodPrice>;
691
- marketprices(location: ActionParams.Type.coordinates): Promise<GoodPrice[]>;
692
- hasSystem(location: ActionParams.Type.coordinates): Promise<boolean>;
693
- findNearbyPlanets(origin: ActionParams.Type.coordinates, maxDistance?: UInt16Type): Promise<Distance[]>;
694
- travelplan(ship: Types.ship_row, origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, recharge?: boolean): Promise<Types.travel_plan>;
695
- getCargo(ship: UInt64Type | Types.ship_row): Promise<Types.cargo_row[]>;
696
- getCurrentEpochHeight(): Promise<UInt64>;
697
- getCurrentEpoch(): Promise<EpochInfo>;
698
- getEpoch(height: UInt64Type): Promise<EpochInfo>;
699
- getLocation(location: Coordinates): Promise<any[]>;
700
- }
701
-
702
- export { CameraPosition, Coordinates, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, EpochInfo, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, GoodType, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, Rarities, Rarity, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Ship, TRAVEL_MAXMASS_PENALTY, calc_acceleration, calc_energyusage, calc_flighttime, calc_loader_acceleration, calc_loader_flighttime, calc_mass_penalty, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_loadtime, calc_ship_mass, calc_ship_rechargetime, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, generateLocationSeed, getCurrentEpoch, getEpochInfo, getGood, getGoods, getLocationMultiplier, getRarity, getRarityMultiplier, getSupply, getSystemName, goodIds, hasSystem, hash, hash512, lerp, marketprice, marketprices, rotation, travelplan, travelplanDuration };
2541
+ getState(reload?: boolean): Promise<GameState>;
2542
+ }
2543
+
2544
+ declare function makeShip(state: ShipStateInput): Ship;
2545
+ declare function makeWarehouse(state: WarehouseStateInput): Warehouse;
2546
+ declare function makeContainer(state: ContainerStateInput): Container;
2547
+
2548
+ declare const itemIds: number[];
2549
+ declare function getItem(itemId: UInt16Type): Item;
2550
+ declare function getItems(): Item[];
2551
+ declare function getResources(opts?: {
2552
+ category?: ResourceCategory;
2553
+ tier?: number;
2554
+ }): Item[];
2555
+ declare function getComponents(opts?: {
2556
+ tier?: number;
2557
+ }): Item[];
2558
+ declare function getModules(opts?: {
2559
+ moduleType?: ModuleType;
2560
+ tier?: number;
2561
+ }): Item[];
2562
+ declare function getEntityItems(opts?: {
2563
+ tier?: number;
2564
+ }): Item[];
2565
+ declare function resolveItemCategory(id: number): ResourceCategory | undefined;
2566
+ declare function typeLabel(type: ItemType | number): string;
2567
+ declare function categoryLabel(cat: ResourceCategory): string;
2568
+ declare function tierLabel(tier: number): string;
2569
+ declare function categoryFromIndex(i: number): ResourceCategory | undefined;
2570
+ declare function categoryLabelFromIndex(i: number): string;
2571
+
2572
+ declare function getLocationType(gameSeed: Checksum256Type, coordinates: CoordinatesType): LocationType;
2573
+ declare function isGatherableLocation(locationType: LocationType): boolean;
2574
+ declare function getLocationTypeName(type: LocationType): string;
2575
+ declare function getSystemName(gameSeed: Checksum256Type, location: CoordinatesType): string;
2576
+ declare function hasSystem(gameSeed: Checksum256Type, coordinates: CoordinatesType): boolean;
2577
+ declare function deriveLocationStatic(gameSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_static;
2578
+ declare function deriveLocationEpoch(epochSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_epoch;
2579
+ declare function deriveLocation(gameSeed: Checksum256Type, epochSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_derived;
2580
+
2581
+ declare function hash(seed: Checksum256Type, string: string): Checksum256;
2582
+ declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2583
+
2584
+ /**
2585
+ * Travel calculations for ship movement, energy usage, and flight times.
2586
+ *
2587
+ * Functions prefixed with `calc_` are contract-parity functions that mirror
2588
+ * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
2589
+ * These use snake_case intentionally to match the contract naming convention
2590
+ * and signal that they must produce identical results to the on-chain code.
2591
+ *
2592
+ * Functions prefixed with `calculate` are higher-level SDK helpers that may
2593
+ * combine multiple contract calculations for convenience.
2594
+ */
2595
+
2596
+ declare function calc_orbital_altitude(mass: number): number;
2597
+ declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
2598
+ declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
2599
+ declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
2600
+ declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
2601
+ declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
2602
+ declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
2603
+ declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
2604
+ declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
2605
+ declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
2606
+ declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
2607
+ declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
2608
+ declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
2609
+ declare function calc_acceleration(thrust: number, mass: number): number;
2610
+ declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
2611
+ declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
2612
+ declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
2613
+ declare function calculateRefuelingTime(ship: ShipLike): UInt32;
2614
+ declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
2615
+ interface LoadTimeBreakdown {
2616
+ unloadTime: number;
2617
+ loadTime: number;
2618
+ totalTime: number;
2619
+ unloadMass: number;
2620
+ loadMass: number;
2621
+ }
2622
+ declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
2623
+ interface EstimatedTravelTime {
2624
+ flightTime: UInt32;
2625
+ rechargeTime: UInt32;
2626
+ loadTime: UInt32;
2627
+ unloadTime: UInt32;
2628
+ total: UInt32;
2629
+ }
2630
+ interface EstimateTravelTimeOptions {
2631
+ needsRecharge?: boolean;
2632
+ loadMass?: UInt32Type;
2633
+ unloadMass?: UInt32Type;
2634
+ }
2635
+ declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
2636
+ declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
2637
+ declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
2638
+ interface TransferEntity {
2639
+ location: {
2640
+ z?: {
2641
+ toNumber(): number;
2642
+ } | number;
2643
+ };
2644
+ loaders?: {
2645
+ thrust: {
2646
+ toNumber(): number;
2647
+ } | number;
2648
+ mass: {
2649
+ toNumber(): number;
2650
+ } | number;
2651
+ quantity: {
2652
+ toNumber(): number;
2653
+ } | number;
2654
+ };
2655
+ }
2656
+ interface HasScheduleAndLocation {
2657
+ coordinates: ActionParams.Type.coordinates;
2658
+ schedule?: Types.schedule;
2659
+ }
2660
+ declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
2661
+ declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
2662
+ declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
2663
+ declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
2664
+
2665
+ interface CargoData {
2666
+ cargo: EntityInventory[];
2667
+ }
2668
+ declare function totalCargoMass(cargo: EntityInventory[]): UInt64;
2669
+ declare function getCargoForItem(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
2670
+ declare function hasSpace(currentMass: UInt64, maxCapacity: UInt64, goodMass: UInt64, quantity: number): boolean;
2671
+ declare function availableCapacity(currentMass: UInt64, maxCapacity: UInt64): UInt64;
2672
+ declare function isFull(currentMass: UInt64, maxCapacity: UInt64): boolean;
2673
+ declare function afterRemoveItems(cargo: Types.cargo_item[], goodsToRemove: Array<{
2674
+ goodId: number;
2675
+ quantity: number;
2676
+ }>): EntityInventory[];
2677
+ declare function afterRemoveAllItems(cargo: Types.cargo_item[]): EntityInventory[];
2678
+
2679
+ type cargoUtils_CargoData = CargoData;
2680
+ declare const cargoUtils_totalCargoMass: typeof totalCargoMass;
2681
+ declare const cargoUtils_getCargoForItem: typeof getCargoForItem;
2682
+ declare const cargoUtils_hasSpace: typeof hasSpace;
2683
+ declare const cargoUtils_availableCapacity: typeof availableCapacity;
2684
+ declare const cargoUtils_isFull: typeof isFull;
2685
+ declare const cargoUtils_afterRemoveItems: typeof afterRemoveItems;
2686
+ declare const cargoUtils_afterRemoveAllItems: typeof afterRemoveAllItems;
2687
+ declare namespace cargoUtils {
2688
+ export {
2689
+ cargoUtils_CargoData as CargoData,
2690
+ cargoUtils_totalCargoMass as totalCargoMass,
2691
+ cargoUtils_getCargoForItem as getCargoForItem,
2692
+ cargoUtils_hasSpace as hasSpace,
2693
+ cargoUtils_availableCapacity as availableCapacity,
2694
+ cargoUtils_isFull as isFull,
2695
+ cargoUtils_afterRemoveItems as afterRemoveItems,
2696
+ cargoUtils_afterRemoveAllItems as afterRemoveAllItems,
2697
+ };
2698
+ }
2699
+
2700
+ interface Entity {
2701
+ id: UInt64;
2702
+ type: Name;
2703
+ owner: Name;
2704
+ entity_name: string;
2705
+ location: Coordinates | Types.coordinates;
2706
+ }
2707
+ type ShipEntity = Entity & Partial<MovementCapability> & Partial<EnergyCapability> & StorageCapability & Partial<LoaderCapability> & MassCapability & ScheduleCapability & {
2708
+ gatherer?: Types.gatherer_stats;
2709
+ };
2710
+ type WarehouseEntity = Entity & StorageCapability & Partial<LoaderCapability> & MassCapability & ScheduleCapability;
2711
+ type ContainerEntity = Entity & StorageCapability & MassCapability & ScheduleCapability;
2712
+ type AnyEntity = ShipEntity | WarehouseEntity | ContainerEntity;
2713
+
2714
+ declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCapability;
2715
+ declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
2716
+ declare function hasStorage(e: Entity): e is Entity & StorageCapability;
2717
+ declare function hasLoaders(e: Entity): e is Entity & LoaderCapability;
2718
+ declare function hasMass(e: Entity): e is Entity & MassCapability;
2719
+ declare function hasSchedule(e: Entity): e is Entity & ScheduleCapability;
2720
+ declare function hasGatherer(e: Entity): e is Entity & GathererCapability;
2721
+
2722
+ declare function maxTravelDistance(entity: MovementCapability): UInt32;
2723
+ declare function calcEnergyUsage(entity: MovementCapability, distance: UInt64): UInt64;
2724
+ declare function energyPercent(entity: MovementCapability & EnergyCapability): number;
2725
+ declare function needsRecharge(entity: MovementCapability & EnergyCapability): boolean;
2726
+
2727
+ declare function calcLoadDuration(entity: LoaderCapability, cargoMass: UInt64): UInt32;
2728
+
2729
+ declare function calc_gather_duration(gatherer: Types.gatherer_stats, itemMass: number, quantity: number, stratum: number, richness: number): UInt32;
2730
+ declare function calc_gather_energy(gatherer: Types.gatherer_stats, duration: number): UInt16;
2731
+
2732
+ interface CrafterCapability {
2733
+ crafter: Types.crafter_stats;
2734
+ }
2735
+ declare function capsHasCrafter(caps: EntityCapabilities): boolean;
2736
+ declare function calc_craft_duration(speed: number, totalInputMass: number): UInt32;
2737
+ declare function calc_craft_energy(drain: number, totalInputMass: number): UInt16;
2738
+
2739
+ declare const MODULE_ANY = 0;
2740
+ declare const MODULE_ENGINE = 1;
2741
+ declare const MODULE_GENERATOR = 2;
2742
+ declare const MODULE_GATHERER = 3;
2743
+ declare const MODULE_LOADER = 4;
2744
+ declare const MODULE_WARP = 5;
2745
+ declare const MODULE_CRAFTER = 6;
2746
+ declare const MODULE_LAUNCHER = 7;
2747
+ declare const MODULE_STORAGE = 8;
2748
+ declare const MODULE_HAULER = 9;
2749
+ interface PackedModule {
2750
+ itemId: number;
2751
+ stats: bigint;
2752
+ }
2753
+ interface ModuleEntry {
2754
+ type: number;
2755
+ installed?: PackedModule;
2756
+ }
2757
+ declare function moduleAccepts(slotType: number, moduleType: number): boolean;
2758
+ declare function getModuleCapabilityType(itemId: number): number;
2759
+ declare function isModuleItem(itemId: number): boolean;
2760
+ declare function moduleSlotTypeToCode(slotType: string): number;
2761
+
2762
+ declare function computeHaulPenalty(totalThrust: number, haulCount: number, avgEfficiency: number): number;
2763
+ declare function computeHaulerDrain(distance: number, drain: number, haulCount: number): number;
2764
+
2765
+ declare const categoryColors: Record<ResourceCategory, string>;
2766
+ declare const tierColors: Record<number, string>;
2767
+ declare const tierLabels: Record<number, string>;
2768
+ declare const categoryIcons: Record<ResourceCategory, string>;
2769
+ type CategoryIconShape = 'hex' | 'diamond' | 'star' | 'circle' | 'square';
2770
+ declare const categoryIconShapes: Record<ResourceCategory, CategoryIconShape>;
2771
+ declare const componentIcon = "\u25A3";
2772
+ declare const moduleIcon = "\u2B22";
2773
+ declare const itemAbbreviations: Record<number, string>;
2774
+
2775
+ type CraftedItemCategory = 'component' | 'module' | 'entity' | 'resource';
2776
+ declare const ITEM_TYPE_RESOURCE = 0;
2777
+ declare const ITEM_TYPE_COMPONENT = 1;
2778
+ declare const ITEM_TYPE_MODULE = 2;
2779
+ declare const ITEM_TYPE_ENTITY = 3;
2780
+ declare function itemTypeCode(id: number): number;
2781
+ declare function itemTier(id: number): number;
2782
+ declare function itemOffset(id: number): number;
2783
+ declare function itemCategory(id: number): CraftedItemCategory;
2784
+ declare function isRelatedItem(a: number, b: number): boolean;
2785
+ declare function isCraftedItem(id: number): boolean;
2786
+
2787
+ interface CategoryInfo {
2788
+ id: ResourceCategory;
2789
+ name: string;
2790
+ label: string;
2791
+ description: string;
2792
+ color: string;
2793
+ }
2794
+ declare function getCategoryInfo(): CategoryInfo[];
2795
+ declare function getCategoryInfo(id: ResourceCategory): CategoryInfo | undefined;
2796
+
2797
+ interface PlanetSubtypeInfo {
2798
+ id: number;
2799
+ label: string;
2800
+ description: string;
2801
+ paletteType: string;
2802
+ }
2803
+ declare function getPlanetSubtypes(): PlanetSubtypeInfo[];
2804
+ declare function getPlanetSubtype(id: number): PlanetSubtypeInfo | undefined;
2805
+
2806
+ interface CapabilityAttribute {
2807
+ capability: string;
2808
+ attribute: string;
2809
+ description: string;
2810
+ }
2811
+ interface StatMapping {
2812
+ stat: string;
2813
+ capability: string;
2814
+ attribute: string;
2815
+ rationale: string;
2816
+ }
2817
+ declare const capabilityNames: string[];
2818
+ declare const capabilityAttributes: CapabilityAttribute[];
2819
+ declare const statMappings: StatMapping[];
2820
+ declare function isInvertedAttribute(attribute: string): boolean;
2821
+ declare function getCapabilityAttributes(capability?: string): CapabilityAttribute[];
2822
+ declare function getStatMappings(): StatMapping[];
2823
+ declare function getStatMappingsForStat(stat: string): StatMapping[];
2824
+ declare function getStatMappingsForCapability(capability: string): StatMapping[];
2825
+
2826
+ declare function computeShipHullCapabilities(stats: Record<string, number>): {
2827
+ hullmass: number;
2828
+ capacity: number;
2829
+ };
2830
+ declare function computeEngineCapabilities(stats: Record<string, number>): {
2831
+ thrust: number;
2832
+ drain: number;
2833
+ };
2834
+ declare function computeGeneratorCapabilities(stats: Record<string, number>): {
2835
+ capacity: number;
2836
+ recharge: number;
2837
+ };
2838
+ declare function computeGathererCapabilities(stats: Record<string, number>): {
2839
+ yield: number;
2840
+ drain: number;
2841
+ depth: number;
2842
+ speed: number;
2843
+ };
2844
+ declare function computeLoaderCapabilities(stats: Record<string, number>): {
2845
+ mass: number;
2846
+ thrust: number;
2847
+ quantity: number;
2848
+ };
2849
+ declare function computeCrafterCapabilities(stats: Record<string, number>): {
2850
+ speed: number;
2851
+ drain: number;
2852
+ };
2853
+ declare function computeHaulerCapabilities(stats: Record<string, number>): {
2854
+ capacity: number;
2855
+ efficiency: number;
2856
+ drain: number;
2857
+ };
2858
+ declare function computeStorageCapabilities(stats: Record<string, number>, baseCapacity: number): {
2859
+ capacityBonus: number;
2860
+ };
2861
+ declare function computeWarehouseHullCapabilities(stats: Record<string, number>): {
2862
+ hullmass: number;
2863
+ capacity: number;
2864
+ };
2865
+ interface ShipCapabilities {
2866
+ engines?: {
2867
+ thrust: number;
2868
+ drain: number;
2869
+ };
2870
+ generator?: {
2871
+ capacity: number;
2872
+ recharge: number;
2873
+ };
2874
+ gatherer?: {
2875
+ yield: number;
2876
+ drain: number;
2877
+ depth: number;
2878
+ speed: number;
2879
+ };
2880
+ hauler?: {
2881
+ capacity: number;
2882
+ efficiency: number;
2883
+ drain: number;
2884
+ };
2885
+ loaders?: {
2886
+ mass: number;
2887
+ thrust: number;
2888
+ quantity: number;
2889
+ };
2890
+ crafter?: {
2891
+ speed: number;
2892
+ drain: number;
2893
+ };
2894
+ }
2895
+ declare function computeShipCapabilities(modules: {
2896
+ itemId: number;
2897
+ stats: bigint;
2898
+ }[]): ShipCapabilities;
2899
+
2900
+ interface ResolvedItemStat {
2901
+ key: string;
2902
+ label: string;
2903
+ abbreviation: string;
2904
+ value: number;
2905
+ color: string;
2906
+ category?: ResourceCategory;
2907
+ inverted?: boolean;
2908
+ }
2909
+ interface ResolvedAttributeGroup {
2910
+ capability: string;
2911
+ attributes: {
2912
+ label: string;
2913
+ value: number;
2914
+ }[];
2915
+ }
2916
+ type ResolvedItemType = 'resource' | 'component' | 'module' | 'entity';
2917
+ interface ResolvedModuleSlot {
2918
+ name?: string;
2919
+ installed: boolean;
2920
+ attributes?: {
2921
+ label: string;
2922
+ value: number;
2923
+ }[];
2924
+ }
2925
+ interface ResolvedItem {
2926
+ itemId: number;
2927
+ name: string;
2928
+ icon: string;
2929
+ abbreviation: string | null;
2930
+ category?: ResourceCategory;
2931
+ tier: number;
2932
+ mass: number;
2933
+ itemType: ResolvedItemType;
2934
+ stats?: ResolvedItemStat[];
2935
+ attributes?: ResolvedAttributeGroup[];
2936
+ moduleSlots?: ResolvedModuleSlot[];
2937
+ }
2938
+ declare function resolveItem(itemId: UInt16Type, stats?: UInt64Type, modules?: Types.module_entry[]): ResolvedItem;
2939
+
2940
+ interface TextSpan {
2941
+ text: string;
2942
+ highlight?: boolean;
2943
+ }
2944
+ interface CapabilityInput {
2945
+ capability: string;
2946
+ attributes: {
2947
+ label: string;
2948
+ value: number;
2949
+ }[];
2950
+ }
2951
+ interface ModuleDescription {
2952
+ id: string;
2953
+ template: string;
2954
+ params: Readonly<Record<string, number | string>>;
2955
+ highlightKeys: readonly string[];
2956
+ }
2957
+ interface RenderDescriptionOptions {
2958
+ translate?: (id: string, fallback: string) => string;
2959
+ formatNumber?: (n: number) => string;
2960
+ }
2961
+ declare function describeModule(input: CapabilityInput): ModuleDescription | null;
2962
+ declare function describeModuleForItem(resolved: ResolvedItem): ModuleDescription | null;
2963
+ declare function describeModuleForSlot(slot: ResolvedModuleSlot): ModuleDescription | null;
2964
+ declare function renderDescription(desc: ModuleDescription, options?: RenderDescriptionOptions): TextSpan[];
2965
+
2966
+ interface NFTInstalledModule {
2967
+ item_id: number;
2968
+ stats: string;
2969
+ }
2970
+ interface NFTModuleSlot {
2971
+ type: number;
2972
+ installed?: NFTInstalledModule;
2973
+ }
2974
+ interface NFTCargoItem {
2975
+ item_id: number;
2976
+ quantity: number;
2977
+ stats: string;
2978
+ modules?: NFTModuleSlot[];
2979
+ }
2980
+ interface NFTCommonBase {
2981
+ quantity: number;
2982
+ stats: string;
2983
+ origin_x: string;
2984
+ origin_y: string;
2985
+ }
2986
+ declare function readCommonBase(data: Record<string, any>): NFTCommonBase;
2987
+ declare function deserializeScalar(data: Record<string, any>, itemId: number): NFTCargoItem;
2988
+ declare const deserializeResource: typeof deserializeScalar;
2989
+ declare const deserializeComponent: typeof deserializeScalar;
2990
+ declare const deserializeModule: typeof deserializeScalar;
2991
+ declare function deserializeEntity(data: Record<string, any>, itemId: number): NFTCargoItem;
2992
+ declare function deserializeAsset(data: Record<string, any>, itemId: number): NFTCargoItem;
2993
+
2994
+ declare function computeBaseHullmass(stats: bigint): number;
2995
+ declare function computeBaseCapacityShip(stats: bigint): number;
2996
+ declare function computeBaseCapacityWarehouse(stats: bigint): number;
2997
+ declare const computeEngineThrust: (vol: number) => number;
2998
+ declare const computeEngineDrain: (thm: number) => number;
2999
+ declare const computeGeneratorCap: (res: number) => number;
3000
+ declare const computeGeneratorRech: (ref: number) => number;
3001
+ declare const computeGathererYield: (str: number) => number;
3002
+ declare const computeGathererDrain: (con: number) => number;
3003
+ declare const computeGathererDepth: (tol: number) => number;
3004
+ declare const computeGathererSpeed: (ref: number) => number;
3005
+ declare const computeLoaderMass: (fin: number) => number;
3006
+ declare const computeLoaderThrust: (pla: number) => number;
3007
+ declare const computeCrafterSpeed: (rea: number) => number;
3008
+ declare const computeCrafterDrain: (com: number) => number;
3009
+ declare function entityDisplayName(itemId: number): string;
3010
+ declare function moduleDisplayName(itemId: number): string;
3011
+ declare function formatModuleLine(slot: number, itemId: number, stats: bigint): string;
3012
+ declare function buildEntityDescription(itemId: number, hullStats: bigint, moduleItems: number[], moduleStats: bigint[]): string;
3013
+
3014
+ type index_NFTInstalledModule = NFTInstalledModule;
3015
+ type index_NFTModuleSlot = NFTModuleSlot;
3016
+ type index_NFTCargoItem = NFTCargoItem;
3017
+ type index_NFTCommonBase = NFTCommonBase;
3018
+ declare const index_readCommonBase: typeof readCommonBase;
3019
+ declare const index_deserializeScalar: typeof deserializeScalar;
3020
+ declare const index_deserializeResource: typeof deserializeResource;
3021
+ declare const index_deserializeComponent: typeof deserializeComponent;
3022
+ declare const index_deserializeModule: typeof deserializeModule;
3023
+ declare const index_deserializeEntity: typeof deserializeEntity;
3024
+ declare const index_deserializeAsset: typeof deserializeAsset;
3025
+ declare const index_computeBaseHullmass: typeof computeBaseHullmass;
3026
+ declare const index_computeBaseCapacityShip: typeof computeBaseCapacityShip;
3027
+ declare const index_computeBaseCapacityWarehouse: typeof computeBaseCapacityWarehouse;
3028
+ declare const index_computeEngineThrust: typeof computeEngineThrust;
3029
+ declare const index_computeEngineDrain: typeof computeEngineDrain;
3030
+ declare const index_computeGeneratorCap: typeof computeGeneratorCap;
3031
+ declare const index_computeGeneratorRech: typeof computeGeneratorRech;
3032
+ declare const index_computeGathererYield: typeof computeGathererYield;
3033
+ declare const index_computeGathererDrain: typeof computeGathererDrain;
3034
+ declare const index_computeGathererDepth: typeof computeGathererDepth;
3035
+ declare const index_computeGathererSpeed: typeof computeGathererSpeed;
3036
+ declare const index_computeLoaderMass: typeof computeLoaderMass;
3037
+ declare const index_computeLoaderThrust: typeof computeLoaderThrust;
3038
+ declare const index_computeCrafterSpeed: typeof computeCrafterSpeed;
3039
+ declare const index_computeCrafterDrain: typeof computeCrafterDrain;
3040
+ declare const index_entityDisplayName: typeof entityDisplayName;
3041
+ declare const index_moduleDisplayName: typeof moduleDisplayName;
3042
+ declare const index_formatModuleLine: typeof formatModuleLine;
3043
+ declare const index_buildEntityDescription: typeof buildEntityDescription;
3044
+ declare namespace index {
3045
+ export {
3046
+ index_NFTInstalledModule as NFTInstalledModule,
3047
+ index_NFTModuleSlot as NFTModuleSlot,
3048
+ index_NFTCargoItem as NFTCargoItem,
3049
+ index_NFTCommonBase as NFTCommonBase,
3050
+ index_readCommonBase as readCommonBase,
3051
+ index_deserializeScalar as deserializeScalar,
3052
+ index_deserializeResource as deserializeResource,
3053
+ index_deserializeComponent as deserializeComponent,
3054
+ index_deserializeModule as deserializeModule,
3055
+ index_deserializeEntity as deserializeEntity,
3056
+ index_deserializeAsset as deserializeAsset,
3057
+ index_computeBaseHullmass as computeBaseHullmass,
3058
+ index_computeBaseCapacityShip as computeBaseCapacityShip,
3059
+ index_computeBaseCapacityWarehouse as computeBaseCapacityWarehouse,
3060
+ index_computeEngineThrust as computeEngineThrust,
3061
+ index_computeEngineDrain as computeEngineDrain,
3062
+ index_computeGeneratorCap as computeGeneratorCap,
3063
+ index_computeGeneratorRech as computeGeneratorRech,
3064
+ index_computeGathererYield as computeGathererYield,
3065
+ index_computeGathererDrain as computeGathererDrain,
3066
+ index_computeGathererDepth as computeGathererDepth,
3067
+ index_computeGathererSpeed as computeGathererSpeed,
3068
+ index_computeLoaderMass as computeLoaderMass,
3069
+ index_computeLoaderThrust as computeLoaderThrust,
3070
+ index_computeCrafterSpeed as computeCrafterSpeed,
3071
+ index_computeCrafterDrain as computeCrafterDrain,
3072
+ index_entityDisplayName as entityDisplayName,
3073
+ index_moduleDisplayName as moduleDisplayName,
3074
+ index_formatModuleLine as formatModuleLine,
3075
+ index_buildEntityDescription as buildEntityDescription,
3076
+ };
3077
+ }
3078
+
3079
+ declare function formatMass(kg: number): string;
3080
+ declare function formatMassDelta(kg: number): string;
3081
+
3082
+ interface DisplayNameInput {
3083
+ itemType: 'resource' | 'component' | 'module' | 'entity' | string;
3084
+ tier: number;
3085
+ category?: ResourceCategory;
3086
+ name: string;
3087
+ }
3088
+ declare function displayName(resolved: DisplayNameInput): string;
3089
+ interface DescribeOptions {
3090
+ translate?: (key: string) => string;
3091
+ formatNumber?: (n: number) => string;
3092
+ formatMass?: (kg: number) => string;
3093
+ }
3094
+ declare function describeItem(resolved: ResolvedItem, opts?: DescribeOptions): string;
3095
+
3096
+ type ConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
3097
+ interface WebSocketConnectionOptions {
3098
+ url: string;
3099
+ onMessage: (message: ServerMessage) => void;
3100
+ onStateChange?: (state: ConnectionState) => void;
3101
+ }
3102
+ declare class WebSocketConnection {
3103
+ private ws;
3104
+ private url;
3105
+ private onMessage;
3106
+ private onStateChange?;
3107
+ private reconnectAttempts;
3108
+ private reconnectTimeout;
3109
+ private _state;
3110
+ private shouldReconnect;
3111
+ private sendQueue;
3112
+ private static readonly MIN_RECONNECT_DELAY;
3113
+ private static readonly MAX_RECONNECT_DELAY;
3114
+ private static readonly RECONNECT_MULTIPLIER;
3115
+ constructor(options: WebSocketConnectionOptions);
3116
+ get state(): ConnectionState;
3117
+ private setState;
3118
+ connect(): void;
3119
+ private scheduleReconnect;
3120
+ disconnect(): void;
3121
+ close(): void;
3122
+ send(message: ClientMessage): void;
3123
+ get isConnected(): boolean;
3124
+ }
3125
+
3126
+ declare function mapEntity(ei: Types.entity_info): Ship | Warehouse | Container;
3127
+ declare function parseWireEntity(raw: WireEntity): Types.entity_info;
3128
+
3129
+ declare function setSubscriptionsDebug(on: boolean): void;
3130
+ declare function isSubscriptionsDebugEnabled(): boolean;
3131
+
3132
+ type movement_stats = Types.movement_stats;
3133
+ type energy_stats = Types.energy_stats;
3134
+ type loader_stats = Types.loader_stats;
3135
+ type task = Types.task;
3136
+ type cargo_item = Types.cargo_item;
3137
+ type warehouse_row = Types.warehouse_row;
3138
+ type container_row = Types.container_row;
3139
+ type gatherer_stats = Types.gatherer_stats;
3140
+ type location_static = Types.location_static;
3141
+ type location_epoch = Types.location_epoch;
3142
+ type location_derived = Types.location_derived;
3143
+ type location_row = Types.location_row;
3144
+
3145
+ export { AckMessage, ActionsManager, AnyEntity, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, BoundingBox, BoundsDeltaMessage, BoundsSubscriptionHandle, CANCEL_CONTAINS_GROUPED_TASK, CANCEL_PAIRED_HAS_PENDING, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_CAPACITY_EXCEEDED, CONTAINER_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CRAFT_EXCEEDS_ENERGY_CAPACITY, CRAFT_NOT_ENOUGH_ENERGY, CapabilityAttribute, CapabilityInput, CargoData, CargoMassInfo, CargoStack, CategoryIconShape, CategoryInfo, CategoryStacks, ClientMessage, ConnectionState, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, CraftedItemCategory, CrafterCapability, DEPLOY_ENTITY_HAS_SCHEDULE, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, DESTINATION_CAPACITY_EXCEEDED, DerivedStratum, DescribeOptions, Distance, ENTITY_CAPACITY_EXCEEDED, ENTITY_NO_CRAFTER, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityInfo, EntityInstance, EntityInventory, EntityLayout, EntityRefInput, EntitySlot, EntityState, EntitySubscriptionHandle, EntityType, EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GATHER_EXCEEDS_ENERGY_CAPACITY, GATHER_NOT_ENOUGH_ENERGY, GROUP_DUPLICATE_ENTITY, GROUP_EMPTY, GROUP_ENTITY_NOT_MOVABLE, GROUP_HAUL_CAPACITY_EXCEEDED, GROUP_NOT_FOUND, GROUP_NOT_SAME_LOCATION, GROUP_NOT_SAME_OWNER, GROUP_NO_THRUST, GameState, GathererCapability, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_BIOMASS_T1, ITEM_BIOMASS_T10, ITEM_BIOMASS_T2, ITEM_BIOMASS_T3, ITEM_BIOMASS_T4, ITEM_BIOMASS_T5, ITEM_BIOMASS_T6, ITEM_BIOMASS_T7, ITEM_BIOMASS_T8, ITEM_BIOMASS_T9, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CARGO_LINING_T2, ITEM_CONTAINER_T1_PACKED, ITEM_CONTAINER_T2_PACKED, ITEM_CRAFTER_T1, ITEM_CRYSTAL_T1, ITEM_CRYSTAL_T10, ITEM_CRYSTAL_T2, ITEM_CRYSTAL_T3, ITEM_CRYSTAL_T4, ITEM_CRYSTAL_T5, ITEM_CRYSTAL_T6, ITEM_CRYSTAL_T7, ITEM_CRYSTAL_T8, ITEM_CRYSTAL_T9, ITEM_DOES_NOT_EXIST, ITEM_ENGINE_T1, ITEM_FOCUSING_ARRAY, ITEM_GAS_T1, ITEM_GAS_T10, ITEM_GAS_T2, ITEM_GAS_T3, ITEM_GAS_T4, ITEM_GAS_T5, ITEM_GAS_T6, ITEM_GAS_T7, ITEM_GAS_T8, ITEM_GAS_T9, ITEM_GATHERER_T1, ITEM_GENERATOR_T1, ITEM_HAULER_T1, ITEM_HULL_PLATES, ITEM_HULL_PLATES_T2, ITEM_LOADER_T1, ITEM_MATTER_CONDUIT, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_NOT_DEPLOYABLE, ITEM_NOT_PACKED_ENTITY, ITEM_ORE_T1, ITEM_ORE_T10, ITEM_ORE_T2, ITEM_ORE_T3, ITEM_ORE_T4, ITEM_ORE_T5, ITEM_ORE_T6, ITEM_ORE_T7, ITEM_ORE_T8, ITEM_ORE_T9, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_REGOLITH_T1, ITEM_REGOLITH_T10, ITEM_REGOLITH_T2, ITEM_REGOLITH_T3, ITEM_REGOLITH_T4, ITEM_REGOLITH_T5, ITEM_REGOLITH_T6, ITEM_REGOLITH_T7, ITEM_REGOLITH_T8, ITEM_REGOLITH_T9, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_SURVEY_PROBE, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, InventoryAccessor, Item, ItemType, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationStratum, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MODULE_ANY, MODULE_CARGO_NOT_FOUND, MODULE_CRAFTER, MODULE_ENGINE, MODULE_ENTITY_BUSY, MODULE_GATHERER, MODULE_GENERATOR, MODULE_HAULER, MODULE_LAUNCHER, MODULE_LOADER, MODULE_NOT_MODULE, MODULE_SLOT_EMPTY, MODULE_SLOT_INVALID, MODULE_SLOT_OCCUPIED, MODULE_STORAGE, MODULE_TYPE_MISMATCH, MODULE_WARP, MassCapability, ModuleDescription, ModuleEntry, ModuleType, MovementCapability, index as NFT, NFTCargoItem, NFTCommonBase, NFTInstalledModule, NFTModuleSlot, NO_SCHEDULE, NamedStats, PLANET_SUBTYPE_GAS_GIANT, PLANET_SUBTYPE_ICY, PLANET_SUBTYPE_INDUSTRIAL, PLANET_SUBTYPE_OCEAN, PLANET_SUBTYPE_ROCKY, PLANET_SUBTYPE_TERRESTRIAL, PLAYER_ALREADY_JOINED, PLAYER_NOT_FOUND, PLAYER_NOT_JOINED, PRECISION, PackedModule, PackedModuleInput, PingMessage, PlanetSubtypeInfo, platform as PlatformContract, Types$1 as PlatformTypes, Player, PlayerStateInput, PlayersManager, PongMessage, Projectable, ProjectableSnapshot, ProjectedEntity, ProjectionOptions, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, RECIPE_NOT_FOUND, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RESOLVE_COUNT_EXCEEDS_COMPLETED, Recipe, RecipeInput, RecipeInputCategory, RecipeInputItemId, RecipeSlotInput, RenderDescriptionOptions, ReserveTier, ResolvedAttributeGroup, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedModuleSlot, ResourceCategory, ResourceStats, SHIP_ALREADY_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, SHIP_CAPACITY_EXCEEDED, SHIP_CARGO_NOT_LOADED, SHIP_CARGO_NOT_OWNED, SHIP_INVALID_CARGO, SHIP_INVALID_DESTINATION, SHIP_INVALID_TRAVEL_DURATION, SHIP_NOT_ARRIVED, SHIP_NOT_ENOUGH_ENERGY, SHIP_NOT_ENOUGH_ENERGY_CAPACITY, SHIP_NOT_FOUND, SHIP_NOT_IDLE, SHIP_NOT_OWNED, SHIP_NO_COMPLETED_TASKS, SHIP_NO_TASKS_TO_CANCEL, STARTER_ALREADY_CLAIMED, ScheduleAccessor, ScheduleCapability, ScheduleData, Scheduleable, server as ServerContract, ServerMessage, Types as ServerTypes, Ship, ShipCapabilities, ShipEntity, ShipLike, ShipStateInput, Shipload, SnapshotMessage, StackInput, StatDefinition, StatMapping, StatSlot, StorageCapability, StratumInfo, SubscribeEntityMessage, SubscribeEventsMessage, SubscribeMessage, SubscriptionEntityType, SubscriptionsManager, SubscriptionsOptions, TIER_ADJECTIVES, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, WARP_HAS_CARGO, WARP_HAS_SCHEDULE, WARP_NOT_FULL_ENERGY, WARP_NO_CAPABILITY, WARP_OUT_OF_RANGE, Warehouse, WarehouseEntity, WarehouseStateInput, WebSocketConnection, WebSocketConnectionOptions, WireCoordinates, WireEntity, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildEntityDescription, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcLoadDuration, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, calc_loader_acceleration, calc_loader_flighttime, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItemToStack, cargoUtils, cargo_item, categoryColors, categoryFromIndex, categoryIconShapes, categoryIcons, categoryLabel, categoryLabelFromIndex, componentIcon, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterCapabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityStats, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerDrain, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseCapabilities, computeWarehouseHullCapabilities, container_row, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStrata, deriveStratum, describeItem, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, displayName, distanceBetweenCoordinates, distanceBetweenPoints, encodeGatheredCargoStats, encodeStats, energyPercent, energy_stats, entityDisplayName, estimateDealTravelTime, estimateTravelTime, findItemByCategoryAndTier, findNearbyPlanets, formatMass, formatMassDelta, formatModuleLine, formatTier, gatherer_stats, getCapabilityAttributes, getCategoryInfo, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityItems, getEntityLayout, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getLocationTypeName, getModuleCapabilityType, getModules, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getRecipe, getResourceTier, getResourceWeight, getResources, getStatDefinitions, getStatMappings, getStatMappingsForCapability, getStatMappingsForStat, getStatName, getSystemName, hasEnergy, hasEnergyForDistance, hasGatherer, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, isCraftedItem, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isModuleItem, isRelatedItem, isSubscriptionsDebugEnabled, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, mapEntity, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, movement_stats, needsRecharge, parseWireEntity, projectEntity, projectEntityAt, projectFromCurrentState, projectFromCurrentStateAt, readCommonBase, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveStats, rollTier, rollWithinTier, rotation, schedule, setSubscriptionsDebug, stackKey, stackToCargoItem, stacksEqual, statMappings, task, tierColors, tierLabel, tierLabels, toLocation, typeLabel, validateSchedule, warehouse_row };