@shipload/sdk 2.0.0-rc5 → 2.0.0-rc6

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 (44) hide show
  1. package/lib/shipload.d.ts +376 -1008
  2. package/lib/shipload.js +712 -1948
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +694 -1924
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/capabilities/crafting.ts +10 -0
  8. package/src/capabilities/guards.ts +0 -5
  9. package/src/capabilities/index.ts +1 -0
  10. package/src/capabilities/storage.ts +0 -8
  11. package/src/contracts/server.ts +103 -220
  12. package/src/data/items.json +15 -15
  13. package/src/data/recipes.ts +129 -0
  14. package/src/derivation/crafting.ts +120 -0
  15. package/src/derivation/index.ts +1 -0
  16. package/src/derivation/stats.ts +91 -15
  17. package/src/derivation/stratum.ts +2 -2
  18. package/src/entities/cargo-utils.ts +6 -64
  19. package/src/entities/container.ts +18 -0
  20. package/src/entities/entity-inventory.ts +0 -4
  21. package/src/entities/inventory-accessor.ts +0 -4
  22. package/src/entities/location.ts +2 -197
  23. package/src/entities/player.ts +1 -274
  24. package/src/entities/ship.ts +0 -21
  25. package/src/entities/warehouse.ts +0 -4
  26. package/src/index-module.ts +34 -41
  27. package/src/managers/actions.ts +38 -90
  28. package/src/managers/context.ts +0 -9
  29. package/src/managers/index.ts +0 -1
  30. package/src/managers/locations.ts +2 -85
  31. package/src/market/items.ts +0 -1
  32. package/src/scheduling/projection.ts +0 -10
  33. package/src/shipload.ts +0 -5
  34. package/src/types/capabilities.ts +1 -9
  35. package/src/types/entity-traits.ts +3 -4
  36. package/src/types/entity.ts +0 -1
  37. package/src/types.ts +5 -25
  38. package/src/utils/system.ts +5 -4
  39. package/src/managers/trades.ts +0 -119
  40. package/src/market/market.ts +0 -195
  41. package/src/market/rolls.ts +0 -8
  42. package/src/trading/collect.ts +0 -938
  43. package/src/trading/deal.ts +0 -207
  44. 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, UInt8, TimePoint, Int64, UInt16Type, UInt8Type, TimePointType, Int64Type, Checksum512, APIClient } from '@wharfkit/antelope';
2
+ import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt8, TimePoint, UInt16, Int64, UInt16Type, UInt8Type, TimePointType, Int64Type, 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';
@@ -162,26 +162,6 @@ declare namespace Types {
162
162
  reveal: string;
163
163
  commit: Checksum256;
164
164
  }
