@shipload/sdk 0.7.0 → 2.0.0-rc1

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 (48) hide show
  1. package/lib/shipload.d.ts +1651 -226
  2. package/lib/shipload.js +4960 -1972
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +4789 -1941
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +5 -4
  7. package/src/contracts/platform.ts +30 -30
  8. package/src/contracts/server.ts +635 -253
  9. package/src/data/goods.json +23 -0
  10. package/src/data/syllables.json +1184 -0
  11. package/src/entities/cargo-utils.ts +47 -0
  12. package/src/entities/entity-inventory.ts +39 -0
  13. package/src/entities/gamestate.ts +152 -0
  14. package/src/entities/location.ts +241 -0
  15. package/src/entities/player.ts +287 -0
  16. package/src/entities/ship.ts +559 -0
  17. package/src/entities/warehouse.ts +205 -0
  18. package/src/errors.ts +46 -9
  19. package/src/index-module.ts +119 -7
  20. package/src/managers/actions.ts +168 -0
  21. package/src/managers/base.ts +25 -0
  22. package/src/managers/context.ts +104 -0
  23. package/src/managers/entities.ts +86 -0
  24. package/src/managers/epochs.ts +47 -0
  25. package/src/managers/index.ts +9 -0
  26. package/src/managers/locations.ts +103 -0
  27. package/src/managers/players.ts +13 -0
  28. package/src/managers/trades.ts +119 -0
  29. package/src/market/goods.ts +31 -0
  30. package/src/{market.ts → market/market.ts} +32 -37
  31. package/src/{rolls.ts → market/rolls.ts} +3 -3
  32. package/src/{epoch.ts → scheduling/epoch.ts} +1 -1
  33. package/src/scheduling/projection.ts +218 -0
  34. package/src/scheduling/schedule.ts +155 -0
  35. package/src/shipload.ts +39 -157
  36. package/src/trading/collect.ts +939 -0
  37. package/src/trading/deal.ts +208 -0
  38. package/src/trading/trade.ts +203 -0
  39. package/src/travel/travel.ts +425 -0
  40. package/src/types.ts +60 -25
  41. package/src/utils/system.ts +27 -0
  42. package/src/goods.ts +0 -124
  43. package/src/ship.ts +0 -36
  44. package/src/state.ts +0 -0
  45. package/src/syllables.ts +0 -1184
  46. package/src/system.ts +0 -36
  47. package/src/travel.ts +0 -259
  48. /package/src/{hash.ts → utils/hash.ts} +0 -0
package/lib/shipload.d.ts CHANGED
@@ -1,4 +1,6 @@
1
- import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, Int64, UInt16, TimePoint, UInt8, Float64, Int64Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
1
+ import * as _wharfkit_antelope from '@wharfkit/antelope';
2
+ import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt16, Int64, UInt8, TimePoint, UInt8Type, TimePointType, Int64Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
3
+ import * as _wharfkit_contract from '@wharfkit/contract';
2
4
  import { Contract as Contract$2, PartialBy, ContractArgs, ActionOptions, Table } from '@wharfkit/contract';
3
5
  import { ChainDefinition } from '@wharfkit/session';
4
6
 
@@ -160,25 +162,64 @@ declare namespace Types {
160
162
  reveal: string;
161
163
  commit: Checksum256;
162
164
  }
163
- class arrive extends Struct {
164
- id: UInt64;
165
- }
166
165
  class buygoods extends Struct {
167
166
  ship_id: UInt64;
168
- good_id: UInt64;
169
- quantity: UInt64;
167
+ good_id: UInt16;
168
+ quantity: UInt32;
170
169
  }
171
170
  class buyship extends Struct {
172
171
  account: Name;
173
172
  name: string;
174
173
  }
174
+ class buywarehouse extends Struct {
175
+ account: Name;
176
+ ship_id: UInt64;
177
+ name: string;
178
+ }
179
+ class cancel extends Struct {
180
+ entity_type: Name;
181
+ id: UInt64;
182
+ count: UInt64;
183
+ }
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;
205
+ entity_type: Name;
206
+ entity_id: UInt64;
207
+ task_index: UInt8;
208
+ task: task;
209
+ started_at: TimePoint;
210
+ }
211
+ class cancel_results extends Struct {
212
+ entity_id: UInt64;
213
+ entity_type: Name;
214
+ cancelled_count: UInt8;
215
+ schedule_started?: TimePoint;
216
+ }
175
217
  class cargo_row extends Struct {
176
218
  id: UInt64;
177
- ship_id: UInt64;
219
+ entity_id: UInt64;
178
220
  good_id: UInt64;
179
- paid: UInt64;
180
- owned: UInt32;
181
- loaded: UInt32;
221
+ quantity: UInt64;
222
+ unit_cost: UInt64;
182
223
  }
