@shipload/sdk 2.0.0-rc1 → 2.0.0-rc11

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 (74) hide show
  1. package/lib/shipload.d.ts +1701 -1183
  2. package/lib/shipload.js +6746 -3447
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +6429 -3229
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +6 -6
  7. package/src/capabilities/crafting.ts +26 -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 +57 -0
  14. package/src/capabilities/movement.ts +29 -0
  15. package/src/capabilities/storage.ts +72 -0
  16. package/src/contracts/server.ts +932 -314
  17. package/src/data/capabilities.ts +408 -0
  18. package/src/data/categories.ts +58 -0
  19. package/src/data/colors.ts +53 -0
  20. package/src/data/items.json +17 -0
  21. package/src/data/locations.ts +53 -0
  22. package/src/data/nebula-adjectives.json +211 -0
  23. package/src/data/nebula-nouns.json +151 -0
  24. package/src/data/recipes.ts +571 -0
  25. package/src/data/syllables.json +1386 -780
  26. package/src/data/tiers.ts +45 -0
  27. package/src/derivation/crafting.ts +197 -0
  28. package/src/derivation/index.ts +28 -0
  29. package/src/derivation/location-size.ts +15 -0
  30. package/src/derivation/resources.ts +142 -0
  31. package/src/derivation/stats.ts +146 -0
  32. package/src/derivation/stratum.ts +124 -0
  33. package/src/entities/cargo-utils.ts +46 -9
  34. package/src/entities/container.ts +106 -0
  35. package/src/entities/entity-inventory.ts +13 -13
  36. package/src/entities/inventory-accessor.ts +42 -0
  37. package/src/entities/location.ts +7 -188
  38. package/src/entities/makers.ts +72 -0
  39. package/src/entities/player.ts +1 -273
  40. package/src/entities/ship-deploy.ts +263 -0
  41. package/src/entities/ship.ts +93 -453
  42. package/src/entities/warehouse.ts +34 -148
  43. package/src/errors.ts +4 -4
  44. package/src/index-module.ts +226 -42
  45. package/src/managers/actions.ts +111 -79
  46. package/src/managers/context.ts +0 -9
  47. package/src/managers/entities.ts +22 -5
  48. package/src/managers/index.ts +0 -1
  49. package/src/managers/locations.ts +15 -79
  50. package/src/market/items.ts +30 -0
  51. package/src/nft/description.ts +175 -0
  52. package/src/nft/deserializers.ts +81 -0
  53. package/src/nft/index.ts +2 -0
  54. package/src/resolution/resolve-item.ts +313 -0
  55. package/src/scheduling/accessor.ts +82 -0
  56. package/src/scheduling/projection.ts +158 -54
  57. package/src/scheduling/schedule.ts +24 -0
  58. package/src/shipload.ts +0 -5
  59. package/src/travel/travel.ts +93 -19
  60. package/src/types/capabilities.ts +71 -0
  61. package/src/types/entity-traits.ts +69 -0
  62. package/src/types/entity.ts +39 -0
  63. package/src/types/index.ts +3 -0
  64. package/src/types.ts +76 -33
  65. package/src/utils/hash.ts +1 -1
  66. package/src/utils/system.ts +148 -11
  67. package/src/data/goods.json +0 -23
  68. package/src/managers/trades.ts +0 -119
  69. package/src/market/goods.ts +0 -31
  70. package/src/market/market.ts +0 -209
  71. package/src/market/rolls.ts +0 -8
  72. package/src/trading/collect.ts +0 -939
  73. package/src/trading/deal.ts +0 -208
  74. package/src/trading/trade.ts +0 -203
package/lib/shipload.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _wharfkit_antelope from '@wharfkit/antelope';
2
- import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt16, Int64, UInt8, TimePoint, UInt8Type, TimePointType, Int64Type, UInt16Type, Checksum512, APIClient } 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
3
  import * as _wharfkit_contract from '@wharfkit/contract';
4
4
  import { Contract as Contract$2, PartialBy, ContractArgs, ActionOptions, Table } from '@wharfkit/contract';
5
5
  import { ChainDefinition } from '@wharfkit/session';
@@ -158,68 +158,69 @@ declare namespace platform {
158
158
  declare const abiBlob: Blob;
159
159
  declare const abi: ABI;
160
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
+ }
161
173
  class advance extends Struct {
162
174
  reveal: string;
163
175
  commit: Checksum256;
164
176
  }