165
- class buycontainer extends Struct {
166
- account: Name;
167
- ship_id: UInt64;
168
- name: string;
169
- }
170
- class buyitems extends Struct {
171
- entity_type: Name;
172
- id: UInt64;
173
- item_id: UInt16;
174
- quantity: UInt32;
175
- }
176
- class buyship extends Struct {
177
- account: Name;
178
- name: string;
179
- }
180
- class buywarehouse extends Struct {
181
- account: Name;
182
- ship_id: UInt64;
183
- name: string;
184
- }
185
165
  class cancel extends Struct {
186
166
  entity_type: Name;
187
167
  id: UInt64;
@@ -202,7 +182,6 @@ declare namespace Types {
202
182
  class cargo_item extends Struct {
203
183
  item_id: UInt16;
204
184
  quantity: UInt32;
205
- unit_cost: UInt64;
206
185
  seed?: UInt64;
207
186
  }
208
187
  class cargo_row extends Struct {
@@ -210,7 +189,6 @@ declare namespace Types {
210
189
  entity_id: UInt64;
211
190
  item_id: UInt64;
212
191
  quantity: UInt64;
213
- unit_cost: UInt64;
214
192
  seed: UInt64;
215
193
  }
216
194
  class cleanrsvp extends Struct {
@@ -238,9 +216,6 @@ declare namespace Types {
238
216
  thrust: UInt16;
239
217
  quantity: UInt8;
240
218
  }
241
- class trade_stats extends Struct {
242
- margin: UInt16;
243
- }
244
219
  class extractor_stats extends Struct {
245
220
  rate: UInt16;
246
221
  drain: UInt16;
@@ -251,6 +226,10 @@ declare namespace Types {
251
226
  class warp_stats extends Struct {
252
227
  range: UInt32;
253
228
  }
229
+ class crafter_stats extends Struct {
230
+ speed: UInt16;
231
+ drain: UInt16;
232
+ }
254
233
  class entity_defaults extends Struct {
255
234
  ship_hullmass: UInt32;
256
235
  ship_capacity: UInt32;
@@ -259,9 +238,9 @@ declare namespace Types {
259
238
  ship_engines: movement_stats;
260
239
  ship_generator: energy_stats;
261
240
  ship_loaders: loader_stats;
262
- ship_trade: trade_stats;
263
241
  ship_extractor: extractor_stats;
264
242
  ship_warp: warp_stats;
243
+ ship_crafter: crafter_stats;
265
244
  warehouse_capacity: UInt32;
266
245
  warehouse_z: UInt16;
267
246
  warehouse_loaders: loader_stats;
@@ -271,7 +250,6 @@ declare namespace Types {
271
250
  }
272
251
  class item_def extends Struct {
273
252
  id: UInt16;
274
- base_price: UInt32;
275
253
  mass: UInt32;
276
254
  }
277
255
  class game_config extends Struct {
@@ -295,7 +273,6 @@ declare namespace Types {
295
273
  cargo: cargo_item[];
296
274
  entitytarget?: entity_ref;
297
275
  entitygroup?: UInt64;
298
- credits?: Int64;
299
276
  energy_cost?: UInt16;
300
277
  }
301
278
  class schedule extends Struct {
@@ -312,6 +289,27 @@ declare namespace Types {
312
289
  cargomass: UInt32;
313
290
  schedule?: schedule;
314
291
  }
292
+ class craft extends Struct {
293
+ entity_type: Name;
294
+ id: UInt64;
295
+ recipe_id: UInt16;
296
+ quantity: UInt32;
297
+ inputs: cargo_item[];
298
+ }
299
+ class createentity extends Struct {
300
+ owner: Name;
301
+ entity_type: Name;
302
+ entity_name: string;
303
+ x: Int64;
304
+ y: Int64;
305
+ }
306
+ class deploy extends Struct {
307
+ entity_type: Name;
308
+ id: UInt64;
309
+ packed_item_id: UInt16;
310
+ seed: UInt64;
311
+ entity_name: string;
312
+ }
315
313
  class enable extends Struct {
316
314
  enabled: boolean;
317
315
  }
@@ -335,6 +333,7 @@ declare namespace Types {
335
333
  capacity?: UInt32;
336
334
  extractor?: extractor_stats;
337
335
  warp?: warp_stats;
336
+ crafter?: crafter_stats;
338
337
  is_idle: boolean;
339
338
  current_task?: task;
340
339
  current_task_elapsed: UInt32;
@@ -446,17 +445,9 @@ declare namespace Types {
446
445
  epoch_props: location_epoch;
447
446
  size: UInt16;
448
447
  }
449
- class location_item extends Struct {
450
- id: UInt16;
451
- price: UInt32;
452
- supply: UInt16;
453
- rarity_multiplier: UInt32;
454
- location_multiplier: UInt32;
455
- }
456
448
  class location_info extends Struct {
457
449
  coords: coordinates;
458
450
  is_system: boolean;
459
- items: location_item[];
460
451
  }
461
452
  class location_row extends Struct {
462
453
  id: UInt64;
@@ -493,33 +484,16 @@ declare namespace Types {
493
484
  class notify extends Struct {
494
485
  event: task_event;
495
486
  }
496
- class payloan extends Struct {
497
- account: Name;
498
- amount: UInt64;
499
- }
500
487
  class player_info extends Struct {
501
488
  owner: Name;
502
489
  is_player: boolean;
503
490
  company_name: string;
504
- balance: UInt64;
505
- debt: UInt32;
506
- networth: Int64;
507
- available_loan: UInt64;
508
- next_ship_price: UInt64;
509
- next_warehouse_price: UInt64;
510
- next_container_price: UInt64;
511
491
  ship_count: UInt64;
512
492
  warehouse_count: UInt64;
513
493
  container_count: UInt64;
514
494
  }
515
495
  class player_row extends Struct {
516
496
  owner: Name;
517
- balance: UInt64;
518
- debt: UInt32;
519
- networth: Int64;
520
- }
521
- class purgesupply extends Struct {
522
- max_rows?: UInt64;
523
497
  }
524
498
  class recharge extends Struct {
525
499
  entity_type: Name;
@@ -550,12 +524,6 @@ declare namespace Types {
550
524
  class salt extends Struct {
551
525
  salt: UInt64;
552
526
  }
553
- class sellitems extends Struct {
554
- entity_type: Name;
555
- id: UInt64;
556
- item_id: UInt16;
557
- quantity: UInt32;
558
- }
559
527
  class sequence_row extends Struct {
560
528
  key: Name;
561
529
  value: UInt64;
@@ -572,14 +540,17 @@ declare namespace Types {
572
540
  engines: movement_stats;
573
541
  generator: energy_stats;
574
542
  loaders: loader_stats;
575
- trade?: trade_stats;
576
543
  extractor?: extractor_stats;
577
544
  warp?: warp_stats;
545
+ crafter?: crafter_stats;
578
546
  schedule?: schedule;
579
547
  }
548
+ class spawncargo extends Struct {
549
+ entity_id: UInt64;
550
+ item_id: UInt64;
551
+ quantity: UInt64;
552
+ }
580
553
  class starter_info extends Struct {
581
- balance: UInt64;
582
- debt: UInt64;
583
554
  ship: entity_info;
584
555
  }
585
556
  class state_row extends Struct {
@@ -600,17 +571,6 @@ declare namespace Types {
600
571
  stratum: stratum_info;
601
572
  stats: resource_stats;
602
573
  }
603
- class supply_row extends Struct {
604
- id: UInt64;
605
- coordinates: coordinates;
606
- epoch: UInt64;
607
- item_id: UInt16;
608
- supply: UInt16;
609
- }
610
- class takeloan extends Struct {
611
- account: Name;
612
- amount: UInt64;
613
- }
614
574
  class task_results extends Struct {
615
575
  entities: entity_task_info[];
616
576
  }
@@ -635,14 +595,6 @@ declare namespace Types {
635
595
  starter_info_type: starter_info;
636
596
  game_config_type: game_config;
637
597
  }
638
- class updatecredit extends Struct {
639
- account: Name;
640
- amount: Int64;
641
- }
642
- class updatedebt extends Struct {
643
- account: Name;
644
- amount: Int64;
645
- }
646
598
  class warehouse_row extends Struct {
647
599
  id: UInt64;
648
600
  owner: Name;
@@ -674,7 +626,6 @@ declare const TableMap: {
674
626
  sequence: typeof Types.sequence_row;
675
627
  ship: typeof Types.ship_row;
676
628
  state: typeof Types.state_row;
677
- supply: typeof Types.supply_row;
678
629
  types: typeof Types.types_row;
679
630
  warehouse: typeof Types.warehouse_row;
680
631
  };
@@ -688,7 +639,6 @@ interface TableTypes {
688
639
  sequence: Types.sequence_row;
689
640
  ship: Types.ship_row;
690
641
  state: Types.state_row;
691
- supply: Types.supply_row;
692
642
  types: Types.types_row;
693
643
  warehouse: Types.warehouse_row;
694
644
  }
@@ -709,9 +659,9 @@ declare namespace ActionParams {
709
659
  ship_engines: Type.movement_stats;
710
660
  ship_generator: Type.energy_stats;
711
661
  ship_loaders: Type.loader_stats;
712
- ship_trade: Type.trade_stats;
713
662
  ship_extractor: Type.extractor_stats;
714
663
  ship_warp: Type.warp_stats;
664
+ ship_crafter: Type.crafter_stats;
715
665
  warehouse_capacity: UInt32Type;
716
666
  warehouse_z: UInt16Type;
717
667
  warehouse_loaders: Type.loader_stats;
@@ -732,9 +682,6 @@ declare namespace ActionParams {
732
682
  thrust: UInt16Type;
733
683
  quantity: UInt8Type;
734
684
  }
735
- interface trade_stats {
736
- margin: UInt16Type;
737
- }
738
685
  interface extractor_stats {
739
686
  rate: UInt16Type;
740
687
  drain: UInt16Type;
@@ -745,11 +692,19 @@ declare namespace ActionParams {
745
692
  interface warp_stats {
746
693
  range: UInt32Type;
747
694
  }
695
+ interface crafter_stats {
696
+ speed: UInt16Type;
697
+ drain: UInt16Type;
698
+ }
748
699
  interface item_def {
749
700
  id: UInt16Type;
750
- base_price: UInt32Type;
751
701
  mass: UInt32Type;
752
702
  }
703
+ interface cargo_item {
704
+ item_id: UInt16Type;
705
+ quantity: UInt32Type;
706
+ seed?: UInt64Type;
707
+ }
753
708
  interface entity_ref {
754
709
  entity_type: NameType;
755
710
  entity_id: UInt64Type;
@@ -773,7 +728,6 @@ declare namespace ActionParams {
773
728
  cargo: Type.cargo_item[];
774
729
  entitytarget?: Type.entity_ref;
775
730
  entitygroup?: UInt64Type;
776
- credits?: Int64Type;
777
731
  energy_cost?: UInt16Type;
778
732
  }
779
733
  interface coordinates {
@@ -781,37 +735,11 @@ declare namespace ActionParams {
781
735
  y: Int64Type;
782
736
  z?: UInt16Type;
783
737
  }
784
- interface cargo_item {
785
- item_id: UInt16Type;
786
- quantity: UInt32Type;
787
- unit_cost: UInt64Type;
788
- seed?: UInt64Type;
789
- }
790
738
  }
791
739
  interface advance {
792
740
  reveal: string;
793
741
  commit: Checksum256Type;
794
742
  }
795
- interface buycontainer {
796
- account: NameType;
797
- ship_id: UInt64Type;
798
- name: string;
799
- }
800
- interface buyitems {
801
- entity_type: NameType;
802
- id: UInt64Type;
803
- item_id: UInt16Type;
804
- quantity: UInt32Type;
805
- }
806
- interface buyship {
807
- account: NameType;
808
- name: string;
809
- }
810
- interface buywarehouse {
811
- account: NameType;
812
- ship_id: UInt64Type;
813
- name: string;
814
- }
815
743
  interface cancel {
816
744
  entity_type: NameType;
817
745
  id: UInt64Type;
@@ -832,6 +760,27 @@ declare namespace ActionParams {
832
760
  interface configlog {
833
761
  config: Type.game_config;
834
762
  }
763
+ interface craft {
764
+ entity_type: NameType;
765
+ id: UInt64Type;
766
+ recipe_id: UInt16Type;
767
+ quantity: UInt32Type;
768
+ inputs: Type.cargo_item[];
769
+ }
770
+ interface createentity {
771
+ owner: NameType;
772
+ entity_type: NameType;
773
+ entity_name: string;
774
+ x: Int64Type;
775
+ y: Int64Type;
776
+ }
777
+ interface deploy {
778
+ entity_type: NameType;
779
+ id: UInt64Type;
780
+ packed_item_id: UInt16Type;
781
+ seed: UInt64Type;
782
+ entity_name: string;
783
+ }
835
784
  interface enable {
836
785
  enabled: boolean;
837
786
  }
@@ -901,13 +850,6 @@ declare namespace ActionParams {
901
850
  interface notify {
902
851
  event: Type.task_event;
903
852
  }
904
- interface payloan {
905
- account: NameType;
906
- amount: UInt64Type;
907
- }
908
- interface purgesupply {
909
- max_rows?: UInt64Type;
910
- }
911
853
  interface recharge {
912
854
  entity_type: NameType;
913
855
  id: UInt64Type;
@@ -920,15 +862,10 @@ declare namespace ActionParams {
920
862
  interface salt {
921
863
  salt: UInt64Type;
922
864
  }
923
- interface sellitems {
924
- entity_type: NameType;
925
- id: UInt64Type;
926
- item_id: UInt16Type;
927
- quantity: UInt32Type;
928
- }
929
- interface takeloan {
930
- account: NameType;
931
- amount: UInt64Type;
865
+ interface spawncargo {
866
+ entity_id: UInt64Type;
867
+ item_id: UInt64Type;
868
+ quantity: UInt64Type;
932
869
  }
933
870
  interface transfer {
934
871
  source_type: NameType;
@@ -945,14 +882,6 @@ declare namespace ActionParams {
945
882
  y: Int64Type;
946
883
  recharge: boolean;
947
884
  }
948
- interface updatecredit {
949
- account: NameType;
950
- amount: Int64Type;
951
- }
952
- interface updatedebt {
953
- account: NameType;
954
- amount: Int64Type;
955
- }
956
885
  interface warp {
957
886
  entity_type: NameType;
958
887
  id: UInt64Type;
@@ -966,15 +895,14 @@ declare namespace ActionParams {
966
895
  }
967
896
  interface ActionNameParams {
968
897
  advance: ActionParams.advance;
969
- buycontainer: ActionParams.buycontainer;
970
- buyitems: ActionParams.buyitems;
971
- buyship: ActionParams.buyship;
972
- buywarehouse: ActionParams.buywarehouse;
973
898
  cancel: ActionParams.cancel;
974
899
  cleanrsvp: ActionParams.cleanrsvp;
975
900
  cleartable: ActionParams.cleartable;
976
901
  commit: ActionParams.commit;
977
902
  configlog: ActionParams.configlog;
903
+ craft: ActionParams.craft;
904
+ createentity: ActionParams.createentity;
905
+ deploy: ActionParams.deploy;
978
906
  enable: ActionParams.enable;
979
907
  extract: ActionParams.extract;
980
908
  getconfig: ActionParams.getconfig;
@@ -994,25 +922,21 @@ interface ActionNameParams {
994
922
  init: ActionParams.init;
995
923
  join: ActionParams.join;
996
924
  notify: ActionParams.notify;
997
- payloan: ActionParams.payloan;
998
- purgesupply: ActionParams.purgesupply;
999
925
  recharge: ActionParams.recharge;
1000
926
  resolve: ActionParams.resolve;
1001
927
  salt: ActionParams.salt;
1002
- sellitems: ActionParams.sellitems;
1003
- takeloan: ActionParams.takeloan;
928
+ spawncargo: ActionParams.spawncargo;
1004
929
  transfer: ActionParams.transfer;
1005
930
  travel: ActionParams.travel;
1006
- updatecredit: ActionParams.updatecredit;
1007
- updatedebt: ActionParams.updatedebt;
1008
931
  warp: ActionParams.warp;
1009
932
  wipe: ActionParams.wipe;
1010
933
  wipesequence: ActionParams.wipesequence;
1011
934
  }
1012
935
  type ActionNames = keyof ActionNameParams;
1013
936
  interface ActionReturnValues {
1014
- buyitems: Types.task_results;
1015
937
  cancel: Types.cancel_results;
938
+ craft: Types.task_results;
939
+ deploy: Types.task_results;
1016
940
  extract: Types.task_results;
1017
941
  getconfig: Types.game_config;
1018
942
  getentities: Types.entity_info[];
@@ -1030,7 +954,6 @@ interface ActionReturnValues {
1030
954
  hash512: Checksum512;
1031
955
  recharge: Types.task_results;
1032
956
  resolve: Types.resolve_results;
1033
- sellitems: Types.task_results;
1034
957
  transfer: Types.task_results;
1035
958
  travel: Types.task_results;
1036
959
  warp: Types.task_results;
@@ -1163,7 +1086,9 @@ declare enum TaskType {
1163
1086
  LOAD = 3,
1164
1087
  UNLOAD = 4,
1165
1088
  EXTRACT = 5,
1166
- WARP = 6
1089
+ WARP = 6,
1090
+ CRAFT = 7,
1091
+ DEPLOY = 8
1167
1092
  }
1168
1093
  declare enum LocationType {
1169
1094
  EMPTY = 0,
@@ -1203,18 +1128,11 @@ declare class Item extends Struct {
1203
1128
  id: UInt16;
1204
1129
  name: string;
1205
1130
  description: string;
1206
- base_price: UInt32;
1207
1131
  mass: UInt32;
1208
1132
  category: ResourceCategory;
1209
1133
  tier: ResourceTier;
1210
1134
  color: string;
1211
1135
  }
1212
- declare class ItemPrice extends Struct {
1213
- id: UInt16;
1214
- item: Item;
1215
- price: UInt32;
1216
- supply: UInt16;
1217
- }
1218
1136
 
1219
1137
  interface EpochInfo {
1220
1138
  epoch: UInt64;
@@ -1302,282 +1220,103 @@ declare class GameState extends Types.state_row {
1302
1220
 
1303
1221
  interface PlayerStateInput {
1304
1222
  owner: NameType;
1305
- balance: UInt64Type;
1306
- debt: UInt32Type;
1307
- networth: Int64Type;
1308
1223
  }
1309
- /**
1310
- * Player helper class extending player_row with computed financial properties.
1311
- * Provides easy access to balance, debt, networth, and loan calculations.
1312
- */
1313
1224
  declare class Player extends Types.player_row {
1314
- /**
1315
- * Construct a Player instance from individual state pieces.
1316
- * Used by UI's ReactivePlayer to reconstruct Player from reactive state.
1317
- */
1318
1225
  static fromState(state: PlayerStateInput): Player;
1319
- private static readonly MAX_LOAN;
1320
- private static readonly BASE_SHIP_COST;
1321
- private static readonly SHIP_COST_MULTIPLIER;
1322
- private _shipCount?;
1323
- /**
1324
- * Set the current ship count (needed for nextShipCost calculation)
1325
- */
1326
- setShipCount(count: number): void;
1327
- /**
1328
- * Get the current ship count (if set)
1329
- */
1330
- get shipCount(): number | undefined;
1331
- /**
1332
- * Calculate the cost of the next ship based on current ship count
1333
- * Matches contract: pow(5, sequence) * 100
1334
- * @param shipCount - Optional ship count (uses cached value if not provided)
1335
- */
1336
- getNextShipCost(shipCount?: number): UInt64;
1337
- /**
1338
- * Get the cost of the next ship based on cached ship count
1339
- */
1340
- get nextShipCost(): UInt64;
1341
- /**
1342
- * Check if player can afford to buy a ship
1343
- * @param shipCount - Optional ship count (uses cached value if not provided)
1344
- */
1345
- canBuyShip(shipCount?: number): boolean;
1346
- /**
1347
- * Calculate available loan amount (max loan - current debt)
1348
- */
1349
- get availableLoan(): UInt64;
1350
- /**
1351
- * Check if player can take out a loan
1352
- */
1353
- get canTakeLoan(): boolean;
1354
- /**
1355
- * Check if player can pay back loan
1356
- */
1357
- get canPayLoan(): boolean;
1358
- /**
1359
- * Calculate maximum payback amount (min of debt and balance)
1360
- */
1361
- get maxPayback(): UInt64;
1362
- /**
1363
- * Get the maximum loan amount (constant)
1364
- */
1365
- static get MAX_LOAN_LIMIT(): number;
1366
- /**
1367
- * Check if player is in debt
1368
- */
1369
- get hasDebt(): boolean;
1370
- /**
1371
- * Check if player is solvent (positive networth)
1372
- */
1373
- get isSolvent(): boolean;
1374
- /**
1375
- * Create an optimistic update for balance changes
1376
- * Uses integer math to match contract
1377
- * @param delta - Amount to change (can be negative)
1378
- */
1379
- withBalanceChange(delta: UInt64 | number): Player;
1380
- /**
1381
- * Create an optimistic update for debt changes
1382
- * Uses integer math to match contract
1383
- * @param delta - Amount to change (can be negative)
1384
- */
1385
- withDebtChange(delta: UInt64 | number): Player;
1386
- /**
1387
- * Create an optimistic update for taking a loan
1388
- */
1389
- withLoan(amount: UInt64): Player;
1390
- /**
1391
- * Create an optimistic update for paying back a loan
1392
- */
1393
- withLoanPayment(amount: UInt64): Player;
1394
- /**
1395
- * Simulate networth update from selling goods.
1396
- * Matches contract: networth += (sellPrice - paid * quantity)
1397
- * Contract reference: market.cpp:75
1398
- *
1399
- * @param sellPrice - Total revenue from sale (price * quantity)
1400
- * @param paidPerUnit - Average cost per unit paid (from cargo.paid)
1401
- * @param quantity - Quantity being sold
1402
- * @returns New player with updated networth
1403
- *
1404
- * @example
1405
- * // Sold 10 units at 150 each (revenue=1500), paid 100 per unit
1406
- * const newPlayer = player.withSaleNetworth(
1407
- * UInt64.from(1500),
1408
- * UInt64.from(100),
1409
- * UInt32.from(10)
1410
- * )
1411
- * // Networth increases by: 1500 - (100*10) = 500
1412
- */
1413
- withSaleNetworth(sellPrice: UInt64, paidPerUnit: UInt64, quantity: UInt64): Player;
1414
- /**
1415
- * Simulate complete sell goods transaction.
1416
- * Updates both balance (adds revenue) and networth (adds profit).
1417
- * Matches contract actions: update_balance + update_networth
1418
- *
1419
- * @param sellPrice - Total revenue from sale (price * quantity)
1420
- * @param paidPerUnit - Average cost per unit paid (from cargo.paid)
1421
- * @param quantity - Quantity being sold
1422
- * @returns New player with updated balance and networth
1423
- */
1424
- withSellGoods(sellPrice: UInt64, paidPerUnit: UInt64, quantity: UInt64): Player;
1425
- /**
1426
- * Simulate complete buy goods transaction.
1427
- * Updates balance (subtracts cost).
1428
- *
1429
- * @param purchaseCost - Total cost of purchase (price * quantity)
1430
- * @returns New player with updated balance
1431
- */
1432
- withBuyGoods(purchaseCost: UInt64): Player;
1433
1226
  }
1434
1227
 
1435
1228
  declare class PlayersManager extends BaseManager {
1436
1229
  getPlayer(account: NameType): Promise<Player | undefined>;
1437
1230
  }
1438
1231
 
1439
- /**
1440
- * Location helper class for working with game coordinates.
1441
- * Provides system detection, market price caching, nearby planet finding, and supply tracking.
1442
- */
1443
- declare class Location {
1444
- readonly coordinates: Coordinates;
1445
- private _marketPrices?;
1446
- private _gameSeed?;
1447
- private _hasSystem?;
1448
- private _locationRows?;
1449
- private _epoch?;
1450
- constructor(coordinates: CoordinatesType);
1451
- /**
1452
- * Create a Location from coordinates
1453
- */
1454
- static from(coordinates: CoordinatesType): Location;
1455
- /**
1456
- * Check if this location has a system (planet, asteroid, or nebula)
1457
- */
1458
- hasSystemAt(gameSeed: Checksum256Type): boolean;
1459
- /**
1460
- * Get the location type (EMPTY, PLANET, ASTEROID, or NEBULA)
1461
- */
1462
- getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
1463
- /**
1464
- * Check if this location is extractable (asteroid or nebula)
1465
- */
1466
- isExtractableAt(gameSeed: Checksum256Type): boolean;
1467
- /**
1468
- * Set cached market prices for this location
1469
- */
1470
- setMarketPrices(prices: ItemPrice[]): void;
1471
- /**
1472
- * Get cached market prices (returns undefined if not cached)
1473
- */
1474
- get marketPrices(): ItemPrice[] | undefined;
1475
- /**
1476
- * Get price for a specific good (from cache)
1477
- */
1478
- getPrice(goodId: UInt16Type): ItemPrice | undefined;
1479
- /**
1480
- * Find nearby planets from this location
1481
- */
1482
- findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
1483
- /**
1484
- * Check if this location equals another location
1485
- */
1486
- equals(other: CoordinatesType | Location): boolean;
1487
- /**
1488
- * Set location rows (supply data) for this location
1489
- */
1490
- setLocationRows(rows: Types.supply_row[], epoch: UInt64): void;
1491
- /**
1492
- * Get cached location rows (supply data)
1493
- */
1494
- get locationRows(): Types.supply_row[] | undefined;
1495
- /**
1496
- * Get supply for a specific good at this location
1497
- * Returns undefined if location rows not cached or good not found
1498
- */
1499
- getSupply(goodId: UInt16Type): UInt16 | undefined;
1500
- /**
1501
- * Get all available goods at this location (goods with supply > 0)
1502
- * Returns undefined if location rows not cached
1503
- */
1504
- get availableGoods(): Types.supply_row[] | undefined;
1505
- /**
1506
- * Check if a specific good is available (has supply)
1507
- * Returns false if location rows not cached
1508
- */
1509
- hasGood(goodId: UInt16Type): boolean;
1510
- /**
1511
- * Get the epoch for cached location data
1512
- */
1513
- get epoch(): UInt64 | undefined;
1514
- /**
1515
- * Check if cached data exists
1516
- */
1517
- get hasCachedData(): boolean;
1518
- /**
1519
- * Check if supply data is cached
1520
- */
1521
- get hasSupplyData(): boolean;
1522
- /**
1523
- * Clear all cached data
1524
- */
1525
- clearCache(): void;
1526
- /**
1527
- * Create optimistic Location with updated supply after purchase/sale.
1528
- * Matches contract: update_location_supply (delta can be positive or negative)
1529
- * Contract reference: market.cpp:53, 123-151
1530
- *
1531
- * @param goodId - Good ID to update supply for
1532
- * @param quantityDelta - Change in supply (negative for purchase, positive for sale)
1533
- * @returns New Location with updated supply in cached data
1534
- *
1535
- * @example
1536
- * // After buying 10 units (supply decreases)
1537
- * const newLocation = location.withUpdatedSupply(1, -10)
1538
- *
1539
- * // After selling 5 units (supply increases)
1540
- * const newLocation = location.withUpdatedSupply(1, 5)
1541
- */
1542
- withUpdatedSupply(goodId: UInt16Type, quantityDelta: number): Location;
1543
- }
1544
- /**
1545
- * Helper function to convert various coordinate types to Location
1546
- */
1547
- declare function toLocation(coords: CoordinatesType | Location): Location;
1548
-
1549
1232
  declare class LocationsManager extends BaseManager {
1550
- getMarketPrice(location: CoordinatesType, goodId: number): Promise<ItemPrice>;
1551
- getMarketPrices(location: CoordinatesType): Promise<ItemPrice[]>;
1552
- getMarketPricesWithSupply(location: CoordinatesType): Promise<ItemPrice[]>;
1553
1233
  hasSystem(location: CoordinatesType): Promise<boolean>;
1554
1234
  findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
1555
- getSupplyRows(location: CoordinatesType): Promise<any[]>;
1556
- getLocationWithPrices(coords: CoordinatesType): Promise<Location>;
1557
- getLocationWithSupply(coords: CoordinatesType): Promise<Location>;
1558
- getLocationComplete(coords: CoordinatesType): Promise<Location>;
1559
1235
  getLocationEntity(id: UInt64Type): Promise<Types.location_row | undefined>;
1560
1236
  getLocationEntityAt(coords: CoordinatesType): Promise<Types.location_row | undefined>;
1561
1237
  getAllLocationEntities(): Promise<Types.location_row[]>;
1562
1238
  }
1563
1239
 
1564
- interface MovementCapability {
1565
- engines: Types.movement_stats;
1566
- generator: Types.energy_stats;
1567
- }
1568
- interface EnergyCapability {
1569
- energy: UInt16;
1570
- }
1571
- interface StorageCapability {
1572
- capacity: UInt32;
1573
- cargomass: UInt32;
1574
- cargo: Types.cargo_item[];
1575
- }
1576
- interface LoaderCapability {
1577
- loaders: Types.loader_stats;
1240
+ declare class EpochsManager extends BaseManager {
1241
+ getCurrentHeight(): Promise<UInt64>;
1242
+ getCurrent(): Promise<EpochInfo>;
1243
+ getByHeight(height: UInt64Type): Promise<EpochInfo>;
1244
+ getTimeRemaining(): Promise<number>;
1245
+ getProgress(): Promise<number>;
1246
+ fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
1578
1247
  }
1579
- interface TradeCapability {
1580
- trade: Types.trade_stats;
1248
+
1249
+ type EntityRefInput = {
1250
+ entityType: EntityTypeName;
1251
+ entityId: UInt64Type;
1252
+ };
1253
+ declare class ActionsManager extends BaseManager {
1254
+ travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
1255
+ grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
1256
+ resolve(entityId: UInt64Type, entityType?: EntityTypeName): Action;
1257
+ cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
1258
+ recharge(shipId: UInt64Type): Action;
1259
+ transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type): Action;
1260
+ foundCompany(account: NameType, name: string): Action;
1261
+ join(account: NameType): Action;
1262
+ extract(shipId: UInt64Type): Action;
1263
+ warp(shipId: UInt64Type, destination: CoordinatesType): Action;
1264
+ craft(entityType: EntityTypeName, entityId: UInt64Type, recipeId: number, quantity: number, inputs: {
1265
+ itemId: number;
1266
+ quantity: number;
1267
+ seed?: bigint;
1268
+ }[]): Action;
1269
+ deploy(entityType: EntityTypeName, entityId: UInt64Type, packedItemId: number, seed: bigint, entityName: string): Action;
1270
+ joinGame(account: NameType, companyName: string): Action[];
1271
+ }
1272
+
1273
+ declare class GameContext {
1274
+ readonly client: APIClient;
1275
+ readonly server: Contract$2;
1276
+ readonly platform: Contract$2;
1277
+ private _entities?;
1278
+ private _players?;
1279
+ private _locations?;
1280
+ private _epochs?;
1281
+ private _actions?;
1282
+ private _gameCache?;
1283
+ private _stateCache?;
1284
+ constructor(client: APIClient, server: Contract$2, platform: Contract$2);
1285
+ get entities(): EntitiesManager;
1286
+ get players(): PlayersManager;
1287
+ get locations(): LocationsManager;
1288
+ get epochs(): EpochsManager;
1289
+ get actions(): ActionsManager;
1290
+ getGame(reload?: boolean): Promise<Types$1.game_row>;
1291
+ getState(reload?: boolean): Promise<GameState>;
1292
+ get cachedGame(): Types$1.game_row | undefined;
1293
+ get cachedState(): GameState | undefined;
1294
+ }
1295
+
1296
+ declare abstract class BaseManager {
1297
+ protected readonly context: GameContext;
1298
+ constructor(context: GameContext);
1299
+ protected get client(): _wharfkit_antelope.APIClient;
1300
+ protected get server(): _wharfkit_contract.Contract;
1301
+ protected get platform(): _wharfkit_contract.Contract;
1302
+ protected getGame(): Promise<Types$1.game_row>;
1303
+ protected getState(): Promise<GameState>;
1304
+ }
1305
+
1306
+ interface MovementCapability {
1307
+ engines: Types.movement_stats;
1308
+ generator: Types.energy_stats;
1309
+ }
1310
+ interface EnergyCapability {
1311
+ energy: UInt16;
1312
+ }
1313
+ interface StorageCapability {
1314
+ capacity: UInt32;
1315
+ cargomass: UInt32;
1316
+ cargo: Types.cargo_item[];
1317
+ }
1318
+ interface LoaderCapability {
1319
+ loaders: Types.loader_stats;
1581
1320
  }
1582
1321
  interface ExtractorCapability {
1583
1322
  extractor: Types.extractor_stats;
@@ -1594,8 +1333,8 @@ interface EntityCapabilities {
1594
1333
  engines?: Types.movement_stats;
1595
1334
  generator?: Types.energy_stats;
1596
1335
  loaders?: Types.loader_stats;
1597
- trade?: Types.trade_stats;
1598
1336
  extractor?: Types.extractor_stats;
1337
+ crafter?: Types.crafter_stats;
1599
1338
  }
1600
1339
  interface EntityState {
1601
1340
  owner: Name;
@@ -1607,7 +1346,6 @@ interface EntityState {
1607
1346
  declare function capsHasMovement(caps: EntityCapabilities): boolean;
1608
1347
  declare function capsHasStorage(caps: EntityCapabilities): boolean;
1609
1348
  declare function capsHasLoaders(caps: EntityCapabilities): boolean;
1610
- declare function capsHasTrade(caps: EntityCapabilities): boolean;
1611
1349
  declare function capsHasExtractor(caps: EntityCapabilities): boolean;
1612
1350
  declare function capsHasMass(caps: EntityCapabilities): boolean;
1613
1351
 
@@ -1722,12 +1460,10 @@ interface ProjectedEntity {
1722
1460
  engines?: Types.movement_stats;
1723
1461
  loaders?: Types.loader_stats;
1724
1462
  generator?: Types.energy_stats;
1725
- trade?: Types.trade_stats;
1726
1463
  readonly totalMass: UInt64;
1727
1464
  hasMovement(): boolean;
1728
1465
  hasStorage(): boolean;
1729
1466
  hasLoaders(): boolean;
1730
- hasTrade(): boolean;
1731
1467
  capabilities(): EntityCapabilities;
1732
1468
  state(): EntityState;
1733
1469
  }
@@ -1738,7 +1474,6 @@ interface Projectable extends ScheduleData {
1738
1474
  generator?: Types.energy_stats;
1739
1475
  engines?: Types.movement_stats;
1740
1476
  loaders?: Types.loader_stats;
1741
- trade?: Types.trade_stats;
1742
1477
  capacity?: UInt32;
1743
1478
  cargo: Types.cargo_item[];
1744
1479
  cargomass: UInt32;
@@ -1748,6 +1483,23 @@ declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
1748
1483
  declare function projectEntity(entity: Projectable): ProjectedEntity;
1749
1484
  declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
1750
1485
 
1486
+ declare class Location {
1487
+ readonly coordinates: Coordinates;
1488
+ private _gameSeed?;
1489
+ private _hasSystem?;
1490
+ private _epoch?;
1491
+ constructor(coordinates: CoordinatesType);
1492
+ static from(coordinates: CoordinatesType): Location;
1493
+ hasSystemAt(gameSeed: Checksum256Type): boolean;
1494
+ getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
1495
+ isExtractableAt(gameSeed: Checksum256Type): boolean;
1496
+ findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
1497
+ equals(other: CoordinatesType | Location): boolean;
1498
+ get epoch(): UInt64 | undefined;
1499
+ clearCache(): void;
1500
+ }
1501
+ declare function toLocation(coords: CoordinatesType | Location): Location;
1502
+
1751
1503
  type Task = Types.task;
1752
1504
  declare class ScheduleAccessor {
1753
1505
  private entity;
@@ -1779,7 +1531,6 @@ declare class EntityInventory extends Types.cargo_item {
1779
1531
  get name(): string;
1780
1532
  get unitMass(): UInt32;
1781
1533
  get totalMass(): UInt64;
1782
- get totalCost(): UInt64;
1783
1534
  get hasCargo(): boolean;
1784
1535
  get isEmpty(): boolean;
1785
1536
  }
@@ -1794,7 +1545,6 @@ interface HasCargomass {
1794
1545
  cargomass: UInt32;
1795
1546
  }
1796
1547
  declare function calcCargoMass(entity: HasCargo): UInt64;
1797
- declare function calcCargoValue(entity: HasCargo): UInt64;
1798
1548
  declare function availableCapacity$1(entity: StorageCapability): UInt64;
1799
1549
  declare function availableCapacityFromMass(capacity: UInt64Type, cargoMass: UInt64Type): UInt64;
1800
1550
  declare function hasSpace$1(entity: StorageCapability, goodMass: UInt64, quantity: number): boolean;
@@ -1808,7 +1558,6 @@ declare class InventoryAccessor {
1808
1558
  constructor(entity: HasCargo);
1809
1559
  get items(): EntityInventory[];
1810
1560
  get totalMass(): UInt64;
1811
- get totalValue(): UInt64;
1812
1561
  forItem(goodId: UInt64Type): EntityInventory | undefined;
1813
1562
  get sellable(): EntityInventory[];
1814
1563
  get hasSellable(): boolean;
@@ -1816,57 +1565,6 @@ declare class InventoryAccessor {
1816
1565
  }
1817
1566
  declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
1818
1567
 
1819
- interface CargoData {
1820
- cargo: EntityInventory[];
1821
- }
1822
- declare function totalCargoMass(cargo: EntityInventory[]): UInt64;
1823
- declare function cargoValue(cargo: EntityInventory[]): UInt64;
1824
- declare function getCargoForItem(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
1825
- declare function hasSpace(currentMass: UInt64, maxCapacity: UInt64, goodMass: UInt64, quantity: number): boolean;
1826
- declare function availableCapacity(currentMass: UInt64, maxCapacity: UInt64): UInt64;
1827
- declare function isFull(currentMass: UInt64, maxCapacity: UInt64): boolean;
1828
- interface SaleValue {
1829
- revenue: UInt64;
1830
- profit: UInt64;
1831
- cost: UInt64;
1832
- }
1833
- declare function calculateSaleValue(cargo: Types.cargo_item[], prices: Map<number, UInt64>): SaleValue;
1834
- declare function calculateSaleValueFromArray(cargo: Types.cargo_item[], prices: UInt64[]): SaleValue;
1835
- declare function afterSellItems(cargo: Types.cargo_item[], goodsToSell: Array<{
1836
- goodId: number;
1837
- quantity: number;
1838
- }>): EntityInventory[];
1839
- declare function afterSellAllItems(cargo: Types.cargo_item[]): EntityInventory[];
1840
-
1841
- type cargoUtils_CargoData = CargoData;
1842
- declare const cargoUtils_totalCargoMass: typeof totalCargoMass;
1843
- declare const cargoUtils_cargoValue: typeof cargoValue;
1844
- declare const cargoUtils_getCargoForItem: typeof getCargoForItem;
1845
- declare const cargoUtils_hasSpace: typeof hasSpace;
1846
- declare const cargoUtils_availableCapacity: typeof availableCapacity;
1847
- declare const cargoUtils_isFull: typeof isFull;
1848
- type cargoUtils_SaleValue = SaleValue;
1849
- declare const cargoUtils_calculateSaleValue: typeof calculateSaleValue;
1850
- declare const cargoUtils_calculateSaleValueFromArray: typeof calculateSaleValueFromArray;
1851
- declare const cargoUtils_afterSellItems: typeof afterSellItems;
1852
- declare const cargoUtils_afterSellAllItems: typeof afterSellAllItems;
1853
- declare namespace cargoUtils {
1854
- export {
1855
- cargoUtils_CargoData as CargoData,
1856
- cargoUtils_totalCargoMass as totalCargoMass,
1857
- cargoUtils_cargoValue as cargoValue,
1858
- cargoUtils_getCargoForItem as getCargoForItem,
1859
- cargoUtils_hasSpace as hasSpace,
1860
- cargoUtils_availableCapacity as availableCapacity,
1861
- cargoUtils_isFull as isFull,
1862
- cargoUtils_SaleValue as SaleValue,
1863
- cargoUtils_calculateSaleValue as calculateSaleValue,
1864
- cargoUtils_calculateSaleValueFromArray as calculateSaleValueFromArray,
1865
- cargoUtils_afterSellItems as afterSellItems,
1866
- cargoUtils_afterSellAllItems as afterSellAllItems,
1867
- };
1868
- }
1869
-
1870
1568
  interface ShipStateInput {
1871
1569
  id: UInt64Type;
1872
1570
  owner: string;
@@ -1908,7 +1606,6 @@ declare class Ship extends Types.entity_info {
1908
1606
  projectAt(now: Date): ProjectedEntity;
1909
1607
  get location(): Location;
1910
1608
  get totalCargoMass(): UInt64;
1911
- get cargoValue(): UInt64;
1912
1609
  get totalMass(): UInt64;
1913
1610
  get maxCapacity(): UInt64;
1914
1611
  hasSpace(goodMass: UInt64, quantity: number): boolean;
@@ -1921,440 +1618,6 @@ declare class Ship extends Types.entity_info {
1921
1618
  get energyPercent(): number;
1922
1619
  get needsRecharge(): boolean;
1923
1620
  hasEnergyFor(distance: UInt64): boolean;
1924
- calculateSaleValue(prices: Map<number, UInt64>): SaleValue;
1925
- calculateSaleValueFromArray(prices: UInt64[]): SaleValue;
1926
- afterSellItems(goodsToSell: Array<{
1927
- goodId: number;
1928
- quantity: number;
1929
- }>): EntityInventory[];
1930
- afterSellAllItems(): EntityInventory[];
1931
- }
1932
-
1933
- /**
1934
- * Travel calculations for ship movement, energy usage, and flight times.
1935
- *
1936
- * Functions prefixed with `calc_` are contract-parity functions that mirror
1937
- * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
1938
- * These use snake_case intentionally to match the contract naming convention
1939
- * and signal that they must produce identical results to the on-chain code.
1940
- *
1941
- * Functions prefixed with `calculate` are higher-level SDK helpers that may
1942
- * combine multiple contract calculations for convenience.
1943
- */
1944
-
1945
- declare function calc_orbital_altitude(mass: number): number;
1946
- declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
1947
- declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
1948
- declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
1949
- declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
1950
- declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
1951
- declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
1952
- declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
1953
- declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
1954
- declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
1955
- declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
1956
- declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
1957
- declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
1958
- declare function calc_acceleration(thrust: number, mass: number): number;
1959
- declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
1960
- declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
1961
- declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
1962
- declare function calculateRefuelingTime(ship: ShipLike): UInt32;
1963
- declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
1964
- interface LoadTimeBreakdown {
1965
- unloadTime: number;
1966
- loadTime: number;
1967
- totalTime: number;
1968
- unloadMass: number;
1969
- loadMass: number;
1970
- }
1971
- declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
1972
- interface EstimatedTravelTime {
1973
- flightTime: UInt32;
1974
- rechargeTime: UInt32;
1975
- loadTime: UInt32;
1976
- unloadTime: UInt32;
1977
- total: UInt32;
1978
- }
1979
- interface EstimateTravelTimeOptions {
1980
- needsRecharge?: boolean;
1981
- loadMass?: UInt32Type;
1982
- unloadMass?: UInt32Type;
1983
- }
1984
- declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
1985
- declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
1986
- declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
1987
- interface TransferEntity {
1988
- location: {
1989
- z?: {
1990
- toNumber(): number;
1991
- } | number;
1992
- };
1993
- loaders?: {
1994
- thrust: {
1995
- toNumber(): number;
1996
- } | number;
1997
- mass: {
1998
- toNumber(): number;
1999
- } | number;
2000
- quantity: {
2001
- toNumber(): number;
2002
- } | number;
2003
- };
2004
- }
2005
- interface HasScheduleAndLocation {
2006
- coordinates: ActionParams.Type.coordinates;
2007
- schedule?: Types.schedule;
2008
- }
2009
- declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
2010
- declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
2011
- declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
2012
- declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
2013
-
2014
- /**
2015
- * Trading deal interface representing a profitable trade opportunity
2016
- */
2017
- interface Deal {
2018
- /** Origin location */
2019
- origin: Location;
2020
- /** Destination location */
2021
- destination: Location;
2022
- /** Item to trade */
2023
- item: ItemPrice;
2024
- /** Distance between origin and destination */
2025
- distance: UInt64;
2026
- /** Available supply at origin */
2027
- supply: UInt16;
2028
- /** Buy price at origin */
2029
- buyPrice: UInt32;
2030
- /** Sell price at destination */
2031
- sellPrice: UInt32;
2032
- /** Profit per unit */
2033
- profitPerUnit: UInt32;
2034
- /** Maximum quantity that can be traded */
2035
- maxQuantity: UInt32;
2036
- /** Total profit for max quantity */
2037
- totalProfit: Int64;
2038
- /** Estimated travel time in seconds */
2039
- travelTime: UInt32;
2040
- /** Detailed breakdown of travel time components */
2041
- travelTimeBreakdown: EstimatedTravelTime;
2042
- /** Profit per second (floating point for UI display) */
2043
- profitPerSecond: number;
2044
- /** Profit margin percentage (floating point for UI display) */
2045
- marginPercent: number;
2046
- }
2047
- /**
2048
- * Options for finding deals
2049
- */
2050
- interface FindDealsOptions {
2051
- /** Maximum number of deals to return */
2052
- maxDeals?: number;
2053
- /** Maximum search distance */
2054
- maxDistance?: number;
2055
- /** Player's current balance (for affordability filtering) */
2056
- playerBalance?: UInt64Type;
2057
- /** Minimum profit per second threshold */
2058
- minProfitPerSecond?: number;
2059
- /** Minimum profit margin percentage */
2060
- minMarginPercent?: number;
2061
- /** Override available cargo space (in mass units). If provided, uses this instead of calculating from ship's current cargo. */
2062
- availableSpace?: number;
2063
- }
2064
- /**
2065
- * Calculate deals for a ship from a specific origin location
2066
- */
2067
- declare function findDealsForShip(ship: Ship, originLocation: Coordinates, getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>, getMarketPrices: (location: Coordinates) => Promise<ItemPrice[]>, options?: FindDealsOptions): Promise<Deal[]>;
2068
- /**
2069
- * Find the single best deal for a ship from a specific origin location
2070
- */
2071
- declare function findBestDeal(ship: Ship, originLocation: Coordinates, getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>, getMarketPrices: (location: Coordinates) => Promise<ItemPrice[]>, options?: FindDealsOptions): Promise<Deal | undefined>;
2072
-
2073
- /**
2074
- * Types of collect actions available to the player
2075
- */
2076
- type CollectActionType = 'sell-and-trade' | 'sell-and-reposition' | 'travel-to-sell' | 'sell-and-stay' | 'explore' | 'orbit';
2077
- /**
2078
- * Represents a single collect option presented to the player
2079
- */
2080
- interface CollectOption {
2081
- /** Unique identifier for this option */
2082
- id: string;
2083
- /** Type of action sequence */
2084
- type: CollectActionType;
2085
- /** Human-readable title */
2086
- title: string;
2087
- /** Detailed description of what will happen */
2088
- description: string;
2089
- /** Brief explanation of why this option is worth considering */
2090
- reason: string;
2091
- /** Whether this is the recommended option (best profitPerSecond with quality threshold) */
2092
- recommended: boolean;
2093
- /** Whether this option has the highest absolute profit (may differ from recommended) */
2094
- highestProfit: boolean;
2095
- /** Estimated profit/loss from this action */
2096
- estimatedProfit: UInt64;
2097
- /** Revenue from selling cargo (if applicable) */
2098
- saleRevenue?: UInt64;
2099
- /** Cost of purchasing new cargo (if applicable) */
2100
- purchaseCost?: UInt64;
2101
- /** Expected profit from the next trade (if applicable) */
2102
- nextTradeProfit?: UInt64;
2103
- /** Profit per second for this option (floating point for display) */
2104
- profitPerSecond?: number;
2105
- /** Margin percentage for the deal (floating point for display) */
2106
- marginPercent?: number;
2107
- /** Destination location (if traveling) */
2108
- destination?: Location;
2109
- /** Deal to execute (if buying goods) */
2110
- deal?: Deal;
2111
- /** Sale location if different from current */
2112
- saleLocation?: Location;
2113
- /** Price per unit at sale location */
2114
- salePrice?: UInt32;
2115
- /** Price per unit at current location (for comparison) */
2116
- currentPrice?: UInt32;
2117
- /** Estimated travel time in seconds (undefined = instant/no travel) */
2118
- travelTime?: UInt32;
2119
- /** Detailed breakdown of travel time components */
2120
- travelTimeBreakdown?: EstimatedTravelTime;
2121
- /** Info about a discounted good at the destination (for explore options) */
2122
- discountedGood?: DiscountedItemInfo;
2123
- /** Top potential deals available at destination (for explore options) */
2124
- potentialDeals?: PotentialDeal[];
2125
- /** Details of cargo being sold (if selling cargo) */
2126
- cargoSale?: CargoSaleItem[];
2127
- /** Total profit/loss from selling cargo */
2128
- cargoProfitLoss?: Int64;
2129
- }
2130
- /**
2131
- * Analysis result for collect options
2132
- */
2133
- interface CollectAnalysis {
2134
- /** Current location where ship arrived */
2135
- arrivedAt: Coordinates;
2136
- /** Ship being analyzed */
2137
- ship: Ship;
2138
- /** Current cargo on ship */
2139
- cargo: EntityInventory[];
2140
- /** Value of cargo if sold at current location */
2141
- cargoValueHere: UInt64;
2142
- /** All available options, sorted by estimated profit */
2143
- options: CollectOption[];
2144
- /** Whether any profitable options exist */
2145
- hasProfitableOptions: boolean;
2146
- }
2147
- /**
2148
- * Options for analyzing collect choices
2149
- */
2150
- interface CollectAnalysisOptions {
2151
- /** Player's current balance (defaults to Infinity) */
2152
- playerBalance?: number;
2153
- /** Maximum distance to search (defaults to ship's max range) */
2154
- maxDistance?: number;
2155
- /** Minimum profit improvement to suggest traveling elsewhere to sell */
2156
- minSaleImprovement?: number;
2157
- }
2158
- /**
2159
- * Find locations where current cargo could be sold for more
2160
- */
2161
- interface BetterSaleLocation {
2162
- location: Location;
2163
- /** Price per unit at this location */
2164
- price: UInt32;
2165
- /** Total revenue if sold here */
2166
- revenue: UInt64;
2167
- /** Difference vs selling at current location */
2168
- improvement: Int64;
2169
- /** Best deal available at this location after selling */
2170
- bestDealAfterSale?: Deal;
2171
- /** Distance to this location */
2172
- distance: UInt64;
2173
- /** Estimated travel time */
2174
- travelTime: UInt32;
2175
- /** Detailed breakdown of travel time components */
2176
- travelTimeBreakdown?: EstimatedTravelTime;
2177
- }
2178
- /**
2179
- * Find locations with good deals when current location has none
2180
- */
2181
- interface RepositionLocation {
2182
- location: Location;
2183
- /** Best deal available at this location */
2184
- bestDeal: Deal;
2185
- /** Distance to this location */
2186
- distance: UInt64;
2187
- /** Estimated travel time */
2188
- travelTime: UInt32;
2189
- /** Detailed breakdown of travel time components */
2190
- travelTimeBreakdown?: EstimatedTravelTime;
2191
- }
2192
- /**
2193
- * Analyze cargo sale value at a specific location
2194
- */
2195
- declare function analyzeCargoSale(cargo: EntityInventory[], prices: Map<number, UInt64>): {
2196
- revenue: UInt64;
2197
- cost: UInt64;
2198
- profit: Int64;
2199
- };
2200
- /**
2201
- * Create a "Sell & Trade" option (full loop)
2202
- */
2203
- declare function createSellAndTradeOption(saleRevenue: UInt64, saleCost: UInt64, deal: Deal, cargoSale?: CargoSaleItem[], unloadTime?: UInt32): CollectOption;
2204
- /**
2205
- * Create a "Travel to Sell" option (better market elsewhere)
2206
- */
2207
- declare function createTravelToSellOption(currentRevenue: UInt64, cargoCost: UInt64, betterSale: BetterSaleLocation, cargo: EntityInventory[], destPrices?: Map<number, UInt64>): CollectOption;
2208
- /**
2209
- * Create a "Sell & Reposition" option (sell here, travel empty to deals)
2210
- */
2211
- declare function createSellAndRepositionOption(saleRevenue: UInt64, saleCost: UInt64, reposition: RepositionLocation, cargoSale?: CargoSaleItem[]): CollectOption;
2212
- /**
2213
- * Create a "Sell & Stay" option (just sell, stay idle)
2214
- */
2215
- declare function createSellAndStayOption(saleRevenue: UInt64, saleCost: UInt64, cargoSale?: CargoSaleItem[], unloadTime?: UInt32): CollectOption;
2216
- /**
2217
- * Details about a cargo item being sold
2218
- */
2219
- interface CargoSaleItem {
2220
- goodId: UInt16;
2221
- goodName: string;
2222
- quantity: UInt32;
2223
- /** Price per unit at sale location */
2224
- pricePerUnit: UInt32;
2225
- /** Total revenue from this item */
2226
- revenue: UInt64;
2227
- /** Original cost (paid) per unit */
2228
- costPerUnit: UInt64;
2229
- /** Profit/loss on this item */
2230
- profit: Int64;
2231
- }
2232
- /**
2233
- * Info about a discounted good for explore options
2234
- */
2235
- interface DiscountedItemInfo {
2236
- goodId: number;
2237
- name: string;
2238
- rarity: string;
2239
- discountPercent: number;
2240
- }
2241
- /**
2242
- * A potential deal available at a destination (for explore options)
2243
- */
2244
- interface PotentialDeal {
2245
- goodId: number;
2246
- goodName: string;
2247
- destinationCoords: Coordinates;
2248
- marginPercent: number;
2249
- profitPerSecond: number;
2250
- }
2251
- /**
2252
- * Create an "Explore" option (travel to find opportunities)
2253
- */
2254
- declare function createExploreOption(destination: Location, travelTime?: UInt32, discountedGood?: DiscountedItemInfo, travelTimeBreakdown?: EstimatedTravelTime, potentialDeals?: PotentialDeal[]): CollectOption;
2255
- /**
2256
- * Callbacks for collect analysis (provided by manager)
2257
- */
2258
- interface CollectAnalysisCallbacks {
2259
- getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>;
2260
- getMarketPrices: (location: Coordinates) => Promise<ItemPrice[]>;
2261
- getGameSeed?: () => Checksum256Type;
2262
- getState?: () => Types.state_row;
2263
- }
2264
- /**
2265
- * Analyze all collect options for a ship that has arrived at its destination.
2266
- * Returns all available options sorted by estimated profit.
2267
- */
2268
- declare function analyzeCollectOptions(ship: Ship, arrivedAt: Coordinates, callbacks: CollectAnalysisCallbacks, options?: CollectAnalysisOptions): Promise<CollectAnalysis>;
2269
-
2270
- declare class TradesManager extends BaseManager {
2271
- private priceCache;
2272
- private priceCacheEpoch;
2273
- private makePriceCacheKey;
2274
- private createCallbacks;
2275
- clearPriceCache(): void;
2276
- findDeals(ship: Ship, originLocation?: Coordinates, options?: FindDealsOptions): Promise<Deal[]>;
2277
- findBestDeal(ship: Ship, originLocation?: Coordinates, options?: FindDealsOptions): Promise<Deal | undefined>;
2278
- getCollectOptions(ship: Ship, arrivedAt?: Coordinates, options?: CollectAnalysisOptions): Promise<CollectAnalysis>;
2279
- }
2280
-
2281
- declare class EpochsManager extends BaseManager {
2282
- getCurrentHeight(): Promise<UInt64>;
2283
- getCurrent(): Promise<EpochInfo>;
2284
- getByHeight(height: UInt64Type): Promise<EpochInfo>;
2285
- getTimeRemaining(): Promise<number>;
2286
- getProgress(): Promise<number>;
2287
- fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
2288
- }
2289
-
2290
- interface SellableCargo {
2291
- item_id: {
2292
- toNumber(): number;
2293
- } | number;
2294
- quantity: {
2295
- toNumber(): number;
2296
- } | number;
2297
- hasCargo: boolean;
2298
- }
2299
- type EntityRefInput = {
2300
- entityType: EntityTypeName;
2301
- entityId: UInt64Type;
2302
- };
2303
- declare class ActionsManager extends BaseManager {
2304
- travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
2305
- grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
2306
- resolve(entityId: UInt64Type, entityType?: EntityTypeName): Action;
2307
- cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
2308
- recharge(shipId: UInt64Type): Action;
2309
- transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type): Action;
2310
- buyItems(entityId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type, entityType?: EntityTypeName): Action;
2311
- sellItems(entityId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type, entityType?: EntityTypeName): Action;
2312
- buyShip(account: NameType, name: string): Action;
2313
- buyWarehouse(account: NameType, shipId: UInt64Type, name: string): Action;
2314
- buyContainer(account: NameType, shipId: UInt64Type, name: string): Action;
2315
- takeLoan(account: NameType, amount: UInt64Type): Action;
2316
- payLoan(account: NameType, amount: UInt64Type): Action;
2317
- foundCompany(account: NameType, name: string): Action;
2318
- join(account: NameType): Action;
2319
- extract(shipId: UInt64Type): Action;
2320
- warp(shipId: UInt64Type, destination: CoordinatesType): Action;
2321
- joinGame(account: NameType, companyName: string): Action[];
2322
- sellAllCargo(ship: Ship | UInt64Type, cargo?: SellableCargo[]): Action[];
2323
- }
2324
-
2325
- declare class GameContext {
2326
- readonly client: APIClient;
2327
- readonly server: Contract$2;
2328
- readonly platform: Contract$2;
2329
- private _entities?;
2330
- private _players?;
2331
- private _locations?;
2332
- private _trades?;
2333
- private _epochs?;
2334
- private _actions?;
2335
- private _gameCache?;
2336
- private _stateCache?;
2337
- constructor(client: APIClient, server: Contract$2, platform: Contract$2);
2338
- get entities(): EntitiesManager;
2339
- get players(): PlayersManager;
2340
- get locations(): LocationsManager;
2341
- get trades(): TradesManager;
2342
- get epochs(): EpochsManager;
2343
- get actions(): ActionsManager;
2344
- getGame(reload?: boolean): Promise<Types$1.game_row>;
2345
- getState(reload?: boolean): Promise<GameState>;
2346
- get cachedGame(): Types$1.game_row | undefined;
2347
- get cachedState(): GameState | undefined;
2348
- }
2349
-
2350
- declare abstract class BaseManager {
2351
- protected readonly context: GameContext;
2352
- constructor(context: GameContext);
2353
- protected get client(): _wharfkit_antelope.APIClient;
2354
- protected get server(): _wharfkit_contract.Contract;
2355
- protected get platform(): _wharfkit_contract.Contract;
2356
- protected getGame(): Promise<Types$1.game_row>;
2357
- protected getState(): Promise<GameState>;
2358
1621
  }
2359
1622
 
2360
1623
  interface WarehouseStateInput {
@@ -2383,7 +1646,6 @@ declare class Warehouse extends Types.entity_info {
2383
1646
  isUnloading(now: Date): boolean;
2384
1647
  get location(): Location;
2385
1648
  get totalCargoMass(): UInt64;
2386
- get cargoValue(): UInt64;
2387
1649
  get maxCapacity(): UInt64;
2388
1650
  get availableCapacity(): UInt64;
2389
1651
  hasSpace(goodMass: UInt64, quantity: number): boolean;
@@ -2421,6 +1683,10 @@ declare class Container extends Types.entity_info {
2421
1683
  get isFull(): boolean;
2422
1684
  get orbitalAltitude(): number;
2423
1685
  }
1686
+ declare function computeContainerCapabilities(stats: Record<string, number>): {
1687
+ hullmass: number;
1688
+ capacity: number;
1689
+ };
2424
1690
 
2425
1691
  type EntityType = 'ship' | 'warehouse' | 'container' | 'location';
2426
1692
  declare class EntitiesManager extends BaseManager {
@@ -2459,7 +1725,6 @@ declare class Shipload {
2459
1725
  get entities(): EntitiesManager;
2460
1726
  get players(): PlayersManager;
2461
1727
  get locations(): LocationsManager;
2462
- get trades(): TradesManager;
2463
1728
  get epochs(): EpochsManager;
2464
1729
  get actions(): ActionsManager;
2465
1730
  getGame(reload?: boolean): Promise<Types$1.game_row>;
@@ -2474,24 +1739,6 @@ declare const itemIds: UInt16[];
2474
1739
  declare function getItem(itemId: UInt16Type): Item;
2475
1740
  declare function getItems(): Item[];
2476
1741
 
2477
- declare enum Rarities {
2478
- legendary = "LEGENDARY",
2479
- epic = "EPIC",
2480
- rare = "RARE",
2481
- uncommon = "UNCOMMON",
2482
- common = "COMMON",
2483
- trash = "TRASH"
2484
- }
2485
- interface Rarity {
2486
- rarity: Rarities;
2487
- minMultiplier: number;
2488
- maxMultiplier: number;
2489
- }
2490
- declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: CoordinatesType, goodId: UInt16Type): Rarity;
2491
- declare function getRarityMultiplier(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: CoordinatesType, goodId: UInt16Type): number;
2492
- declare function marketPrice(location: ActionParams.Type.coordinates, goodId: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): ItemPrice;
2493
- declare function marketPrices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): ItemPrice[];
2494
-
2495
1742
  declare function getLocationType(gameSeed: Checksum256Type, coordinates: CoordinatesType): LocationType;
2496
1743
  declare function isExtractableLocation(locationType: LocationType): boolean;
2497
1744
  declare function getSystemName(gameSeed: Checksum256Type, location: CoordinatesType): string;
@@ -2555,88 +1802,152 @@ declare function resolveStats(category: ResourceCategory, stats: {
2555
1802
  stat3: number;
2556
1803
  }): NamedStats;
2557
1804
 
1805
+ interface StackInput {
1806
+ quantity: number;
1807
+ stats: Record<string, number>;
1808
+ }
1809
+ interface CategoryStacks {
1810
+ category: ResourceCategory;
1811
+ stacks: StackInput[];
1812
+ }
1813
+ declare function encodeStats(values: number[]): bigint;
1814
+ declare function decodeStats(seed: bigint, count: number): number[];
1815
+ declare function decodeCraftedItemStats(itemId: number, seed: bigint): Record<string, number>;
1816
+ declare function blendStacks(stacks: StackInput[], statKey: string): number;
1817
+ declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
1818
+ key: string;
1819
+ value: number;
1820
+ }[];
1821
+ declare function blendComponentStacks(stacks: {
1822
+ quantity: number;
1823
+ stats: Record<string, number>;
1824
+ }[]): Record<string, number>;
1825
+ declare function computeEntityStats(entityRecipeId: string, componentStacks: Record<number, {
1826
+ quantity: number;
1827
+ stats: Record<string, number>;
1828
+ }[]>): {
1829
+ key: string;
1830
+ value: number;
1831
+ }[];
1832
+
2558
1833
  declare function hash(seed: Checksum256Type, string: string): Checksum256;
2559
1834
  declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2560
1835
 
2561
1836
  /**
2562
- * Trade calculation result
2563
- */
2564
- interface TradeCalculation {
2565
- maxQuantity: number;
2566
- totalCost: number;
2567
- totalMass: UInt64;
2568
- affordableQuantity: number;
2569
- spaceForQuantity: number;
2570
- }
2571
- /**
2572
- * Calculate updated weighted average cargo cost after purchase.
2573
- * Matches contract logic: (paid * owned + cost) / (owned + quantity)
1837
+ * Travel calculations for ship movement, energy usage, and flight times.
2574
1838
  *
2575
- * @param currentPaid - Current average cost per unit (from cargo.paid)
2576
- * @param currentOwned - Current owned quantity
2577
- * @param purchaseCost - Total cost of new purchase (price * quantity)
2578
- * @param purchaseQuantity - Quantity being purchased
2579
- * @returns New weighted average cost per unit
1839
+ * Functions prefixed with `calc_` are contract-parity functions that mirror
1840
+ * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
1841
+ * These use snake_case intentionally to match the contract naming convention
1842
+ * and signal that they must produce identical results to the on-chain code.
2580
1843
  *
2581
- * @example
2582
- * // Owned 10 units at 100 each, buying 5 more at 120 each
2583
- * const newPaid = calculateUpdatedCargoCost(
2584
- * UInt64.from(100),
2585
- * UInt32.from(10),
2586
- * UInt64.from(600),
2587
- * UInt32.from(5)
2588
- * )
2589
- * // Result: (100*10 + 600) / (10+5) = 106.67 per unit
2590
- */
2591
- declare function calculateUpdatedCargoCost(currentPaid: UInt64, currentOwned: UInt32, purchaseCost: UInt64, purchaseQuantity: UInt32): UInt64;
2592
- /**
2593
- * Calculate the maximum quantity of a good a ship can buy
2594
- * considering both space and player balance
2595
- */
2596
- declare function calculateMaxTradeQuantity(ship: Ship, player: Player, goodPrice: ItemPrice): TradeCalculation;
2597
- /**
2598
- * Trade profit calculation result
1844
+ * Functions prefixed with `calculate` are higher-level SDK helpers that may
1845
+ * combine multiple contract calculations for convenience.
2599
1846
  */
2600
- interface TradeProfitResult {
2601
- revenue: UInt64;
2602
- cost: UInt64;
2603
- profit: Int64;
2604
- margin: number;
1847
+
1848
+ declare function calc_orbital_altitude(mass: number): number;
1849
+ declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
1850
+ declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
1851
+ declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
1852
+ declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
1853
+ declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
1854
+ declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
1855
+ declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
1856
+ declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
1857
+ declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
1858
+ declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
1859
+ declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
1860
+ declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
1861
+ declare function calc_acceleration(thrust: number, mass: number): number;
1862
+ declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
1863
+ declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
1864
+ declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
1865
+ declare function calculateRefuelingTime(ship: ShipLike): UInt32;
1866
+ declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
1867
+ interface LoadTimeBreakdown {
1868
+ unloadTime: number;
1869
+ loadTime: number;
1870
+ totalTime: number;
1871
+ unloadMass: number;
1872
+ loadMass: number;
2605
1873
  }
2606
- /**
2607
- * Calculate profit for a trade route
2608
- */
2609
- declare function calculateTradeProfit(quantity: UInt32Type, buyPrice: UInt32Type, sellPrice: UInt32Type): TradeProfitResult;
2610
- /**
2611
- * Calculate profit per unit of mass
2612
- */
2613
- declare function calculateProfitPerMass(quantity: number, buyPrice: number, sellPrice: number, massPerUnit: number): number;
2614
- /**
2615
- * Calculate profit per second for a trade route
2616
- */
2617
- declare function calculateProfitPerSecond(profit: Int64Type, travelTimeSeconds: UInt32Type): number;
2618
- /**
2619
- * Find the best good to trade between two locations
2620
- */
2621
- declare function findBestItemToTrade(ship: Ship, player: Player, originPrices: ItemPrice[], destPrices: ItemPrice[], travelTimeSeconds: UInt32Type): {
2622
- item: ItemPrice;
1874
+ declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
1875
+ interface EstimatedTravelTime {
1876
+ flightTime: UInt32;
1877
+ rechargeTime: UInt32;
1878
+ loadTime: UInt32;
1879
+ unloadTime: UInt32;
1880
+ total: UInt32;
1881
+ }
1882
+ interface EstimateTravelTimeOptions {
1883
+ needsRecharge?: boolean;
1884
+ loadMass?: UInt32Type;
1885
+ unloadMass?: UInt32Type;
1886
+ }
1887
+ declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
1888
+ declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
1889
+ declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
1890
+ interface TransferEntity {
1891
+ location: {
1892
+ z?: {
1893
+ toNumber(): number;
1894
+ } | number;
1895
+ };
1896
+ loaders?: {
1897
+ thrust: {
1898
+ toNumber(): number;
1899
+ } | number;
1900
+ mass: {
1901
+ toNumber(): number;
1902
+ } | number;
1903
+ quantity: {
1904
+ toNumber(): number;
1905
+ } | number;
1906
+ };
1907
+ }
1908
+ interface HasScheduleAndLocation {
1909
+ coordinates: ActionParams.Type.coordinates;
1910
+ schedule?: Types.schedule;
1911
+ }
1912
+ declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
1913
+ declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
1914
+ declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
1915
+ declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
1916
+
1917
+ interface CargoData {
1918
+ cargo: EntityInventory[];
1919
+ }
1920
+ declare function totalCargoMass(cargo: EntityInventory[]): UInt64;
1921
+ declare function getCargoForItem(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
1922
+ declare function hasSpace(currentMass: UInt64, maxCapacity: UInt64, goodMass: UInt64, quantity: number): boolean;
1923
+ declare function availableCapacity(currentMass: UInt64, maxCapacity: UInt64): UInt64;
1924
+ declare function isFull(currentMass: UInt64, maxCapacity: UInt64): boolean;
1925
+ declare function afterRemoveItems(cargo: Types.cargo_item[], goodsToRemove: Array<{
1926
+ goodId: number;
2623
1927
  quantity: number;
2624
- profit: number;
2625
- profitPerSecond: number;
2626
- margin: number;
2627
- } | null;
2628
- /**
2629
- * Calculate break-even price for selling cargo
2630
- */
2631
- declare function calculateBreakEvenPrice(costPaid: number, quantity: number): number;
2632
- /**
2633
- * Check if a trade is profitable
2634
- */
2635
- declare function isProfitable(buyPrice: UInt32Type, sellPrice: UInt32Type): boolean;
2636
- /**
2637
- * Calculate return on investment percentage
2638
- */
2639
- declare function calculateROI(cost: number, profit: number): number;
1928
+ }>): EntityInventory[];
1929
+ declare function afterRemoveAllItems(cargo: Types.cargo_item[]): EntityInventory[];
1930
+
1931
+ type cargoUtils_CargoData = CargoData;
1932
+ declare const cargoUtils_totalCargoMass: typeof totalCargoMass;
1933
+ declare const cargoUtils_getCargoForItem: typeof getCargoForItem;
1934
+ declare const cargoUtils_hasSpace: typeof hasSpace;
1935
+ declare const cargoUtils_availableCapacity: typeof availableCapacity;
1936
+ declare const cargoUtils_isFull: typeof isFull;
1937
+ declare const cargoUtils_afterRemoveItems: typeof afterRemoveItems;
1938
+ declare const cargoUtils_afterRemoveAllItems: typeof afterRemoveAllItems;
1939
+ declare namespace cargoUtils {
1940
+ export {
1941
+ cargoUtils_CargoData as CargoData,
1942
+ cargoUtils_totalCargoMass as totalCargoMass,
1943
+ cargoUtils_getCargoForItem as getCargoForItem,
1944
+ cargoUtils_hasSpace as hasSpace,
1945
+ cargoUtils_availableCapacity as availableCapacity,
1946
+ cargoUtils_isFull as isFull,
1947
+ cargoUtils_afterRemoveItems as afterRemoveItems,
1948
+ cargoUtils_afterRemoveAllItems as afterRemoveAllItems,
1949
+ };
1950
+ }
2640
1951
 
2641
1952
  interface Entity {
2642
1953
  id: UInt64;
@@ -2646,7 +1957,6 @@ interface Entity {
2646
1957
  location: Coordinates | Types.coordinates;
2647
1958
  }
2648
1959
  type ShipEntity = Entity & MovementCapability & EnergyCapability & StorageCapability & LoaderCapability & MassCapability & ScheduleCapability & {
2649
- trade?: Types.trade_stats;
2650
1960
  extractor?: Types.extractor_stats;
2651
1961
  };
2652
1962
  type WarehouseEntity = Entity & StorageCapability & LoaderCapability & ScheduleCapability;
@@ -2657,7 +1967,6 @@ declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCa
2657
1967
  declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
2658
1968
  declare function hasStorage(e: Entity): e is Entity & StorageCapability;
2659
1969
  declare function hasLoaders(e: Entity): e is Entity & LoaderCapability;
2660
- declare function hasTrade(e: Entity): e is Entity & TradeCapability;
2661
1970
  declare function hasMass(e: Entity): e is Entity & MassCapability;
2662
1971
  declare function hasSchedule(e: Entity): e is Entity & ScheduleCapability;
2663
1972
  declare function hasExtractor(e: Entity): e is Entity & ExtractorCapability;
@@ -2672,6 +1981,65 @@ declare function calcLoadDuration(entity: LoaderCapability, cargoMass: UInt64):
2672
1981
  declare function calc_extraction_duration(extractor: Types.extractor_stats, cargoMass: number, stratum: number, richness: number): UInt32;
2673
1982
  declare function calc_extraction_energy(extractor: Types.extractor_stats, duration: number): UInt16;
2674
1983
 
1984
+ interface CrafterCapability {
1985
+ crafter: Types.crafter_stats;
1986
+ }
1987
+ declare function capsHasCrafter(caps: EntityCapabilities): boolean;
1988
+
1989
+ declare const ITEM_HULL_PLATES = 10001;
1990
+ declare const ITEM_CARGO_LINING = 10002;
1991
+ declare const ITEM_CONTAINER_PACKED = 10003;
1992
+ interface RecipeInput {
1993
+ category?: ResourceCategory;
1994
+ itemId?: number;
1995
+ quantity: number;
1996
+ }
1997
+ interface ComponentStat {
1998
+ key: string;
1999
+ source: ResourceCategory;
2000
+ }
2001
+ interface ComponentDefinition {
2002
+ id: number;
2003
+ name: string;
2004
+ description: string;
2005
+ color: string;
2006
+ mass: number;
2007
+ stats: ComponentStat[];
2008
+ recipe: RecipeInput[];
2009
+ usedIn: {
2010
+ type: 'entity';
2011
+ name: string;
2012
+ }[];
2013
+ }
2014
+ interface EntityRecipe {
2015
+ id: string;
2016
+ name: string;
2017
+ description: string;
2018
+ color: string;
2019
+ packedItemId: number;
2020
+ recipe: RecipeInput[];
2021
+ stats: {
2022
+ key: string;
2023
+ sourceComponentId: number;
2024
+ sourceStatKey: string;
2025
+ }[];
2026
+ }
2027
+ interface CraftableItem {
2028
+ type: 'component' | 'entity';
2029
+ id: number | string;
2030
+ name: string;
2031
+ description: string;
2032
+ color: string;
2033
+ }
2034
+ declare const components: ComponentDefinition[];
2035
+ declare const entityRecipes: EntityRecipe[];
2036
+ declare function getComponentById(id: number): ComponentDefinition | undefined;
2037
+ declare function getEntityRecipe(id: string): EntityRecipe | undefined;
2038
+ declare function getEntityRecipeByItemId(itemId: number): EntityRecipe | undefined;
2039
+ declare function getAllCraftableItems(): CraftableItem[];
2040
+ declare function getComponentsForCategory(category: ResourceCategory): ComponentDefinition[];
2041
+ declare function getComponentsForStat(statKey: string): ComponentDefinition[];
2042
+
2675
2043
  type movement_stats = Types.movement_stats;
2676
2044
  type energy_stats = Types.energy_stats;
2677
2045
  type loader_stats = Types.loader_stats;
@@ -2685,4 +2053,4 @@ type location_epoch = Types.location_epoch;
2685
2053
  type location_derived = Types.location_derived;
2686
2054
  type location_row = Types.location_row;
2687
2055
 
2688
- export { ActionsManager, AnyEntity, BetterSaleLocation, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, CargoData, CargoMassInfo, CargoSaleItem, CollectActionType, CollectAnalysis, CollectAnalysisCallbacks, CollectAnalysisOptions, CollectOption, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, Deal, DiscountedItemInfo, Distance, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityInventory, EntityRefInput, EntityState, EntityType, EntityTypeName, EpochInfo, EpochsManager, EstimateTravelTimeOptions, EstimatedTravelTime, ExtractorCapability, FindDealsOptions, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_EXTRACTOR_DRAIN, INITIAL_EXTRACTOR_EFFICIENCY, INITIAL_EXTRACTOR_RATE, INITIAL_LOADER_MASS, INITIAL_LOADER_QUANTITY, INITIAL_LOADER_THRUST, INITIAL_SHIP_CAPACITY, INITIAL_SHIP_DRAIN, INITIAL_SHIP_ENERGY, INITIAL_SHIP_GENERATOR_CAPACITY, INITIAL_SHIP_HULLMASS, INITIAL_SHIP_MASS, INITIAL_SHIP_RECHARGE, INITIAL_SHIP_THRUST, INITIAL_SHIP_Z, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_DOES_NOT_EXIST, ITEM_NOT_AVAILABLE_AT_LOCATION, InventoryAccessor, Item, ItemPrice, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MassCapability, MovementCapability, 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, platform as PlatformContract, Player, PlayerStateInput, PlayersManager, PotentialDeal, Projectable, ProjectedEntity, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, Rarities, Rarity, RepositionLocation, 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, ShipEntity, ShipLike, ShipStateInput, Shipload, StatDefinition, StorageCapability, StratumInfo, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, TradeCalculation, TradeCapability, TradeProfitResult, TradesManager, TransferEntity, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, Warehouse, WarehouseEntity, WarehouseStateInput, analyzeCargoSale, analyzeCollectOptions, availableCapacity$1 as availableCapacity, availableCapacityFromMass, calcCargoMass, calcCargoValue, calcEnergyUsage, calcLoadDuration, calc_acceleration, calc_energyusage, calc_extraction_duration, calc_extraction_energy, 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, canMove, capsHasExtractor, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, capsHasTrade, cargoUtils, cargo_item, container_row, coordsToLocationId, createExploreOption, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, createSellAndRepositionOption, createSellAndStayOption, createSellAndTradeOption, createTravelToSellOption, Shipload as default, depthScaleFactor, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, distanceBetweenCoordinates, distanceBetweenPoints, energyPercent, energy_stats, estimateDealTravelTime, estimateTravelTime, extractor_stats, findBestDeal, findBestItemToTrade, findDealsForShip, findNearbyPlanets, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getPositionAt, getRarity, getRarityMultiplier, getResourceTier, getResourceWeight, getStatDefinitions, getStatName, getSystemName, hasEnergy, hasEnergyForDistance, hasExtractor, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hasTrade, hash, hash512, isExtractableLocation, isFull$1 as isFull, isFullFromMass, isProfitable, itemIds, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, marketPrice, marketPrices, maxTravelDistance, movement_stats, needsRecharge, projectEntity, projectEntityAt, resolveStats, rotation, schedule, task, toLocation, warehouse_row };
2056
+ export { ActionsManager, AnyEntity, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, CargoData, CargoMassInfo, CategoryStacks, ComponentDefinition, ComponentStat, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, CraftableItem, 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, ExtractorCapability, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_EXTRACTOR_DRAIN, INITIAL_EXTRACTOR_EFFICIENCY, INITIAL_EXTRACTOR_RATE, INITIAL_LOADER_MASS, INITIAL_LOADER_QUANTITY, INITIAL_LOADER_THRUST, INITIAL_SHIP_CAPACITY, INITIAL_SHIP_DRAIN, INITIAL_SHIP_ENERGY, INITIAL_SHIP_GENERATOR_CAPACITY, INITIAL_SHIP_HULLMASS, INITIAL_SHIP_MASS, INITIAL_SHIP_RECHARGE, INITIAL_SHIP_THRUST, INITIAL_SHIP_Z, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_CARGO_LINING, ITEM_CONTAINER_PACKED, ITEM_DOES_NOT_EXIST, ITEM_HULL_PLATES, ITEM_NOT_AVAILABLE_AT_LOCATION, InventoryAccessor, Item, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MassCapability, MovementCapability, 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, platform as PlatformContract, Player, PlayerStateInput, PlayersManager, Projectable, ProjectedEntity, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RecipeInput, 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, ShipEntity, ShipLike, ShipStateInput, Shipload, StackInput, StatDefinition, 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, blendComponentStacks, blendStacks, calcCargoMass, calcEnergyUsage, calcLoadDuration, calc_acceleration, calc_energyusage, calc_extraction_duration, calc_extraction_energy, 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, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, capsHasCrafter, capsHasExtractor, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoUtils, cargo_item, components, computeComponentStats, computeContainerCapabilities, computeEntityStats, container_row, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStats, Shipload as default, depthScaleFactor, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, distanceBetweenCoordinates, distanceBetweenPoints, encodeStats, energyPercent, energy_stats, entityRecipes, estimateDealTravelTime, estimateTravelTime, extractor_stats, findNearbyPlanets, getAllCraftableItems, getComponentById, getComponentsForCategory, getComponentsForStat, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityRecipe, getEntityRecipeByItemId, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getPositionAt, getResourceTier, getResourceWeight, getStatDefinitions, getStatName, getSystemName, hasEnergy, hasEnergyForDistance, hasExtractor, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, isExtractableLocation, isFull$1 as isFull, isFullFromMass, itemIds, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, maxTravelDistance, movement_stats, needsRecharge, projectEntity, projectEntityAt, resolveStats, rotation, schedule, task, toLocation, warehouse_row };