183
224
  class cleartable extends Struct {
184
225
  table_name: Name;
@@ -188,17 +229,101 @@ declare namespace Types {
188
229
  class commit extends Struct {
189
230
  commit: Checksum256;
190
231
  }
191
- class coordinates extends Struct {
232
+ class enable extends Struct {
233
+ enabled: boolean;
234
+ }
235
+ class energy_stats extends Struct {
236
+ capacity: UInt16;
237
+ recharge: UInt16;
238
+ }
239
+ class loader_stats extends Struct {
240
+ mass: UInt32;
241
+ thrust: UInt16;
242
+ quantity: UInt8;
243
+ }
244
+ class movement_stats extends Struct {
245
+ thrust: UInt32;
246
+ drain: UInt16;
247
+ }
248
+ class schedule extends Struct {
249
+ started: TimePoint;
250
+ tasks: task[];
251
+ }
252
+ class entity_info extends Struct {
253
+ type: Name;
254
+ id: UInt64;
255
+ owner: Name;
256
+ entity_name: string;
257
+ location: coordinates;
258
+ cargomass: UInt32;
259
+ cargo: cargo_item[];
260
+ loaders?: loader_stats;
261
+ energy?: UInt16;
262
+ mass?: UInt32;
263
+ engines?: movement_stats;
264
+ generator?: energy_stats;
265
+ capacity?: UInt32;
266
+ is_idle: boolean;
267
+ current_task?: task;
268
+ current_task_elapsed: UInt32;
269
+ current_task_remaining: UInt32;
270
+ pending_tasks: task[];
271
+ idle_at?: TimePoint;
272
+ schedule?: schedule;
273
+ }
274
+ class entity_state extends Struct {
275
+ location: coordinates;
276
+ energy: UInt16;
277
+ }
278
+ class entity_summary extends Struct {
279
+ type: Name;
280
+ id: UInt64;
281
+ owner: Name;
282
+ entity_name: string;
283
+ location: coordinates;
284
+ is_idle: boolean;
285
+ resolved_count: UInt32;
286
+ pending_count: UInt32;
287
+ }
288
+ class entity_task_info extends Struct {
289
+ entity_id: UInt64;
290
+ entity_type: Name;
291
+ task_count: UInt8;
292
+ schedule_started: TimePoint;
293
+ }
294
+ class getentities extends Struct {
295
+ owner: Name;
296
+ entity_type?: Name;
297
+ }
298
+ class getentity extends Struct {
299
+ entity_type: Name;
300
+ entity_id: UInt64;
301
+ }
302
+ class getgoods extends Struct {
303
+ }
304
+ class getlocation extends Struct {
192
305
  x: Int64;
193
306
  y: Int64;
194
307
  }
195
- class enable extends Struct {
196
- enabled: boolean;
308
+ class getnearby extends Struct {
309
+ entity_type: Name;
310
+ entity_id: UInt64;
311
+ recharge: boolean;
197
312
  }
198
- class good_price extends Struct {
313
+ class getplayer extends Struct {
314
+ account: Name;
315
+ }
316
+ class getsummaries extends Struct {
317
+ owner: Name;
318
+ entity_type?: Name;
319
+ }
320
+ class good extends Struct {
199
321
  id: UInt16;
200
- price: UInt64;
201
- supply: UInt64;
322
+ base_price: UInt32;
323
+ mass: UInt32;
324
+ }
325
+ class goods_info extends Struct {
326
+ goods: good[];
202
327
  }
203
328
  class hash extends Struct {
204
329
  value: string;
@@ -209,18 +334,20 @@ declare namespace Types {
209
334
  class init extends Struct {
210
335
  seed: Checksum256;
211
336
  }
212
- class jettison extends Struct {
213
- ship_id: UInt64;
214
- good_id: UInt16;
215
- quantity: UInt64;
216
- }
217
337
  class join extends Struct {
218
338
  account: Name;
219
339
  }
220
- class loader_stats extends Struct {
221
- mass: UInt32;
222
- quantity: UInt16;
223
- thrust: UInt32;
340
+ class location_good extends Struct {
341
+ id: UInt16;
342
+ price: UInt32;
343
+ supply: UInt16;
344
+ rarity_multiplier: UInt32;
345
+ location_multiplier: UInt32;
346
+ }
347
+ class location_info extends Struct {
348
+ coords: coordinates;
349
+ is_system: boolean;
350
+ goods: location_good[];
224
351
  }
225
352
  class location_row extends Struct {
226
353
  id: UInt64;
@@ -229,73 +356,108 @@ declare namespace Types {
229
356
  good_id: UInt16;
230
357
  supply: UInt16;
231
358
  }
232
- class marketprice extends Struct {
233
- location: coordinates;
234
- good_id: UInt16;
359
+ class logcancel extends Struct {
360
+ log: cancel_log;
235
361
  }
236
- class marketprices extends Struct {
237
- location: coordinates;
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;
376
+ }
377
+ class logresolve extends Struct {
378
+ log: resolve_log;
379
+ }
380
+ class nearby_system extends Struct {
381
+ distance: UInt64;
382
+ energy_cost: UInt64;
383
+ flight_time: UInt32;
384
+ location: location_info;
385
+ }
386
+ class nearby_info extends Struct {
387
+ can_travel: boolean;
388
+ current: entity_state;
389
+ projected: entity_state;
390
+ max_energy: UInt16;
391
+ systems: nearby_system[];
238
392
  }
239
393
  class payloan extends Struct {
240
394
  account: Name;
241
395
  amount: UInt64;
242
396
  }
397
+ class player_info extends Struct {
398
+ owner: Name;
399
+ is_player: boolean;
400
+ 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
+ ship_count: UInt64;
408
+ warehouse_count: UInt64;
409
+ }
243
410
  class player_row extends Struct {
244
411
  owner: Name;
245
412
  balance: UInt64;
246
- debt: UInt64;
413
+ debt: UInt32;
247
414
  networth: Int64;
248
415
  }
416
+ class purgesupply extends Struct {
417
+ max_rows?: UInt64;
418
+ }
419
+ class recharge extends Struct {
420
+ entity_type: Name;
421
+ id: UInt64;
422
+ }
423
+ class resolve extends Struct {
424
+ entity_type: Name;
425
+ id: UInt64;
426
+ }
427
+ class resolve_results extends Struct {
428
+ entity_id: UInt64;
429
+ entity_type: Name;
430
+ resolved_count: UInt8;
431
+ new_schedule_started?: TimePoint;
432
+ }
249
433
  class salt extends Struct {
250
434
  salt: UInt64;
251
435
  }
252
436
  class sellgoods extends Struct {
253
437
  ship_id: UInt64;
254
- good_id: UInt64;
255
- quantity: UInt64;
438
+ good_id: UInt16;
439
+ quantity: UInt32;
256
440
  }
257
441
  class sequence_row extends Struct {
258
442
  key: Name;
259
443
  value: UInt64;
260
444
  }
261
- class ship_state extends Struct {
262
- energy: UInt32;
263
- }
264
- class ship_stats extends Struct {
265
- capacity: UInt32;
266
- drain: UInt32;
267
- mass: UInt64;
268
- maxmass: UInt64;
269
- orbit: UInt16;
270
- recharge: UInt32;
271
- thrust: UInt64;
272
- }
273
- class travel_plan extends Struct {
274
- departure: TimePoint;
275
- destination: coordinates;
276
- distance: UInt64;
277
- flighttime: UInt32;
278
- loadtime: UInt32;
279
- rechargetime: UInt32;
280
- masspenalty: UInt32;
281
- mass: UInt64;
282
- energyusage: UInt32;
283
- }
284
445
  class ship_row extends Struct {
285
446
  id: UInt64;
286
447
  owner: Name;
287
448
  name: string;
288
449
  location: coordinates;
289
- skin: UInt8;
290
- tier: UInt8;
291
- state: ship_state;
292
- stats: ship_stats;
450
+ mass: UInt32;
451
+ capacity: UInt32;
452
+ energy: UInt16;
453
+ engines: movement_stats;
454
+ generator: energy_stats;
293
455
  loaders: loader_stats;
294
- travelplan?: travel_plan;
456
+ schedule?: schedule;
295
457
  }
296
458
  class state_row extends Struct {
297
459
  enabled: boolean;
298
- epoch: UInt64;
460
+ epoch: UInt32;
299
461
  salt: UInt64;
300
462
  ships: UInt32;
301
463
  seed: Checksum256;
@@ -305,35 +467,27 @@ declare namespace Types {
305
467
  account: Name;
306
468
  amount: UInt64;
307
469
  }
308
- class travel extends Struct {
309
- id: UInt64;
310
- destination: coordinates;
311
- recharge: boolean;
470
+ class task_results extends Struct {
471
+ entities: entity_task_info[];
312
472
  }
313
- class travel_summary extends Struct {
314
- stats: ship_stats;
315
- loaders: loader_stats;
316
- origin: coordinates;
317
- destination: coordinates;
318
- distance: UInt64;
319
- totalmass: UInt64;
320
- acceleration: Float64;
321
- flighttime: UInt32;
322
- energyusage: UInt32;
323
- rechargetime: UInt32;
324
- masspenalty: UInt32;
325
- loadtime: UInt64;
326
- time: UInt64;
327
- }
328
- class travelplan extends Struct {
473
+ class transfer extends Struct {
474
+ source_type: Name;
475
+ source_id: UInt64;
476
+ dest_type: Name;
477
+ dest_id: UInt64;
478
+ good_id: UInt16;
479
+ quantity: UInt32;
480
+ }
481
+ class travel extends Struct {
482
+ entity_type: Name;
329
483
  id: UInt64;
330
- origin: coordinates;
331
- destination: coordinates;
484
+ x: Int64;
485
+ y: Int64;
332
486
  recharge: boolean;
333
487
  }
334
- class traveltime extends Struct {
488
+ class types_row extends Struct {
335
489
  id: UInt64;
336
- destination: coordinates;
490
+ entity_summary_type: entity_summary;
337
491
  }
338
492
  class updatecredit extends Struct {
339
493
  account: Name;
@@ -343,9 +497,14 @@ declare namespace Types {
343
497
  account: Name;
344
498
  amount: Int64;
345
499
  }
346
- class upgradeship extends Struct {
347
- account: Name;
500
+ class warehouse_row extends Struct {
348
501
  id: UInt64;
502
+ owner: Name;
503
+ name: string;
504
+ location: coordinates;
505
+ capacity: UInt32;
506
+ loaders: loader_stats;
507
+ schedule?: schedule;
349
508
  }
350
509
  class wipe extends Struct {
351
510
  }
@@ -359,6 +518,8 @@ declare const TableMap: {
359
518
  sequence: typeof Types.sequence_row;
360
519
  ship: typeof Types.ship_row;
361
520
  state: typeof Types.state_row;
521
+ types: typeof Types.types_row;
522
+ warehouse: typeof Types.warehouse_row;
362
523
  };
363
524
  interface TableTypes {
364
525
  cargo: Types.cargo_row;
@@ -367,32 +528,79 @@ interface TableTypes {
367
528
  sequence: Types.sequence_row;
368
529
  ship: Types.ship_row;
369
530
  state: Types.state_row;
531
+ types: Types.types_row;
532
+ warehouse: Types.warehouse_row;
370
533
  }
371
534
  type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any;
372
535
  type TableNames = keyof TableTypes;
373
536
  declare namespace ActionParams {
374
537
  namespace Type {
538
+ interface cancel_log {
539
+ owner: NameType;
540
+ entity_type: NameType;
541
+ entity_id: UInt64Type;
542
+ task_index: UInt8Type;
543
+ task: Type.task;
544
+ started_at: TimePointType;
545
+ }
546
+ interface task {
547
+ type: UInt8Type;
548
+ duration: UInt32Type;
549
+ cancelable: UInt8Type;
550
+ location?: Type.coordinates;
551
+ cargo: Type.cargo_item[];
552
+ entity?: UInt64Type;
553
+ credits?: Int64Type;
554
+ }
375
555
  interface coordinates {
376
556
  x: Int64Type;
377
557
  y: Int64Type;
558
+ z?: UInt16Type;
559
+ }
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;
378
579
  }
379
580
  }
380
581
  interface advance {
381
582
  reveal: string;
382
583
  commit: Checksum256Type;
383
584
  }
384
- interface arrive {
385
- id: UInt64Type;
386
- }
387
585
  interface buygoods {
388
586
  ship_id: UInt64Type;
389
- good_id: UInt64Type;
390
- quantity: UInt64Type;
587
+ good_id: UInt16Type;
588
+ quantity: UInt32Type;
391
589
  }
392
590
  interface buyship {
393
591
  account: NameType;
394
592
  name: string;
395
593
  }
594
+ interface buywarehouse {
595
+ account: NameType;
596
+ ship_id: UInt64Type;
597
+ name: string;
598
+ }
599
+ interface cancel {
600
+ entity_type: NameType;
601
+ id: UInt64Type;
602
+ count: UInt64Type;
603
+ }
396
604
  interface cleartable {
397
605
  table_name: NameType;
398
606
  scope?: NameType;
@@ -404,6 +612,32 @@ declare namespace ActionParams {
404
612
  interface enable {
405
613
  enabled: boolean;
406
614
  }
615
+ interface getentities {
616
+ owner: NameType;
617
+ entity_type?: NameType;
618
+ }
619
+ interface getentity {
620
+ entity_type: NameType;
621
+ entity_id: UInt64Type;
622
+ }
623
+ interface getgoods {
624
+ }
625
+ interface getlocation {
626
+ x: Int64Type;
627
+ y: Int64Type;
628
+ }
629
+ interface getnearby {
630
+ entity_type: NameType;
631
+ entity_id: UInt64Type;
632
+ recharge: boolean;
633
+ }
634
+ interface getplayer {
635
+ account: NameType;
636
+ }
637
+ interface getsummaries {
638
+ owner: NameType;
639
+ entity_type?: NameType;
640
+ }
407
641
  interface hash {
408
642
  value: string;
409
643
  }
@@ -413,52 +647,57 @@ declare namespace ActionParams {
413
647
  interface init {
414
648
  seed: Checksum256Type;
415
649
  }
416
- interface jettison {
417
- ship_id: UInt64Type;
418
- good_id: UInt16Type;
419
- quantity: UInt64Type;
420
- }
421
650
  interface join {
422
651
  account: NameType;
423
652
  }
424
- interface marketprice {
425
- location: Type.coordinates;
426
- good_id: UInt16Type;
653
+ interface logcancel {
654
+ log: Type.cancel_log;
427
655
  }
428
- interface marketprices {
429
- location: Type.coordinates;
656
+ interface logresolve {
657
+ log: Type.resolve_log;
430
658
  }
431
659
  interface payloan {
432
660
  account: NameType;
433
661
  amount: UInt64Type;
434
662
  }
663
+ interface purgesupply {
664
+ max_rows?: UInt64Type;
665
+ }
666
+ interface recharge {
667
+ entity_type: NameType;
668
+ id: UInt64Type;
669
+ }
670
+ interface resolve {
671
+ entity_type: NameType;
672
+ id: UInt64Type;
673
+ }
435
674
  interface salt {
436
675
  salt: UInt64Type;
437
676
  }
438
677
  interface sellgoods {
439
678
  ship_id: UInt64Type;
440
- good_id: UInt64Type;
441
- quantity: UInt64Type;
679
+ good_id: UInt16Type;
680
+ quantity: UInt32Type;
442
681
  }
443
682
  interface takeloan {
444
683
  account: NameType;
445
684
  amount: UInt64Type;
446
685
  }
447
- interface travel {
448
- id: UInt64Type;
449
- destination: Type.coordinates;
450
- recharge: boolean;
686
+ interface transfer {
687
+ source_type: NameType;
688
+ source_id: UInt64Type;
689
+ dest_type: NameType;
690
+ dest_id: UInt64Type;
691
+ good_id: UInt16Type;
692
+ quantity: UInt32Type;
451
693
  }
452
- interface travelplan {
694
+ interface travel {
695
+ entity_type: NameType;
453
696
  id: UInt64Type;
454
- origin: Type.coordinates;
455
- destination: Type.coordinates;
697
+ x: Int64Type;
698
+ y: Int64Type;
456
699
  recharge: boolean;
457
700
  }
458
- interface traveltime {
459
- id: UInt64Type;
460
- destination: Type.coordinates;
461
- }
462
701
  interface updatecredit {
463
702
  account: NameType;
464
703
  amount: Int64Type;
@@ -467,10 +706,6 @@ declare namespace ActionParams {
467
706
  account: NameType;
468
707
  amount: Int64Type;
469
708
  }
470
- interface upgradeship {
471
- account: NameType;
472
- id: UInt64Type;
473
- }
474
709
  interface wipe {
475
710
  }
476
711
  interface wipesequence {
@@ -478,40 +713,58 @@ declare namespace ActionParams {
478
713
  }
479
714
  interface ActionNameParams {
480
715
  advance: ActionParams.advance;
481
- arrive: ActionParams.arrive;
482
716
  buygoods: ActionParams.buygoods;
483
717
  buyship: ActionParams.buyship;
718
+ buywarehouse: ActionParams.buywarehouse;
719
+ cancel: ActionParams.cancel;
484
720
  cleartable: ActionParams.cleartable;
485
721
  commit: ActionParams.commit;
486
722
  enable: ActionParams.enable;
723
+ getentities: ActionParams.getentities;
724
+ getentity: ActionParams.getentity;
725
+ getgoods: ActionParams.getgoods;
726
+ getlocation: ActionParams.getlocation;
727
+ getnearby: ActionParams.getnearby;
728
+ getplayer: ActionParams.getplayer;
729
+ getsummaries: ActionParams.getsummaries;
487
730
  hash: ActionParams.hash;
488
731
  hash512: ActionParams.hash512;
489
732
  init: ActionParams.init;
490
- jettison: ActionParams.jettison;
491
733
  join: ActionParams.join;
492
- marketprice: ActionParams.marketprice;
493
- marketprices: ActionParams.marketprices;
734
+ logcancel: ActionParams.logcancel;
735
+ logresolve: ActionParams.logresolve;
494
736
  payloan: ActionParams.payloan;
737
+ purgesupply: ActionParams.purgesupply;
738
+ recharge: ActionParams.recharge;
739
+ resolve: ActionParams.resolve;
495
740
  salt: ActionParams.salt;
496
741
  sellgoods: ActionParams.sellgoods;
497
742
  takeloan: ActionParams.takeloan;
743
+ transfer: ActionParams.transfer;
498
744
  travel: ActionParams.travel;
499
- travelplan: ActionParams.travelplan;
500
- traveltime: ActionParams.traveltime;
501
745
  updatecredit: ActionParams.updatecredit;
502
746
  updatedebt: ActionParams.updatedebt;
503
- upgradeship: ActionParams.upgradeship;
504
747
  wipe: ActionParams.wipe;
505
748
  wipesequence: ActionParams.wipesequence;
506
749
  }
507
750
  type ActionNames = keyof ActionNameParams;
508
751
  interface ActionReturnValues {
752
+ buygoods: Types.task_results;
753
+ cancel: Types.cancel_results;
754
+ getentities: Types.entity_info[];
755
+ getentity: Types.entity_info;
756
+ getgoods: Types.goods_info;
757
+ getlocation: Types.location_info;
758
+ getnearby: Types.nearby_info;
759
+ getplayer: Types.player_info;
760
+ getsummaries: Types.entity_summary[];
509
761
  hash: Checksum256;
510
762
  hash512: Checksum512;
511
- marketprice: Types.good_price;
512
- marketprices: Types.good_price[];
513
- travelplan: Types.travel_plan;
514
- traveltime: Types.travel_summary;
763
+ recharge: Types.task_results;
764
+ resolve: Types.resolve_results;
765
+ sellgoods: Types.task_results;
766
+ transfer: Types.task_results;
767
+ travel: Types.task_results;
515
768
  }
516
769
  type ActionReturnNames = keyof ActionReturnValues;
517
770
  declare class Contract extends Contract$2 {
@@ -553,32 +806,90 @@ declare namespace server {
553
806
  };
554
807
  }
555
808
 
556
- interface EpochInfo {
557
- epoch: UInt64;
558
- start: Date;
559
- end: Date;
560
- }
561
- declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
562
- declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
563
-
564
- declare const ERROR_SYSTEM_NOT_INITIALIZED = "System not initialized";
565
- declare const GOOD_DOES_NOT_EXIST = "Good does not exist";
566
- declare const GOOD_NOT_AVAILABLE_AT_LOCATION = "Good not available at location";
567
- declare const PLAYER_NOT_FOUND = "Player not found";
568
- declare const SHIP_NOT_FOUND = "Ship not found";
569
- declare const SHIP_CANNOT_BUY_TRAVELING = "Ship cannot buy while traveling";
570
- declare const INSUFFICIENT_BALANCE = "Insufficient balance";
571
- declare const INSUFFICIENT_GOOD_QUANTITY = "Insufficient good quantity";
572
- declare const REQUIRES_MORE_THAN_ONE = "Requires more than one";
809
+ declare const COMPANY_NOT_FOUND = "Cannot find company for given account.";
810
+ declare const COMMIT_ALREADY_SET = "Commit has already been set.";
811
+ declare const COMMIT_CANNOT_MATCH = "Next commit cannot match current commit.";
812
+ declare const COMMIT_NOT_SET = "Commit has not been set.";
813
+ declare const EPOCH_NON_ZERO = "Epoch must be greater than zero.";
814
+ declare const EPOCH_NOT_READY = "Current epoch is not ready to advance";
815
+ declare const ERROR_SYSTEM_ALREADY_INITIALIZED = "This game has already been initialized.";
816
+ declare const ERROR_SYSTEM_DISABLED = "This game is currently disabled.";
817
+ declare const ERROR_SYSTEM_NOT_INITIALIZED = "This game has not been initialized.";
818
+ declare const GAME_NOT_FOUND = "Cannot find game for given account name.";
819
+ 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.";
822
+ 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.";
825
+ declare const INVALID_AMOUNT = "Invalid amount.";
826
+ declare const REQUIRES_MORE_THAN_ONE = "A value greater than one is required.";
827
+ declare const REQUIRES_POSITIVE_VALUE = "Value must be greater than zero.";
828
+ declare const PLAYER_ALREADY_JOINED = "Player has already joined the game.";
829
+ declare const PLAYER_NOT_FOUND = "Cannot find player for given account name.";
830
+ declare const SHIP_ALREADY_THERE = "Ship cannot travel to the location its already at.";
831
+ declare const SHIP_ALREADY_TRAVELING = "Ship is already traveling.";
832
+ declare const SHIP_CANNOT_BUY_TRAVELING = "Ship cannot buy goods while traveling.";
833
+ declare const SHIP_CANNOT_UPDATE_TRAVELING = "Ship cannot be updated while traveling.";
834
+ declare const SHIP_INVALID_DESTINATION = "Ship cannot travel, no system at specified destination.";
835
+ declare const SHIP_INVALID_TRAVEL_DURATION = "This trip cannot be made as it would exceed the maximum travel duration.";
836
+ declare const SHIP_NOT_ARRIVED = "Ship has not yet arrived at its destination.";
837
+ declare const SHIP_NOT_ENOUGH_ENERGY = "Ship does not have enough energy to travel to the destination.";
838
+ declare const SHIP_NOT_ENOUGH_ENERGY_CAPACITY = "Ship does not have enough energy capacity to travel.";
839
+ declare const SHIP_NOT_FOUND = "Cannot find ship for given account.";
840
+ declare const SHIP_NOT_OWNED = "Ship is not owned by this account.";
841
+ declare const NO_SCHEDULE = "No scheduled tasks.";
842
+ declare const SHIP_NOT_IDLE = "Ship must be idle (no active schedule) for this action.";
843
+ declare const SHIP_NO_COMPLETED_TASKS = "No completed tasks to resolve.";
844
+ declare const SHIP_CANNOT_CANCEL_TASK = "Cannot cancel task that is immutable or in progress.";
845
+ declare const SHIP_NO_TASKS_TO_CANCEL = "No tasks to cancel.";
846
+ declare const SHIP_INVALID_CARGO = "Invalid cargo specified for load/unload.";
847
+ declare const SHIP_CARGO_NOT_OWNED = "Cannot load cargo that is not owned.";
848
+ declare const SHIP_CARGO_NOT_LOADED = "Cannot unload cargo that is not loaded.";
849
+ declare const WAREHOUSE_NOT_FOUND = "Cannot find warehouse for given id.";
850
+ declare const WAREHOUSE_ALREADY_AT_LOCATION = "Warehouse already exists at this location.";
851
+ declare const WAREHOUSE_CAPACITY_EXCEEDED = "Warehouse capacity would be exceeded.";
573
852
 
574
853
  declare const PRECISION = 10000;
575
- declare const TRAVEL_MAXMASS_PENALTY = 5;
576
- interface CameraPosition extends ActionParams.Type.coordinates {
577
- z: number;
854
+ declare const INITIAL_SHIP_MASS = 500000;
855
+ declare const MIN_ORBITAL_ALTITUDE = 800;
856
+ declare const MAX_ORBITAL_ALTITUDE = 3000;
857
+ 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;
578
865
  }
579
- interface Dimensions {
580
- width: number;
581
- height: number;
866
+ interface CargoMassInfo {
867
+ good_id: UInt16Type;
868
+ quantity: UInt32Type;
869
+ }
870
+ declare enum TaskType {
871
+ RECHARGE = 0,
872
+ LOAD = 1,
873
+ UNLOAD = 2,
874
+ FLIGHT = 3
875
+ }
876
+ declare enum TaskCancelable {
877
+ NEVER = 0,
878
+ BEFORE_START = 1,
879
+ ALWAYS = 2
880
+ }
881
+ declare const EntityType$1: {
882
+ readonly SHIP: Name;
883
+ readonly WAREHOUSE: Name;
884
+ };
885
+ type EntityTypeName = (typeof EntityType$1)[keyof typeof EntityType$1];
886
+ type CoordinatesType = Coordinates | Types.coordinates | {
887
+ x: Int64Type;
888
+ y: Int64Type;
889
+ };
890
+ declare class Coordinates extends Types.coordinates {
891
+ static from(value: CoordinatesType): Coordinates;
892
+ equals(other: CoordinatesType): boolean;
582
893
  }
583
894
  interface Distance {
584
895
  origin: ActionParams.Type.coordinates;
@@ -589,83 +900,1060 @@ declare class Good extends Struct {
589
900
  id: UInt16;
590
901
  name: string;
591
902
  description: string;
592
- base_price: UInt64;
593
- mass: UInt64;
594
- }
595
- interface GoodType {
596
- id: UInt16Type;
597
- name: string;
598
- description: string;
599
- base_price: UInt64Type;
600
- mass: UInt64Type;
903
+ base_price: UInt32;
904
+ mass: UInt32;
601
905
  }
602
906
  declare class GoodPrice extends Struct {
603
907
  id: UInt16;
604
908
  good: Good;
605
- price: UInt64;
606
- supply: UInt64;
909
+ price: UInt32;
910
+ supply: UInt16;
607
911
  }
608
- interface Coordinates extends ActionParams.Type.coordinates {
912
+
913
+ interface EpochInfo {
914
+ epoch: UInt64;
915
+ start: Date;
916
+ end: Date;
609
917
  }
918
+ declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
919
+ declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
610
920
 
611
- declare const goodIds: any[];
612
- declare function getGood(good_id: UInt16Type): Good;
613
- declare function getGoods(): Good[];
921
+ /**
922
+ * GameState class extends the state_row from the server contract
923
+ * with helper methods for epoch management and system generation
924
+ */
925
+ declare class GameState extends Types.state_row {
926
+ private _game?;
927
+ /**
928
+ * Create a GameState instance from a state_row
929
+ */
930
+ static from(state: Types.state_row, game?: Types$1.game_row): GameState;
931
+ /**
932
+ * Set the game configuration (needed for epoch calculations)
933
+ */
934
+ setGame(game: Types$1.game_row): void;
935
+ /**
936
+ * Get the current epoch number from the state
937
+ */
938
+ get currentEpoch(): UInt64;
939
+ /**
940
+ * Get the epoch seed (used for market pricing and system generation)
941
+ */
942
+ get epochSeed(): Checksum256;
943
+ /**
944
+ * Get the game seed (from game config, if available)
945
+ */
946
+ get gameSeed(): Checksum256 | undefined;
947
+ /**
948
+ * Check if the game is currently enabled
949
+ */
950
+ get isEnabled(): boolean;
951
+ /**
952
+ * Get the total number of ships in the game
953
+ */
954
+ get shipCount(): number;
955
+ /**
956
+ * Get the current salt value (used for random number generation)
957
+ */
958
+ get currentSalt(): UInt64;
959
+ /**
960
+ * Get the commit hash for the next epoch
961
+ */
962
+ get nextEpochCommit(): Checksum256;
963
+ /**
964
+ * Calculate the current epoch from game config (if game is set)
965
+ * This might differ from state.epoch if the blockchain hasn't advanced yet
966
+ */
967
+ get calculatedCurrentEpoch(): UInt64 | undefined;
968
+ /**
969
+ * Get epoch info (start/end times) for the current epoch
970
+ */
971
+ get currentEpochInfo(): EpochInfo | undefined;
972
+ /**
973
+ * Get epoch info for a specific epoch number
974
+ */
975
+ getEpochInfo(epoch: UInt64): EpochInfo | undefined;
976
+ /**
977
+ * Check if a system exists at given coordinates
978
+ * Requires game seed from game config
979
+ */
980
+ hasSystemAt(x: number, y: number): boolean;
981
+ /**
982
+ * Check if a system exists at coordinates object
983
+ */
984
+ hasSystemAtCoords(coords: Types.coordinates): boolean;
985
+ /**
986
+ * Get a summary of the game state
987
+ */
988
+ get summary(): {
989
+ enabled: boolean;
990
+ epoch: string;
991
+ ships: number;
992
+ hasSeed: boolean;
993
+ hasCommit: boolean;
994
+ };
995
+ }
614
996
 
615
- declare function hash(seed: Checksum256Type, string: string): Checksum512;
616
- declare function hash512(seed: Checksum256Type, string: string): Checksum512;
997
+ interface PlayerStateInput {
998
+ owner: NameType;
999
+ balance: UInt64Type;
1000
+ debt: UInt32Type;
1001
+ networth: Int64Type;
1002
+ }
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
+ 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
+ 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
+ }
617
1128
 
618
- declare function getSystemName(gameSeed: Checksum256, location: Coordinates): string;
619
- declare function hasSystem(gameSeed: Checksum256, coordinates: ActionParams.Type.coordinates): boolean;
1129
+ declare class PlayersManager extends BaseManager {
1130
+ getPlayer(account: NameType): Promise<Player | undefined>;
1131
+ }
620
1132
 
621
- declare enum Rarities {
622
- legendary = "LEGENDARY",
623
- epic = "EPIC",
624
- rare = "RARE",
625
- uncommon = "UNCOMMON",
626
- common = "COMMON",
627
- trash = "TRASH"
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;
628
1229
  }
629
- interface Rarity {
630
- rarity: Rarities;
631
- minMultiplier: number;
632
- maxMultiplier: number;
1230
+ /**
1231
+ * Helper function to convert various coordinate types to Location
1232
+ */
1233
+ declare function toLocation(coords: CoordinatesType | Location): Location;
1234
+
1235
+ 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
+ hasSystem(location: CoordinatesType): Promise<boolean>;
1240
+ 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>;
633
1245
  }
634
- declare function generateLocationSeed(epochSeed: Checksum256Type, location: Coordinates, entitySalt: string): string;
635
- declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): Rarity;
636
- declare function getRarityMultiplier(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): number;
637
- declare function getLocationMultiplier(gameSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): number;
638
- declare function getSupply(gameSeed: Checksum256Type, state: Types.state_row, location: Coordinates, good_id: UInt16Type): number;
639
- declare function marketprice(location: ActionParams.Type.coordinates, good_id: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice;
640
- declare function marketprices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice[];
641
1246
 
642
- declare class Ship extends Types.ship_row {
1247
+ type Schedule = Types.schedule;
1248
+ type Task = Types.task;
1249
+ interface ScheduleData {
1250
+ schedule?: Schedule;
1251
+ }
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;
1270
+ }
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
+
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;
1307
+ declare const schedule_scheduleProgress: typeof scheduleProgress;
1308
+ declare namespace schedule {
1309
+ export {
1310
+ schedule_ScheduleData as ScheduleData,
1311
+ schedule_Scheduleable as Scheduleable,
1312
+ schedule_hasSchedule as hasSchedule,
1313
+ schedule_isIdle as isIdle,
1314
+ schedule_getTasks as getTasks,
1315
+ schedule_scheduleDuration as scheduleDuration,
1316
+ schedule_scheduleElapsed as scheduleElapsed,
1317
+ schedule_scheduleRemaining as scheduleRemaining,
1318
+ schedule_scheduleComplete as scheduleComplete,
1319
+ schedule_currentTaskIndex as currentTaskIndex,
1320
+ schedule_currentTask as currentTask,
1321
+ schedule_currentTaskType as currentTaskType,
1322
+ schedule_getTaskStartTime as getTaskStartTime,
1323
+ schedule_getTaskElapsed as getTaskElapsed,
1324
+ schedule_getTaskRemaining as getTaskRemaining,
1325
+ schedule_isTaskComplete as isTaskComplete,
1326
+ schedule_isTaskInProgress as isTaskInProgress,
1327
+ schedule_currentTaskProgress as currentTaskProgress,
1328
+ schedule_scheduleProgress as scheduleProgress,
1329
+ };
1330
+ }
1331
+
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
+ interface ProjectedEntity {
1348
+ location: Coordinates;
1349
+ energy: UInt16;
1350
+ cargoMass: UInt64;
1351
+ shipMass: UInt32;
1352
+ capacity?: UInt64;
1353
+ engines?: Types.movement_stats;
1354
+ loaders?: Types.loader_stats;
1355
+ generator?: Types.energy_stats;
1356
+ readonly totalMass: UInt64;
1357
+ }
1358
+ /**
1359
+ * Interface for entities that can be projected.
1360
+ * Ships and Warehouses both implement this.
1361
+ */
1362
+ interface Projectable extends ScheduleData {
1363
+ location: Coordinates;
1364
+ energy: UInt16;
1365
+ mass: UInt32;
1366
+ generator?: Types.energy_stats;
1367
+ engines?: Types.movement_stats;
1368
+ loaders?: Types.loader_stats;
1369
+ capacity?: UInt64;
1370
+ calcCargoMass(): UInt64;
1371
+ }
1372
+ /**
1373
+ * Create initial projected entity state from a projectable entity.
1374
+ */
1375
+ 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
+ declare function projectEntity(entity: Projectable): ProjectedEntity;
1381
+ /**
1382
+ * Project entity state at a specific time (partial task execution).
1383
+ */
1384
+ declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
1385
+
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[];
1403
+ }
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[];
643
1410
  get maxDistance(): UInt32;
644
- get traveling(): boolean;
645
- get arrived(): boolean;
646
- get eta(): number;
1411
+ get hasSchedule(): boolean;
1412
+ 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;
1418
+ currentTaskIndex(now: Date): number;
1419
+ currentTask(now: Date): Types.task | undefined;
1420
+ 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;
1426
+ 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[];
647
1471
  }
648
1472
 
649
- declare function travelplanDuration(travelplan: Types.travel_plan): UInt64;
650
- declare function distanceTraveled(ship: Types.ship_row, current?: Date): number;
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;
651
1486
  declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
652
1487
  declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
653
1488
  declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
654
1489
  declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
655
1490
  declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
656
- declare function travelplan(game: Types$1.game_row, ship: Types.ship_row, cargos: Types.cargo_row[], origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, recharge: boolean, alwaysValid?: boolean): Types.travel_plan;
657
- declare function calc_mass_penalty(ship: Types.ship_row, mass: UInt64Type): UInt32;
658
1491
  declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
659
- declare function calc_ship_rechargetime(ship: Types.ship_row): UInt32;
660
- declare function calc_ship_loadtime(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt32;
1492
+ declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
661
1493
  declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
662
- declare function calc_loader_flighttime(ship: Types.ship_row, mass: UInt64): UInt32;
663
- declare function calc_loader_acceleration(ship: Types.ship_row, mass: UInt64): number;
664
- declare function calc_ship_flighttime(ship: Types.ship_row, mass: UInt64, distance: UInt64): UInt32;
665
- declare function calc_ship_acceleration(ship: Types.ship_row, mass: UInt64): number;
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;
666
1498
  declare function calc_acceleration(thrust: number, mass: number): number;
667
- declare function calc_ship_mass(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt64;
1499
+ declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
668
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>;
1812
+ }
1813
+
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>;
1821
+ }
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[];
1853
+ }
1854
+
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;
1878
+ }
1879
+
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>;
1888
+ }
1889
+
1890
+ interface WarehouseStateInput {
1891
+ id: UInt64Type;
1892
+ owner: NameType;
1893
+ name: string;
1894
+ location: CoordinatesType | {
1895
+ x: number;
1896
+ y: number;
1897
+ z?: number;
1898
+ };
1899
+ capacity: number;
1900
+ loaders: Types.loader_stats;
1901
+ schedule?: Types.schedule;
1902
+ cargo?: Types.cargo_item[];
1903
+ }
1904
+ declare class Warehouse extends Types.entity_info implements Scheduleable {
1905
+ static fromState(state: WarehouseStateInput): Warehouse;
1906
+ private _location?;
1907
+ private _inventory?;
1908
+ get name(): string;
1909
+ get inventory(): EntityInventory[];
1910
+ get hasSchedule(): boolean;
1911
+ 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
+ isLoading(now: Date): boolean;
1928
+ isUnloading(now: Date): boolean;
1929
+ calcCargoMass(): UInt64;
1930
+ get currentLocation(): Coordinates;
1931
+ get totalCargoMass(): UInt64;
1932
+ get cargoValue(): UInt64;
1933
+ get maxCapacity(): UInt64;
1934
+ get availableCapacity(): UInt64;
1935
+ hasSpace(goodMass: UInt64, quantity: number): boolean;
1936
+ get isFull(): boolean;
1937
+ get locationObject(): Location;
1938
+ setLocation(location: Location): void;
1939
+ getCargoForGood(goodId: UInt64Type): EntityInventory | undefined;
1940
+ get orbitalAltitude(): number;
1941
+ }
1942
+
1943
+ type EntityType = 'ship' | 'warehouse';
1944
+ 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)[]>;
1947
+ getSummaries(owner: NameType | Types.player_row, type?: EntityType): Promise<Types.entity_summary[]>;
1948
+ getShip(id: UInt64Type): Promise<Ship>;
1949
+ getWarehouse(id: UInt64Type): Promise<Warehouse>;
1950
+ getShips(owner: NameType | Types.player_row): Promise<Ship[]>;
1951
+ getWarehouses(owner: NameType | Types.player_row): Promise<Warehouse[]>;
1952
+ getShipSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
1953
+ getWarehouseSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
1954
+ private wrapEntity;
1955
+ private resolveOwner;
1956
+ }
669
1957
 
670
1958
  interface ShiploadOptions {
671
1959
  platformContractName?: string;
@@ -677,26 +1965,163 @@ interface ShiploadConstructorOptions extends ShiploadOptions {
677
1965
  serverContract?: Contract$2;
678
1966
  }
679
1967
  declare class Shipload {
680
- client: APIClient;
681
- server: Contract$2;
682
- platform: Contract$2;
683
- game: Types$1.game_row | undefined;
1968
+ private readonly _context;
684
1969
  constructor(chain: ChainDefinition, constructorOptions?: ShiploadConstructorOptions);
685
1970
  static load(chain: ChainDefinition, shiploadOptions?: ShiploadOptions): Promise<Shipload>;
1971
+ get client(): APIClient;
1972
+ get server(): Contract$2;
1973
+ get platform(): Contract$2;
1974
+ get entities(): EntitiesManager;
1975
+ get players(): PlayersManager;
1976
+ get locations(): LocationsManager;
1977
+ get trades(): TradesManager;
1978
+ get epochs(): EpochsManager;
1979
+ get actions(): ActionsManager;
686
1980
  getGame(reload?: boolean): Promise<Types$1.game_row>;
687
- getState(): Promise<Types.state_row>;
688
- getShip(ship_id: UInt64Type): Promise<Ship>;
689
- getShips(player: NameType | Types.player_row): Promise<Ship[]>;
690
- marketprice(location: ActionParams.Type.coordinates, good_id: number): Promise<GoodPrice>;
691
- marketprices(location: ActionParams.Type.coordinates): Promise<GoodPrice[]>;
692
- hasSystem(location: ActionParams.Type.coordinates): Promise<boolean>;
693
- findNearbyPlanets(origin: ActionParams.Type.coordinates, maxDistance?: UInt16Type): Promise<Distance[]>;
694
- travelplan(ship: Types.ship_row, origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, recharge?: boolean): Promise<Types.travel_plan>;
695
- getCargo(ship: UInt64Type | Types.ship_row): Promise<Types.cargo_row[]>;
696
- getCurrentEpochHeight(): Promise<UInt64>;
697
- getCurrentEpoch(): Promise<EpochInfo>;
698
- getEpoch(height: UInt64Type): Promise<EpochInfo>;
699
- getLocation(location: Coordinates): Promise<any[]>;
700
- }
701
-
702
- export { CameraPosition, Coordinates, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, EpochInfo, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, GoodType, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, Rarities, Rarity, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Ship, TRAVEL_MAXMASS_PENALTY, calc_acceleration, calc_energyusage, calc_flighttime, calc_loader_acceleration, calc_loader_flighttime, calc_mass_penalty, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_loadtime, calc_ship_mass, calc_ship_rechargetime, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, generateLocationSeed, getCurrentEpoch, getEpochInfo, getGood, getGoods, getLocationMultiplier, getRarity, getRarityMultiplier, getSupply, getSystemName, goodIds, hasSystem, hash, hash512, lerp, marketprice, marketprices, rotation, travelplan, travelplanDuration };
1981
+ getState(reload?: boolean): Promise<GameState>;
1982
+ }
1983
+
1984
+ declare const goodIds: number[];
1985
+ declare function getGood(goodId: UInt16Type): Good;
1986
+ declare function getGoods(): Good[];
1987
+
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[];
2004
+
2005
+ declare function getSystemName(gameSeed: Checksum256Type, location: CoordinatesType): string;
2006
+ declare function hasSystem(gameSeed: Checksum256Type, coordinates: CoordinatesType): boolean;
2007
+
2008
+ declare function hash(seed: Checksum256Type, string: string): Checksum512;
2009
+ declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2010
+
2011
+ /**
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)
2024
+ *
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
2030
+ *
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
2049
+ */
2050
+ interface TradeProfitResult {
2051
+ revenue: UInt64;
2052
+ cost: UInt64;
2053
+ profit: Int64;
2054
+ margin: number;
2055
+ }
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;
2090
+
2091
+ interface CargoData {
2092
+ cargo: EntityInventory[];
2093
+ }
2094
+ declare function totalCargoMass(cargo: EntityInventory[]): UInt64;
2095
+ declare function cargoValue(cargo: EntityInventory[]): UInt64;
2096
+ declare function getCargoForGood(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
2097
+ declare function hasSpace(currentMass: UInt64, maxCapacity: UInt64, goodMass: UInt64, quantity: number): boolean;
2098
+ declare function availableCapacity(currentMass: UInt64, maxCapacity: UInt64): UInt64;
2099
+ declare function isFull(currentMass: UInt64, maxCapacity: UInt64): boolean;
2100
+
2101
+ type cargoUtils_CargoData = CargoData;
2102
+ declare const cargoUtils_totalCargoMass: typeof totalCargoMass;
2103
+ declare const cargoUtils_cargoValue: typeof cargoValue;
2104
+ declare const cargoUtils_getCargoForGood: typeof getCargoForGood;
2105
+ declare const cargoUtils_hasSpace: typeof hasSpace;
2106
+ declare const cargoUtils_availableCapacity: typeof availableCapacity;
2107
+ declare const cargoUtils_isFull: typeof isFull;
2108
+ declare namespace cargoUtils {
2109
+ export {
2110
+ cargoUtils_CargoData as CargoData,
2111
+ cargoUtils_totalCargoMass as totalCargoMass,
2112
+ cargoUtils_cargoValue as cargoValue,
2113
+ cargoUtils_getCargoForGood as getCargoForGood,
2114
+ cargoUtils_hasSpace as hasSpace,
2115
+ cargoUtils_availableCapacity as availableCapacity,
2116
+ cargoUtils_isFull as isFull,
2117
+ };
2118
+ }
2119
+
2120
+ type movement_stats = Types.movement_stats;
2121
+ type energy_stats = Types.energy_stats;
2122
+ type loader_stats = Types.loader_stats;
2123
+ type task = Types.task;
2124
+ type cargo_item = Types.cargo_item;
2125
+ type warehouse_row = Types.warehouse_row;
2126
+
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 };