165
- class buygoods extends Struct {
166
- ship_id: UInt64;
167
- good_id: UInt16;
168
- quantity: UInt32;
177
+ class cargo_seed extends Struct {
178
+ item_id: UInt16;
179
+ seed: UInt64;
169
180
  }
170
- class buyship extends Struct {
171
- account: Name;
172
- name: string;
181
+ class module_entry extends Struct {
182
+ type: UInt8;
183
+ installed?: cargo_seed;
173
184
  }
174
- class buywarehouse extends Struct {
175
- account: Name;
176
- ship_id: UInt64;
177
- name: string;
185
+ class cargo_item extends Struct {
186
+ item_id: UInt16;
187
+ quantity: UInt32;
188
+ seed?: UInt64;
189
+ modules: module_entry[];
190
+ }
191
+ class blend extends Struct {
192
+ entity_type: Name;
193
+ id: UInt64;
194
+ inputs: cargo_item[];
178
195
  }
179
196
  class cancel extends Struct {
180
197
  entity_type: Name;
181
198
  id: UInt64;
182
199
  count: UInt64;
183
200
  }
184
- class coordinates extends Struct {
185
- x: Int64;
186
- y: Int64;
187
- z?: UInt16;
188
- }
189
- class cargo_item extends Struct {
190
- good_id: UInt16;
191
- quantity: UInt32;
192
- unit_cost: UInt64;
193
- }
194
- class task extends Struct {
195
- type: UInt8;
196
- duration: UInt32;
197
- cancelable: UInt8;
198
- location?: coordinates;
199
- cargo: cargo_item[];
200
- entity?: UInt64;
201
- credits?: Int64;
202
- }
203
- class cancel_log extends Struct {
204
- owner: Name;
201
+ class entity_ref extends Struct {
205
202
  entity_type: Name;
206
203
  entity_id: UInt64;
207
- task_index: UInt8;
208
- task: task;
209
- started_at: TimePoint;
210
204
  }
211
205
  class cancel_results extends Struct {
212
206
  entity_id: UInt64;
213
207
  entity_type: Name;
214
208
  cancelled_count: UInt8;
215
209
  schedule_started?: TimePoint;
210
+ entitygroup?: UInt64;
211
+ group_members?: entity_ref[];
216
212
  }
217
213
  class cargo_row extends Struct {
218
214
  id: UInt64;
219
215
  entity_id: UInt64;
220
- good_id: UInt64;
216
+ item_id: UInt64;
221
217
  quantity: UInt64;
222
- unit_cost: UInt64;
218
+ seed: UInt64;
219
+ modules: module_entry[];
220
+ }
221
+ class cleanrsvp extends Struct {
222
+ epoch: UInt64;
223
+ max_rows: UInt64;
223
224
  }
224
225
  class cleartable extends Struct {
225
226
  table_name: Name;
@@ -229,6 +230,88 @@ declare namespace Types {
229
230
  class commit extends Struct {
230
231
  commit: Checksum256;
231
232
  }
233
+ class entity_defaults extends Struct {
234
+ warehouse_capacity: UInt32;
235
+ warehouse_z: UInt16;
236
+ container_hullmass: UInt32;
237
+ container_capacity: UInt32;
238
+ container_z: UInt16;
239
+ }
240
+ class item_def extends Struct {
241
+ id: UInt16;
242
+ mass: UInt32;
243
+ type: UInt8;
244
+ subtype: UInt8;
245
+ tier: UInt8;
246
+ }
247
+ class game_config extends Struct {
248
+ version: UInt32;
249
+ defaults: entity_defaults;
250
+ items: item_def[];
251
+ }
252
+ class configlog extends Struct {
253
+ config: game_config;
254
+ }
255
+ class coordinates extends Struct {
256
+ x: Int64;
257
+ y: Int64;
258
+ z?: UInt16;
259
+ }
260
+ class task extends Struct {
261
+ type: UInt8;
262
+ duration: UInt32;
263
+ cancelable: UInt8;
264
+ coordinates?: coordinates;
265
+ cargo: cargo_item[];
266
+ entitytarget?: entity_ref;
267
+ entitygroup?: UInt64;
268
+ energy_cost?: UInt16;
269
+ }
270
+ class schedule extends Struct {
271
+ started: TimePoint;
272
+ tasks: task[];
273
+ }
274
+ class container_row extends Struct {
275
+ id: UInt64;
276
+ owner: Name;
277
+ name: string;
278
+ coordinates: coordinates;
279
+ hullmass: UInt32;
280
+ capacity: UInt32;
281
+ cargomass: UInt32;
282
+ schedule?: schedule;
283
+ }
284
+ class craft extends Struct {
285
+ entity_type: Name;
286
+ id: UInt64;
287
+ recipe_id: UInt16;
288
+ quantity: UInt32;
289
+ inputs: cargo_item[];
290
+ }
291
+ class crafter_stats extends Struct {
292
+ speed: UInt16;
293
+ drain: UInt16;
294
+ }
295
+ class createentity extends Struct {
296
+ owner: Name;
297
+ entity_type: Name;
298
+ entity_name: string;
299
+ x: Int64;
300
+ y: Int64;
301
+ }
302
+ class deploy extends Struct {
303
+ entity_type: Name;
304
+ id: UInt64;
305
+ packed_item_id: UInt16;
306
+ seed: UInt64;
307
+ entity_name: string;
308
+ }
309
+ class descentity extends Struct {
310
+ item_id: UInt16;
311
+ hull_seed: UInt64;
312
+ module_items: UInt16[];
313
+ module_seeds: UInt64[];
314
+ }
232
315
  class enable extends Struct {
233
316
  enabled: boolean;
234
317
  }
@@ -236,6 +319,10 @@ declare namespace Types {
236
319
  capacity: UInt16;
237
320
  recharge: UInt16;
238
321
  }
322
+ class entity_current_state extends Struct {
323
+ coordinates: coordinates;
324
+ energy: UInt16;
325
+ }
239
326
  class loader_stats extends Struct {
240
327
  mass: UInt32;
241
328
  thrust: UInt16;
@@ -245,24 +332,38 @@ declare namespace Types {
245
332
  thrust: UInt32;
246
333
  drain: UInt16;
247
334
  }
248
- class schedule extends Struct {
249
- started: TimePoint;
250
- tasks: task[];
335
+ class gatherer_stats extends Struct {
336
+ yield: UInt16;
337
+ drain: UInt16;
338
+ depth: UInt16;
339
+ speed: UInt16;
340
+ }
341
+ class hauler_stats extends Struct {
342
+ capacity: UInt8;
343
+ efficiency: UInt16;
344
+ drain: UInt16;
345
+ }
346
+ class warp_stats extends Struct {
347
+ range: UInt32;
251
348
  }
252
349
  class entity_info extends Struct {
253
350
  type: Name;
254
351
  id: UInt64;
255
352
  owner: Name;
256
353
  entity_name: string;
257
- location: coordinates;
354
+ coordinates: coordinates;
258
355
  cargomass: UInt32;
259
356
  cargo: cargo_item[];
260
357
  loaders?: loader_stats;
261
358
  energy?: UInt16;
262
- mass?: UInt32;
359
+ hullmass?: UInt32;
263
360
  engines?: movement_stats;
264
361
  generator?: energy_stats;
265
362
  capacity?: UInt32;
363
+ gatherer?: gatherer_stats;
364
+ hauler?: hauler_stats;
365
+ warp?: warp_stats;
366
+ crafter?: crafter_stats;
266
367
  is_idle: boolean;
267
368
  current_task?: task;
268
369
  current_task_elapsed: UInt32;
@@ -271,16 +372,12 @@ declare namespace Types {
271
372
  idle_at?: TimePoint;
272
373
  schedule?: schedule;
273
374
  }
274
- class entity_state extends Struct {
275
- location: coordinates;
276
- energy: UInt16;
277
- }
278
375
  class entity_summary extends Struct {
279
376
  type: Name;
280
377
  id: UInt64;
281
378
  owner: Name;
282
379
  entity_name: string;
283
- location: coordinates;
380
+ coordinates: coordinates;
284
381
  is_idle: boolean;
285
382
  resolved_count: UInt32;
286
383
  pending_count: UInt32;
@@ -291,6 +388,18 @@ declare namespace Types {
291
388
  task_count: UInt8;
292
389
  schedule_started: TimePoint;
293
390
  }
391
+ class entitygroup_row extends Struct {
392
+ id: UInt64;
393
+ participants: entity_ref[];
394
+ }
395
+ class gather extends Struct {
396
+ entity_type: Name;
397
+ id: UInt64;
398
+ stratum: UInt16;
399
+ quantity: UInt32;
400
+ }
401
+ class getconfig extends Struct {
402
+ }
294
403
  class getentities extends Struct {
295
404
  owner: Name;
296
405
  entity_type?: Name;
@@ -299,31 +408,53 @@ declare namespace Types {
299
408
  entity_type: Name;
300
409
  entity_id: UInt64;
301
410
  }
302
- class getgoods extends Struct {
411
+ class getitemdata extends Struct {
412
+ }
413
+ class getitems extends Struct {
303
414
  }
304
415
  class getlocation extends Struct {
305
416
  x: Int64;
306
417
  y: Int64;
307
418
  }
419
+ class getlocdata extends Struct {
420
+ x: Int64;
421
+ y: Int64;
422
+ }
423
+ class getmodules extends Struct {
424
+ }
308
425
  class getnearby extends Struct {
309
426
  entity_type: Name;
310
427
  entity_id: UInt64;
311
428
  recharge: boolean;
312
429
  }
430
+ class getnftinfo extends Struct {
431
+ }
313
432
  class getplayer extends Struct {
314
433
  account: Name;
315
434
  }
435
+ class getrecipe extends Struct {
436
+ output_item_id: UInt16;
437
+ }
438
+ class getrecipes extends Struct {
439
+ lower_bound: UInt16;
440
+ limit: UInt8;
441
+ }
442
+ class getresources extends Struct {
443
+ }
444
+ class getstratum extends Struct {
445
+ x: Int64;
446
+ y: Int64;
447
+ stratum: UInt16;
448
+ }
316
449
  class getsummaries extends Struct {
317
450
  owner: Name;
318
451
  entity_type?: Name;
319
452
  }
320
- class good extends Struct {
321
- id: UInt16;
322
- base_price: UInt32;
323
- mass: UInt32;
324
- }
325
- class goods_info extends Struct {
326
- goods: good[];
453
+ class grouptravel extends Struct {
454
+ entities: entity_ref[];
455
+ x: Int64;
456
+ y: Int64;
457
+ recharge: boolean;
327
458
  }
328
459
  class hash extends Struct {
329
460
  value: string;
@@ -334,48 +465,81 @@ declare namespace Types {
334
465
  class init extends Struct {
335
466
  seed: Checksum256;
336
467
  }
468
+ class recipe_input extends Struct {
469
+ item_id: UInt16;
470
+ category: UInt8;
471
+ quantity: UInt32;
472
+ }
473
+ class stat_source extends Struct {
474
+ input_index: UInt8;
475
+ input_stat_index: UInt8;
476
+ }
477
+ class stat_slot_response extends Struct {
478
+ sources: stat_source[];
479
+ }
480
+ class recipe_item_info extends Struct {
481
+ id: UInt16;
482
+ mass: UInt32;
483
+ }
484
+ class recipe_response extends Struct {
485
+ output_item_id: UInt16;
486
+ output_mass: UInt32;
487
+ inputs: recipe_input[];
488
+ stat_slots: stat_slot_response[];
489
+ blend_weights: Bytes;
490
+ output_item: recipe_item_info;
491
+ input_items: recipe_item_info[];
492
+ }
493
+ class recipes_result extends Struct {
494
+ recipes: recipe_response[];
495
+ }
496
+ class itemdata_result extends Struct {
497
+ items: item_def[];
498
+ recipes: recipes_result;
499
+ }
500
+ class items_info extends Struct {
501
+ items: item_def[];
502
+ }
337
503
  class join extends Struct {
338
504
  account: Name;
339
505
  }
340
- class location_good extends Struct {
341
- id: UInt16;
342
- price: UInt32;
343
- supply: UInt16;
344
- rarity_multiplier: UInt32;
345
- location_multiplier: UInt32;
506
+ class location_static extends Struct {
507
+ coords: coordinates;
508
+ type: UInt8;
509
+ subtype: UInt8;
510
+ seed0: UInt8;
511
+ seed1: UInt8;
512
+ }
513
+ class location_epoch extends Struct {
514
+ active: boolean;
515
+ seed0: UInt8;
516
+ seed1: UInt8;
517
+ }
518
+ class location_derived extends Struct {
519
+ static_props: location_static;
520
+ epoch_props: location_epoch;
521
+ size: UInt16;
346
522
  }
347
523
  class location_info extends Struct {
348
524
  coords: coordinates;
349
525
  is_system: boolean;
350
- goods: location_good[];
351
526
  }
352
527
  class location_row extends Struct {
353
528
  id: UInt64;
529
+ owner: Name;
354
530
  coordinates: coordinates;
355
- epoch: UInt64;
356
- good_id: UInt16;
357
- supply: UInt16;
358
- }
359
- class logcancel extends Struct {
360
- log: cancel_log;
531
+ cargomass: UInt32;
532
+ cargo: cargo_item[];
533
+ schedule?: schedule;
361
534
  }
362
- class resolve_log extends Struct {
363
- owner: Name;
364
- entity_type: Name;
365
- entity_id: UInt64;
366
- task_index: UInt8;
367
- task: task;
368
- started_at: TimePoint;
369
- completed_at: TimePoint;
370
- new_energy?: UInt16;
371
- new_location?: coordinates;
372
- cargomass_delta: Int64;
373
- cargo_added: cargo_item[];
374
- cargo_removed: cargo_item[];
375
- credits?: Int64;
535
+ class module_info extends Struct {
536
+ id: UInt16;
537
+ mass: UInt32;
538
+ module_type: UInt8;
539
+ tier: UInt8;
376
540
  }
377
- class logresolve extends Struct {
378
- log: resolve_log;
541
+ class modules_result extends Struct {
542
+ modules: module_info[];
379
543
  }
380
544
  class nearby_system extends Struct {
381
545
  distance: UInt64;
@@ -385,76 +549,156 @@ declare namespace Types {
385
549
  }
386
550
  class nearby_info extends Struct {
387
551
  can_travel: boolean;
388
- current: entity_state;
389
- projected: entity_state;
552
+ current: entity_current_state;
553
+ projected: entity_current_state;
390
554
  max_energy: UInt16;
391
555
  systems: nearby_system[];
392
556
  }
393
- class payloan extends Struct {
394
- account: Name;
395
- amount: UInt64;
557
+ class nexus_row extends Struct {
558
+ id: UInt64;
559
+ owner: Name;
560
+ name: string;
561
+ coordinates: coordinates;
562
+ }
563
+ class schema_field extends Struct {
564
+ name: string;
565
+ field_type: string;
566
+ }
567
+ class nft_schema_def extends Struct {
568
+ schema_name: Name;
569
+ fields: schema_field[];
570
+ }
571
+ class nft_template_def extends Struct {
572
+ item_id: UInt16;
573
+ schema_name: Name;
574
+ }
575
+ class nftconfig_row extends Struct {
576
+ item_id: UInt16;
577
+ template_id: Int32;
578
+ schema_name: Name;
579
+ }
580
+ class nftinfo_result extends Struct {
581
+ schemas: nft_schema_def[];
582
+ templates: nft_template_def[];
583
+ }
584
+ class task_event extends Struct {
585
+ event_type: UInt8;
586
+ owner: Name;
587
+ entity_type: Name;
588
+ entity_id: UInt64;
589
+ task_index: UInt8;
590
+ task: task;
591
+ starts_at: TimePoint;
592
+ completes_at: TimePoint;
593
+ new_energy?: UInt16;
594
+ }
595
+ class notify extends Struct {
596
+ event: task_event;
396
597
  }
397
598
  class player_info extends Struct {
398
599
  owner: Name;
399
600
  is_player: boolean;
400
601
  company_name: string;
401
- balance: UInt64;
402
- debt: UInt32;
403
- networth: Int64;
404
- available_loan: UInt64;
405
- next_ship_price: UInt64;
406
- next_warehouse_price: UInt64;
407
602
  ship_count: UInt64;
408
603
  warehouse_count: UInt64;
604
+ container_count: UInt64;
409
605
  }
410
606
  class player_row extends Struct {
411
607
  owner: Name;
412
- balance: UInt64;
413
- debt: UInt32;
414
- networth: Int64;
415
- }
416
- class purgesupply extends Struct {
417
- max_rows?: UInt64;
418
608
  }
419
609
  class recharge extends Struct {
420
610
  entity_type: Name;
421
611
  id: UInt64;
422
612
  }
613
+ class reserve_row extends Struct {
614
+ id: UInt64;
615
+ remaining: UInt32;
616
+ }
423
617
  class resolve extends Struct {
424
618
  entity_type: Name;
425
619
  id: UInt64;
620
+ count?: UInt64;
426
621
  }
427
622
  class resolve_results extends Struct {
428
623
  entity_id: UInt64;
429
624
  entity_type: Name;
430
625
  resolved_count: UInt8;
431
626
  new_schedule_started?: TimePoint;
627
+ entitygroup?: UInt64;
628
+ group_members?: entity_ref[];
629
+ }
630
+ class resource_info extends Struct {
631
+ id: UInt16;
632
+ mass: UInt32;
633
+ category: UInt8;
634
+ tier: UInt8;
635
+ }
636
+ class resource_stats extends Struct {
637
+ stat1: UInt16;
638
+ stat2: UInt16;
639
+ stat3: UInt16;
640
+ }
641
+ class resources_result extends Struct {
642
+ resources: resource_info[];
643
+ }
644
+ class rmmodule extends Struct {
645
+ entity_type: Name;
646
+ entity_id: UInt64;
647
+ module_index: UInt8;
648
+ target_cargo_id: UInt64;
649
+ }
650
+ class rmnftcfg extends Struct {
651
+ item_id: UInt16;
432
652
  }
433
653
  class salt extends Struct {
434
654
  salt: UInt64;
435
655
  }
436
- class sellgoods extends Struct {
437
- ship_id: UInt64;
438
- good_id: UInt16;
439
- quantity: UInt32;
440
- }
441
656
  class sequence_row extends Struct {
442
657
  key: Name;
443
658
  value: UInt64;
444
659
  }
660
+ class setnftcfg extends Struct {
661
+ item_id: UInt16;
662
+ template_id: Int32;
663
+ schema_name: Name;
664
+ }
445
665
  class ship_row extends Struct {
446
666
  id: UInt64;
447
667
  owner: Name;
448
668
  name: string;
449
- location: coordinates;
450
- mass: UInt32;
451
- capacity: UInt32;
452
- energy: UInt16;
453
- engines: movement_stats;
454
- generator: energy_stats;
455
- loaders: loader_stats;
669
+ seed: UInt64;
670
+ coordinates: coordinates;
671
+ hullmass?: UInt32;
672
+ capacity?: UInt32;
673
+ energy?: UInt16;
674
+ cargomass: UInt32;
675
+ engines?: movement_stats;
676
+ generator?: energy_stats;
677
+ loaders?: loader_stats;
678
+ gatherer?: gatherer_stats;
679
+ warp?: warp_stats;
680
+ crafter?: crafter_stats;
681
+ hauler?: hauler_stats;
682
+ modules: module_entry[];
456
683
  schedule?: schedule;
457
684
  }
685
+ class spawncargo extends Struct {
686
+ entity_id: UInt64;
687
+ item_id: UInt64;
688
+ quantity: UInt64;
689
+ }
690
+ class spawnpacked extends Struct {
691
+ entity_id: UInt64;
692
+ item_id: UInt16;
693
+ hull_seed: UInt64;
694
+ installed: cargo_seed[];
695
+ }
696
+ class spawnseeded extends Struct {
697
+ entity_id: UInt64;
698
+ item_id: UInt64;
699
+ quantity: UInt64;
700
+ seed: UInt64;
701
+ }
458
702
  class state_row extends Struct {
459
703
  enabled: boolean;
460
704
  epoch: UInt32;
@@ -463,9 +707,15 @@ declare namespace Types {
463
707
  seed: Checksum256;
464
708
  commit: Checksum256;
465
709
  }
466
- class takeloan extends Struct {
467
- account: Name;
468
- amount: UInt64;
710
+ class stratum_info extends Struct {
711
+ item_id: UInt16;
712
+ seed: UInt64;
713
+ richness: UInt16;
714
+ reserve: UInt32;
715
+ }
716
+ class stratum_data extends Struct {
717
+ stratum: stratum_info;
718
+ stats: resource_stats;
469
719
  }
470
720
  class task_results extends Struct {
471
721
  entities: entity_task_info[];
@@ -475,7 +725,7 @@ declare namespace Types {
475
725
  source_id: UInt64;
476
726
  dest_type: Name;
477
727
  dest_id: UInt64;
478
- good_id: UInt16;
728
+ item_id: UInt16;
479
729
  quantity: UInt32;
480
730
  }
481
731
  class travel extends Struct {
@@ -488,33 +738,48 @@ declare namespace Types {
488
738
  class types_row extends Struct {
489
739
  id: UInt64;
490
740
  entity_summary_type: entity_summary;
491
- }
492
- class updatecredit extends Struct {
493
- account: Name;
494
- amount: Int64;
495
- }
496
- class updatedebt extends Struct {
497
- account: Name;
498
- amount: Int64;
741
+ game_config_type: game_config;
499
742
  }
500
743
  class warehouse_row extends Struct {
501
744
  id: UInt64;
502
745
  owner: Name;
503
746
  name: string;
504
- location: coordinates;
505
- capacity: UInt32;
506
- loaders: loader_stats;
747
+ seed: UInt64;
748
+ coordinates: coordinates;
749
+ hullmass?: UInt32;
750
+ capacity?: UInt32;
751
+ cargomass: UInt32;
752
+ loaders?: loader_stats;
753
+ modules: module_entry[];
507
754
  schedule?: schedule;
508
755
  }
756
+ class warp extends Struct {
757
+ entity_type: Name;
758
+ id: UInt64;
759
+ x: Int64;
760
+ y: Int64;
761
+ }
509
762
  class wipe extends Struct {
510
763
  }
511
764
  class wipesequence extends Struct {
512
765
  }
766
+ class wrap extends Struct {
767
+ owner: Name;
768
+ entity_type: Name;
769
+ entity_id: UInt64;
770
+ cargo_id: UInt64;
771
+ quantity: UInt64;
772
+ }
513
773
  }
514
774
  declare const TableMap: {
515
775
  cargo: typeof Types.cargo_row;
776
+ container: typeof Types.container_row;
777
+ entitygroup: typeof Types.entitygroup_row;
516
778
  location: typeof Types.location_row;
779
+ nexus: typeof Types.nexus_row;
780
+ nftconfig: typeof Types.nftconfig_row;
517
781
  player: typeof Types.player_row;
782
+ reserve: typeof Types.reserve_row;
518
783
  sequence: typeof Types.sequence_row;
519
784
  ship: typeof Types.ship_row;
520
785
  state: typeof Types.state_row;
@@ -523,8 +788,13 @@ declare const TableMap: {
523
788
  };
524
789
  interface TableTypes {
525
790
  cargo: Types.cargo_row;
791
+ container: Types.container_row;
792
+ entitygroup: Types.entitygroup_row;
526
793
  location: Types.location_row;
794
+ nexus: Types.nexus_row;
795
+ nftconfig: Types.nftconfig_row;
527
796
  player: Types.player_row;
797
+ reserve: Types.reserve_row;
528
798
  sequence: Types.sequence_row;
529
799
  ship: Types.ship_row;
530
800
  state: Types.state_row;
@@ -535,72 +805,100 @@ type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any;
535
805
  type TableNames = keyof TableTypes;
536
806
  declare namespace ActionParams {
537
807
  namespace Type {
538
- interface cancel_log {
808
+ interface cargo_item {
809
+ item_id: UInt16Type;
810
+ quantity: UInt32Type;
811
+ seed?: UInt64Type;
812
+ modules: Type.module_entry[];
813
+ }
814
+ interface module_entry {
815
+ type: UInt8Type;
816
+ installed?: Type.cargo_seed;
817
+ }
818
+ interface cargo_seed {
819
+ item_id: UInt16Type;
820
+ seed: UInt64Type;
821
+ }
822
+ interface game_config {
823
+ version: UInt32Type;
824
+ defaults: Type.entity_defaults;
825
+ items: Type.item_def[];
826
+ }
827
+ interface entity_defaults {
828
+ warehouse_capacity: UInt32Type;
829
+ warehouse_z: UInt16Type;
830
+ container_hullmass: UInt32Type;
831
+ container_capacity: UInt32Type;
832
+ container_z: UInt16Type;
833
+ }
834
+ interface item_def {
835
+ id: UInt16Type;
836
+ mass: UInt32Type;
837
+ type: UInt8Type;
838
+ subtype: UInt8Type;
839
+ tier: UInt8Type;
840
+ }
841
+ interface entity_ref {
842
+ entity_type: NameType;
843
+ entity_id: UInt64Type;
844
+ }
845
+ interface task_event {
846
+ event_type: UInt8Type;
539
847
  owner: NameType;
540
848
  entity_type: NameType;
541
849
  entity_id: UInt64Type;
542
850
  task_index: UInt8Type;
543
851
  task: Type.task;
544
- started_at: TimePointType;
852
+ starts_at: TimePointType;
853
+ completes_at: TimePointType;
854
+ new_energy?: UInt16Type;
545
855
  }
546
856
  interface task {
547
857
  type: UInt8Type;
548
858
  duration: UInt32Type;
549
859
  cancelable: UInt8Type;
550
- location?: Type.coordinates;
860
+ coordinates?: Type.coordinates;
551
861
  cargo: Type.cargo_item[];
552
- entity?: UInt64Type;
553
- credits?: Int64Type;
862
+ entitytarget?: Type.entity_ref;
863
+ entitygroup?: UInt64Type;
864
+ energy_cost?: UInt16Type;
554
865
  }
555
866
  interface coordinates {
556
867
  x: Int64Type;
557
868
  y: Int64Type;
558
869
  z?: UInt16Type;
559
870
  }
560
- interface cargo_item {
561
- good_id: UInt16Type;
562
- quantity: UInt32Type;
563
- unit_cost: UInt64Type;
564
- }
565
- interface resolve_log {
566
- owner: NameType;
567
- entity_type: NameType;
568
- entity_id: UInt64Type;
569
- task_index: UInt8Type;
570
- task: Type.task;
571
- started_at: TimePointType;
572
- completed_at: TimePointType;
573
- new_energy?: UInt16Type;
574
- new_location?: Type.coordinates;
575
- cargomass_delta: Int64Type;
576
- cargo_added: Type.cargo_item[];
577
- cargo_removed: Type.cargo_item[];
578
- credits?: Int64Type;
579
- }
580
871
  }
581
- interface advance {
582
- reveal: string;
583
- commit: Checksum256Type;
872
+ interface addmodule {
873
+ entity_type: NameType;
874
+ entity_id: UInt64Type;
875
+ module_index: UInt8Type;
876
+ module_cargo_id: UInt64Type;
877
+ target_cargo_id: UInt64Type;
584
878
  }
585
- interface buygoods {
586
- ship_id: UInt64Type;
587
- good_id: UInt16Type;
588
- quantity: UInt32Type;
879
+ interface addnexus {
880
+ nexus_name: string;
881
+ x: Int64Type;
882
+ y: Int64Type;
589
883
  }
590
- interface buyship {
591
- account: NameType;
592
- name: string;
884
+ interface advance {
885
+ reveal: string;
886
+ commit: Checksum256Type;
593
887
  }
594
- interface buywarehouse {
595
- account: NameType;
596
- ship_id: UInt64Type;
597
- name: string;
888
+ interface blend {
889
+ entity_type: NameType;
890
+ id: UInt64Type;
891
+ inputs: Type.cargo_item[];
598
892
  }
599
893
  interface cancel {
600
894
  entity_type: NameType;
601
895
  id: UInt64Type;
602
896
  count: UInt64Type;
603
897
  }
898
+ interface cleanrsvp {
899
+ epoch: UInt64Type;
900
+ max_rows: UInt64Type;
901
+ }
604
902
  interface cleartable {
605
903
  table_name: NameType;
606
904
  scope?: NameType;
@@ -609,9 +907,47 @@ declare namespace ActionParams {
609
907
  interface commit {
610
908
  commit: Checksum256Type;
611
909
  }
910
+ interface configlog {
911
+ config: Type.game_config;
912
+ }
913
+ interface craft {
914
+ entity_type: NameType;
915
+ id: UInt64Type;
916
+ recipe_id: UInt16Type;
917
+ quantity: UInt32Type;
918
+ inputs: Type.cargo_item[];
919
+ }
920
+ interface createentity {
921
+ owner: NameType;
922
+ entity_type: NameType;
923
+ entity_name: string;
924
+ x: Int64Type;
925
+ y: Int64Type;
926
+ }
927
+ interface deploy {
928
+ entity_type: NameType;
929
+ id: UInt64Type;
930
+ packed_item_id: UInt16Type;
931
+ seed: UInt64Type;
932
+ entity_name: string;
933
+ }
934
+ interface descentity {
935
+ item_id: UInt16Type;
936
+ hull_seed: UInt64Type;
937
+ module_items: UInt16Type[];
938
+ module_seeds: UInt64Type[];
939
+ }
612
940
  interface enable {
613
941
  enabled: boolean;
614
942
  }
943
+ interface gather {
944
+ entity_type: NameType;
945
+ id: UInt64Type;
946
+ stratum: UInt16Type;
947
+ quantity: UInt32Type;
948
+ }
949
+ interface getconfig {
950
+ }
615
951
  interface getentities {
616
952
  owner: NameType;
617
953
  entity_type?: NameType;
@@ -620,24 +956,54 @@ declare namespace ActionParams {
620
956
  entity_type: NameType;
621
957
  entity_id: UInt64Type;
622
958
  }
623
- interface getgoods {
959
+ interface getitemdata {
960
+ }
961
+ interface getitems {
624
962
  }
625
963
  interface getlocation {
626
964
  x: Int64Type;
627
965
  y: Int64Type;
628
966
  }
967
+ interface getlocdata {
968
+ x: Int64Type;
969
+ y: Int64Type;
970
+ }
971
+ interface getmodules {
972
+ }
629
973
  interface getnearby {
630
974
  entity_type: NameType;
631
975
  entity_id: UInt64Type;
632
976
  recharge: boolean;
633
977
  }
978
+ interface getnftinfo {
979
+ }
634
980
  interface getplayer {
635
981
  account: NameType;
636
982
  }
983
+ interface getrecipe {
984
+ output_item_id: UInt16Type;
985
+ }
986
+ interface getrecipes {
987
+ lower_bound: UInt16Type;
988
+ limit: UInt8Type;
989
+ }
990
+ interface getresources {
991
+ }
992
+ interface getstratum {
993
+ x: Int64Type;
994
+ y: Int64Type;
995
+ stratum: UInt16Type;
996
+ }
637
997
  interface getsummaries {
638
998
  owner: NameType;
639
999
  entity_type?: NameType;
640
1000
  }
1001
+ interface grouptravel {
1002
+ entities: Type.entity_ref[];
1003
+ x: Int64Type;
1004
+ y: Int64Type;
1005
+ recharge: boolean;
1006
+ }
641
1007
  interface hash {
642
1008
  value: string;
643
1009
  }
@@ -650,18 +1016,8 @@ declare namespace ActionParams {
650
1016
  interface join {
651
1017
  account: NameType;
652
1018
  }
653
- interface logcancel {
654
- log: Type.cancel_log;
655
- }
656
- interface logresolve {
657
- log: Type.resolve_log;
658
- }
659
- interface payloan {
660
- account: NameType;
661
- amount: UInt64Type;
662
- }
663
- interface purgesupply {
664
- max_rows?: UInt64Type;
1019
+ interface notify {
1020
+ event: Type.task_event;
665
1021
  }
666
1022
  interface recharge {
667
1023
  entity_type: NameType;
@@ -670,25 +1026,48 @@ declare namespace ActionParams {
670
1026
  interface resolve {
671
1027
  entity_type: NameType;
672
1028
  id: UInt64Type;
1029
+ count?: UInt64Type;
1030
+ }
1031
+ interface rmmodule {
1032
+ entity_type: NameType;
1033
+ entity_id: UInt64Type;
1034
+ module_index: UInt8Type;
1035
+ target_cargo_id: UInt64Type;
1036
+ }
1037
+ interface rmnftcfg {
1038
+ item_id: UInt16Type;
673
1039
  }
674
1040
  interface salt {
675
1041
  salt: UInt64Type;
676
1042
  }
677
- interface sellgoods {
678
- ship_id: UInt64Type;
679
- good_id: UInt16Type;
680
- quantity: UInt32Type;
1043
+ interface setnftcfg {
1044
+ item_id: UInt16Type;
1045
+ template_id: Int32Type;
1046
+ schema_name: NameType;
681
1047
  }
682
- interface takeloan {
683
- account: NameType;
684
- amount: UInt64Type;
1048
+ interface spawncargo {
1049
+ entity_id: UInt64Type;
1050
+ item_id: UInt64Type;
1051
+ quantity: UInt64Type;
1052
+ }
1053
+ interface spawnpacked {
1054
+ entity_id: UInt64Type;
1055
+ item_id: UInt16Type;
1056
+ hull_seed: UInt64Type;
1057
+ installed: Type.cargo_seed[];
1058
+ }
1059
+ interface spawnseeded {
1060
+ entity_id: UInt64Type;
1061
+ item_id: UInt64Type;
1062
+ quantity: UInt64Type;
1063
+ seed: UInt64Type;
685
1064
  }
686
1065
  interface transfer {
687
1066
  source_type: NameType;
688
1067
  source_id: UInt64Type;
689
1068
  dest_type: NameType;
690
1069
  dest_id: UInt64Type;
691
- good_id: UInt16Type;
1070
+ item_id: UInt16Type;
692
1071
  quantity: UInt32Type;
693
1072
  }
694
1073
  interface travel {
@@ -698,73 +1077,110 @@ declare namespace ActionParams {
698
1077
  y: Int64Type;
699
1078
  recharge: boolean;
700
1079
  }
701
- interface updatecredit {
702
- account: NameType;
703
- amount: Int64Type;
704
- }
705
- interface updatedebt {
706
- account: NameType;
707
- amount: Int64Type;
1080
+ interface warp {
1081
+ entity_type: NameType;
1082
+ id: UInt64Type;
1083
+ x: Int64Type;
1084
+ y: Int64Type;
708
1085
  }
709
1086
  interface wipe {
710
1087
  }
711
1088
  interface wipesequence {
712
1089
  }
1090
+ interface wrap {
1091
+ owner: NameType;
1092
+ entity_type: NameType;
1093
+ entity_id: UInt64Type;
1094
+ cargo_id: UInt64Type;
1095
+ quantity: UInt64Type;
1096
+ }
713
1097
  }
714
1098
  interface ActionNameParams {
1099
+ addmodule: ActionParams.addmodule;
1100
+ addnexus: ActionParams.addnexus;
715
1101
  advance: ActionParams.advance;
716
- buygoods: ActionParams.buygoods;
717
- buyship: ActionParams.buyship;
718
- buywarehouse: ActionParams.buywarehouse;
1102
+ blend: ActionParams.blend;
719
1103
  cancel: ActionParams.cancel;
1104
+ cleanrsvp: ActionParams.cleanrsvp;
720
1105
  cleartable: ActionParams.cleartable;
721
1106
  commit: ActionParams.commit;
1107
+ configlog: ActionParams.configlog;
1108
+ craft: ActionParams.craft;
1109
+ createentity: ActionParams.createentity;
1110
+ deploy: ActionParams.deploy;
1111
+ descentity: ActionParams.descentity;
722
1112
  enable: ActionParams.enable;
1113
+ gather: ActionParams.gather;
1114
+ getconfig: ActionParams.getconfig;
723
1115
  getentities: ActionParams.getentities;
724
1116
  getentity: ActionParams.getentity;
725
- getgoods: ActionParams.getgoods;
1117
+ getitemdata: ActionParams.getitemdata;
1118
+ getitems: ActionParams.getitems;
726
1119
  getlocation: ActionParams.getlocation;
1120
+ getlocdata: ActionParams.getlocdata;
1121
+ getmodules: ActionParams.getmodules;
727
1122
  getnearby: ActionParams.getnearby;
1123
+ getnftinfo: ActionParams.getnftinfo;
728
1124
  getplayer: ActionParams.getplayer;
1125
+ getrecipe: ActionParams.getrecipe;
1126
+ getrecipes: ActionParams.getrecipes;
1127
+ getresources: ActionParams.getresources;
1128
+ getstratum: ActionParams.getstratum;
729
1129
  getsummaries: ActionParams.getsummaries;
1130
+ grouptravel: ActionParams.grouptravel;
730
1131
  hash: ActionParams.hash;
731
1132
  hash512: ActionParams.hash512;
732
1133
  init: ActionParams.init;
733
1134
  join: ActionParams.join;
734
- logcancel: ActionParams.logcancel;
735
- logresolve: ActionParams.logresolve;
736
- payloan: ActionParams.payloan;
737
- purgesupply: ActionParams.purgesupply;
1135
+ notify: ActionParams.notify;
738
1136
  recharge: ActionParams.recharge;
739
1137
  resolve: ActionParams.resolve;
1138
+ rmmodule: ActionParams.rmmodule;
1139
+ rmnftcfg: ActionParams.rmnftcfg;
740
1140
  salt: ActionParams.salt;
741
- sellgoods: ActionParams.sellgoods;
742
- takeloan: ActionParams.takeloan;
1141
+ setnftcfg: ActionParams.setnftcfg;
1142
+ spawncargo: ActionParams.spawncargo;
1143
+ spawnpacked: ActionParams.spawnpacked;
1144
+ spawnseeded: ActionParams.spawnseeded;
743
1145
  transfer: ActionParams.transfer;
744
1146
  travel: ActionParams.travel;
745
- updatecredit: ActionParams.updatecredit;
746
- updatedebt: ActionParams.updatedebt;
1147
+ warp: ActionParams.warp;
747
1148
  wipe: ActionParams.wipe;
748
1149
  wipesequence: ActionParams.wipesequence;
1150
+ wrap: ActionParams.wrap;
749
1151
  }
750
1152
  type ActionNames = keyof ActionNameParams;
751
1153
  interface ActionReturnValues {
752
- buygoods: Types.task_results;
753
1154
  cancel: Types.cancel_results;
1155
+ craft: Types.task_results;
1156
+ deploy: Types.task_results;
1157
+ descentity: string;
1158
+ gather: Types.task_results;
1159
+ getconfig: Types.game_config;
754
1160
  getentities: Types.entity_info[];
755
1161
  getentity: Types.entity_info;
756
- getgoods: Types.goods_info;
1162
+ getitemdata: Types.itemdata_result;
1163
+ getitems: Types.items_info;
757
1164
  getlocation: Types.location_info;
1165
+ getlocdata: Types.location_derived;
1166
+ getmodules: Types.modules_result;
758
1167
  getnearby: Types.nearby_info;
1168
+ getnftinfo: Types.nftinfo_result;
759
1169
  getplayer: Types.player_info;
1170
+ getrecipe: Types.recipes_result;
1171
+ getrecipes: Types.recipes_result;
1172
+ getresources: Types.resources_result;
1173
+ getstratum: Types.stratum_data;
760
1174
  getsummaries: Types.entity_summary[];
1175
+ grouptravel: Types.task_results;
761
1176
  hash: Checksum256;
762
1177
  hash512: Checksum512;
763
1178
  recharge: Types.task_results;
764
1179
  resolve: Types.resolve_results;
765
- sellgoods: Types.task_results;
766
1180
  transfer: Types.task_results;
767
1181
  travel: Types.task_results;
1182
+ warp: Types.task_results;
1183
+ wrap: Types.task_results;
768
1184
  }
769
1185
  type ActionReturnNames = keyof ActionReturnValues;
770
1186
  declare class Contract extends Contract$2 {
@@ -817,11 +1233,11 @@ declare const ERROR_SYSTEM_DISABLED = "This game is currently disabled.";
817
1233
  declare const ERROR_SYSTEM_NOT_INITIALIZED = "This game has not been initialized.";
818
1234
  declare const GAME_NOT_FOUND = "Cannot find game for given account name.";
819
1235
  declare const GAME_SEED_NOT_SET = "This game has not initialized an epoch seed value.";
820
- declare const GOOD_DOES_NOT_EXIST = "Good does not exist.";
821
- declare const GOOD_NOT_AVAILABLE_AT_LOCATION = "Good is not tradeable at ship location.";
1236
+ declare const ITEM_DOES_NOT_EXIST = "Item does not exist.";
1237
+ declare const ITEM_NOT_AVAILABLE_AT_LOCATION = "Item is not tradeable at ship location.";
822
1238
  declare const INSUFFICIENT_BALANCE = "Insufficient balance.";
823
- declare const INSUFFICIENT_GOOD_QUANTITY = "Insufficient quantity in cargo.";
824
- declare const INSUFFICIENT_GOOD_SUPPLY = "Insufficient supply of good at location.";
1239
+ declare const INSUFFICIENT_ITEM_QUANTITY = "Insufficient quantity in cargo.";
1240
+ declare const INSUFFICIENT_ITEM_SUPPLY = "Insufficient supply of item at location.";
825
1241
  declare const INVALID_AMOUNT = "Invalid amount.";
826
1242
  declare const REQUIRES_MORE_THAN_ONE = "A value greater than one is required.";
827
1243
  declare const REQUIRES_POSITIVE_VALUE = "Value must be greater than zero.";
@@ -851,27 +1267,47 @@ declare const WAREHOUSE_ALREADY_AT_LOCATION = "Warehouse already exists at this
851
1267
  declare const WAREHOUSE_CAPACITY_EXCEEDED = "Warehouse capacity would be exceeded.";
852
1268
 
853
1269
  declare const PRECISION = 10000;
854
- declare const INITIAL_SHIP_MASS = 500000;
1270
+ declare const CRAFT_ENERGY_DIVISOR = 150000;
1271
+ declare const WAREHOUSE_Z = 500;
1272
+ declare const INITIAL_WAREHOUSE_CAPACITY = 10000000;
1273
+ declare const CONTAINER_Z = 300;
1274
+ declare const INITIAL_CONTAINER_HULLMASS = 50000;
1275
+ declare const INITIAL_CONTAINER_CAPACITY = 2000000;
1276
+ declare const TRAVEL_MAX_DURATION = 86400;
855
1277
  declare const MIN_ORBITAL_ALTITUDE = 800;
856
1278
  declare const MAX_ORBITAL_ALTITUDE = 3000;
1279
+ declare const BASE_ORBITAL_MASS = 100000;
857
1280
  interface ShipLike {
858
- location: Types.coordinates;
859
- mass: UInt32;
860
- energy: UInt16;
861
- engines: Types.movement_stats;
862
- generator: Types.energy_stats;
863
- loaders: Types.loader_stats;
864
- capacity: UInt32;
1281
+ coordinates: Types.coordinates;
1282
+ hullmass?: UInt32;
1283
+ energy?: UInt16;
1284
+ engines?: Types.movement_stats;
1285
+ generator?: Types.energy_stats;
1286
+ loaders?: Types.loader_stats;
1287
+ hauler?: Types.hauler_stats;
1288
+ capacity?: UInt32;
865
1289
  }
866
1290
  interface CargoMassInfo {
867
- good_id: UInt16Type;
1291
+ item_id: UInt16Type;
868
1292
  quantity: UInt32Type;
869
1293
  }
870
1294
  declare enum TaskType {
871
- RECHARGE = 0,
872
- LOAD = 1,
873
- UNLOAD = 2,
874
- FLIGHT = 3
1295
+ IDLE = 0,
1296
+ TRAVEL = 1,
1297
+ RECHARGE = 2,
1298
+ LOAD = 3,
1299
+ UNLOAD = 4,
1300
+ GATHER = 5,
1301
+ WARP = 6,
1302
+ CRAFT = 7,
1303
+ DEPLOY = 8,
1304
+ DEPLOY_SHIP = 9
1305
+ }
1306
+ declare enum LocationType {
1307
+ EMPTY = 0,
1308
+ PLANET = 1,
1309
+ ASTEROID = 2,
1310
+ NEBULA = 3
875
1311
  }
876
1312
  declare enum TaskCancelable {
877
1313
  NEVER = 0,
@@ -881,6 +1317,7 @@ declare enum TaskCancelable {
881
1317
  declare const EntityType$1: {
882
1318
  readonly SHIP: Name;
883
1319
  readonly WAREHOUSE: Name;
1320
+ readonly CONTAINER: Name;
884
1321
  };
885
1322
  type EntityTypeName = (typeof EntityType$1)[keyof typeof EntityType$1];
886
1323
  type CoordinatesType = Coordinates | Types.coordinates | {
@@ -890,24 +1327,24 @@ type CoordinatesType = Coordinates | Types.coordinates | {
890
1327
  declare class Coordinates extends Types.coordinates {
891
1328
  static from(value: CoordinatesType): Coordinates;
892
1329
  equals(other: CoordinatesType): boolean;
1330
+ toLocationId(): UInt64;
893
1331
  }
1332
+ declare function coordsToLocationId(coords: CoordinatesType): UInt64;
894
1333
  interface Distance {
895
1334
  origin: ActionParams.Type.coordinates;
896
1335
  destination: ActionParams.Type.coordinates;
897
1336
  distance: UInt16;
898
1337
  }
899
- declare class Good extends Struct {
1338
+ type ResourceCategory = 'metal' | 'precious' | 'gas' | 'mineral' | 'organic';
1339
+ type ResourceTier = 't1' | 't2' | 't3' | 't4' | 't5';
1340
+ declare class Item extends Struct {
900
1341
  id: UInt16;
901
1342
  name: string;
902
1343
  description: string;
903
- base_price: UInt32;
904
1344
  mass: UInt32;
905
- }
906
- declare class GoodPrice extends Struct {
907
- id: UInt16;
908
- good: Good;
909
- price: UInt32;
910
- supply: UInt16;
1345
+ category: ResourceCategory;
1346
+ tier: ResourceTier;
1347
+ color: string;
911
1348
  }
912
1349
 
913
1350
  interface EpochInfo {
@@ -996,320 +1433,211 @@ declare class GameState extends Types.state_row {
996
1433
 
997
1434
  interface PlayerStateInput {
998
1435
  owner: NameType;
999
- balance: UInt64Type;
1000
- debt: UInt32Type;
1001
- networth: Int64Type;
1002
1436
  }
1003
- /**
1004
- * Player helper class extending player_row with computed financial properties.
1005
- * Provides easy access to balance, debt, networth, and loan calculations.
1006
- */
1007
1437
  declare class Player extends Types.player_row {
1008
- /**
1009
- * Construct a Player instance from individual state pieces.
1010
- * Used by UI's ReactivePlayer to reconstruct Player from reactive state.
1011
- */
1012
1438
  static fromState(state: PlayerStateInput): Player;
1013
- private static readonly MAX_LOAN;
1014
- private static readonly BASE_SHIP_COST;
1015
- private static readonly SHIP_COST_MULTIPLIER;
1016
- private _shipCount?;
1017
- /**
1018
- * Set the current ship count (needed for nextShipCost calculation)
1019
- */
1020
- setShipCount(count: number): void;
1021
- /**
1022
- * Get the current ship count (if set)
1023
- */
1024
- get shipCount(): number | undefined;
1025
- /**
1026
- * Calculate the cost of the next ship based on current ship count
1027
- * Matches contract: pow(5, sequence) * 100
1028
- * @param shipCount - Optional ship count (uses cached value if not provided)
1029
- */
1030
- getNextShipCost(shipCount?: number): UInt64;
1031
- /**
1032
- * Get the cost of the next ship based on cached ship count
1033
- */
1034
- get nextShipCost(): UInt64;
1035
- /**
1036
- * Check if player can afford to buy a ship
1037
- * @param shipCount - Optional ship count (uses cached value if not provided)
1038
- */
1039
- canBuyShip(shipCount?: number): boolean;
1040
- /**
1041
- * Calculate available loan amount (max loan - current debt)
1042
- */
1043
- get availableLoan(): UInt64;
1044
- /**
1045
- * Check if player can take out a loan
1046
- */
1047
- get canTakeLoan(): boolean;
1048
- /**
1049
- * Check if player can pay back loan
1050
- */
1051
- get canPayLoan(): boolean;
1052
- /**
1053
- * Calculate maximum payback amount (min of debt and balance)
1054
- */
1055
- get maxPayback(): UInt64;
1056
- /**
1057
- * Get the maximum loan amount (constant)
1058
- */
1059
- static get MAX_LOAN_LIMIT(): number;
1060
- /**
1061
- * Check if player is in debt
1062
- */
1063
- get hasDebt(): boolean;
1064
- /**
1065
- * Check if player is solvent (positive networth)
1066
- */
1067
- get isSolvent(): boolean;
1068
- /**
1069
- * Create an optimistic update for balance changes
1070
- * Uses integer math to match contract
1071
- * @param delta - Amount to change (can be negative)
1072
- */
1073
- withBalanceChange(delta: UInt64 | number): Player;
1074
- /**
1075
- * Create an optimistic update for debt changes
1076
- * Uses integer math to match contract
1077
- * @param delta - Amount to change (can be negative)
1078
- */
1079
- withDebtChange(delta: UInt64 | number): Player;
1080
- /**
1081
- * Create an optimistic update for taking a loan
1082
- */
1083
- withLoan(amount: UInt64): Player;
1084
- /**
1085
- * Create an optimistic update for paying back a loan
1086
- */
1087
- withLoanPayment(amount: UInt64): Player;
1088
- /**
1089
- * Simulate networth update from selling goods.
1090
- * Matches contract: networth += (sellPrice - paid * quantity)
1091
- * Contract reference: market.cpp:75
1092
- *
1093
- * @param sellPrice - Total revenue from sale (price * quantity)
1094
- * @param paidPerUnit - Average cost per unit paid (from cargo.paid)
1095
- * @param quantity - Quantity being sold
1096
- * @returns New player with updated networth
1097
- *
1098
- * @example
1099
- * // Sold 10 units at 150 each (revenue=1500), paid 100 per unit
1100
- * const newPlayer = player.withSaleNetworth(
1101
- * UInt64.from(1500),
1102
- * UInt64.from(100),
1103
- * UInt32.from(10)
1104
- * )
1105
- * // Networth increases by: 1500 - (100*10) = 500
1106
- */
1107
- withSaleNetworth(sellPrice: UInt64, paidPerUnit: UInt64, quantity: UInt64): Player;
1108
- /**
1109
- * Simulate complete sell goods transaction.
1110
- * Updates both balance (adds revenue) and networth (adds profit).
1111
- * Matches contract actions: update_balance + update_networth
1112
- *
1113
- * @param sellPrice - Total revenue from sale (price * quantity)
1114
- * @param paidPerUnit - Average cost per unit paid (from cargo.paid)
1115
- * @param quantity - Quantity being sold
1116
- * @returns New player with updated balance and networth
1117
- */
1118
- withSellGoods(sellPrice: UInt64, paidPerUnit: UInt64, quantity: UInt64): Player;
1119
- /**
1120
- * Simulate complete buy goods transaction.
1121
- * Updates balance (subtracts cost).
1122
- *
1123
- * @param purchaseCost - Total cost of purchase (price * quantity)
1124
- * @returns New player with updated balance
1125
- */
1126
- withBuyGoods(purchaseCost: UInt64): Player;
1127
1439
  }
1128
1440
 
1129
1441
  declare class PlayersManager extends BaseManager {
1130
1442
  getPlayer(account: NameType): Promise<Player | undefined>;
1131
1443
  }
1132
1444
 
1133
- /**
1134
- * Location helper class for working with game coordinates.
1135
- * Provides system detection, market price caching, nearby planet finding, and supply tracking.
1136
- */
1137
- declare class Location {
1138
- readonly coordinates: Coordinates;
1139
- private _marketPrices?;
1140
- private _gameSeed?;
1141
- private _hasSystem?;
1142
- private _locationRows?;
1143
- private _epoch?;
1144
- constructor(coordinates: CoordinatesType);
1145
- /**
1146
- * Create a Location from coordinates
1147
- */
1148
- static from(coordinates: CoordinatesType): Location;
1149
- /**
1150
- * Check if this location has a system (planet)
1151
- */
1152
- hasSystemAt(gameSeed: Checksum256Type): boolean;
1153
- /**
1154
- * Set cached market prices for this location
1155
- */
1156
- setMarketPrices(prices: GoodPrice[]): void;
1157
- /**
1158
- * Get cached market prices (returns undefined if not cached)
1159
- */
1160
- get marketPrices(): GoodPrice[] | undefined;
1161
- /**
1162
- * Get price for a specific good (from cache)
1163
- */
1164
- getPrice(goodId: UInt16Type): GoodPrice | undefined;
1165
- /**
1166
- * Find nearby planets from this location
1167
- */
1168
- findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
1169
- /**
1170
- * Check if this location equals another location
1171
- */
1172
- equals(other: CoordinatesType | Location): boolean;
1173
- /**
1174
- * Set location rows (supply data) for this location
1175
- */
1176
- setLocationRows(rows: Types.location_row[], epoch: UInt64): void;
1177
- /**
1178
- * Get cached location rows (supply data)
1179
- */
1180
- get locationRows(): Types.location_row[] | undefined;
1181
- /**
1182
- * Get supply for a specific good at this location
1183
- * Returns undefined if location rows not cached or good not found
1184
- */
1185
- getSupply(goodId: UInt16Type): UInt16 | undefined;
1186
- /**
1187
- * Get all available goods at this location (goods with supply > 0)
1188
- * Returns undefined if location rows not cached
1189
- */
1190
- get availableGoods(): Types.location_row[] | undefined;
1191
- /**
1192
- * Check if a specific good is available (has supply)
1193
- * Returns false if location rows not cached
1194
- */
1195
- hasGood(goodId: UInt16Type): boolean;
1196
- /**
1197
- * Get the epoch for cached location data
1198
- */
1199
- get epoch(): UInt64 | undefined;
1200
- /**
1201
- * Check if cached data exists
1202
- */
1203
- get hasCachedData(): boolean;
1204
- /**
1205
- * Check if supply data is cached
1206
- */
1207
- get hasSupplyData(): boolean;
1208
- /**
1209
- * Clear all cached data
1210
- */
1211
- clearCache(): void;
1212
- /**
1213
- * Create optimistic Location with updated supply after purchase/sale.
1214
- * Matches contract: update_location_supply (delta can be positive or negative)
1215
- * Contract reference: market.cpp:53, 123-151
1216
- *
1217
- * @param goodId - Good ID to update supply for
1218
- * @param quantityDelta - Change in supply (negative for purchase, positive for sale)
1219
- * @returns New Location with updated supply in cached data
1220
- *
1221
- * @example
1222
- * // After buying 10 units (supply decreases)
1223
- * const newLocation = location.withUpdatedSupply(1, -10)
1224
- *
1225
- * // After selling 5 units (supply increases)
1226
- * const newLocation = location.withUpdatedSupply(1, 5)
1227
- */
1228
- withUpdatedSupply(goodId: UInt16Type, quantityDelta: number): Location;
1229
- }
1230
- /**
1231
- * Helper function to convert various coordinate types to Location
1232
- */
1233
- declare function toLocation(coords: CoordinatesType | Location): Location;
1234
-
1235
1445
  declare class LocationsManager extends BaseManager {
1236
- getMarketPrice(location: CoordinatesType, goodId: number): Promise<GoodPrice>;
1237
- getMarketPrices(location: CoordinatesType): Promise<GoodPrice[]>;
1238
- getMarketPricesWithSupply(location: CoordinatesType): Promise<GoodPrice[]>;
1239
1446
  hasSystem(location: CoordinatesType): Promise<boolean>;
1240
1447
  findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
1241
- getLocation(location: CoordinatesType): Promise<any[]>;
1242
- getLocationWithPrices(coords: CoordinatesType): Promise<Location>;
1243
- getLocationWithSupply(coords: CoordinatesType): Promise<Location>;
1244
- getLocationComplete(coords: CoordinatesType): Promise<Location>;
1448
+ getLocationEntity(id: UInt64Type): Promise<Types.location_row | undefined>;
1449
+ getLocationEntityAt(coords: CoordinatesType): Promise<Types.location_row | undefined>;
1450
+ getAllLocationEntities(): Promise<Types.location_row[]>;
1245
1451
  }
1246
1452
 
1247
- type Schedule = Types.schedule;
1248
- type Task = Types.task;
1249
- interface ScheduleData {
1250
- schedule?: Schedule;
1453
+ declare class EpochsManager extends BaseManager {
1454
+ getCurrentHeight(): Promise<UInt64>;
1455
+ getCurrent(): Promise<EpochInfo>;
1456
+ getByHeight(height: UInt64Type): Promise<EpochInfo>;
1457
+ getTimeRemaining(): Promise<number>;
1458
+ getProgress(): Promise<number>;
1459
+ fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
1251
1460
  }
1252
- interface Scheduleable extends ScheduleData {
1253
- hasSchedule: boolean;
1254
- isIdle: boolean;
1255
- tasks: Task[];
1256
- scheduleDuration(): number;
1257
- scheduleElapsed(now: Date): number;
1258
- scheduleRemaining(now: Date): number;
1259
- scheduleComplete(now: Date): boolean;
1260
- currentTaskIndex(now: Date): number;
1261
- currentTask(now: Date): Task | undefined;
1262
- currentTaskType(now: Date): TaskType | undefined;
1263
- getTaskStartTime(index: number): number;
1264
- getTaskElapsed(index: number, now: Date): number;
1265
- getTaskRemaining(index: number, now: Date): number;
1266
- isTaskComplete(index: number, now: Date): boolean;
1267
- isTaskInProgress(index: number, now: Date): boolean;
1268
- currentTaskProgress(now: Date): number;
1269
- scheduleProgress(now: Date): number;
1461
+
1462
+ type EntityRefInput = {
1463
+ entityType: EntityTypeName;
1464
+ entityId: UInt64Type;
1465
+ };
1466
+ declare class ActionsManager extends BaseManager {
1467
+ travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
1468
+ grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
1469
+ resolve(entityId: UInt64Type, entityType?: EntityTypeName): Action;
1470
+ cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
1471
+ recharge(shipId: UInt64Type): Action;
1472
+ transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type): Action;
1473
+ foundCompany(account: NameType, name: string): Action;
1474
+ join(account: NameType): Action;
1475
+ gather(shipId: UInt64Type, stratum: number, quantity: number): Action;
1476
+ warp(shipId: UInt64Type, destination: CoordinatesType): Action;
1477
+ craft(entityType: EntityTypeName, entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
1478
+ blend(entityType: EntityTypeName, entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
1479
+ deploy(entityType: EntityTypeName, entityId: UInt64Type, packedItemId: number, seed: bigint, entityName: string): Action;
1480
+ addmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, moduleCargoId: UInt64Type, targetCargoId?: UInt64Type): Action;
1481
+ rmmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, targetCargoId?: UInt64Type): Action;
1482
+ joinGame(account: NameType, companyName: string): Action[];
1270
1483
  }
1271
- declare function hasSchedule(entity: ScheduleData): boolean;
1272
- declare function isIdle(entity: ScheduleData): boolean;
1273
- declare function getTasks(entity: ScheduleData): Task[];
1274
- declare function scheduleDuration(entity: ScheduleData): number;
1275
- declare function scheduleElapsed(entity: ScheduleData, now: Date): number;
1276
- declare function scheduleRemaining(entity: ScheduleData, now: Date): number;
1277
- declare function scheduleComplete(entity: ScheduleData, now: Date): boolean;
1278
- declare function currentTaskIndex(entity: ScheduleData, now: Date): number;
1279
- declare function currentTask(entity: ScheduleData, now: Date): Task | undefined;
1280
- declare function currentTaskType(entity: ScheduleData, now: Date): TaskType | undefined;
1281
- declare function getTaskStartTime(entity: ScheduleData, index: number): number;
1282
- declare function getTaskElapsed(entity: ScheduleData, index: number, now: Date): number;
1283
- declare function getTaskRemaining(entity: ScheduleData, index: number, now: Date): number;
1284
- declare function isTaskComplete(entity: ScheduleData, index: number, now: Date): boolean;
1285
- declare function isTaskInProgress(entity: ScheduleData, index: number, now: Date): boolean;
1286
- declare function currentTaskProgress(entity: ScheduleData, now: Date): number;
1287
- declare function scheduleProgress(entity: ScheduleData, now: Date): number;
1288
1484
 
1289
- type schedule_ScheduleData = ScheduleData;
1290
- type schedule_Scheduleable = Scheduleable;
1291
- declare const schedule_hasSchedule: typeof hasSchedule;
1292
- declare const schedule_isIdle: typeof isIdle;
1293
- declare const schedule_getTasks: typeof getTasks;
1294
- declare const schedule_scheduleDuration: typeof scheduleDuration;
1295
- declare const schedule_scheduleElapsed: typeof scheduleElapsed;
1296
- declare const schedule_scheduleRemaining: typeof scheduleRemaining;
1297
- declare const schedule_scheduleComplete: typeof scheduleComplete;
1298
- declare const schedule_currentTaskIndex: typeof currentTaskIndex;
1299
- declare const schedule_currentTask: typeof currentTask;
1300
- declare const schedule_currentTaskType: typeof currentTaskType;
1301
- declare const schedule_getTaskStartTime: typeof getTaskStartTime;
1302
- declare const schedule_getTaskElapsed: typeof getTaskElapsed;
1303
- declare const schedule_getTaskRemaining: typeof getTaskRemaining;
1304
- declare const schedule_isTaskComplete: typeof isTaskComplete;
1305
- declare const schedule_isTaskInProgress: typeof isTaskInProgress;
1306
- declare const schedule_currentTaskProgress: typeof currentTaskProgress;
1485
+ declare class GameContext {
1486
+ readonly client: APIClient;
1487
+ readonly server: Contract$2;
1488
+ readonly platform: Contract$2;
1489
+ private _entities?;
1490
+ private _players?;
1491
+ private _locations?;
1492
+ private _epochs?;
1493
+ private _actions?;
1494
+ private _gameCache?;
1495
+ private _stateCache?;
1496
+ constructor(client: APIClient, server: Contract$2, platform: Contract$2);
1497
+ get entities(): EntitiesManager;
1498
+ get players(): PlayersManager;
1499
+ get locations(): LocationsManager;
1500
+ get epochs(): EpochsManager;
1501
+ get actions(): ActionsManager;
1502
+ getGame(reload?: boolean): Promise<Types$1.game_row>;
1503
+ getState(reload?: boolean): Promise<GameState>;
1504
+ get cachedGame(): Types$1.game_row | undefined;
1505
+ get cachedState(): GameState | undefined;
1506
+ }
1507
+
1508
+ declare abstract class BaseManager {
1509
+ protected readonly context: GameContext;
1510
+ constructor(context: GameContext);
1511
+ protected get client(): _wharfkit_antelope.APIClient;
1512
+ protected get server(): _wharfkit_contract.Contract;
1513
+ protected get platform(): _wharfkit_contract.Contract;
1514
+ protected getGame(): Promise<Types$1.game_row>;
1515
+ protected getState(): Promise<GameState>;
1516
+ }
1517
+
1518
+ interface MovementCapability {
1519
+ engines: Types.movement_stats;
1520
+ generator: Types.energy_stats;
1521
+ }
1522
+ interface EnergyCapability {
1523
+ energy: UInt16;
1524
+ }
1525
+ interface StorageCapability {
1526
+ capacity: UInt32;
1527
+ cargomass: UInt32;
1528
+ cargo: Types.cargo_item[];
1529
+ }
1530
+ interface LoaderCapability {
1531
+ loaders: Types.loader_stats;
1532
+ }
1533
+ interface GathererCapability {
1534
+ gatherer: Types.gatherer_stats;
1535
+ }
1536
+ interface MassCapability {
1537
+ hullmass: UInt32;
1538
+ }
1539
+ interface ScheduleCapability {
1540
+ schedule?: Types.schedule;
1541
+ }
1542
+ interface EntityCapabilities {
1543
+ hullmass?: UInt32;
1544
+ capacity?: UInt32;
1545
+ engines?: Types.movement_stats;
1546
+ generator?: Types.energy_stats;
1547
+ loaders?: Types.loader_stats;
1548
+ gatherer?: Types.gatherer_stats;
1549
+ crafter?: Types.crafter_stats;
1550
+ }
1551
+ interface EntityState {
1552
+ owner: Name;
1553
+ location: Types.coordinates;
1554
+ energy?: UInt16;
1555
+ cargomass: UInt32;
1556
+ cargo: Types.cargo_item[];
1557
+ }
1558
+ declare function capsHasMovement(caps: EntityCapabilities): boolean;
1559
+ declare function capsHasStorage(caps: EntityCapabilities): boolean;
1560
+ declare function capsHasLoaders(caps: EntityCapabilities): boolean;
1561
+ declare function capsHasGatherer(caps: EntityCapabilities): boolean;
1562
+ declare function capsHasMass(caps: EntityCapabilities): boolean;
1563
+
1564
+ type Schedule = Types.schedule;
1565
+ type Task$1 = Types.task;
1566
+ interface ScheduleData {
1567
+ schedule?: Schedule;
1568
+ }
1569
+ interface Scheduleable extends ScheduleData {
1570
+ hasSchedule: boolean;
1571
+ isIdle: boolean;
1572
+ tasks: Task$1[];
1573
+ scheduleDuration(): number;
1574
+ scheduleElapsed(now: Date): number;
1575
+ scheduleRemaining(now: Date): number;
1576
+ scheduleComplete(now: Date): boolean;
1577
+ currentTaskIndex(now: Date): number;
1578
+ currentTask(now: Date): Task$1 | undefined;
1579
+ currentTaskType(now: Date): TaskType | undefined;
1580
+ getTaskStartTime(index: number): number;
1581
+ getTaskElapsed(index: number, now: Date): number;
1582
+ getTaskRemaining(index: number, now: Date): number;
1583
+ isTaskComplete(index: number, now: Date): boolean;
1584
+ isTaskInProgress(index: number, now: Date): boolean;
1585
+ currentTaskProgress(now: Date): number;
1586
+ scheduleProgress(now: Date): number;
1587
+ }
1588
+ declare function hasSchedule$1(entity: ScheduleData): boolean;
1589
+ declare function isIdle(entity: ScheduleData): boolean;
1590
+ declare function getTasks(entity: ScheduleData): Task$1[];
1591
+ declare function scheduleDuration(entity: ScheduleData): number;
1592
+ declare function scheduleElapsed(entity: ScheduleData, now: Date): number;
1593
+ declare function scheduleRemaining(entity: ScheduleData, now: Date): number;
1594
+ declare function scheduleComplete(entity: ScheduleData, now: Date): boolean;
1595
+ declare function currentTaskIndex(entity: ScheduleData, now: Date): number;
1596
+ declare function currentTask(entity: ScheduleData, now: Date): Task$1 | undefined;
1597
+ declare function currentTaskType(entity: ScheduleData, now: Date): TaskType | undefined;
1598
+ declare function getTaskStartTime(entity: ScheduleData, index: number): number;
1599
+ declare function getTaskElapsed(entity: ScheduleData, index: number, now: Date): number;
1600
+ declare function getTaskRemaining(entity: ScheduleData, index: number, now: Date): number;
1601
+ declare function isTaskComplete(entity: ScheduleData, index: number, now: Date): boolean;
1602
+ declare function isTaskInProgress(entity: ScheduleData, index: number, now: Date): boolean;
1603
+ declare function currentTaskProgress(entity: ScheduleData, now: Date): number;
1604
+ declare function scheduleProgress(entity: ScheduleData, now: Date): number;
1605
+ declare function isTaskType(entity: ScheduleData, taskType: TaskType, now: Date): boolean;
1606
+ declare function isInFlight(entity: ScheduleData, now: Date): boolean;
1607
+ declare function isRecharging(entity: ScheduleData, now: Date): boolean;
1608
+ declare function isLoading(entity: ScheduleData, now: Date): boolean;
1609
+ declare function isUnloading(entity: ScheduleData, now: Date): boolean;
1610
+ declare function isGathering(entity: ScheduleData, now: Date): boolean;
1611
+
1612
+ type schedule_ScheduleData = ScheduleData;
1613
+ type schedule_Scheduleable = Scheduleable;
1614
+ declare const schedule_isIdle: typeof isIdle;
1615
+ declare const schedule_getTasks: typeof getTasks;
1616
+ declare const schedule_scheduleDuration: typeof scheduleDuration;
1617
+ declare const schedule_scheduleElapsed: typeof scheduleElapsed;
1618
+ declare const schedule_scheduleRemaining: typeof scheduleRemaining;
1619
+ declare const schedule_scheduleComplete: typeof scheduleComplete;
1620
+ declare const schedule_currentTaskIndex: typeof currentTaskIndex;
1621
+ declare const schedule_currentTask: typeof currentTask;
1622
+ declare const schedule_currentTaskType: typeof currentTaskType;
1623
+ declare const schedule_getTaskStartTime: typeof getTaskStartTime;
1624
+ declare const schedule_getTaskElapsed: typeof getTaskElapsed;
1625
+ declare const schedule_getTaskRemaining: typeof getTaskRemaining;
1626
+ declare const schedule_isTaskComplete: typeof isTaskComplete;
1627
+ declare const schedule_isTaskInProgress: typeof isTaskInProgress;
1628
+ declare const schedule_currentTaskProgress: typeof currentTaskProgress;
1307
1629
  declare const schedule_scheduleProgress: typeof scheduleProgress;
1630
+ declare const schedule_isTaskType: typeof isTaskType;
1631
+ declare const schedule_isInFlight: typeof isInFlight;
1632
+ declare const schedule_isRecharging: typeof isRecharging;
1633
+ declare const schedule_isLoading: typeof isLoading;
1634
+ declare const schedule_isUnloading: typeof isUnloading;
1635
+ declare const schedule_isGathering: typeof isGathering;
1308
1636
  declare namespace schedule {
1309
1637
  export {
1310
1638
  schedule_ScheduleData as ScheduleData,
1311
1639
  schedule_Scheduleable as Scheduleable,
1312
- schedule_hasSchedule as hasSchedule,
1640
+ hasSchedule$1 as hasSchedule,
1313
1641
  schedule_isIdle as isIdle,
1314
1642
  schedule_getTasks as getTasks,
1315
1643
  schedule_scheduleDuration as scheduleDuration,
@@ -1326,24 +1654,15 @@ declare namespace schedule {
1326
1654
  schedule_isTaskInProgress as isTaskInProgress,
1327
1655
  schedule_currentTaskProgress as currentTaskProgress,
1328
1656
  schedule_scheduleProgress as scheduleProgress,
1657
+ schedule_isTaskType as isTaskType,
1658
+ schedule_isInFlight as isInFlight,
1659
+ schedule_isRecharging as isRecharging,
1660
+ schedule_isLoading as isLoading,
1661
+ schedule_isUnloading as isUnloading,
1662
+ schedule_isGathering as isGathering,
1329
1663
  };
1330
1664
  }
1331
1665
 
1332
- declare class EntityInventory extends Types.cargo_item {
1333
- private _good?;
1334
- get good(): Good;
1335
- get name(): string;
1336
- get unitMass(): UInt32;
1337
- get totalMass(): UInt64;
1338
- get totalCost(): UInt64;
1339
- get hasCargo(): boolean;
1340
- get isEmpty(): boolean;
1341
- }
1342
-
1343
- /**
1344
- * Projected state of an entity after scheduled tasks complete.
1345
- * Mirrors contract's projected_entity struct.
1346
- */
1347
1666
  interface ProjectedEntity {
1348
1667
  location: Coordinates;
1349
1668
  energy: UInt16;
@@ -1353,604 +1672,259 @@ interface ProjectedEntity {
1353
1672
  engines?: Types.movement_stats;
1354
1673
  loaders?: Types.loader_stats;
1355
1674
  generator?: Types.energy_stats;
1675
+ hauler?: Types.hauler_stats;
1356
1676
  readonly totalMass: UInt64;
1677
+ hasMovement(): boolean;
1678
+ hasStorage(): boolean;
1679
+ hasLoaders(): boolean;
1680
+ capabilities(): EntityCapabilities;
1681
+ state(): EntityState;
1357
1682
  }
1358
- /**
1359
- * Interface for entities that can be projected.
1360
- * Ships and Warehouses both implement this.
1361
- */
1362
1683
  interface Projectable extends ScheduleData {
1363
- location: Coordinates;
1364
- energy: UInt16;
1365
- mass: UInt32;
1684
+ coordinates: Coordinates | Types.coordinates;
1685
+ energy?: UInt16;
1686
+ hullmass?: UInt32;
1366
1687
  generator?: Types.energy_stats;
1367
1688
  engines?: Types.movement_stats;
1368
1689
  loaders?: Types.loader_stats;
1369
- capacity?: UInt64;
1370
- calcCargoMass(): UInt64;
1690
+ hauler?: Types.hauler_stats;
1691
+ capacity?: UInt32;
1692
+ cargo: Types.cargo_item[];
1693
+ cargomass: UInt32;
1694
+ owner?: Name;
1371
1695
  }
1372
- /**
1373
- * Create initial projected entity state from a projectable entity.
1374
- */
1375
1696
  declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
1376
- /**
1377
- * Project entity state after all scheduled tasks complete.
1378
- * Mirrors contract's project_ship/project_warehouse methods.
1379
- */
1380
1697
  declare function projectEntity(entity: Projectable): ProjectedEntity;
1381
- /**
1382
- * Project entity state at a specific time (partial task execution).
1383
- */
1384
1698
  declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
1385
1699
 
1386
- interface ShipStateInput {
1387
- id: UInt64Type;
1388
- owner: NameType;
1389
- name: string;
1390
- location: CoordinatesType | {
1391
- x: number;
1392
- y: number;
1393
- z?: number;
1394
- };
1395
- mass: number;
1396
- capacity: number;
1397
- energy: number;
1398
- engines: Types.movement_stats;
1399
- generator: Types.energy_stats;
1400
- loaders: Types.loader_stats;
1401
- schedule?: Types.schedule;
1402
- cargo?: Types.cargo_item[];
1700
+ declare class Location {
1701
+ readonly coordinates: Coordinates;
1702
+ private _gameSeed?;
1703
+ private _hasSystem?;
1704
+ private _epoch?;
1705
+ constructor(coordinates: CoordinatesType);
1706
+ static from(coordinates: CoordinatesType): Location;
1707
+ hasSystemAt(gameSeed: Checksum256Type): boolean;
1708
+ getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
1709
+ isGatherableAt(gameSeed: Checksum256Type): boolean;
1710
+ findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
1711
+ equals(other: CoordinatesType | Location): boolean;
1712
+ get epoch(): UInt64 | undefined;
1713
+ clearCache(): void;
1403
1714
  }
1404
- declare class Ship extends Types.entity_info implements Scheduleable {
1405
- static fromState(state: ShipStateInput): Ship;
1406
- private _location?;
1407
- private _inventory?;
1408
- get name(): string;
1409
- get inventory(): EntityInventory[];
1410
- get maxDistance(): UInt32;
1715
+ declare function toLocation(coords: CoordinatesType | Location): Location;
1716
+
1717
+ type Task = Types.task;
1718
+ declare class ScheduleAccessor {
1719
+ private entity;
1720
+ constructor(entity: ScheduleData);
1411
1721
  get hasSchedule(): boolean;
1412
1722
  get isIdle(): boolean;
1413
- get tasks(): Types.task[];
1414
- scheduleDuration(): number;
1415
- scheduleElapsed(now: Date): number;
1416
- scheduleRemaining(now: Date): number;
1417
- scheduleComplete(now: Date): boolean;
1723
+ get tasks(): Task[];
1724
+ duration(): number;
1725
+ elapsed(now: Date): number;
1726
+ remaining(now: Date): number;
1727
+ complete(now: Date): boolean;
1418
1728
  currentTaskIndex(now: Date): number;
1419
- currentTask(now: Date): Types.task | undefined;
1729
+ currentTask(now: Date): Task | undefined;
1420
1730
  currentTaskType(now: Date): TaskType | undefined;
1421
- getTaskStartTime(index: number): number;
1422
- getTaskElapsed(index: number, now: Date): number;
1423
- getTaskRemaining(index: number, now: Date): number;
1424
- isTaskComplete(index: number, now: Date): boolean;
1425
- isTaskInProgress(index: number, now: Date): boolean;
1731
+ taskStartTime(index: number): number;
1732
+ taskElapsed(index: number, now: Date): number;
1733
+ taskRemaining(index: number, now: Date): number;
1734
+ taskComplete(index: number, now: Date): boolean;
1735
+ taskInProgress(index: number, now: Date): boolean;
1426
1736
  currentTaskProgress(now: Date): number;
1427
- scheduleProgress(now: Date): number;
1428
- getFlightOrigin(flightTaskIndex: number): Coordinates;
1429
- destinationLocation(): Coordinates | undefined;
1430
- positionAt(now: Date): Coordinates;
1431
- isInFlight(now: Date): boolean;
1432
- isRecharging(now: Date): boolean;
1433
- isLoading(now: Date): boolean;
1434
- isUnloading(now: Date): boolean;
1435
- calcCargoMass(): UInt64;
1436
- private createProjectedEntity;
1437
- project(): ProjectedEntity;
1438
- projectAt(now: Date): ProjectedEntity;
1439
- get currentLocation(): Coordinates;
1440
- get totalCargoMass(): UInt64;
1441
- get cargoValue(): UInt64;
1442
- get totalMass(): UInt64;
1443
- get maxCapacity(): UInt64;
1444
- hasSpace(goodMass: UInt64, quantity: number): boolean;
1445
- get availableCapacity(): UInt64;
1446
- get locationObject(): Location;
1447
- setLocation(location: Location): void;
1448
- getCargoForGood(goodId: UInt64Type): EntityInventory | undefined;
1449
- get sellableCargo(): EntityInventory[];
1450
- get hasSellableCargo(): boolean;
1451
- get sellableGoodsCount(): number;
1452
- get isFull(): boolean;
1453
- get energyPercent(): number;
1454
- get needsRecharge(): boolean;
1455
- hasEnergyFor(distance: UInt64): boolean;
1456
- calculateSaleValue(prices: Map<number, UInt64>): {
1457
- revenue: UInt64;
1458
- profit: UInt64;
1459
- cost: UInt64;
1460
- };
1461
- calculateSaleValueFromArray(prices: UInt64[]): {
1462
- revenue: UInt64;
1463
- profit: UInt64;
1464
- cost: UInt64;
1465
- };
1466
- afterSellGoods(goodsToSell: Array<{
1467
- goodId: number;
1468
- quantity: number;
1469
- }>): EntityInventory[];
1470
- afterSellAllGoods(): EntityInventory[];
1737
+ progress(now: Date): number;
1471
1738
  }
1739
+ declare function createScheduleAccessor(entity: ScheduleData): ScheduleAccessor;
1472
1740
 
1473
- /**
1474
- * Travel calculations for ship movement, energy usage, and flight times.
1475
- *
1476
- * Functions prefixed with `calc_` are contract-parity functions that mirror
1477
- * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
1478
- * These use snake_case intentionally to match the contract naming convention
1479
- * and signal that they must produce identical results to the on-chain code.
1480
- *
1481
- * Functions prefixed with `calculate` are higher-level SDK helpers that may
1482
- * combine multiple contract calculations for convenience.
1483
- */
1484
-
1485
- declare function calc_orbital_altitude(mass: number): number;
1486
- declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
1487
- declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
1488
- declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
1489
- declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
1490
- declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
1491
- declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
1492
- declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
1493
- declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
1494
- declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
1495
- declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
1496
- declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
1497
- declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
1498
- declare function calc_acceleration(thrust: number, mass: number): number;
1499
- declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
1500
- declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
1501
- declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
1502
- declare function calculateRefuelingTime(ship: ShipLike): UInt32;
1503
- declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
1504
- interface LoadTimeBreakdown {
1505
- unloadTime: number;
1506
- loadTime: number;
1507
- totalTime: number;
1508
- unloadMass: number;
1509
- loadMass: number;
1510
- }
1511
- declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
1512
- interface EstimatedTravelTime {
1513
- flightTime: UInt32;
1514
- rechargeTime: UInt32;
1515
- loadTime: UInt32;
1516
- unloadTime: UInt32;
1517
- total: UInt32;
1518
- }
1519
- interface EstimateTravelTimeOptions {
1520
- needsRecharge?: boolean;
1521
- loadMass?: UInt32Type;
1522
- unloadMass?: UInt32Type;
1523
- }
1524
- declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
1525
- declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
1526
- declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
1527
- interface TransferEntity {
1528
- location: {
1529
- z?: {
1530
- toNumber(): number;
1531
- } | number;
1532
- };
1533
- loaders?: {
1534
- thrust: {
1535
- toNumber(): number;
1536
- } | number;
1537
- mass: {
1538
- toNumber(): number;
1539
- } | number;
1540
- quantity: {
1541
- toNumber(): number;
1542
- } | number;
1543
- };
1544
- }
1545
- declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
1546
-
1547
- /**
1548
- * Trading deal interface representing a profitable trade opportunity
1549
- */
1550
- interface Deal {
1551
- /** Origin location */
1552
- origin: Location;
1553
- /** Destination location */
1554
- destination: Location;
1555
- /** Good to trade */
1556
- good: GoodPrice;
1557
- /** Distance between origin and destination */
1558
- distance: UInt64;
1559
- /** Available supply at origin */
1560
- supply: UInt16;
1561
- /** Buy price at origin */
1562
- buyPrice: UInt32;
1563
- /** Sell price at destination */
1564
- sellPrice: UInt32;
1565
- /** Profit per unit */
1566
- profitPerUnit: UInt32;
1567
- /** Maximum quantity that can be traded */
1568
- maxQuantity: UInt32;
1569
- /** Total profit for max quantity */
1570
- totalProfit: Int64;
1571
- /** Estimated travel time in seconds */
1572
- travelTime: UInt32;
1573
- /** Detailed breakdown of travel time components */
1574
- travelTimeBreakdown: EstimatedTravelTime;
1575
- /** Profit per second (floating point for UI display) */
1576
- profitPerSecond: number;
1577
- /** Profit margin percentage (floating point for UI display) */
1578
- marginPercent: number;
1579
- }
1580
- /**
1581
- * Options for finding deals
1582
- */
1583
- interface FindDealsOptions {
1584
- /** Maximum number of deals to return */
1585
- maxDeals?: number;
1586
- /** Maximum search distance */
1587
- maxDistance?: number;
1588
- /** Player's current balance (for affordability filtering) */
1589
- playerBalance?: UInt64Type;
1590
- /** Minimum profit per second threshold */
1591
- minProfitPerSecond?: number;
1592
- /** Minimum profit margin percentage */
1593
- minMarginPercent?: number;
1594
- /** Override available cargo space (in mass units). If provided, uses this instead of calculating from ship's current cargo. */
1595
- availableSpace?: number;
1596
- }
1597
- /**
1598
- * Calculate deals for a ship from a specific origin location
1599
- */
1600
- declare function findDealsForShip(ship: Ship, originLocation: Coordinates, getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>, getMarketPrices: (location: Coordinates) => Promise<GoodPrice[]>, options?: FindDealsOptions): Promise<Deal[]>;
1601
- /**
1602
- * Find the single best deal for a ship from a specific origin location
1603
- */
1604
- declare function findBestDeal(ship: Ship, originLocation: Coordinates, getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>, getMarketPrices: (location: Coordinates) => Promise<GoodPrice[]>, options?: FindDealsOptions): Promise<Deal | undefined>;
1605
-
1606
- /**
1607
- * Types of collect actions available to the player
1608
- */
1609
- type CollectActionType = 'sell-and-trade' | 'sell-and-reposition' | 'travel-to-sell' | 'sell-and-stay' | 'explore' | 'orbit';
1610
- /**
1611
- * Represents a single collect option presented to the player
1612
- */
1613
- interface CollectOption {
1614
- /** Unique identifier for this option */
1615
- id: string;
1616
- /** Type of action sequence */
1617
- type: CollectActionType;
1618
- /** Human-readable title */
1619
- title: string;
1620
- /** Detailed description of what will happen */
1621
- description: string;
1622
- /** Brief explanation of why this option is worth considering */
1623
- reason: string;
1624
- /** Whether this is the recommended option (best profitPerSecond with quality threshold) */
1625
- recommended: boolean;
1626
- /** Whether this option has the highest absolute profit (may differ from recommended) */
1627
- highestProfit: boolean;
1628
- /** Estimated profit/loss from this action */
1629
- estimatedProfit: UInt64;
1630
- /** Revenue from selling cargo (if applicable) */
1631
- saleRevenue?: UInt64;
1632
- /** Cost of purchasing new cargo (if applicable) */
1633
- purchaseCost?: UInt64;
1634
- /** Expected profit from the next trade (if applicable) */
1635
- nextTradeProfit?: UInt64;
1636
- /** Profit per second for this option (floating point for display) */
1637
- profitPerSecond?: number;
1638
- /** Margin percentage for the deal (floating point for display) */
1639
- marginPercent?: number;
1640
- /** Destination location (if traveling) */
1641
- destination?: Location;
1642
- /** Deal to execute (if buying goods) */
1643
- deal?: Deal;
1644
- /** Sale location if different from current */
1645
- saleLocation?: Location;
1646
- /** Price per unit at sale location */
1647
- salePrice?: UInt32;
1648
- /** Price per unit at current location (for comparison) */
1649
- currentPrice?: UInt32;
1650
- /** Estimated travel time in seconds (undefined = instant/no travel) */
1651
- travelTime?: UInt32;
1652
- /** Detailed breakdown of travel time components */
1653
- travelTimeBreakdown?: EstimatedTravelTime;
1654
- /** Info about a discounted good at the destination (for explore options) */
1655
- discountedGood?: DiscountedGoodInfo;
1656
- /** Top potential deals available at destination (for explore options) */
1657
- potentialDeals?: PotentialDeal[];
1658
- /** Details of cargo being sold (if selling cargo) */
1659
- cargoSale?: CargoSaleItem[];
1660
- /** Total profit/loss from selling cargo */
1661
- cargoProfitLoss?: Int64;
1662
- }
1663
- /**
1664
- * Analysis result for collect options
1665
- */
1666
- interface CollectAnalysis {
1667
- /** Current location where ship arrived */
1668
- arrivedAt: Coordinates;
1669
- /** Ship being analyzed */
1670
- ship: Ship;
1671
- /** Current cargo on ship */
1672
- cargo: EntityInventory[];
1673
- /** Value of cargo if sold at current location */
1674
- cargoValueHere: UInt64;
1675
- /** All available options, sorted by estimated profit */
1676
- options: CollectOption[];
1677
- /** Whether any profitable options exist */
1678
- hasProfitableOptions: boolean;
1679
- }
1680
- /**
1681
- * Options for analyzing collect choices
1682
- */
1683
- interface CollectAnalysisOptions {
1684
- /** Player's current balance (defaults to Infinity) */
1685
- playerBalance?: number;
1686
- /** Maximum distance to search (defaults to ship's max range) */
1687
- maxDistance?: number;
1688
- /** Minimum profit improvement to suggest traveling elsewhere to sell */
1689
- minSaleImprovement?: number;
1690
- }
1691
- /**
1692
- * Find locations where current cargo could be sold for more
1693
- */
1694
- interface BetterSaleLocation {
1695
- location: Location;
1696
- /** Price per unit at this location */
1697
- price: UInt32;
1698
- /** Total revenue if sold here */
1699
- revenue: UInt64;
1700
- /** Difference vs selling at current location */
1701
- improvement: Int64;
1702
- /** Best deal available at this location after selling */
1703
- bestDealAfterSale?: Deal;
1704
- /** Distance to this location */
1705
- distance: UInt64;
1706
- /** Estimated travel time */
1707
- travelTime: UInt32;
1708
- /** Detailed breakdown of travel time components */
1709
- travelTimeBreakdown?: EstimatedTravelTime;
1710
- }
1711
- /**
1712
- * Find locations with good deals when current location has none
1713
- */
1714
- interface RepositionLocation {
1715
- location: Location;
1716
- /** Best deal available at this location */
1717
- bestDeal: Deal;
1718
- /** Distance to this location */
1719
- distance: UInt64;
1720
- /** Estimated travel time */
1721
- travelTime: UInt32;
1722
- /** Detailed breakdown of travel time components */
1723
- travelTimeBreakdown?: EstimatedTravelTime;
1724
- }
1725
- /**
1726
- * Analyze cargo sale value at a specific location
1727
- */
1728
- declare function analyzeCargoSale(cargo: EntityInventory[], prices: Map<number, UInt64>): {
1729
- revenue: UInt64;
1730
- cost: UInt64;
1731
- profit: Int64;
1732
- };
1733
- /**
1734
- * Create a "Sell & Trade" option (full loop)
1735
- */
1736
- declare function createSellAndTradeOption(saleRevenue: UInt64, saleCost: UInt64, deal: Deal, cargoSale?: CargoSaleItem[], unloadTime?: UInt32): CollectOption;
1737
- /**
1738
- * Create a "Travel to Sell" option (better market elsewhere)
1739
- */
1740
- declare function createTravelToSellOption(currentRevenue: UInt64, cargoCost: UInt64, betterSale: BetterSaleLocation, cargo: EntityInventory[], destPrices?: Map<number, UInt64>): CollectOption;
1741
- /**
1742
- * Create a "Sell & Reposition" option (sell here, travel empty to deals)
1743
- */
1744
- declare function createSellAndRepositionOption(saleRevenue: UInt64, saleCost: UInt64, reposition: RepositionLocation, cargoSale?: CargoSaleItem[]): CollectOption;
1745
- /**
1746
- * Create a "Sell & Stay" option (just sell, stay idle)
1747
- */
1748
- declare function createSellAndStayOption(saleRevenue: UInt64, saleCost: UInt64, cargoSale?: CargoSaleItem[], unloadTime?: UInt32): CollectOption;
1749
- /**
1750
- * Details about a cargo item being sold
1751
- */
1752
- interface CargoSaleItem {
1753
- goodId: UInt16;
1754
- goodName: string;
1755
- quantity: UInt32;
1756
- /** Price per unit at sale location */
1757
- pricePerUnit: UInt32;
1758
- /** Total revenue from this item */
1759
- revenue: UInt64;
1760
- /** Original cost (paid) per unit */
1761
- costPerUnit: UInt64;
1762
- /** Profit/loss on this item */
1763
- profit: Int64;
1764
- }
1765
- /**
1766
- * Info about a discounted good for explore options
1767
- */
1768
- interface DiscountedGoodInfo {
1769
- goodId: number;
1770
- name: string;
1771
- rarity: string;
1772
- discountPercent: number;
1773
- }
1774
- /**
1775
- * A potential deal available at a destination (for explore options)
1776
- */
1777
- interface PotentialDeal {
1778
- goodId: number;
1779
- goodName: string;
1780
- destinationCoords: Coordinates;
1781
- marginPercent: number;
1782
- profitPerSecond: number;
1783
- }
1784
- /**
1785
- * Create an "Explore" option (travel to find opportunities)
1786
- */
1787
- declare function createExploreOption(destination: Location, travelTime?: UInt32, discountedGood?: DiscountedGoodInfo, travelTimeBreakdown?: EstimatedTravelTime, potentialDeals?: PotentialDeal[]): CollectOption;
1788
- /**
1789
- * Callbacks for collect analysis (provided by manager)
1790
- */
1791
- interface CollectAnalysisCallbacks {
1792
- getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>;
1793
- getMarketPrices: (location: Coordinates) => Promise<GoodPrice[]>;
1794
- getGameSeed?: () => Checksum256Type;
1795
- getState?: () => Types.state_row;
1796
- }
1797
- /**
1798
- * Analyze all collect options for a ship that has arrived at its destination.
1799
- * Returns all available options sorted by estimated profit.
1800
- */
1801
- declare function analyzeCollectOptions(ship: Ship, arrivedAt: Coordinates, callbacks: CollectAnalysisCallbacks, options?: CollectAnalysisOptions): Promise<CollectAnalysis>;
1802
-
1803
- declare class TradesManager extends BaseManager {
1804
- private priceCache;
1805
- private priceCacheEpoch;
1806
- private makePriceCacheKey;
1807
- private createCallbacks;
1808
- clearPriceCache(): void;
1809
- findDeals(ship: Ship, originLocation?: Coordinates, options?: FindDealsOptions): Promise<Deal[]>;
1810
- findBestDeal(ship: Ship, originLocation?: Coordinates, options?: FindDealsOptions): Promise<Deal | undefined>;
1811
- getCollectOptions(ship: Ship, arrivedAt?: Coordinates, options?: CollectAnalysisOptions): Promise<CollectAnalysis>;
1741
+ declare class EntityInventory extends Types.cargo_item {
1742
+ private _item?;
1743
+ get item(): Item;
1744
+ get good(): Item;
1745
+ get name(): string;
1746
+ get unitMass(): UInt32;
1747
+ get totalMass(): UInt64;
1748
+ get hasCargo(): boolean;
1749
+ get isEmpty(): boolean;
1812
1750
  }
1813
1751
 
1814
- declare class EpochsManager extends BaseManager {
1815
- getCurrentHeight(): Promise<UInt64>;
1816
- getCurrent(): Promise<EpochInfo>;
1817
- getByHeight(height: UInt64Type): Promise<EpochInfo>;
1818
- getTimeRemaining(): Promise<number>;
1819
- getProgress(): Promise<number>;
1820
- fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
1752
+ interface HasCargo {
1753
+ cargo: Types.cargo_item[];
1821
1754
  }
1822
-
1823
- interface SellableCargo {
1824
- good_id: {
1825
- toNumber(): number;
1826
- } | number;
1827
- quantity: {
1828
- toNumber(): number;
1829
- } | number;
1830
- hasCargo: boolean;
1831
- }
1832
- type CargoItemInput = {
1833
- goodId: UInt64Type;
1834
- quantity: UInt64Type;
1835
- unitCost?: UInt64Type;
1836
- };
1837
- declare class ActionsManager extends BaseManager {
1838
- travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
1839
- resolve(entityId: UInt64Type, entityType?: EntityTypeName): Action;
1840
- cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
1841
- recharge(shipId: UInt64Type): Action;
1842
- transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, cargo: CargoItemInput[]): Action;
1843
- buyGoods(shipId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type): Action;
1844
- sellGoods(shipId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type): Action;
1845
- buyShip(account: NameType, name: string): Action;
1846
- buyWarehouse(account: NameType, shipId: UInt64Type, name: string): Action;
1847
- takeLoan(account: NameType, amount: UInt64Type): Action;
1848
- payLoan(account: NameType, amount: UInt64Type): Action;
1849
- foundCompany(account: NameType, name: string): Action;
1850
- join(account: NameType): Action;
1851
- joinGame(account: NameType, companyName: string): Action[];
1852
- sellAllCargo(ship: Ship | UInt64Type, cargo?: SellableCargo[]): Action[];
1755
+ interface HasCapacity {
1756
+ capacity: UInt32;
1853
1757
  }
1758
+ interface HasCargomass {
1759
+ cargomass: UInt32;
1760
+ }
1761
+ declare function calcCargoItemMass(item: Types.cargo_item): UInt64;
1762
+ declare function calcCargoMass(entity: HasCargo): UInt64;
1763
+ declare function availableCapacity$1(entity: StorageCapability): UInt64;
1764
+ declare function availableCapacityFromMass(capacity: UInt64Type, cargoMass: UInt64Type): UInt64;
1765
+ declare function hasSpace$1(entity: StorageCapability, goodMass: UInt64, quantity: number): boolean;
1766
+ declare function hasSpaceForMass(capacity: UInt64Type, currentMass: UInt64Type, additionalMass: UInt64Type): boolean;
1767
+ declare function isFull$1(entity: HasCapacity & HasCargomass): boolean;
1768
+ declare function isFullFromMass(capacity: UInt64Type, cargoMass: UInt64Type): boolean;
1854
1769
 
1855
- declare class GameContext {
1856
- readonly client: APIClient;
1857
- readonly server: Contract$2;
1858
- readonly platform: Contract$2;
1859
- private _entities?;
1860
- private _players?;
1861
- private _locations?;
1862
- private _trades?;
1863
- private _epochs?;
1864
- private _actions?;
1865
- private _gameCache?;
1866
- private _stateCache?;
1867
- constructor(client: APIClient, server: Contract$2, platform: Contract$2);
1868
- get entities(): EntitiesManager;
1869
- get players(): PlayersManager;
1870
- get locations(): LocationsManager;
1871
- get trades(): TradesManager;
1872
- get epochs(): EpochsManager;
1873
- get actions(): ActionsManager;
1874
- getGame(reload?: boolean): Promise<Types$1.game_row>;
1875
- getState(reload?: boolean): Promise<GameState>;
1876
- get cachedGame(): Types$1.game_row | undefined;
1877
- get cachedState(): GameState | undefined;
1770
+ declare class InventoryAccessor {
1771
+ private readonly entity;
1772
+ private _items?;
1773
+ constructor(entity: HasCargo);
1774
+ get items(): EntityInventory[];
1775
+ get totalMass(): UInt64;
1776
+ forItem(goodId: UInt64Type): EntityInventory | undefined;
1777
+ get sellable(): EntityInventory[];
1778
+ get hasSellable(): boolean;
1779
+ get sellableCount(): number;
1878
1780
  }
1781
+ declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
1879
1782
 
1880
- declare abstract class BaseManager {
1881
- protected readonly context: GameContext;
1882
- constructor(context: GameContext);
1883
- protected get client(): _wharfkit_antelope.APIClient;
1884
- protected get server(): _wharfkit_contract.Contract;
1885
- protected get platform(): _wharfkit_contract.Contract;
1886
- protected getGame(): Promise<Types$1.game_row>;
1887
- protected getState(): Promise<GameState>;
1783
+ interface ShipStateInput {
1784
+ id: UInt64Type;
1785
+ owner: string;
1786
+ name: string;
1787
+ coordinates: CoordinatesType | {
1788
+ x: number;
1789
+ y: number;
1790
+ z?: number;
1791
+ };
1792
+ hullmass?: number;
1793
+ capacity?: number;
1794
+ energy?: number;
1795
+ engines?: Types.movement_stats;
1796
+ generator?: Types.energy_stats;
1797
+ loaders?: Types.loader_stats;
1798
+ schedule?: Types.schedule;
1799
+ cargo?: Types.cargo_item[];
1800
+ }
1801
+ declare class Ship extends Types.entity_info {
1802
+ private _sched?;
1803
+ private _inv?;
1804
+ get name(): string;
1805
+ get inv(): InventoryAccessor;
1806
+ get inventory(): EntityInventory[];
1807
+ get sched(): ScheduleAccessor;
1808
+ get maxDistance(): UInt32;
1809
+ get isIdle(): boolean;
1810
+ getFlightOrigin(flightTaskIndex: number): Coordinates;
1811
+ destinationLocation(): Coordinates | undefined;
1812
+ positionAt(now: Date): Coordinates;
1813
+ isInFlight(now: Date): boolean;
1814
+ isRecharging(now: Date): boolean;
1815
+ isLoading(now: Date): boolean;
1816
+ isUnloading(now: Date): boolean;
1817
+ isGathering(now: Date): boolean;
1818
+ get hasEngines(): boolean;
1819
+ get hasGenerator(): boolean;
1820
+ get hasGatherer(): boolean;
1821
+ get hasWarp(): boolean;
1822
+ project(): ProjectedEntity;
1823
+ projectAt(now: Date): ProjectedEntity;
1824
+ get location(): Location;
1825
+ get totalCargoMass(): UInt64;
1826
+ get totalMass(): UInt64;
1827
+ get maxCapacity(): UInt64;
1828
+ hasSpace(goodMass: UInt64, quantity: number): boolean;
1829
+ get availableCapacity(): UInt64;
1830
+ getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
1831
+ get sellableCargo(): EntityInventory[];
1832
+ get hasSellableCargo(): boolean;
1833
+ get sellableGoodsCount(): number;
1834
+ get isFull(): boolean;
1835
+ get energyPercent(): number;
1836
+ get needsRecharge(): boolean;
1837
+ hasEnergyFor(distance: UInt64): boolean;
1888
1838
  }
1889
1839
 
1890
1840
  interface WarehouseStateInput {
1891
1841
  id: UInt64Type;
1892
- owner: NameType;
1842
+ owner: string;
1893
1843
  name: string;
1894
- location: CoordinatesType | {
1844
+ coordinates: CoordinatesType | {
1895
1845
  x: number;
1896
1846
  y: number;
1897
1847
  z?: number;
1898
1848
  };
1849
+ hullmass?: number;
1899
1850
  capacity: number;
1900
- loaders: Types.loader_stats;
1851
+ loaders?: Types.loader_stats;
1901
1852
  schedule?: Types.schedule;
1902
1853
  cargo?: Types.cargo_item[];
1903
1854
  }
1904
- declare class Warehouse extends Types.entity_info implements Scheduleable {
1905
- static fromState(state: WarehouseStateInput): Warehouse;
1906
- private _location?;
1907
- private _inventory?;
1855
+ declare class Warehouse extends Types.entity_info {
1856
+ private _sched?;
1857
+ private _inv?;
1908
1858
  get name(): string;
1859
+ get inv(): InventoryAccessor;
1909
1860
  get inventory(): EntityInventory[];
1910
- get hasSchedule(): boolean;
1861
+ get sched(): ScheduleAccessor;
1911
1862
  get isIdle(): boolean;
1912
- get tasks(): Types.task[];
1913
- scheduleDuration(): number;
1914
- scheduleElapsed(now: Date): number;
1915
- scheduleRemaining(now: Date): number;
1916
- scheduleComplete(now: Date): boolean;
1917
- currentTaskIndex(now: Date): number;
1918
- currentTask(now: Date): Types.task | undefined;
1919
- currentTaskType(now: Date): TaskType | undefined;
1920
- getTaskStartTime(index: number): number;
1921
- getTaskElapsed(index: number, now: Date): number;
1922
- getTaskRemaining(index: number, now: Date): number;
1923
- isTaskComplete(index: number, now: Date): boolean;
1924
- isTaskInProgress(index: number, now: Date): boolean;
1925
- currentTaskProgress(now: Date): number;
1926
- scheduleProgress(now: Date): number;
1927
1863
  isLoading(now: Date): boolean;
1928
1864
  isUnloading(now: Date): boolean;
1929
- calcCargoMass(): UInt64;
1930
- get currentLocation(): Coordinates;
1865
+ get location(): Location;
1931
1866
  get totalCargoMass(): UInt64;
1932
- get cargoValue(): UInt64;
1933
1867
  get maxCapacity(): UInt64;
1934
1868
  get availableCapacity(): UInt64;
1935
1869
  hasSpace(goodMass: UInt64, quantity: number): boolean;
1936
1870
  get isFull(): boolean;
1937
- get locationObject(): Location;
1938
- setLocation(location: Location): void;
1939
- getCargoForGood(goodId: UInt64Type): EntityInventory | undefined;
1871
+ getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
1872
+ get orbitalAltitude(): number;
1873
+ get totalMass(): UInt64;
1874
+ }
1875
+
1876
+ interface ContainerStateInput {
1877
+ id: UInt64Type;
1878
+ owner: string;
1879
+ name: string;
1880
+ coordinates: CoordinatesType | {
1881
+ x: number;
1882
+ y: number;
1883
+ z?: number;
1884
+ };
1885
+ hullmass: number;
1886
+ capacity: number;
1887
+ cargomass?: number;
1888
+ schedule?: Types.schedule;
1889
+ }
1890
+ declare class Container extends Types.entity_info {
1891
+ private _sched?;
1892
+ get name(): string;
1893
+ get sched(): ScheduleAccessor;
1894
+ get isIdle(): boolean;
1895
+ isLoading(now: Date): boolean;
1896
+ isUnloading(now: Date): boolean;
1897
+ get location(): Location;
1898
+ get totalMass(): UInt64;
1899
+ get maxCapacity(): UInt64;
1900
+ get availableCapacity(): UInt64;
1901
+ hasSpace(additionalMass: UInt64): boolean;
1902
+ get isFull(): boolean;
1940
1903
  get orbitalAltitude(): number;
1941
1904
  }
1905
+ declare function computeContainerCapabilities(stats: Record<string, number>): {
1906
+ hullmass: number;
1907
+ capacity: number;
1908
+ };
1909
+ declare function computeContainerT2Capabilities(stats: Record<string, number>): {
1910
+ hullmass: number;
1911
+ capacity: number;
1912
+ };
1942
1913
 
1943
- type EntityType = 'ship' | 'warehouse';
1914
+ type EntityType = 'ship' | 'warehouse' | 'container' | 'location';
1944
1915
  declare class EntitiesManager extends BaseManager {
1945
- getEntity(type: EntityType, id: UInt64Type): Promise<Ship | Warehouse>;
1946
- getEntities(owner: NameType | Types.player_row, type?: EntityType): Promise<(Ship | Warehouse)[]>;
1916
+ getEntity(type: EntityType, id: UInt64Type): Promise<Ship | Warehouse | Container>;
1917
+ getEntities(owner: NameType | Types.player_row, type?: EntityType): Promise<(Ship | Warehouse | Container)[]>;
1947
1918
  getSummaries(owner: NameType | Types.player_row, type?: EntityType): Promise<Types.entity_summary[]>;
1948
1919
  getShip(id: UInt64Type): Promise<Ship>;
1949
1920
  getWarehouse(id: UInt64Type): Promise<Warehouse>;
1921
+ getContainer(id: UInt64Type): Promise<Container>;
1950
1922
  getShips(owner: NameType | Types.player_row): Promise<Ship[]>;
1951
1923
  getWarehouses(owner: NameType | Types.player_row): Promise<Warehouse[]>;
1924
+ getContainers(owner: NameType | Types.player_row): Promise<Container[]>;
1952
1925
  getShipSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
1953
1926
  getWarehouseSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
1927
+ getContainerSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
1954
1928
  private wrapEntity;
1955
1929
  private resolveOwner;
1956
1930
  }
@@ -1974,146 +1948,684 @@ declare class Shipload {
1974
1948
  get entities(): EntitiesManager;
1975
1949
  get players(): PlayersManager;
1976
1950
  get locations(): LocationsManager;
1977
- get trades(): TradesManager;
1978
1951
  get epochs(): EpochsManager;
1979
1952
  get actions(): ActionsManager;
1980
1953
  getGame(reload?: boolean): Promise<Types$1.game_row>;
1981
1954
  getState(reload?: boolean): Promise<GameState>;
1982
1955
  }
1983
1956
 
1984
- declare const goodIds: number[];
1985
- declare function getGood(goodId: UInt16Type): Good;
1986
- declare function getGoods(): Good[];
1957
+ declare function makeShip(state: ShipStateInput): Ship;
1958
+ declare function makeWarehouse(state: WarehouseStateInput): Warehouse;
1959
+ declare function makeContainer(state: ContainerStateInput): Container;
1987
1960
 
1988
- declare enum Rarities {
1989
- legendary = "LEGENDARY",
1990
- epic = "EPIC",
1991
- rare = "RARE",
1992
- uncommon = "UNCOMMON",
1993
- common = "COMMON",
1994
- trash = "TRASH"
1995
- }
1996
- interface Rarity {
1997
- rarity: Rarities;
1998
- minMultiplier: number;
1999
- maxMultiplier: number;
2000
- }
2001
- declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: CoordinatesType, goodId: UInt16Type): Rarity;
2002
- declare function marketPrice(location: ActionParams.Type.coordinates, goodId: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice;
2003
- declare function marketPrices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice[];
1961
+ declare const itemIds: UInt16[];
1962
+ declare function getItem(itemId: UInt16Type): Item;
1963
+ declare function getItems(): Item[];
2004
1964
 
1965
+ declare function getLocationType(gameSeed: Checksum256Type, coordinates: CoordinatesType): LocationType;
1966
+ declare function isGatherableLocation(locationType: LocationType): boolean;
1967
+ declare function getLocationTypeName(type: LocationType): string;
2005
1968
  declare function getSystemName(gameSeed: Checksum256Type, location: CoordinatesType): string;
2006
1969
  declare function hasSystem(gameSeed: Checksum256Type, coordinates: CoordinatesType): boolean;
1970
+ declare function deriveLocationStatic(gameSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_static;
1971
+ declare function deriveLocationEpoch(epochSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_epoch;
1972
+ declare function deriveLocation(gameSeed: Checksum256Type, epochSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_derived;
1973
+
1974
+ interface StratumInfo {
1975
+ itemId: number;
1976
+ seed: bigint;
1977
+ richness: number;
1978
+ reserve: number;
1979
+ }
1980
+ interface ResourceStats {
1981
+ stat1: number;
1982
+ stat2: number;
1983
+ stat3: number;
1984
+ }
1985
+ declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
1986
+ declare function deriveResourceStats(seed: bigint): ResourceStats;
1987
+
1988
+ declare function deriveLocationSize(loc: Types.location_static): number;
1989
+
1990
+ declare const DEPTH_THRESHOLD_T1 = 0;
1991
+ declare const DEPTH_THRESHOLD_T2 = 2000;
1992
+ declare const DEPTH_THRESHOLD_T3 = 10000;
1993
+ declare const DEPTH_THRESHOLD_T4 = 30000;
1994
+ declare const DEPTH_THRESHOLD_T5 = 55000;
1995
+ declare const LOCATION_MIN_DEPTH = 500;
1996
+ declare const LOCATION_MAX_DEPTH = 65535;
1997
+ declare const PLANET_SUBTYPE_GAS_GIANT = 0;
1998
+ declare const PLANET_SUBTYPE_ROCKY = 1;
1999
+ declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
2000
+ declare const PLANET_SUBTYPE_ICY = 3;
2001
+ declare const PLANET_SUBTYPE_OCEAN = 4;
2002
+ declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
2003
+ declare function getDepthThreshold(tier: ResourceTier): number;
2004
+ declare function getResourceTier(itemId: number): ResourceTier;
2005
+ declare function getResourceWeight(itemId: number, stratum: number): number;
2006
+ declare function getLocationCandidates(locationType: number, subtype: number): number[];
2007
+ declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
2008
+ declare function depthScaleFactor(stratum: number): number;
2009
+
2010
+ interface StatDefinition {
2011
+ key: string;
2012
+ label: string;
2013
+ abbreviation: string;
2014
+ purpose: string;
2015
+ inverted?: boolean;
2016
+ }
2017
+ declare function getStatDefinitions(category: ResourceCategory): StatDefinition[];
2018
+ declare function getStatName(category: ResourceCategory, index: 0 | 1 | 2): StatDefinition;
2019
+ interface NamedStats {
2020
+ definitions: StatDefinition[];
2021
+ values: [number, number, number];
2022
+ }
2023
+ declare function resolveStats(category: ResourceCategory, stats: {
2024
+ stat1: number;
2025
+ stat2: number;
2026
+ stat3: number;
2027
+ }): NamedStats;
2028
+
2029
+ interface StackInput {
2030
+ quantity: number;
2031
+ stats: Record<string, number>;
2032
+ }
2033
+ interface CategoryStacks {
2034
+ category: ResourceCategory;
2035
+ stacks: StackInput[];
2036
+ }
2037
+ declare function encodeStats(values: number[]): bigint;
2038
+ declare function decodeStat(seed: bigint, index: number): number;
2039
+ declare function decodeStats(seed: bigint, count: number): number[];
2040
+ declare function decodeCraftedItemStats(itemId: number, seed: bigint): Record<string, number>;
2041
+ declare function blendStacks(stacks: StackInput[], statKey: string): number;
2042
+ declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
2043
+ key: string;
2044
+ value: number;
2045
+ }[];
2046
+ declare function blendComponentStacks(stacks: {
2047
+ quantity: number;
2048
+ stats: Record<string, number>;
2049
+ }[]): Record<string, number>;
2050
+ declare function computeEntityStats(entityRecipeId: string, componentStacks: Record<number, {
2051
+ quantity: number;
2052
+ stats: Record<string, number>;
2053
+ }[]>): {
2054
+ key: string;
2055
+ value: number;
2056
+ }[];
2057
+ declare const categoryItemMass: Record<string, number>;
2058
+ declare function computeInputMass(itemId: string | number, itemType: 'component' | 'module' | 'entity'): number;
2059
+ declare function blendCrossGroup(sources: {
2060
+ value: number;
2061
+ weight: number;
2062
+ }[]): number;
2063
+ declare function blendCargoStacks(itemId: number, stacks: {
2064
+ quantity: number;
2065
+ seed: UInt64;
2066
+ }[]): UInt64;
2007
2067
 
2008
- declare function hash(seed: Checksum256Type, string: string): Checksum512;
2068
+ declare function hash(seed: Checksum256Type, string: string): Checksum256;
2009
2069
  declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2010
2070
 
2011
2071
  /**
2012
- * Trade calculation result
2013
- */
2014
- interface TradeCalculation {
2015
- maxQuantity: number;
2016
- totalCost: number;
2017
- totalMass: UInt64;
2018
- affordableQuantity: number;
2019
- spaceForQuantity: number;
2020
- }
2021
- /**
2022
- * Calculate updated weighted average cargo cost after purchase.
2023
- * Matches contract logic: (paid * owned + cost) / (owned + quantity)
2072
+ * Travel calculations for ship movement, energy usage, and flight times.
2024
2073
  *
2025
- * @param currentPaid - Current average cost per unit (from cargo.paid)
2026
- * @param currentOwned - Current owned quantity
2027
- * @param purchaseCost - Total cost of new purchase (price * quantity)
2028
- * @param purchaseQuantity - Quantity being purchased
2029
- * @returns New weighted average cost per unit
2074
+ * Functions prefixed with `calc_` are contract-parity functions that mirror
2075
+ * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
2076
+ * These use snake_case intentionally to match the contract naming convention
2077
+ * and signal that they must produce identical results to the on-chain code.
2030
2078
  *
2031
- * @example
2032
- * // Owned 10 units at 100 each, buying 5 more at 120 each
2033
- * const newPaid = calculateUpdatedCargoCost(
2034
- * UInt64.from(100),
2035
- * UInt32.from(10),
2036
- * UInt64.from(600),
2037
- * UInt32.from(5)
2038
- * )
2039
- * // Result: (100*10 + 600) / (10+5) = 106.67 per unit
2040
- */
2041
- declare function calculateUpdatedCargoCost(currentPaid: UInt64, currentOwned: UInt32, purchaseCost: UInt64, purchaseQuantity: UInt32): UInt64;
2042
- /**
2043
- * Calculate the maximum quantity of a good a ship can buy
2044
- * considering both space and player balance
2045
- */
2046
- declare function calculateMaxTradeQuantity(ship: Ship, player: Player, goodPrice: GoodPrice): TradeCalculation;
2047
- /**
2048
- * Trade profit calculation result
2079
+ * Functions prefixed with `calculate` are higher-level SDK helpers that may
2080
+ * combine multiple contract calculations for convenience.
2049
2081
  */
2050
- interface TradeProfitResult {
2051
- revenue: UInt64;
2052
- cost: UInt64;
2053
- profit: Int64;
2054
- margin: number;
2082
+
2083
+ declare function calc_orbital_altitude(mass: number): number;
2084
+ declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
2085
+ declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
2086
+ declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
2087
+ declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
2088
+ declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
2089
+ declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
2090
+ declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
2091
+ declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
2092
+ declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
2093
+ declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
2094
+ declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
2095
+ declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
2096
+ declare function calc_acceleration(thrust: number, mass: number): number;
2097
+ declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
2098
+ declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
2099
+ declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
2100
+ declare function calculateRefuelingTime(ship: ShipLike): UInt32;
2101
+ declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
2102
+ interface LoadTimeBreakdown {
2103
+ unloadTime: number;
2104
+ loadTime: number;
2105
+ totalTime: number;
2106
+ unloadMass: number;
2107
+ loadMass: number;
2055
2108
  }
2056
- /**
2057
- * Calculate profit for a trade route
2058
- */
2059
- declare function calculateTradeProfit(quantity: UInt32Type, buyPrice: UInt32Type, sellPrice: UInt32Type): TradeProfitResult;
2060
- /**
2061
- * Calculate profit per unit of mass
2062
- */
2063
- declare function calculateProfitPerMass(quantity: number, buyPrice: number, sellPrice: number, massPerUnit: number): number;
2064
- /**
2065
- * Calculate profit per second for a trade route
2066
- */
2067
- declare function calculateProfitPerSecond(profit: Int64Type, travelTimeSeconds: UInt32Type): number;
2068
- /**
2069
- * Find the best good to trade between two locations
2070
- */
2071
- declare function findBestGoodToTrade(ship: Ship, player: Player, originPrices: GoodPrice[], destPrices: GoodPrice[], travelTimeSeconds: UInt32Type): {
2072
- good: GoodPrice;
2073
- quantity: number;
2074
- profit: number;
2075
- profitPerSecond: number;
2076
- margin: number;
2077
- } | null;
2078
- /**
2079
- * Calculate break-even price for selling cargo
2080
- */
2081
- declare function calculateBreakEvenPrice(costPaid: number, quantity: number): number;
2082
- /**
2083
- * Check if a trade is profitable
2084
- */
2085
- declare function isProfitable(buyPrice: UInt32Type, sellPrice: UInt32Type): boolean;
2086
- /**
2087
- * Calculate return on investment percentage
2088
- */
2089
- declare function calculateROI(cost: number, profit: number): number;
2109
+ declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
2110
+ interface EstimatedTravelTime {
2111
+ flightTime: UInt32;
2112
+ rechargeTime: UInt32;
2113
+ loadTime: UInt32;
2114
+ unloadTime: UInt32;
2115
+ total: UInt32;
2116
+ }
2117
+ interface EstimateTravelTimeOptions {
2118
+ needsRecharge?: boolean;
2119
+ loadMass?: UInt32Type;
2120
+ unloadMass?: UInt32Type;
2121
+ }
2122
+ declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
2123
+ declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
2124
+ declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
2125
+ interface TransferEntity {
2126
+ location: {
2127
+ z?: {
2128
+ toNumber(): number;
2129
+ } | number;
2130
+ };
2131
+ loaders?: {
2132
+ thrust: {
2133
+ toNumber(): number;
2134
+ } | number;
2135
+ mass: {
2136
+ toNumber(): number;
2137
+ } | number;
2138
+ quantity: {
2139
+ toNumber(): number;
2140
+ } | number;
2141
+ };
2142
+ }
2143
+ interface HasScheduleAndLocation {
2144
+ coordinates: ActionParams.Type.coordinates;
2145
+ schedule?: Types.schedule;
2146
+ }
2147
+ declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
2148
+ declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
2149
+ declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
2150
+ declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
2090
2151
 
2091
2152
  interface CargoData {
2092
2153
  cargo: EntityInventory[];
2093
2154
  }
2094
2155
  declare function totalCargoMass(cargo: EntityInventory[]): UInt64;
2095
- declare function cargoValue(cargo: EntityInventory[]): UInt64;
2096
- declare function getCargoForGood(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
2156
+ declare function getCargoForItem(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
2097
2157
  declare function hasSpace(currentMass: UInt64, maxCapacity: UInt64, goodMass: UInt64, quantity: number): boolean;
2098
2158
  declare function availableCapacity(currentMass: UInt64, maxCapacity: UInt64): UInt64;
2099
2159
  declare function isFull(currentMass: UInt64, maxCapacity: UInt64): boolean;
2160
+ declare function afterRemoveItems(cargo: Types.cargo_item[], goodsToRemove: Array<{
2161
+ goodId: number;
2162
+ quantity: number;
2163
+ }>): EntityInventory[];
2164
+ declare function afterRemoveAllItems(cargo: Types.cargo_item[]): EntityInventory[];
2100
2165
 
2101
2166
  type cargoUtils_CargoData = CargoData;
2102
2167
  declare const cargoUtils_totalCargoMass: typeof totalCargoMass;
2103
- declare const cargoUtils_cargoValue: typeof cargoValue;
2104
- declare const cargoUtils_getCargoForGood: typeof getCargoForGood;
2168
+ declare const cargoUtils_getCargoForItem: typeof getCargoForItem;
2105
2169
  declare const cargoUtils_hasSpace: typeof hasSpace;
2106
2170
  declare const cargoUtils_availableCapacity: typeof availableCapacity;
2107
2171
  declare const cargoUtils_isFull: typeof isFull;
2172
+ declare const cargoUtils_afterRemoveItems: typeof afterRemoveItems;
2173
+ declare const cargoUtils_afterRemoveAllItems: typeof afterRemoveAllItems;
2108
2174
  declare namespace cargoUtils {
2109
2175
  export {
2110
2176
  cargoUtils_CargoData as CargoData,
2111
2177
  cargoUtils_totalCargoMass as totalCargoMass,
2112
- cargoUtils_cargoValue as cargoValue,
2113
- cargoUtils_getCargoForGood as getCargoForGood,
2178
+ cargoUtils_getCargoForItem as getCargoForItem,
2114
2179
  cargoUtils_hasSpace as hasSpace,
2115
2180
  cargoUtils_availableCapacity as availableCapacity,
2116
2181
  cargoUtils_isFull as isFull,
2182
+ cargoUtils_afterRemoveItems as afterRemoveItems,
2183
+ cargoUtils_afterRemoveAllItems as afterRemoveAllItems,
2184
+ };
2185
+ }
2186
+
2187
+ interface Entity {
2188
+ id: UInt64;
2189
+ type: Name;
2190
+ owner: Name;
2191
+ entity_name: string;
2192
+ location: Coordinates | Types.coordinates;
2193
+ }
2194
+ type ShipEntity = Entity & Partial<MovementCapability> & Partial<EnergyCapability> & StorageCapability & Partial<LoaderCapability> & MassCapability & ScheduleCapability & {
2195
+ gatherer?: Types.gatherer_stats;
2196
+ };
2197
+ type WarehouseEntity = Entity & StorageCapability & Partial<LoaderCapability> & MassCapability & ScheduleCapability;
2198
+ type ContainerEntity = Entity & StorageCapability & MassCapability & ScheduleCapability;
2199
+ type AnyEntity = ShipEntity | WarehouseEntity | ContainerEntity;
2200
+
2201
+ declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCapability;
2202
+ declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
2203
+ declare function hasStorage(e: Entity): e is Entity & StorageCapability;
2204
+ declare function hasLoaders(e: Entity): e is Entity & LoaderCapability;
2205
+ declare function hasMass(e: Entity): e is Entity & MassCapability;
2206
+ declare function hasSchedule(e: Entity): e is Entity & ScheduleCapability;
2207
+ declare function hasGatherer(e: Entity): e is Entity & GathererCapability;
2208
+
2209
+ declare function maxTravelDistance(entity: MovementCapability): UInt32;
2210
+ declare function calcEnergyUsage(entity: MovementCapability, distance: UInt64): UInt64;
2211
+ declare function energyPercent(entity: MovementCapability & EnergyCapability): number;
2212
+ declare function needsRecharge(entity: MovementCapability & EnergyCapability): boolean;
2213
+
2214
+ declare function calcLoadDuration(entity: LoaderCapability, cargoMass: UInt64): UInt32;
2215
+
2216
+ declare function calc_gather_duration(gatherer: Types.gatherer_stats, itemMass: number, quantity: number, stratum: number, richness: number): UInt32;
2217
+ declare function calc_gather_energy(gatherer: Types.gatherer_stats, duration: number): UInt16;
2218
+
2219
+ interface CrafterCapability {
2220
+ crafter: Types.crafter_stats;
2221
+ }
2222
+ declare function capsHasCrafter(caps: EntityCapabilities): boolean;
2223
+ declare function calc_craft_duration(speed: number, totalInputMass: number, quantity: number): UInt32;
2224
+ declare function calc_craft_energy(drain: number, totalInputMass: number): UInt16;
2225
+
2226
+ declare const ITEM_ENGINE_T1 = 10100;
2227
+ declare const ITEM_GENERATOR_T1 = 10101;
2228
+ declare const ITEM_GATHERER_T1 = 10102;
2229
+ declare const ITEM_LOADER_T1 = 10103;
2230
+ declare const ITEM_MANUFACTURING_T1 = 10104;
2231
+ declare const ITEM_STORAGE_T1 = 10105;
2232
+ declare const ITEM_HAULER_T1 = 10106;
2233
+ declare const MODULE_ANY = 0;
2234
+ declare const MODULE_ENGINE = 1;
2235
+ declare const MODULE_GENERATOR = 2;
2236
+ declare const MODULE_GATHERER = 3;
2237
+ declare const MODULE_LOADER = 4;
2238
+ declare const MODULE_WARP = 5;
2239
+ declare const MODULE_CRAFTER = 6;
2240
+ declare const MODULE_LAUNCHER = 7;
2241
+ declare const MODULE_STORAGE = 8;
2242
+ declare const MODULE_HAULER = 9;
2243
+ interface CargoSeed {
2244
+ itemId: number;
2245
+ seed: bigint;
2246
+ }
2247
+ interface ModuleEntry {
2248
+ type: number;
2249
+ installed?: CargoSeed;
2250
+ }
2251
+ declare function moduleAccepts(slotType: number, moduleType: number): boolean;
2252
+ declare function getModuleCapabilityType(itemId: number): number;
2253
+ declare function isModuleItem(itemId: number): boolean;
2254
+
2255
+ declare function computeHaulPenalty(totalThrust: number, haulCount: number, avgEfficiency: number): number;
2256
+ declare function computeHaulerDrain(distance: number, drain: number, haulCount: number): number;
2257
+
2258
+ declare const categoryColors: Record<ResourceCategory, string>;
2259
+ declare const tierColors: Record<ResourceTier, string>;
2260
+ declare const categoryIcons: Record<ResourceCategory, string>;
2261
+ declare const componentIcon = "\u25A3";
2262
+ declare const moduleIcon = "\u2B22";
2263
+ declare const itemIcons: Record<number, string>;
2264
+
2265
+ type CraftedItemCategory = 'component' | 'module' | 'entity' | 'resource';
2266
+ declare const ITEM_TYPE_RESOURCE = 0;
2267
+ declare const ITEM_TYPE_COMPONENT = 1;
2268
+ declare const ITEM_TYPE_MODULE = 2;
2269
+ declare const ITEM_TYPE_ENTITY = 3;
2270
+ declare function itemTypeCode(id: number): number;
2271
+ declare function itemTier(id: number): number;
2272
+ declare function itemOffset(id: number): number;
2273
+ declare function itemCategory(id: number): CraftedItemCategory;
2274
+ declare function isRelatedItem(a: number, b: number): boolean;
2275
+ declare function isCraftedItem(id: number): boolean;
2276
+
2277
+ interface CategoryInfo {
2278
+ id: ResourceCategory;
2279
+ name: string;
2280
+ label: string;
2281
+ description: string;
2282
+ color: string;
2283
+ }
2284
+ declare function getCategoryInfo(): CategoryInfo[];
2285
+ declare function getCategoryInfo(id: ResourceCategory): CategoryInfo | undefined;
2286
+
2287
+ interface PlanetSubtypeInfo {
2288
+ id: number;
2289
+ label: string;
2290
+ description: string;
2291
+ paletteType: string;
2292
+ }
2293
+ declare function getPlanetSubtypes(): PlanetSubtypeInfo[];
2294
+ declare function getPlanetSubtype(id: number): PlanetSubtypeInfo | undefined;
2295
+
2296
+ interface CapabilityAttribute {
2297
+ capability: string;
2298
+ attribute: string;
2299
+ description: string;
2300
+ }
2301
+ interface StatMapping {
2302
+ stat: string;
2303
+ capability: string;
2304
+ attribute: string;
2305
+ rationale: string;
2306
+ }
2307
+ declare const capabilityNames: string[];
2308
+ declare const capabilityAttributes: CapabilityAttribute[];
2309
+ declare const statMappings: StatMapping[];
2310
+ declare function isInvertedAttribute(attribute: string): boolean;
2311
+ declare function getCapabilityAttributes(capability?: string): CapabilityAttribute[];
2312
+ declare function getStatMappings(): StatMapping[];
2313
+ declare function getStatMappingsForStat(stat: string): StatMapping[];
2314
+ declare function getStatMappingsForCapability(capability: string): StatMapping[];
2315
+
2316
+ declare const ITEM_MATTER_CONDUIT = 10005;
2317
+ declare const ITEM_SURVEY_PROBE = 10006;
2318
+ declare const ITEM_CARGO_ARM = 10007;
2319
+ declare const ITEM_TOOL_BIT = 10008;
2320
+ declare const ITEM_REACTION_CHAMBER = 10009;
2321
+ declare const ITEM_FOCUSING_ARRAY = 10010;
2322
+ declare const ITEM_HULL_PLATES = 10001;
2323
+ declare const ITEM_CARGO_LINING = 10002;
2324
+ declare const ITEM_CONTAINER_T1_PACKED = 10200;
2325
+ declare const ITEM_THRUSTER_CORE = 10003;
2326
+ declare const ITEM_POWER_CELL = 10004;
2327
+ declare const ITEM_SHIP_T1_PACKED = 10201;
2328
+ declare const ITEM_WAREHOUSE_T1_PACKED = 10202;
2329
+ declare const ITEM_HULL_PLATES_T2 = 20001;
2330
+ declare const ITEM_CARGO_LINING_T2 = 20002;
2331
+ declare const ITEM_CONTAINER_T2_PACKED = 20200;
2332
+ interface RecipeInput {
2333
+ category?: ResourceCategory;
2334
+ itemId?: number;
2335
+ quantity: number;
2336
+ }
2337
+ interface ComponentStat {
2338
+ key: string;
2339
+ source: ResourceCategory;
2340
+ }
2341
+ interface ComponentDefinition {
2342
+ id: number;
2343
+ name: string;
2344
+ description: string;
2345
+ color: string;
2346
+ mass: number;
2347
+ stats: ComponentStat[];
2348
+ recipe: RecipeInput[];
2349
+ usedIn: {
2350
+ type: 'entity' | 'module';
2351
+ name: string;
2352
+ }[];
2353
+ }
2354
+ interface ModuleSlot {
2355
+ type: number;
2356
+ label?: string;
2357
+ }
2358
+ interface EntityRecipe {
2359
+ id: string;
2360
+ name: string;
2361
+ description: string;
2362
+ color: string;
2363
+ packedItemId: number;
2364
+ recipe: RecipeInput[];
2365
+ stats: {
2366
+ key: string;
2367
+ sourceComponentId: number;
2368
+ sourceStatKey: string;
2369
+ }[];
2370
+ moduleSlots?: ModuleSlot[];
2371
+ }
2372
+ interface CraftableItem {
2373
+ type: 'component' | 'entity' | 'module';
2374
+ id: number | string;
2375
+ name: string;
2376
+ description: string;
2377
+ color: string;
2378
+ }
2379
+ declare const components: ComponentDefinition[];
2380
+ declare const entityRecipes: EntityRecipe[];
2381
+ interface ModuleRecipe {
2382
+ id: string;
2383
+ name: string;
2384
+ description: string;
2385
+ color: string;
2386
+ itemId: number;
2387
+ moduleType: number;
2388
+ recipe: RecipeInput[];
2389
+ stats: {
2390
+ key: string;
2391
+ sourceComponentId: number;
2392
+ sourceStatKey: string;
2393
+ }[];
2394
+ }
2395
+ declare const moduleRecipes: ModuleRecipe[];
2396
+ declare function getModuleRecipe(id: string): ModuleRecipe | undefined;
2397
+ declare function getModuleRecipeByItemId(itemId: number): ModuleRecipe | undefined;
2398
+ declare function getComponentById(id: number): ComponentDefinition | undefined;
2399
+ declare function getEntityRecipe(id: string): EntityRecipe | undefined;
2400
+ declare function getEntityRecipeByItemId(itemId: number): EntityRecipe | undefined;
2401
+ declare function getEntitySlotLayout(packedItemId: number): ModuleSlot[];
2402
+ declare function getAllCraftableItems(): CraftableItem[];
2403
+ declare function getComponentsForCategory(category: ResourceCategory): ComponentDefinition[];
2404
+ declare function getComponentsForStat(statKey: string): ComponentDefinition[];
2405
+
2406
+ declare function computeShipHullCapabilities(stats: Record<string, number>): {
2407
+ hullmass: number;
2408
+ capacity: number;
2409
+ };
2410
+ declare function computeEngineCapabilities(stats: Record<string, number>): {
2411
+ thrust: number;
2412
+ drain: number;
2413
+ };
2414
+ declare function computeGeneratorCapabilities(stats: Record<string, number>): {
2415
+ capacity: number;
2416
+ recharge: number;
2417
+ };
2418
+ declare function computeGathererCapabilities(stats: Record<string, number>): {
2419
+ yield: number;
2420
+ drain: number;
2421
+ depth: number;
2422
+ speed: number;
2423
+ };
2424
+ declare function computeLoaderCapabilities(stats: Record<string, number>): {
2425
+ mass: number;
2426
+ thrust: number;
2427
+ quantity: number;
2428
+ };
2429
+ declare function computeManufacturingCapabilities(stats: Record<string, number>): {
2430
+ speed: number;
2431
+ drain: number;
2432
+ };
2433
+ declare function computeHaulerCapabilities(stats: Record<string, number>): {
2434
+ capacity: number;
2435
+ efficiency: number;
2436
+ drain: number;
2437
+ };
2438
+ declare function computeStorageCapabilities(stats: Record<string, number>, baseCapacity: number): {
2439
+ capacityBonus: number;
2440
+ };
2441
+ declare function computeWarehouseHullCapabilities(stats: Record<string, number>): {
2442
+ hullmass: number;
2443
+ capacity: number;
2444
+ };
2445
+ interface ShipCapabilities {
2446
+ engines?: {
2447
+ thrust: number;
2448
+ drain: number;
2449
+ };
2450
+ generator?: {
2451
+ capacity: number;
2452
+ recharge: number;
2453
+ };
2454
+ gatherer?: {
2455
+ yield: number;
2456
+ drain: number;
2457
+ depth: number;
2458
+ speed: number;
2459
+ };
2460
+ hauler?: {
2461
+ capacity: number;
2462
+ efficiency: number;
2463
+ drain: number;
2464
+ };
2465
+ loaders?: {
2466
+ mass: number;
2467
+ thrust: number;
2468
+ quantity: number;
2469
+ };
2470
+ crafter?: {
2471
+ speed: number;
2472
+ drain: number;
2473
+ };
2474
+ }
2475
+ declare function computeShipCapabilities(modules: {
2476
+ itemId: number;
2477
+ seed: bigint;
2478
+ }[]): ShipCapabilities;
2479
+
2480
+ interface ResolvedItemStat {
2481
+ key: string;
2482
+ label: string;
2483
+ abbreviation: string;
2484
+ value: number;
2485
+ color: string;
2486
+ category: ResourceCategory;
2487
+ inverted?: boolean;
2488
+ }
2489
+ interface ResolvedAttributeGroup {
2490
+ capability: string;
2491
+ attributes: {
2492
+ label: string;
2493
+ value: number;
2494
+ }[];
2495
+ }
2496
+ type ResolvedItemType = 'resource' | 'component' | 'module' | 'entity';
2497
+ interface ResolvedModuleSlot {
2498
+ name?: string;
2499
+ installed: boolean;
2500
+ attributes?: {
2501
+ label: string;
2502
+ value: number;
2503
+ }[];
2504
+ }
2505
+ interface ResolvedItem {
2506
+ itemId: number;
2507
+ name: string;
2508
+ icon: string;
2509
+ category?: ResourceCategory;
2510
+ tier: ResourceTier;
2511
+ mass: number;
2512
+ itemType: ResolvedItemType;
2513
+ stats?: ResolvedItemStat[];
2514
+ attributes?: ResolvedAttributeGroup[];
2515
+ moduleSlots?: ResolvedModuleSlot[];
2516
+ }
2517
+ declare function resolveItem(itemId: UInt16Type, seed?: UInt64Type, modules?: Types.module_entry[]): ResolvedItem;
2518
+
2519
+ interface NFTInstalledModule {
2520
+ item_id: number;
2521
+ seed: string;
2522
+ }
2523
+ interface NFTModuleSlot {
2524
+ type: number;
2525
+ installed?: NFTInstalledModule;
2526
+ }
2527
+ interface NFTCargoItem {
2528
+ item_id: number;
2529
+ quantity: number;
2530
+ seed: string;
2531
+ modules?: NFTModuleSlot[];
2532
+ }
2533
+ interface NFTCommonBase {
2534
+ quantity: number;
2535
+ seed: string;
2536
+ origin_x: string;
2537
+ origin_y: string;
2538
+ }
2539
+ declare function readCommonBase(data: Record<string, any>): NFTCommonBase;
2540
+ declare function deserializeScalar(data: Record<string, any>, itemId: number): NFTCargoItem;
2541
+ declare const deserializeResource: typeof deserializeScalar;
2542
+ declare const deserializeComponent: typeof deserializeScalar;
2543
+ declare const deserializeModule: typeof deserializeScalar;
2544
+ declare function deserializeEntity(data: Record<string, any>, itemId: number): NFTCargoItem;
2545
+ declare function deserializeAsset(data: Record<string, any>, itemId: number): NFTCargoItem;
2546
+
2547
+ declare function computeBaseHullmass(seed: bigint): number;
2548
+ declare function computeBaseCapacityShip(seed: bigint): number;
2549
+ declare function computeBaseCapacityWarehouse(seed: bigint): number;
2550
+ declare const computeEngineThrust: (vol: number) => number;
2551
+ declare const computeEngineDrain: (thm: number) => number;
2552
+ declare const computeGeneratorCap: (res: number) => number;
2553
+ declare const computeGeneratorRech: (clr: number) => number;
2554
+ declare const computeGathererYield: (str: number) => number;
2555
+ declare const computeGathererDrain: (con: number) => number;
2556
+ declare const computeGathererDepth: (tol: number) => number;
2557
+ declare const computeGathererSpeed: (ref: number) => number;
2558
+ declare const computeLoaderMass: (duc: number) => number;
2559
+ declare const computeLoaderThrust: (pla: number) => number;
2560
+ declare const computeCrafterSpeed: (rea: number) => number;
2561
+ declare const computeCrafterDrain: (clr: number) => number;
2562
+ declare function entityDisplayName(itemId: number): string;
2563
+ declare function moduleDisplayName(itemId: number): string;
2564
+ declare function formatModuleLine(slot: number, itemId: number, seed: bigint): string;
2565
+ declare function buildEntityDescription(itemId: number, hullSeed: bigint, moduleItems: number[], moduleSeeds: bigint[]): string;
2566
+
2567
+ type index_NFTInstalledModule = NFTInstalledModule;
2568
+ type index_NFTModuleSlot = NFTModuleSlot;
2569
+ type index_NFTCargoItem = NFTCargoItem;
2570
+ type index_NFTCommonBase = NFTCommonBase;
2571
+ declare const index_readCommonBase: typeof readCommonBase;
2572
+ declare const index_deserializeScalar: typeof deserializeScalar;
2573
+ declare const index_deserializeResource: typeof deserializeResource;
2574
+ declare const index_deserializeComponent: typeof deserializeComponent;
2575
+ declare const index_deserializeModule: typeof deserializeModule;
2576
+ declare const index_deserializeEntity: typeof deserializeEntity;
2577
+ declare const index_deserializeAsset: typeof deserializeAsset;
2578
+ declare const index_computeBaseHullmass: typeof computeBaseHullmass;
2579
+ declare const index_computeBaseCapacityShip: typeof computeBaseCapacityShip;
2580
+ declare const index_computeBaseCapacityWarehouse: typeof computeBaseCapacityWarehouse;
2581
+ declare const index_computeEngineThrust: typeof computeEngineThrust;
2582
+ declare const index_computeEngineDrain: typeof computeEngineDrain;
2583
+ declare const index_computeGeneratorCap: typeof computeGeneratorCap;
2584
+ declare const index_computeGeneratorRech: typeof computeGeneratorRech;
2585
+ declare const index_computeGathererYield: typeof computeGathererYield;
2586
+ declare const index_computeGathererDrain: typeof computeGathererDrain;
2587
+ declare const index_computeGathererDepth: typeof computeGathererDepth;
2588
+ declare const index_computeGathererSpeed: typeof computeGathererSpeed;
2589
+ declare const index_computeLoaderMass: typeof computeLoaderMass;
2590
+ declare const index_computeLoaderThrust: typeof computeLoaderThrust;
2591
+ declare const index_computeCrafterSpeed: typeof computeCrafterSpeed;
2592
+ declare const index_computeCrafterDrain: typeof computeCrafterDrain;
2593
+ declare const index_entityDisplayName: typeof entityDisplayName;
2594
+ declare const index_moduleDisplayName: typeof moduleDisplayName;
2595
+ declare const index_formatModuleLine: typeof formatModuleLine;
2596
+ declare const index_buildEntityDescription: typeof buildEntityDescription;
2597
+ declare namespace index {
2598
+ export {
2599
+ index_NFTInstalledModule as NFTInstalledModule,
2600
+ index_NFTModuleSlot as NFTModuleSlot,
2601
+ index_NFTCargoItem as NFTCargoItem,
2602
+ index_NFTCommonBase as NFTCommonBase,
2603
+ index_readCommonBase as readCommonBase,
2604
+ index_deserializeScalar as deserializeScalar,
2605
+ index_deserializeResource as deserializeResource,
2606
+ index_deserializeComponent as deserializeComponent,
2607
+ index_deserializeModule as deserializeModule,
2608
+ index_deserializeEntity as deserializeEntity,
2609
+ index_deserializeAsset as deserializeAsset,
2610
+ index_computeBaseHullmass as computeBaseHullmass,
2611
+ index_computeBaseCapacityShip as computeBaseCapacityShip,
2612
+ index_computeBaseCapacityWarehouse as computeBaseCapacityWarehouse,
2613
+ index_computeEngineThrust as computeEngineThrust,
2614
+ index_computeEngineDrain as computeEngineDrain,
2615
+ index_computeGeneratorCap as computeGeneratorCap,
2616
+ index_computeGeneratorRech as computeGeneratorRech,
2617
+ index_computeGathererYield as computeGathererYield,
2618
+ index_computeGathererDrain as computeGathererDrain,
2619
+ index_computeGathererDepth as computeGathererDepth,
2620
+ index_computeGathererSpeed as computeGathererSpeed,
2621
+ index_computeLoaderMass as computeLoaderMass,
2622
+ index_computeLoaderThrust as computeLoaderThrust,
2623
+ index_computeCrafterSpeed as computeCrafterSpeed,
2624
+ index_computeCrafterDrain as computeCrafterDrain,
2625
+ index_entityDisplayName as entityDisplayName,
2626
+ index_moduleDisplayName as moduleDisplayName,
2627
+ index_formatModuleLine as formatModuleLine,
2628
+ index_buildEntityDescription as buildEntityDescription,
2117
2629
  };
2118
2630
  }
2119
2631
 
@@ -2123,5 +2635,11 @@ type loader_stats = Types.loader_stats;
2123
2635
  type task = Types.task;
2124
2636
  type cargo_item = Types.cargo_item;
2125
2637
  type warehouse_row = Types.warehouse_row;
2638
+ type container_row = Types.container_row;
2639
+ type gatherer_stats = Types.gatherer_stats;
2640
+ type location_static = Types.location_static;
2641
+ type location_epoch = Types.location_epoch;
2642
+ type location_derived = Types.location_derived;
2643
+ type location_row = Types.location_row;
2126
2644
 
2127
- export { ActionsManager, BetterSaleLocation, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CargoData, CargoMassInfo, CargoSaleItem, CollectActionType, CollectAnalysis, CollectAnalysisCallbacks, CollectAnalysisOptions, CollectOption, Coordinates, CoordinatesType, Deal, DiscountedGoodInfo, Distance, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EntitiesManager, EntityInventory, EntityType, EntityTypeName, EpochInfo, EpochsManager, EstimateTravelTimeOptions, EstimatedTravelTime, FindDealsOptions, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, GameState, Good, GoodPrice, INITIAL_SHIP_MASS, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, INSUFFICIENT_GOOD_SUPPLY, INVALID_AMOUNT, LoadTimeBreakdown, Location, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, NO_SCHEDULE, PLAYER_ALREADY_JOINED, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, Player, PlayerStateInput, PlayersManager, PotentialDeal, Projectable, ProjectedEntity, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, Rarities, Rarity, RepositionLocation, SHIP_ALREADY_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, 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, ScheduleData, Scheduleable, server as ServerContract, Ship, ShipLike, ShipStateInput, Shipload, TaskCancelable, TaskType, TradeCalculation, TradeProfitResult, TradesManager, TransferEntity, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, Warehouse, analyzeCargoSale, analyzeCollectOptions, calc_acceleration, calc_energyusage, calc_flighttime, 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, calculateBreakEvenPrice, calculateFlightTime, calculateLoadTimeBreakdown, calculateMaxTradeQuantity, calculateProfitPerMass, calculateProfitPerSecond, calculateROI, calculateRefuelingTime, calculateTradeProfit, calculateTransferTime, calculateUpdatedCargoCost, cargoUtils, cargo_item, createExploreOption, createProjectedEntity, createSellAndRepositionOption, createSellAndStayOption, createSellAndTradeOption, createTravelToSellOption, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, energy_stats, estimateDealTravelTime, estimateTravelTime, findBestDeal, findBestGoodToTrade, findDealsForShip, findNearbyPlanets, getCurrentEpoch, getEpochInfo, getGood, getGoods, getRarity, getSystemName, goodIds, hasEnergyForDistance, hasSystem, hash, hash512, isProfitable, lerp, loader_stats, marketPrice, marketPrices, movement_stats, projectEntity, projectEntityAt, rotation, schedule, task, toLocation, warehouse_row };
2645
+ export { ActionsManager, AnyEntity, BASE_ORBITAL_MASS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CapabilityAttribute, CargoData, CargoMassInfo, CargoSeed, CategoryInfo, CategoryStacks, ComponentDefinition, ComponentStat, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, CraftableItem, CraftedItemCategory, CrafterCapability, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, Distance, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityInventory, EntityRecipe, EntityRefInput, EntityState, EntityType, EntityTypeName, EpochInfo, EpochsManager, EstimateTravelTimeOptions, EstimatedTravelTime, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, GathererCapability, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CARGO_LINING_T2, ITEM_CONTAINER_T1_PACKED, ITEM_CONTAINER_T2_PACKED, ITEM_DOES_NOT_EXIST, ITEM_ENGINE_T1, ITEM_FOCUSING_ARRAY, ITEM_GATHERER_T1, ITEM_GENERATOR_T1, ITEM_HAULER_T1, ITEM_HULL_PLATES, ITEM_HULL_PLATES_T2, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1, ITEM_MATTER_CONDUIT, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, 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, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MODULE_ANY, MODULE_CRAFTER, MODULE_ENGINE, MODULE_GATHERER, MODULE_GENERATOR, MODULE_HAULER, MODULE_LAUNCHER, MODULE_LOADER, MODULE_STORAGE, MODULE_WARP, MassCapability, ModuleEntry, ModuleRecipe, ModuleSlot, 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, PRECISION, PlanetSubtypeInfo, platform as PlatformContract, Player, PlayerStateInput, PlayersManager, Projectable, ProjectedEntity, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RecipeInput, ResolvedAttributeGroup, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedModuleSlot, ResourceCategory, ResourceStats, ResourceTier, SHIP_ALREADY_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, 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, ScheduleAccessor, ScheduleCapability, ScheduleData, Scheduleable, server as ServerContract, Ship, ShipCapabilities, ShipEntity, ShipLike, ShipStateInput, Shipload, StackInput, StatDefinition, StatMapping, StorageCapability, StratumInfo, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, TransferEntity, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, Warehouse, WarehouseEntity, WarehouseStateInput, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildEntityDescription, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcLoadDuration, 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, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoUtils, cargo_item, categoryColors, categoryIcons, categoryItemMass, componentIcon, components, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityStats, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerDrain, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeManufacturingCapabilities, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseHullCapabilities, container_row, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, depthScaleFactor, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, deserializeAsset, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, distanceBetweenCoordinates, distanceBetweenPoints, encodeStats, energyPercent, energy_stats, entityDisplayName, entityRecipes, estimateDealTravelTime, estimateTravelTime, findNearbyPlanets, formatModuleLine, gatherer_stats, getAllCraftableItems, getCapabilityAttributes, getCategoryInfo, getComponentById, getComponentsForCategory, getComponentsForStat, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityRecipe, getEntityRecipeByItemId, getEntitySlotLayout, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getLocationTypeName, getModuleCapabilityType, getModuleRecipe, getModuleRecipeByItemId, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getResourceTier, getResourceWeight, 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, itemCategory, itemIcons, itemIds, itemOffset, itemTier, itemTypeCode, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, maxTravelDistance, moduleAccepts, moduleDisplayName, moduleIcon, moduleRecipes, movement_stats, needsRecharge, projectEntity, projectEntityAt, readCommonBase, resolveItem, resolveStats, rotation, schedule, statMappings, task, tierColors, toLocation, warehouse_row };