@shipload/sdk 0.7.1 → 2.0.0-rc2
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.
- package/README.md +349 -1
- package/lib/shipload.d.ts +2016 -230
- package/lib/shipload.js +5733 -2094
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +5425 -2012
- package/lib/shipload.m.js.map +1 -1
- package/package.json +5 -5
- package/src/capabilities/extraction.ts +37 -0
- package/src/capabilities/guards.ts +43 -0
- package/src/capabilities/index.ts +5 -0
- package/src/capabilities/loading.ts +8 -0
- package/src/capabilities/movement.ts +29 -0
- package/src/capabilities/storage.ts +67 -0
- package/src/contracts/server.ts +788 -202
- package/src/data/goods.json +23 -0
- package/src/data/syllables.json +1184 -0
- package/src/entities/cargo-utils.ts +142 -0
- package/src/entities/container.ts +70 -0
- package/src/entities/entity-inventory.ts +39 -0
- package/src/entities/gamestate.ts +152 -0
- package/src/entities/inventory-accessor.ts +46 -0
- package/src/entities/location.ts +255 -0
- package/src/entities/makers.ts +69 -0
- package/src/entities/player.ts +288 -0
- package/src/entities/ship.ts +208 -0
- package/src/entities/warehouse.ts +89 -0
- package/src/errors.ts +46 -9
- package/src/index-module.ts +152 -7
- package/src/managers/actions.ts +200 -0
- package/src/managers/base.ts +25 -0
- package/src/managers/context.ts +104 -0
- package/src/managers/entities.ts +103 -0
- package/src/managers/epochs.ts +47 -0
- package/src/managers/index.ts +9 -0
- package/src/managers/locations.ts +122 -0
- package/src/managers/players.ts +13 -0
- package/src/managers/trades.ts +119 -0
- package/src/market/goods.ts +31 -0
- package/src/{market.ts → market/market.ts} +31 -37
- package/src/{rolls.ts → market/rolls.ts} +3 -3
- package/src/scheduling/accessor.ts +82 -0
- package/src/{epoch.ts → scheduling/epoch.ts} +1 -1
- package/src/scheduling/projection.ts +290 -0
- package/src/scheduling/schedule.ts +179 -0
- package/src/shipload.ts +39 -157
- package/src/trading/collect.ts +938 -0
- package/src/trading/deal.ts +207 -0
- package/src/trading/trade.ts +203 -0
- package/src/travel/travel.ts +486 -0
- package/src/types/capabilities.ts +79 -0
- package/src/types/entity-traits.ts +70 -0
- package/src/types/entity.ts +36 -0
- package/src/types/index.ts +3 -0
- package/src/types.ts +127 -25
- package/src/{hash.ts → utils/hash.ts} +1 -1
- package/src/utils/system.ts +155 -0
- package/src/goods.ts +0 -124
- package/src/ship.ts +0 -36
- package/src/state.ts +0 -0
- package/src/syllables.ts +0 -1184
- package/src/system.ts +0 -37
- package/src/travel.ts +0 -259
package/lib/shipload.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
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, UInt8Type, TimePointType, UInt16Type, Int64Type, 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,62 @@ declare namespace Types {
|
|
|
160
162
|
reveal: string;
|
|
161
163
|
commit: Checksum256;
|
|
162
164
|
}
|
|
163
|
-
class
|
|
164
|
-
|
|
165
|
+
class buycontainer extends Struct {
|
|
166
|
+
account: Name;
|
|
167
|
+
ship_id: UInt64;
|
|
168
|
+
name: string;
|
|
165
169
|
}
|
|
166
170
|
class buygoods extends Struct {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
entity_type: Name;
|
|
172
|
+
id: UInt64;
|
|
173
|
+
good_id: UInt16;
|
|
174
|
+
quantity: UInt32;
|
|
170
175
|
}
|
|
171
176
|
class buyship extends Struct {
|
|
172
177
|
account: Name;
|
|
173
178
|
name: string;
|
|
174
179
|
}
|
|
180
|
+
class buywarehouse extends Struct {
|
|
181
|
+
account: Name;
|
|
182
|
+
ship_id: UInt64;
|
|
183
|
+
name: string;
|
|
184
|
+
}
|
|
185
|
+
class cancel extends Struct {
|
|
186
|
+
entity_type: Name;
|
|
187
|
+
id: UInt64;
|
|
188
|
+
count: UInt64;
|
|
189
|
+
}
|
|
190
|
+
class entity_ref extends Struct {
|
|
191
|
+
entity_type: Name;
|
|
192
|
+
entity_id: UInt64;
|
|
193
|
+
}
|
|
194
|
+
class cancel_results extends Struct {
|
|
195
|
+
entity_id: UInt64;
|
|
196
|
+
entity_type: Name;
|
|
197
|
+
cancelled_count: UInt8;
|
|
198
|
+
schedule_started?: TimePoint;
|
|
199
|
+
entitygroup?: UInt64;
|
|
200
|
+
group_members?: entity_ref[];
|
|
201
|
+
}
|
|
202
|
+
class mixture_component extends Struct {
|
|
203
|
+
good_id: UInt16;
|
|
204
|
+
purity: UInt16;
|
|
205
|
+
}
|
|
206
|
+
class mixture_info extends Struct {
|
|
207
|
+
components: mixture_component[];
|
|
208
|
+
}
|
|
209
|
+
class cargo_item extends Struct {
|
|
210
|
+
good_id: UInt16;
|
|
211
|
+
quantity: UInt32;
|
|
212
|
+
unit_cost: UInt64;
|
|
213
|
+
mixture?: mixture_info;
|
|
214
|
+
}
|
|
175
215
|
class cargo_row extends Struct {
|
|
176
216
|
id: UInt64;
|
|
177
|
-
|
|
217
|
+
entity_id: UInt64;
|
|
178
218
|
good_id: UInt64;
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
loaded: UInt32;
|
|
219
|
+
quantity: UInt64;
|
|
220
|
+
unit_cost: UInt64;
|
|
182
221
|
}
|
|
183
222
|
class cleartable extends Struct {
|
|
184
223
|
table_name: Name;
|
|
@@ -191,14 +230,149 @@ declare namespace Types {
|
|
|
191
230
|
class coordinates extends Struct {
|
|
192
231
|
x: Int64;
|
|
193
232
|
y: Int64;
|
|
233
|
+
z?: UInt16;
|
|
234
|
+
}
|
|
235
|
+
class task extends Struct {
|
|
236
|
+
type: UInt8;
|
|
237
|
+
duration: UInt32;
|
|
238
|
+
cancelable: UInt8;
|
|
239
|
+
coordinates?: coordinates;
|
|
240
|
+
cargo: cargo_item[];
|
|
241
|
+
entitytarget?: entity_ref;
|
|
242
|
+
entitygroup?: UInt64;
|
|
243
|
+
credits?: Int64;
|
|
244
|
+
energy_cost?: UInt16;
|
|
245
|
+
}
|
|
246
|
+
class schedule extends Struct {
|
|
247
|
+
started: TimePoint;
|
|
248
|
+
tasks: task[];
|
|
249
|
+
}
|
|
250
|
+
class container_row extends Struct {
|
|
251
|
+
id: UInt64;
|
|
252
|
+
owner: Name;
|
|
253
|
+
name: string;
|
|
254
|
+
coordinates: coordinates;
|
|
255
|
+
hullmass: UInt32;
|
|
256
|
+
capacity: UInt32;
|
|
257
|
+
cargomass: UInt32;
|
|
258
|
+
schedule?: schedule;
|
|
194
259
|
}
|
|
195
260
|
class enable extends Struct {
|
|
196
261
|
enabled: boolean;
|
|
197
262
|
}
|
|
198
|
-
class
|
|
263
|
+
class energy_stats extends Struct {
|
|
264
|
+
capacity: UInt16;
|
|
265
|
+
recharge: UInt16;
|
|
266
|
+
}
|
|
267
|
+
class entity_current_state extends Struct {
|
|
268
|
+
coordinates: coordinates;
|
|
269
|
+
energy: UInt16;
|
|
270
|
+
}
|
|
271
|
+
class loader_stats extends Struct {
|
|
272
|
+
mass: UInt32;
|
|
273
|
+
thrust: UInt16;
|
|
274
|
+
quantity: UInt8;
|
|
275
|
+
}
|
|
276
|
+
class movement_stats extends Struct {
|
|
277
|
+
thrust: UInt32;
|
|
278
|
+
drain: UInt16;
|
|
279
|
+
}
|
|
280
|
+
class extractor_stats extends Struct {
|
|
281
|
+
rate: UInt16;
|
|
282
|
+
drain: UInt16;
|
|
283
|
+
efficiency: UInt16;
|
|
284
|
+
}
|
|
285
|
+
class entity_info extends Struct {
|
|
286
|
+
type: Name;
|
|
287
|
+
id: UInt64;
|
|
288
|
+
owner: Name;
|
|
289
|
+
entity_name: string;
|
|
290
|
+
coordinates: coordinates;
|
|
291
|
+
cargomass: UInt32;
|
|
292
|
+
cargo: cargo_item[];
|
|
293
|
+
loaders?: loader_stats;
|
|
294
|
+
energy?: UInt16;
|
|
295
|
+
hullmass?: UInt32;
|
|
296
|
+
engines?: movement_stats;
|
|
297
|
+
generator?: energy_stats;
|
|
298
|
+
capacity?: UInt32;
|
|
299
|
+
extractor?: extractor_stats;
|
|
300
|
+
is_idle: boolean;
|
|
301
|
+
current_task?: task;
|
|
302
|
+
current_task_elapsed: UInt32;
|
|
303
|
+
current_task_remaining: UInt32;
|
|
304
|
+
pending_tasks: task[];
|
|
305
|
+
idle_at?: TimePoint;
|
|
306
|
+
schedule?: schedule;
|
|
307
|
+
}
|
|
308
|
+
class entity_summary extends Struct {
|
|
309
|
+
type: Name;
|
|
310
|
+
id: UInt64;
|
|
311
|
+
owner: Name;
|
|
312
|
+
entity_name: string;
|
|
313
|
+
coordinates: coordinates;
|
|
314
|
+
is_idle: boolean;
|
|
315
|
+
resolved_count: UInt32;
|
|
316
|
+
pending_count: UInt32;
|
|
317
|
+
}
|
|
318
|
+
class entity_task_info extends Struct {
|
|
319
|
+
entity_id: UInt64;
|
|
320
|
+
entity_type: Name;
|
|
321
|
+
task_count: UInt8;
|
|
322
|
+
schedule_started: TimePoint;
|
|
323
|
+
}
|
|
324
|
+
class entitygroup_row extends Struct {
|
|
325
|
+
id: UInt64;
|
|
326
|
+
participants: entity_ref[];
|
|
327
|
+
}
|
|
328
|
+
class extract extends Struct {
|
|
329
|
+
ship_id: UInt64;
|
|
330
|
+
}
|
|
331
|
+
class getentities extends Struct {
|
|
332
|
+
owner: Name;
|
|
333
|
+
entity_type?: Name;
|
|
334
|
+
}
|
|
335
|
+
class getentity extends Struct {
|
|
336
|
+
entity_type: Name;
|
|
337
|
+
entity_id: UInt64;
|
|
338
|
+
}
|
|
339
|
+
class getgoods extends Struct {
|
|
340
|
+
}
|
|
341
|
+
class getlocation extends Struct {
|
|
342
|
+
x: Int64;
|
|
343
|
+
y: Int64;
|
|
344
|
+
}
|
|
345
|
+
class getlocdata extends Struct {
|
|
346
|
+
x: Int64;
|
|
347
|
+
y: Int64;
|
|
348
|
+
}
|
|
349
|
+
class getnearby extends Struct {
|
|
350
|
+
entity_type: Name;
|
|
351
|
+
entity_id: UInt64;
|
|
352
|
+
recharge: boolean;
|
|
353
|
+
}
|
|
354
|
+
class getplayer extends Struct {
|
|
355
|
+
account: Name;
|
|
356
|
+
}
|
|
357
|
+
class getstarter extends Struct {
|
|
358
|
+
}
|
|
359
|
+
class getsummaries extends Struct {
|
|
360
|
+
owner: Name;
|
|
361
|
+
entity_type?: Name;
|
|
362
|
+
}
|
|
363
|
+
class good extends Struct {
|
|
199
364
|
id: UInt16;
|
|
200
|
-
|
|
201
|
-
|
|
365
|
+
base_price: UInt32;
|
|
366
|
+
mass: UInt32;
|
|
367
|
+
}
|
|
368
|
+
class goods_info extends Struct {
|
|
369
|
+
goods: good[];
|
|
370
|
+
}
|
|
371
|
+
class grouptravel extends Struct {
|
|
372
|
+
entities: entity_ref[];
|
|
373
|
+
x: Int64;
|
|
374
|
+
y: Int64;
|
|
375
|
+
recharge: boolean;
|
|
202
376
|
}
|
|
203
377
|
class hash extends Struct {
|
|
204
378
|
value: string;
|
|
@@ -209,131 +383,200 @@ declare namespace Types {
|
|
|
209
383
|
class init extends Struct {
|
|
210
384
|
seed: Checksum256;
|
|
211
385
|
}
|
|
212
|
-
class jettison extends Struct {
|
|
213
|
-
ship_id: UInt64;
|
|
214
|
-
good_id: UInt16;
|
|
215
|
-
quantity: UInt64;
|
|
216
|
-
}
|
|
217
386
|
class join extends Struct {
|
|
218
387
|
account: Name;
|
|
219
388
|
}
|
|
220
|
-
class
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
389
|
+
class location_static extends Struct {
|
|
390
|
+
coords: coordinates;
|
|
391
|
+
type: UInt8;
|
|
392
|
+
subtype: UInt8;
|
|
393
|
+
seed0: UInt8;
|
|
394
|
+
seed1: UInt8;
|
|
395
|
+
}
|
|
396
|
+
class location_epoch extends Struct {
|
|
397
|
+
active: boolean;
|
|
398
|
+
seed0: UInt8;
|
|
399
|
+
seed1: UInt8;
|
|
400
|
+
}
|
|
401
|
+
class location_derived extends Struct {
|
|
402
|
+
static_props: location_static;
|
|
403
|
+
epoch_props: location_epoch;
|
|
404
|
+
}
|
|
405
|
+
class location_good extends Struct {
|
|
406
|
+
id: UInt16;
|
|
407
|
+
price: UInt32;
|
|
408
|
+
supply: UInt16;
|
|
409
|
+
rarity_multiplier: UInt32;
|
|
410
|
+
location_multiplier: UInt32;
|
|
411
|
+
}
|
|
412
|
+
class location_info extends Struct {
|
|
413
|
+
coords: coordinates;
|
|
414
|
+
is_system: boolean;
|
|
415
|
+
goods: location_good[];
|
|
224
416
|
}
|
|
225
417
|
class location_row extends Struct {
|
|
226
418
|
id: UInt64;
|
|
419
|
+
owner: Name;
|
|
227
420
|
coordinates: coordinates;
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
421
|
+
cargomass: UInt32;
|
|
422
|
+
cargo: cargo_item[];
|
|
423
|
+
schedule?: schedule;
|
|
231
424
|
}
|
|
232
|
-
class
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
425
|
+
class nearby_system extends Struct {
|
|
426
|
+
distance: UInt64;
|
|
427
|
+
energy_cost: UInt64;
|
|
428
|
+
flight_time: UInt32;
|
|
429
|
+
location: location_info;
|
|
430
|
+
}
|
|
431
|
+
class nearby_info extends Struct {
|
|
432
|
+
can_travel: boolean;
|
|
433
|
+
current: entity_current_state;
|
|
434
|
+
projected: entity_current_state;
|
|
435
|
+
max_energy: UInt16;
|
|
436
|
+
systems: nearby_system[];
|
|
437
|
+
}
|
|
438
|
+
class task_event extends Struct {
|
|
439
|
+
event_type: UInt8;
|
|
440
|
+
owner: Name;
|
|
441
|
+
entity_type: Name;
|
|
442
|
+
entity_id: UInt64;
|
|
443
|
+
task_index: UInt8;
|
|
444
|
+
task: task;
|
|
445
|
+
starts_at: TimePoint;
|
|
446
|
+
completes_at: TimePoint;
|
|
447
|
+
new_energy?: UInt16;
|
|
448
|
+
new_coordinates?: coordinates;
|
|
449
|
+
cargomass_delta: Int64;
|
|
450
|
+
cargo_added: cargo_item[];
|
|
451
|
+
cargo_removed: cargo_item[];
|
|
452
|
+
credits?: Int64;
|
|
453
|
+
}
|
|
454
|
+
class notify extends Struct {
|
|
455
|
+
event: task_event;
|
|
238
456
|
}
|
|
239
457
|
class payloan extends Struct {
|
|
240
458
|
account: Name;
|
|
241
459
|
amount: UInt64;
|
|
242
460
|
}
|
|
461
|
+
class player_info extends Struct {
|
|
462
|
+
owner: Name;
|
|
463
|
+
is_player: boolean;
|
|
464
|
+
company_name: string;
|
|
465
|
+
balance: UInt64;
|
|
466
|
+
debt: UInt32;
|
|
467
|
+
networth: Int64;
|
|
468
|
+
available_loan: UInt64;
|
|
469
|
+
next_ship_price: UInt64;
|
|
470
|
+
next_warehouse_price: UInt64;
|
|
471
|
+
next_container_price: UInt64;
|
|
472
|
+
ship_count: UInt64;
|
|
473
|
+
warehouse_count: UInt64;
|
|
474
|
+
container_count: UInt64;
|
|
475
|
+
}
|
|
243
476
|
class player_row extends Struct {
|
|
244
477
|
owner: Name;
|
|
245
478
|
balance: UInt64;
|
|
246
|
-
debt:
|
|
479
|
+
debt: UInt32;
|
|
247
480
|
networth: Int64;
|
|
248
481
|
}
|
|
482
|
+
class purgesupply extends Struct {
|
|
483
|
+
max_rows?: UInt64;
|
|
484
|
+
}
|
|
485
|
+
class recharge extends Struct {
|
|
486
|
+
entity_type: Name;
|
|
487
|
+
id: UInt64;
|
|
488
|
+
}
|
|
489
|
+
class resolve extends Struct {
|
|
490
|
+
entity_type: Name;
|
|
491
|
+
id: UInt64;
|
|
492
|
+
count?: UInt64;
|
|
493
|
+
}
|
|
494
|
+
class resolve_results extends Struct {
|
|
495
|
+
entity_id: UInt64;
|
|
496
|
+
entity_type: Name;
|
|
497
|
+
resolved_count: UInt8;
|
|
498
|
+
new_schedule_started?: TimePoint;
|
|
499
|
+
entitygroup?: UInt64;
|
|
500
|
+
group_members?: entity_ref[];
|
|
501
|
+
}
|
|
249
502
|
class salt extends Struct {
|
|
250
503
|
salt: UInt64;
|
|
251
504
|
}
|
|
252
505
|
class sellgoods extends Struct {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
506
|
+
entity_type: Name;
|
|
507
|
+
id: UInt64;
|
|
508
|
+
good_id: UInt16;
|
|
509
|
+
quantity: UInt32;
|
|
256
510
|
}
|
|
257
511
|
class sequence_row extends Struct {
|
|
258
512
|
key: Name;
|
|
259
513
|
value: UInt64;
|
|
260
514
|
}
|
|
261
|
-
class
|
|
262
|
-
|
|
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;
|
|
515
|
+
class trade_stats extends Struct {
|
|
516
|
+
margin: UInt16;
|
|
283
517
|
}
|
|
284
518
|
class ship_row extends Struct {
|
|
285
519
|
id: UInt64;
|
|
286
520
|
owner: Name;
|
|
287
521
|
name: string;
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
522
|
+
coordinates: coordinates;
|
|
523
|
+
hullmass: UInt32;
|
|
524
|
+
capacity: UInt32;
|
|
525
|
+
energy: UInt16;
|
|
526
|
+
cargomass: UInt32;
|
|
527
|
+
engines: movement_stats;
|
|
528
|
+
generator: energy_stats;
|
|
293
529
|
loaders: loader_stats;
|
|
294
|
-
|
|
530
|
+
trade?: trade_stats;
|
|
531
|
+
extractor?: extractor_stats;
|
|
532
|
+
schedule?: schedule;
|
|
533
|
+
}
|
|
534
|
+
class starter_info extends Struct {
|
|
535
|
+
balance: UInt64;
|
|
536
|
+
debt: UInt64;
|
|
537
|
+
ship: entity_info;
|
|
295
538
|
}
|
|
296
539
|
class state_row extends Struct {
|
|
297
540
|
enabled: boolean;
|
|
298
|
-
epoch:
|
|
541
|
+
epoch: UInt32;
|
|
299
542
|
salt: UInt64;
|
|
300
543
|
ships: UInt32;
|
|
301
544
|
seed: Checksum256;
|
|
302
545
|
commit: Checksum256;
|
|
303
546
|
}
|
|
547
|
+
class supply_row extends Struct {
|
|
548
|
+
id: UInt64;
|
|
549
|
+
coordinates: coordinates;
|
|
550
|
+
epoch: UInt64;
|
|
551
|
+
good_id: UInt16;
|
|
552
|
+
supply: UInt16;
|
|
553
|
+
}
|
|
304
554
|
class takeloan extends Struct {
|
|
305
555
|
account: Name;
|
|
306
556
|
amount: UInt64;
|
|
307
557
|
}
|
|
308
|
-
class
|
|
309
|
-
|
|
310
|
-
destination: coordinates;
|
|
311
|
-
recharge: boolean;
|
|
558
|
+
class task_results extends Struct {
|
|
559
|
+
entities: entity_task_info[];
|
|
312
560
|
}
|
|
313
|
-
class
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
rechargetime: UInt32;
|
|
324
|
-
masspenalty: UInt32;
|
|
325
|
-
loadtime: UInt64;
|
|
326
|
-
time: UInt64;
|
|
327
|
-
}
|
|
328
|
-
class travelplan extends Struct {
|
|
561
|
+
class transfer extends Struct {
|
|
562
|
+
source_type: Name;
|
|
563
|
+
source_id: UInt64;
|
|
564
|
+
dest_type: Name;
|
|
565
|
+
dest_id: UInt64;
|
|
566
|
+
good_id: UInt16;
|
|
567
|
+
quantity: UInt32;
|
|
568
|
+
}
|
|
569
|
+
class travel extends Struct {
|
|
570
|
+
entity_type: Name;
|
|
329
571
|
id: UInt64;
|
|
330
|
-
|
|
331
|
-
|
|
572
|
+
x: Int64;
|
|
573
|
+
y: Int64;
|
|
332
574
|
recharge: boolean;
|
|
333
575
|
}
|
|
334
|
-
class
|
|
576
|
+
class types_row extends Struct {
|
|
335
577
|
id: UInt64;
|
|
336
|
-
|
|
578
|
+
entity_summary_type: entity_summary;
|
|
579
|
+
starter_info_type: starter_info;
|
|
337
580
|
}
|
|
338
581
|
class updatecredit extends Struct {
|
|
339
582
|
account: Name;
|
|
@@ -343,9 +586,15 @@ declare namespace Types {
|
|
|
343
586
|
account: Name;
|
|
344
587
|
amount: Int64;
|
|
345
588
|
}
|
|
346
|
-
class
|
|
347
|
-
account: Name;
|
|
589
|
+
class warehouse_row extends Struct {
|
|
348
590
|
id: UInt64;
|
|
591
|
+
owner: Name;
|
|
592
|
+
name: string;
|
|
593
|
+
coordinates: coordinates;
|
|
594
|
+
capacity: UInt32;
|
|
595
|
+
cargomass: UInt32;
|
|
596
|
+
loaders: loader_stats;
|
|
597
|
+
schedule?: schedule;
|
|
349
598
|
}
|
|
350
599
|
class wipe extends Struct {
|
|
351
600
|
}
|
|
@@ -354,45 +603,113 @@ declare namespace Types {
|
|
|
354
603
|
}
|
|
355
604
|
declare const TableMap: {
|
|
356
605
|
cargo: typeof Types.cargo_row;
|
|
606
|
+
container: typeof Types.container_row;
|
|
607
|
+
entitygroup: typeof Types.entitygroup_row;
|
|
357
608
|
location: typeof Types.location_row;
|
|
358
609
|
player: typeof Types.player_row;
|
|
359
610
|
sequence: typeof Types.sequence_row;
|
|
360
611
|
ship: typeof Types.ship_row;
|
|
361
612
|
state: typeof Types.state_row;
|
|
613
|
+
supply: typeof Types.supply_row;
|
|
614
|
+
types: typeof Types.types_row;
|
|
615
|
+
warehouse: typeof Types.warehouse_row;
|
|
362
616
|
};
|
|
363
617
|
interface TableTypes {
|
|
364
618
|
cargo: Types.cargo_row;
|
|
619
|
+
container: Types.container_row;
|
|
620
|
+
entitygroup: Types.entitygroup_row;
|
|
365
621
|
location: Types.location_row;
|
|
366
622
|
player: Types.player_row;
|
|
367
623
|
sequence: Types.sequence_row;
|
|
368
624
|
ship: Types.ship_row;
|
|
369
625
|
state: Types.state_row;
|
|
626
|
+
supply: Types.supply_row;
|
|
627
|
+
types: Types.types_row;
|
|
628
|
+
warehouse: Types.warehouse_row;
|
|
370
629
|
}
|
|
371
630
|
type RowType<T> = T extends keyof TableTypes ? TableTypes[T] : any;
|
|
372
631
|
type TableNames = keyof TableTypes;
|
|
373
632
|
declare namespace ActionParams {
|
|
374
633
|
namespace Type {
|
|
634
|
+
interface entity_ref {
|
|
635
|
+
entity_type: NameType;
|
|
636
|
+
entity_id: UInt64Type;
|
|
637
|
+
}
|
|
638
|
+
interface task_event {
|
|
639
|
+
event_type: UInt8Type;
|
|
640
|
+
owner: NameType;
|
|
641
|
+
entity_type: NameType;
|
|
642
|
+
entity_id: UInt64Type;
|
|
643
|
+
task_index: UInt8Type;
|
|
644
|
+
task: Type.task;
|
|
645
|
+
starts_at: TimePointType;
|
|
646
|
+
completes_at: TimePointType;
|
|
647
|
+
new_energy?: UInt16Type;
|
|
648
|
+
new_coordinates?: Type.coordinates;
|
|
649
|
+
cargomass_delta: Int64Type;
|
|
650
|
+
cargo_added: Type.cargo_item[];
|
|
651
|
+
cargo_removed: Type.cargo_item[];
|
|
652
|
+
credits?: Int64Type;
|
|
653
|
+
}
|
|
654
|
+
interface task {
|
|
655
|
+
type: UInt8Type;
|
|
656
|
+
duration: UInt32Type;
|
|
657
|
+
cancelable: UInt8Type;
|
|
658
|
+
coordinates?: Type.coordinates;
|
|
659
|
+
cargo: Type.cargo_item[];
|
|
660
|
+
entitytarget?: Type.entity_ref;
|
|
661
|
+
entitygroup?: UInt64Type;
|
|
662
|
+
credits?: Int64Type;
|
|
663
|
+
energy_cost?: UInt16Type;
|
|
664
|
+
}
|
|
375
665
|
interface coordinates {
|
|
376
666
|
x: Int64Type;
|
|
377
667
|
y: Int64Type;
|
|
668
|
+
z?: UInt16Type;
|
|
669
|
+
}
|
|
670
|
+
interface cargo_item {
|
|
671
|
+
good_id: UInt16Type;
|
|
672
|
+
quantity: UInt32Type;
|
|
673
|
+
unit_cost: UInt64Type;
|
|
674
|
+
mixture?: Type.mixture_info;
|
|
675
|
+
}
|
|
676
|
+
interface mixture_info {
|
|
677
|
+
components: Type.mixture_component[];
|
|
678
|
+
}
|
|
679
|
+
interface mixture_component {
|
|
680
|
+
good_id: UInt16Type;
|
|
681
|
+
purity: UInt16Type;
|
|
378
682
|
}
|
|
379
683
|
}
|
|
380
684
|
interface advance {
|
|
381
685
|
reveal: string;
|
|
382
686
|
commit: Checksum256Type;
|
|
383
687
|
}
|
|
384
|
-
interface
|
|
385
|
-
|
|
688
|
+
interface buycontainer {
|
|
689
|
+
account: NameType;
|
|
690
|
+
ship_id: UInt64Type;
|
|
691
|
+
name: string;
|
|
386
692
|
}
|
|
387
693
|
interface buygoods {
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
694
|
+
entity_type: NameType;
|
|
695
|
+
id: UInt64Type;
|
|
696
|
+
good_id: UInt16Type;
|
|
697
|
+
quantity: UInt32Type;
|
|
391
698
|
}
|
|
392
699
|
interface buyship {
|
|
393
700
|
account: NameType;
|
|
394
701
|
name: string;
|
|
395
702
|
}
|
|
703
|
+
interface buywarehouse {
|
|
704
|
+
account: NameType;
|
|
705
|
+
ship_id: UInt64Type;
|
|
706
|
+
name: string;
|
|
707
|
+
}
|
|
708
|
+
interface cancel {
|
|
709
|
+
entity_type: NameType;
|
|
710
|
+
id: UInt64Type;
|
|
711
|
+
count: UInt64Type;
|
|
712
|
+
}
|
|
396
713
|
interface cleartable {
|
|
397
714
|
table_name: NameType;
|
|
398
715
|
scope?: NameType;
|
|
@@ -404,6 +721,47 @@ declare namespace ActionParams {
|
|
|
404
721
|
interface enable {
|
|
405
722
|
enabled: boolean;
|
|
406
723
|
}
|
|
724
|
+
interface extract {
|
|
725
|
+
ship_id: UInt64Type;
|
|
726
|
+
}
|
|
727
|
+
interface getentities {
|
|
728
|
+
owner: NameType;
|
|
729
|
+
entity_type?: NameType;
|
|
730
|
+
}
|
|
731
|
+
interface getentity {
|
|
732
|
+
entity_type: NameType;
|
|
733
|
+
entity_id: UInt64Type;
|
|
734
|
+
}
|
|
735
|
+
interface getgoods {
|
|
736
|
+
}
|
|
737
|
+
interface getlocation {
|
|
738
|
+
x: Int64Type;
|
|
739
|
+
y: Int64Type;
|
|
740
|
+
}
|
|
741
|
+
interface getlocdata {
|
|
742
|
+
x: Int64Type;
|
|
743
|
+
y: Int64Type;
|
|
744
|
+
}
|
|
745
|
+
interface getnearby {
|
|
746
|
+
entity_type: NameType;
|
|
747
|
+
entity_id: UInt64Type;
|
|
748
|
+
recharge: boolean;
|
|
749
|
+
}
|
|
750
|
+
interface getplayer {
|
|
751
|
+
account: NameType;
|
|
752
|
+
}
|
|
753
|
+
interface getstarter {
|
|
754
|
+
}
|
|
755
|
+
interface getsummaries {
|
|
756
|
+
owner: NameType;
|
|
757
|
+
entity_type?: NameType;
|
|
758
|
+
}
|
|
759
|
+
interface grouptravel {
|
|
760
|
+
entities: Type.entity_ref[];
|
|
761
|
+
x: Int64Type;
|
|
762
|
+
y: Int64Type;
|
|
763
|
+
recharge: boolean;
|
|
764
|
+
}
|
|
407
765
|
interface hash {
|
|
408
766
|
value: string;
|
|
409
767
|
}
|
|
@@ -413,52 +771,56 @@ declare namespace ActionParams {
|
|
|
413
771
|
interface init {
|
|
414
772
|
seed: Checksum256Type;
|
|
415
773
|
}
|
|
416
|
-
interface jettison {
|
|
417
|
-
ship_id: UInt64Type;
|
|
418
|
-
good_id: UInt16Type;
|
|
419
|
-
quantity: UInt64Type;
|
|
420
|
-
}
|
|
421
774
|
interface join {
|
|
422
775
|
account: NameType;
|
|
423
776
|
}
|
|
424
|
-
interface
|
|
425
|
-
|
|
426
|
-
good_id: UInt16Type;
|
|
427
|
-
}
|
|
428
|
-
interface marketprices {
|
|
429
|
-
location: Type.coordinates;
|
|
777
|
+
interface notify {
|
|
778
|
+
event: Type.task_event;
|
|
430
779
|
}
|
|
431
780
|
interface payloan {
|
|
432
781
|
account: NameType;
|
|
433
782
|
amount: UInt64Type;
|
|
434
783
|
}
|
|
784
|
+
interface purgesupply {
|
|
785
|
+
max_rows?: UInt64Type;
|
|
786
|
+
}
|
|
787
|
+
interface recharge {
|
|
788
|
+
entity_type: NameType;
|
|
789
|
+
id: UInt64Type;
|
|
790
|
+
}
|
|
791
|
+
interface resolve {
|
|
792
|
+
entity_type: NameType;
|
|
793
|
+
id: UInt64Type;
|
|
794
|
+
count?: UInt64Type;
|
|
795
|
+
}
|
|
435
796
|
interface salt {
|
|
436
797
|
salt: UInt64Type;
|
|
437
798
|
}
|
|
438
799
|
interface sellgoods {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
800
|
+
entity_type: NameType;
|
|
801
|
+
id: UInt64Type;
|
|
802
|
+
good_id: UInt16Type;
|
|
803
|
+
quantity: UInt32Type;
|
|
442
804
|
}
|
|
443
805
|
interface takeloan {
|
|
444
806
|
account: NameType;
|
|
445
807
|
amount: UInt64Type;
|
|
446
808
|
}
|
|
447
|
-
interface
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
809
|
+
interface transfer {
|
|
810
|
+
source_type: NameType;
|
|
811
|
+
source_id: UInt64Type;
|
|
812
|
+
dest_type: NameType;
|
|
813
|
+
dest_id: UInt64Type;
|
|
814
|
+
good_id: UInt16Type;
|
|
815
|
+
quantity: UInt32Type;
|
|
451
816
|
}
|
|
452
|
-
interface
|
|
817
|
+
interface travel {
|
|
818
|
+
entity_type: NameType;
|
|
453
819
|
id: UInt64Type;
|
|
454
|
-
|
|
455
|
-
|
|
820
|
+
x: Int64Type;
|
|
821
|
+
y: Int64Type;
|
|
456
822
|
recharge: boolean;
|
|
457
823
|
}
|
|
458
|
-
interface traveltime {
|
|
459
|
-
id: UInt64Type;
|
|
460
|
-
destination: Type.coordinates;
|
|
461
|
-
}
|
|
462
824
|
interface updatecredit {
|
|
463
825
|
account: NameType;
|
|
464
826
|
amount: Int64Type;
|
|
@@ -467,10 +829,6 @@ declare namespace ActionParams {
|
|
|
467
829
|
account: NameType;
|
|
468
830
|
amount: Int64Type;
|
|
469
831
|
}
|
|
470
|
-
interface upgradeship {
|
|
471
|
-
account: NameType;
|
|
472
|
-
id: UInt64Type;
|
|
473
|
-
}
|
|
474
832
|
interface wipe {
|
|
475
833
|
}
|
|
476
834
|
interface wipesequence {
|
|
@@ -478,40 +836,66 @@ declare namespace ActionParams {
|
|
|
478
836
|
}
|
|
479
837
|
interface ActionNameParams {
|
|
480
838
|
advance: ActionParams.advance;
|
|
481
|
-
|
|
839
|
+
buycontainer: ActionParams.buycontainer;
|
|
482
840
|
buygoods: ActionParams.buygoods;
|
|
483
841
|
buyship: ActionParams.buyship;
|
|
842
|
+
buywarehouse: ActionParams.buywarehouse;
|
|
843
|
+
cancel: ActionParams.cancel;
|
|
484
844
|
cleartable: ActionParams.cleartable;
|
|
485
845
|
commit: ActionParams.commit;
|
|
486
846
|
enable: ActionParams.enable;
|
|
847
|
+
extract: ActionParams.extract;
|
|
848
|
+
getentities: ActionParams.getentities;
|
|
849
|
+
getentity: ActionParams.getentity;
|
|
850
|
+
getgoods: ActionParams.getgoods;
|
|
851
|
+
getlocation: ActionParams.getlocation;
|
|
852
|
+
getlocdata: ActionParams.getlocdata;
|
|
853
|
+
getnearby: ActionParams.getnearby;
|
|
854
|
+
getplayer: ActionParams.getplayer;
|
|
855
|
+
getstarter: ActionParams.getstarter;
|
|
856
|
+
getsummaries: ActionParams.getsummaries;
|
|
857
|
+
grouptravel: ActionParams.grouptravel;
|
|
487
858
|
hash: ActionParams.hash;
|
|
488
859
|
hash512: ActionParams.hash512;
|
|
489
860
|
init: ActionParams.init;
|
|
490
|
-
jettison: ActionParams.jettison;
|
|
491
861
|
join: ActionParams.join;
|
|
492
|
-
|
|
493
|
-
marketprices: ActionParams.marketprices;
|
|
862
|
+
notify: ActionParams.notify;
|
|
494
863
|
payloan: ActionParams.payloan;
|
|
864
|
+
purgesupply: ActionParams.purgesupply;
|
|
865
|
+
recharge: ActionParams.recharge;
|
|
866
|
+
resolve: ActionParams.resolve;
|
|
495
867
|
salt: ActionParams.salt;
|
|
496
868
|
sellgoods: ActionParams.sellgoods;
|
|
497
869
|
takeloan: ActionParams.takeloan;
|
|
870
|
+
transfer: ActionParams.transfer;
|
|
498
871
|
travel: ActionParams.travel;
|
|
499
|
-
travelplan: ActionParams.travelplan;
|
|
500
|
-
traveltime: ActionParams.traveltime;
|
|
501
872
|
updatecredit: ActionParams.updatecredit;
|
|
502
873
|
updatedebt: ActionParams.updatedebt;
|
|
503
|
-
upgradeship: ActionParams.upgradeship;
|
|
504
874
|
wipe: ActionParams.wipe;
|
|
505
875
|
wipesequence: ActionParams.wipesequence;
|
|
506
876
|
}
|
|
507
877
|
type ActionNames = keyof ActionNameParams;
|
|
508
878
|
interface ActionReturnValues {
|
|
879
|
+
buygoods: Types.task_results;
|
|
880
|
+
cancel: Types.cancel_results;
|
|
881
|
+
extract: Types.task_results;
|
|
882
|
+
getentities: Types.entity_info[];
|
|
883
|
+
getentity: Types.entity_info;
|
|
884
|
+
getgoods: Types.goods_info;
|
|
885
|
+
getlocation: Types.location_info;
|
|
886
|
+
getlocdata: Types.location_derived;
|
|
887
|
+
getnearby: Types.nearby_info;
|
|
888
|
+
getplayer: Types.player_info;
|
|
889
|
+
getstarter: Types.starter_info;
|
|
890
|
+
getsummaries: Types.entity_summary[];
|
|
891
|
+
grouptravel: Types.task_results;
|
|
509
892
|
hash: Checksum256;
|
|
510
893
|
hash512: Checksum512;
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
894
|
+
recharge: Types.task_results;
|
|
895
|
+
resolve: Types.resolve_results;
|
|
896
|
+
sellgoods: Types.task_results;
|
|
897
|
+
transfer: Types.task_results;
|
|
898
|
+
travel: Types.task_results;
|
|
515
899
|
}
|
|
516
900
|
type ActionReturnNames = keyof ActionReturnValues;
|
|
517
901
|
declare class Contract extends Contract$2 {
|
|
@@ -553,33 +937,122 @@ declare namespace server {
|
|
|
553
937
|
};
|
|
554
938
|
}
|
|
555
939
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
declare
|
|
562
|
-
declare
|
|
563
|
-
|
|
564
|
-
declare const ERROR_SYSTEM_NOT_INITIALIZED = "
|
|
565
|
-
declare const
|
|
566
|
-
declare const
|
|
567
|
-
declare const
|
|
568
|
-
declare const
|
|
569
|
-
declare const
|
|
570
|
-
declare const
|
|
571
|
-
declare const
|
|
572
|
-
declare const
|
|
940
|
+
declare const COMPANY_NOT_FOUND = "Cannot find company for given account.";
|
|
941
|
+
declare const COMMIT_ALREADY_SET = "Commit has already been set.";
|
|
942
|
+
declare const COMMIT_CANNOT_MATCH = "Next commit cannot match current commit.";
|
|
943
|
+
declare const COMMIT_NOT_SET = "Commit has not been set.";
|
|
944
|
+
declare const EPOCH_NON_ZERO = "Epoch must be greater than zero.";
|
|
945
|
+
declare const EPOCH_NOT_READY = "Current epoch is not ready to advance";
|
|
946
|
+
declare const ERROR_SYSTEM_ALREADY_INITIALIZED = "This game has already been initialized.";
|
|
947
|
+
declare const ERROR_SYSTEM_DISABLED = "This game is currently disabled.";
|
|
948
|
+
declare const ERROR_SYSTEM_NOT_INITIALIZED = "This game has not been initialized.";
|
|
949
|
+
declare const GAME_NOT_FOUND = "Cannot find game for given account name.";
|
|
950
|
+
declare const GAME_SEED_NOT_SET = "This game has not initialized an epoch seed value.";
|
|
951
|
+
declare const GOOD_DOES_NOT_EXIST = "Good does not exist.";
|
|
952
|
+
declare const GOOD_NOT_AVAILABLE_AT_LOCATION = "Good is not tradeable at ship location.";
|
|
953
|
+
declare const INSUFFICIENT_BALANCE = "Insufficient balance.";
|
|
954
|
+
declare const INSUFFICIENT_GOOD_QUANTITY = "Insufficient quantity in cargo.";
|
|
955
|
+
declare const INSUFFICIENT_GOOD_SUPPLY = "Insufficient supply of good at location.";
|
|
956
|
+
declare const INVALID_AMOUNT = "Invalid amount.";
|
|
957
|
+
declare const REQUIRES_MORE_THAN_ONE = "A value greater than one is required.";
|
|
958
|
+
declare const REQUIRES_POSITIVE_VALUE = "Value must be greater than zero.";
|
|
959
|
+
declare const PLAYER_ALREADY_JOINED = "Player has already joined the game.";
|
|
960
|
+
declare const PLAYER_NOT_FOUND = "Cannot find player for given account name.";
|
|
961
|
+
declare const SHIP_ALREADY_THERE = "Ship cannot travel to the location its already at.";
|
|
962
|
+
declare const SHIP_ALREADY_TRAVELING = "Ship is already traveling.";
|
|
963
|
+
declare const SHIP_CANNOT_BUY_TRAVELING = "Ship cannot buy goods while traveling.";
|
|
964
|
+
declare const SHIP_CANNOT_UPDATE_TRAVELING = "Ship cannot be updated while traveling.";
|
|
965
|
+
declare const SHIP_INVALID_DESTINATION = "Ship cannot travel, no system at specified destination.";
|
|
966
|
+
declare const SHIP_INVALID_TRAVEL_DURATION = "This trip cannot be made as it would exceed the maximum travel duration.";
|
|
967
|
+
declare const SHIP_NOT_ARRIVED = "Ship has not yet arrived at its destination.";
|
|
968
|
+
declare const SHIP_NOT_ENOUGH_ENERGY = "Ship does not have enough energy to travel to the destination.";
|
|
969
|
+
declare const SHIP_NOT_ENOUGH_ENERGY_CAPACITY = "Ship does not have enough energy capacity to travel.";
|
|
970
|
+
declare const SHIP_NOT_FOUND = "Cannot find ship for given account.";
|
|
971
|
+
declare const SHIP_NOT_OWNED = "Ship is not owned by this account.";
|
|
972
|
+
declare const NO_SCHEDULE = "No scheduled tasks.";
|
|
973
|
+
declare const SHIP_NOT_IDLE = "Ship must be idle (no active schedule) for this action.";
|
|
974
|
+
declare const SHIP_NO_COMPLETED_TASKS = "No completed tasks to resolve.";
|
|
975
|
+
declare const SHIP_CANNOT_CANCEL_TASK = "Cannot cancel task that is immutable or in progress.";
|
|
976
|
+
declare const SHIP_NO_TASKS_TO_CANCEL = "No tasks to cancel.";
|
|
977
|
+
declare const SHIP_INVALID_CARGO = "Invalid cargo specified for load/unload.";
|
|
978
|
+
declare const SHIP_CARGO_NOT_OWNED = "Cannot load cargo that is not owned.";
|
|
979
|
+
declare const SHIP_CARGO_NOT_LOADED = "Cannot unload cargo that is not loaded.";
|
|
980
|
+
declare const WAREHOUSE_NOT_FOUND = "Cannot find warehouse for given id.";
|
|
981
|
+
declare const WAREHOUSE_ALREADY_AT_LOCATION = "Warehouse already exists at this location.";
|
|
982
|
+
declare const WAREHOUSE_CAPACITY_EXCEEDED = "Warehouse capacity would be exceeded.";
|
|
573
983
|
|
|
574
984
|
declare const PRECISION = 10000;
|
|
575
|
-
declare const
|
|
576
|
-
|
|
577
|
-
|
|
985
|
+
declare const INITIAL_SHIP_GENERATOR_CAPACITY = 350;
|
|
986
|
+
declare const INITIAL_SHIP_DRAIN = 25;
|
|
987
|
+
declare const INITIAL_SHIP_ENERGY = 350;
|
|
988
|
+
declare const INITIAL_SHIP_HULLMASS = 100000;
|
|
989
|
+
declare const INITIAL_SHIP_CAPACITY = 500000;
|
|
990
|
+
declare const INITIAL_SHIP_Z = 800;
|
|
991
|
+
declare const INITIAL_SHIP_RECHARGE = 10;
|
|
992
|
+
declare const INITIAL_SHIP_THRUST = 250;
|
|
993
|
+
declare const INITIAL_LOADER_MASS = 1000;
|
|
994
|
+
declare const INITIAL_LOADER_QUANTITY = 1;
|
|
995
|
+
declare const INITIAL_LOADER_THRUST = 1;
|
|
996
|
+
declare const WAREHOUSE_Z = 500;
|
|
997
|
+
declare const INITIAL_WAREHOUSE_CAPACITY = 10000000;
|
|
998
|
+
declare const CONTAINER_Z = 300;
|
|
999
|
+
declare const INITIAL_CONTAINER_HULLMASS = 50000;
|
|
1000
|
+
declare const INITIAL_CONTAINER_CAPACITY = 2000000;
|
|
1001
|
+
declare const TRAVEL_MAX_DURATION = 86400;
|
|
1002
|
+
declare const MIN_ORBITAL_ALTITUDE = 800;
|
|
1003
|
+
declare const MAX_ORBITAL_ALTITUDE = 3000;
|
|
1004
|
+
declare const INITIAL_SHIP_MASS = 500000;
|
|
1005
|
+
declare const INITIAL_EXTRACTOR_RATE = 700;
|
|
1006
|
+
declare const INITIAL_EXTRACTOR_DRAIN = 2500;
|
|
1007
|
+
declare const INITIAL_EXTRACTOR_EFFICIENCY = 5000;
|
|
1008
|
+
interface ShipLike {
|
|
1009
|
+
coordinates: Types.coordinates;
|
|
1010
|
+
hullmass: UInt32;
|
|
1011
|
+
energy: UInt16;
|
|
1012
|
+
engines: Types.movement_stats;
|
|
1013
|
+
generator: Types.energy_stats;
|
|
1014
|
+
loaders: Types.loader_stats;
|
|
1015
|
+
capacity: UInt32;
|
|
1016
|
+
}
|
|
1017
|
+
interface CargoMassInfo {
|
|
1018
|
+
good_id: UInt16Type;
|
|
1019
|
+
quantity: UInt32Type;
|
|
1020
|
+
}
|
|
1021
|
+
declare enum TaskType {
|
|
1022
|
+
IDLE = 0,
|
|
1023
|
+
TRAVEL = 1,
|
|
1024
|
+
RECHARGE = 2,
|
|
1025
|
+
LOAD = 3,
|
|
1026
|
+
UNLOAD = 4,
|
|
1027
|
+
EXTRACT = 5
|
|
578
1028
|
}
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
1029
|
+
declare enum LocationType {
|
|
1030
|
+
EMPTY = 0,
|
|
1031
|
+
PLANET = 1,
|
|
1032
|
+
ASTEROID = 2,
|
|
1033
|
+
NEBULA = 3
|
|
582
1034
|
}
|
|
1035
|
+
declare enum TaskCancelable {
|
|
1036
|
+
NEVER = 0,
|
|
1037
|
+
BEFORE_START = 1,
|
|
1038
|
+
ALWAYS = 2
|
|
1039
|
+
}
|
|
1040
|
+
declare const EntityType$1: {
|
|
1041
|
+
readonly SHIP: Name;
|
|
1042
|
+
readonly WAREHOUSE: Name;
|
|
1043
|
+
readonly CONTAINER: Name;
|
|
1044
|
+
};
|
|
1045
|
+
type EntityTypeName = (typeof EntityType$1)[keyof typeof EntityType$1];
|
|
1046
|
+
type CoordinatesType = Coordinates | Types.coordinates | {
|
|
1047
|
+
x: Int64Type;
|
|
1048
|
+
y: Int64Type;
|
|
1049
|
+
};
|
|
1050
|
+
declare class Coordinates extends Types.coordinates {
|
|
1051
|
+
static from(value: CoordinatesType): Coordinates;
|
|
1052
|
+
equals(other: CoordinatesType): boolean;
|
|
1053
|
+
toLocationId(): UInt64;
|
|
1054
|
+
}
|
|
1055
|
+
declare function coordsToLocationId(coords: CoordinatesType): UInt64;
|
|
583
1056
|
interface Distance {
|
|
584
1057
|
origin: ActionParams.Type.coordinates;
|
|
585
1058
|
destination: ActionParams.Type.coordinates;
|
|
@@ -589,83 +1062,1236 @@ declare class Good extends Struct {
|
|
|
589
1062
|
id: UInt16;
|
|
590
1063
|
name: string;
|
|
591
1064
|
description: string;
|
|
592
|
-
base_price:
|
|
593
|
-
mass:
|
|
594
|
-
}
|
|
595
|
-
interface GoodType {
|
|
596
|
-
id: UInt16Type;
|
|
597
|
-
name: string;
|
|
598
|
-
description: string;
|
|
599
|
-
base_price: UInt64Type;
|
|
600
|
-
mass: UInt64Type;
|
|
1065
|
+
base_price: UInt32;
|
|
1066
|
+
mass: UInt32;
|
|
601
1067
|
}
|
|
602
1068
|
declare class GoodPrice extends Struct {
|
|
603
1069
|
id: UInt16;
|
|
604
1070
|
good: Good;
|
|
605
|
-
price:
|
|
606
|
-
supply:
|
|
1071
|
+
price: UInt32;
|
|
1072
|
+
supply: UInt16;
|
|
607
1073
|
}
|
|
608
|
-
|
|
1074
|
+
|
|
1075
|
+
interface EpochInfo {
|
|
1076
|
+
epoch: UInt64;
|
|
1077
|
+
start: Date;
|
|
1078
|
+
end: Date;
|
|
609
1079
|
}
|
|
1080
|
+
declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
|
|
1081
|
+
declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
|
|
610
1082
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
1083
|
+
/**
|
|
1084
|
+
* GameState class extends the state_row from the server contract
|
|
1085
|
+
* with helper methods for epoch management and system generation
|
|
1086
|
+
*/
|
|
1087
|
+
declare class GameState extends Types.state_row {
|
|
1088
|
+
private _game?;
|
|
1089
|
+
/**
|
|
1090
|
+
* Create a GameState instance from a state_row
|
|
1091
|
+
*/
|
|
1092
|
+
static from(state: Types.state_row, game?: Types$1.game_row): GameState;
|
|
1093
|
+
/**
|
|
1094
|
+
* Set the game configuration (needed for epoch calculations)
|
|
1095
|
+
*/
|
|
1096
|
+
setGame(game: Types$1.game_row): void;
|
|
1097
|
+
/**
|
|
1098
|
+
* Get the current epoch number from the state
|
|
1099
|
+
*/
|
|
1100
|
+
get currentEpoch(): UInt64;
|
|
1101
|
+
/**
|
|
1102
|
+
* Get the epoch seed (used for market pricing and system generation)
|
|
1103
|
+
*/
|
|
1104
|
+
get epochSeed(): Checksum256;
|
|
1105
|
+
/**
|
|
1106
|
+
* Get the game seed (from game config, if available)
|
|
1107
|
+
*/
|
|
1108
|
+
get gameSeed(): Checksum256 | undefined;
|
|
1109
|
+
/**
|
|
1110
|
+
* Check if the game is currently enabled
|
|
1111
|
+
*/
|
|
1112
|
+
get isEnabled(): boolean;
|
|
1113
|
+
/**
|
|
1114
|
+
* Get the total number of ships in the game
|
|
1115
|
+
*/
|
|
1116
|
+
get shipCount(): number;
|
|
1117
|
+
/**
|
|
1118
|
+
* Get the current salt value (used for random number generation)
|
|
1119
|
+
*/
|
|
1120
|
+
get currentSalt(): UInt64;
|
|
1121
|
+
/**
|
|
1122
|
+
* Get the commit hash for the next epoch
|
|
1123
|
+
*/
|
|
1124
|
+
get nextEpochCommit(): Checksum256;
|
|
1125
|
+
/**
|
|
1126
|
+
* Calculate the current epoch from game config (if game is set)
|
|
1127
|
+
* This might differ from state.epoch if the blockchain hasn't advanced yet
|
|
1128
|
+
*/
|
|
1129
|
+
get calculatedCurrentEpoch(): UInt64 | undefined;
|
|
1130
|
+
/**
|
|
1131
|
+
* Get epoch info (start/end times) for the current epoch
|
|
1132
|
+
*/
|
|
1133
|
+
get currentEpochInfo(): EpochInfo | undefined;
|
|
1134
|
+
/**
|
|
1135
|
+
* Get epoch info for a specific epoch number
|
|
1136
|
+
*/
|
|
1137
|
+
getEpochInfo(epoch: UInt64): EpochInfo | undefined;
|
|
1138
|
+
/**
|
|
1139
|
+
* Check if a system exists at given coordinates
|
|
1140
|
+
* Requires game seed from game config
|
|
1141
|
+
*/
|
|
1142
|
+
hasSystemAt(x: number, y: number): boolean;
|
|
1143
|
+
/**
|
|
1144
|
+
* Check if a system exists at coordinates object
|
|
1145
|
+
*/
|
|
1146
|
+
hasSystemAtCoords(coords: Types.coordinates): boolean;
|
|
1147
|
+
/**
|
|
1148
|
+
* Get a summary of the game state
|
|
1149
|
+
*/
|
|
1150
|
+
get summary(): {
|
|
1151
|
+
enabled: boolean;
|
|
1152
|
+
epoch: string;
|
|
1153
|
+
ships: number;
|
|
1154
|
+
hasSeed: boolean;
|
|
1155
|
+
hasCommit: boolean;
|
|
1156
|
+
};
|
|
1157
|
+
}
|
|
614
1158
|
|
|
615
|
-
|
|
616
|
-
|
|
1159
|
+
interface PlayerStateInput {
|
|
1160
|
+
owner: NameType;
|
|
1161
|
+
balance: UInt64Type;
|
|
1162
|
+
debt: UInt32Type;
|
|
1163
|
+
networth: Int64Type;
|
|
1164
|
+
}
|
|
1165
|
+
/**
|
|
1166
|
+
* Player helper class extending player_row with computed financial properties.
|
|
1167
|
+
* Provides easy access to balance, debt, networth, and loan calculations.
|
|
1168
|
+
*/
|
|
1169
|
+
declare class Player extends Types.player_row {
|
|
1170
|
+
/**
|
|
1171
|
+
* Construct a Player instance from individual state pieces.
|
|
1172
|
+
* Used by UI's ReactivePlayer to reconstruct Player from reactive state.
|
|
1173
|
+
*/
|
|
1174
|
+
static fromState(state: PlayerStateInput): Player;
|
|
1175
|
+
private static readonly MAX_LOAN;
|
|
1176
|
+
private static readonly BASE_SHIP_COST;
|
|
1177
|
+
private static readonly SHIP_COST_MULTIPLIER;
|
|
1178
|
+
private _shipCount?;
|
|
1179
|
+
/**
|
|
1180
|
+
* Set the current ship count (needed for nextShipCost calculation)
|
|
1181
|
+
*/
|
|
1182
|
+
setShipCount(count: number): void;
|
|
1183
|
+
/**
|
|
1184
|
+
* Get the current ship count (if set)
|
|
1185
|
+
*/
|
|
1186
|
+
get shipCount(): number | undefined;
|
|
1187
|
+
/**
|
|
1188
|
+
* Calculate the cost of the next ship based on current ship count
|
|
1189
|
+
* Matches contract: pow(5, sequence) * 100
|
|
1190
|
+
* @param shipCount - Optional ship count (uses cached value if not provided)
|
|
1191
|
+
*/
|
|
1192
|
+
getNextShipCost(shipCount?: number): UInt64;
|
|
1193
|
+
/**
|
|
1194
|
+
* Get the cost of the next ship based on cached ship count
|
|
1195
|
+
*/
|
|
1196
|
+
get nextShipCost(): UInt64;
|
|
1197
|
+
/**
|
|
1198
|
+
* Check if player can afford to buy a ship
|
|
1199
|
+
* @param shipCount - Optional ship count (uses cached value if not provided)
|
|
1200
|
+
*/
|
|
1201
|
+
canBuyShip(shipCount?: number): boolean;
|
|
1202
|
+
/**
|
|
1203
|
+
* Calculate available loan amount (max loan - current debt)
|
|
1204
|
+
*/
|
|
1205
|
+
get availableLoan(): UInt64;
|
|
1206
|
+
/**
|
|
1207
|
+
* Check if player can take out a loan
|
|
1208
|
+
*/
|
|
1209
|
+
get canTakeLoan(): boolean;
|
|
1210
|
+
/**
|
|
1211
|
+
* Check if player can pay back loan
|
|
1212
|
+
*/
|
|
1213
|
+
get canPayLoan(): boolean;
|
|
1214
|
+
/**
|
|
1215
|
+
* Calculate maximum payback amount (min of debt and balance)
|
|
1216
|
+
*/
|
|
1217
|
+
get maxPayback(): UInt64;
|
|
1218
|
+
/**
|
|
1219
|
+
* Get the maximum loan amount (constant)
|
|
1220
|
+
*/
|
|
1221
|
+
static get MAX_LOAN_LIMIT(): number;
|
|
1222
|
+
/**
|
|
1223
|
+
* Check if player is in debt
|
|
1224
|
+
*/
|
|
1225
|
+
get hasDebt(): boolean;
|
|
1226
|
+
/**
|
|
1227
|
+
* Check if player is solvent (positive networth)
|
|
1228
|
+
*/
|
|
1229
|
+
get isSolvent(): boolean;
|
|
1230
|
+
/**
|
|
1231
|
+
* Create an optimistic update for balance changes
|
|
1232
|
+
* Uses integer math to match contract
|
|
1233
|
+
* @param delta - Amount to change (can be negative)
|
|
1234
|
+
*/
|
|
1235
|
+
withBalanceChange(delta: UInt64 | number): Player;
|
|
1236
|
+
/**
|
|
1237
|
+
* Create an optimistic update for debt changes
|
|
1238
|
+
* Uses integer math to match contract
|
|
1239
|
+
* @param delta - Amount to change (can be negative)
|
|
1240
|
+
*/
|
|
1241
|
+
withDebtChange(delta: UInt64 | number): Player;
|
|
1242
|
+
/**
|
|
1243
|
+
* Create an optimistic update for taking a loan
|
|
1244
|
+
*/
|
|
1245
|
+
withLoan(amount: UInt64): Player;
|
|
1246
|
+
/**
|
|
1247
|
+
* Create an optimistic update for paying back a loan
|
|
1248
|
+
*/
|
|
1249
|
+
withLoanPayment(amount: UInt64): Player;
|
|
1250
|
+
/**
|
|
1251
|
+
* Simulate networth update from selling goods.
|
|
1252
|
+
* Matches contract: networth += (sellPrice - paid * quantity)
|
|
1253
|
+
* Contract reference: market.cpp:75
|
|
1254
|
+
*
|
|
1255
|
+
* @param sellPrice - Total revenue from sale (price * quantity)
|
|
1256
|
+
* @param paidPerUnit - Average cost per unit paid (from cargo.paid)
|
|
1257
|
+
* @param quantity - Quantity being sold
|
|
1258
|
+
* @returns New player with updated networth
|
|
1259
|
+
*
|
|
1260
|
+
* @example
|
|
1261
|
+
* // Sold 10 units at 150 each (revenue=1500), paid 100 per unit
|
|
1262
|
+
* const newPlayer = player.withSaleNetworth(
|
|
1263
|
+
* UInt64.from(1500),
|
|
1264
|
+
* UInt64.from(100),
|
|
1265
|
+
* UInt32.from(10)
|
|
1266
|
+
* )
|
|
1267
|
+
* // Networth increases by: 1500 - (100*10) = 500
|
|
1268
|
+
*/
|
|
1269
|
+
withSaleNetworth(sellPrice: UInt64, paidPerUnit: UInt64, quantity: UInt64): Player;
|
|
1270
|
+
/**
|
|
1271
|
+
* Simulate complete sell goods transaction.
|
|
1272
|
+
* Updates both balance (adds revenue) and networth (adds profit).
|
|
1273
|
+
* Matches contract actions: update_balance + update_networth
|
|
1274
|
+
*
|
|
1275
|
+
* @param sellPrice - Total revenue from sale (price * quantity)
|
|
1276
|
+
* @param paidPerUnit - Average cost per unit paid (from cargo.paid)
|
|
1277
|
+
* @param quantity - Quantity being sold
|
|
1278
|
+
* @returns New player with updated balance and networth
|
|
1279
|
+
*/
|
|
1280
|
+
withSellGoods(sellPrice: UInt64, paidPerUnit: UInt64, quantity: UInt64): Player;
|
|
1281
|
+
/**
|
|
1282
|
+
* Simulate complete buy goods transaction.
|
|
1283
|
+
* Updates balance (subtracts cost).
|
|
1284
|
+
*
|
|
1285
|
+
* @param purchaseCost - Total cost of purchase (price * quantity)
|
|
1286
|
+
* @returns New player with updated balance
|
|
1287
|
+
*/
|
|
1288
|
+
withBuyGoods(purchaseCost: UInt64): Player;
|
|
1289
|
+
}
|
|
617
1290
|
|
|
618
|
-
declare
|
|
619
|
-
|
|
1291
|
+
declare class PlayersManager extends BaseManager {
|
|
1292
|
+
getPlayer(account: NameType): Promise<Player | undefined>;
|
|
1293
|
+
}
|
|
620
1294
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
1295
|
+
/**
|
|
1296
|
+
* Location helper class for working with game coordinates.
|
|
1297
|
+
* Provides system detection, market price caching, nearby planet finding, and supply tracking.
|
|
1298
|
+
*/
|
|
1299
|
+
declare class Location {
|
|
1300
|
+
readonly coordinates: Coordinates;
|
|
1301
|
+
private _marketPrices?;
|
|
1302
|
+
private _gameSeed?;
|
|
1303
|
+
private _hasSystem?;
|
|
1304
|
+
private _locationRows?;
|
|
1305
|
+
private _epoch?;
|
|
1306
|
+
constructor(coordinates: CoordinatesType);
|
|
1307
|
+
/**
|
|
1308
|
+
* Create a Location from coordinates
|
|
1309
|
+
*/
|
|
1310
|
+
static from(coordinates: CoordinatesType): Location;
|
|
1311
|
+
/**
|
|
1312
|
+
* Check if this location has a system (planet, asteroid, or nebula)
|
|
1313
|
+
*/
|
|
1314
|
+
hasSystemAt(gameSeed: Checksum256Type): boolean;
|
|
1315
|
+
/**
|
|
1316
|
+
* Get the location type (EMPTY, PLANET, ASTEROID, or NEBULA)
|
|
1317
|
+
*/
|
|
1318
|
+
getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
|
|
1319
|
+
/**
|
|
1320
|
+
* Check if this location is extractable (asteroid or nebula)
|
|
1321
|
+
*/
|
|
1322
|
+
isExtractableAt(gameSeed: Checksum256Type): boolean;
|
|
1323
|
+
/**
|
|
1324
|
+
* Set cached market prices for this location
|
|
1325
|
+
*/
|
|
1326
|
+
setMarketPrices(prices: GoodPrice[]): void;
|
|
1327
|
+
/**
|
|
1328
|
+
* Get cached market prices (returns undefined if not cached)
|
|
1329
|
+
*/
|
|
1330
|
+
get marketPrices(): GoodPrice[] | undefined;
|
|
1331
|
+
/**
|
|
1332
|
+
* Get price for a specific good (from cache)
|
|
1333
|
+
*/
|
|
1334
|
+
getPrice(goodId: UInt16Type): GoodPrice | undefined;
|
|
1335
|
+
/**
|
|
1336
|
+
* Find nearby planets from this location
|
|
1337
|
+
*/
|
|
1338
|
+
findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
|
|
1339
|
+
/**
|
|
1340
|
+
* Check if this location equals another location
|
|
1341
|
+
*/
|
|
1342
|
+
equals(other: CoordinatesType | Location): boolean;
|
|
1343
|
+
/**
|
|
1344
|
+
* Set location rows (supply data) for this location
|
|
1345
|
+
*/
|
|
1346
|
+
setLocationRows(rows: Types.supply_row[], epoch: UInt64): void;
|
|
1347
|
+
/**
|
|
1348
|
+
* Get cached location rows (supply data)
|
|
1349
|
+
*/
|
|
1350
|
+
get locationRows(): Types.supply_row[] | undefined;
|
|
1351
|
+
/**
|
|
1352
|
+
* Get supply for a specific good at this location
|
|
1353
|
+
* Returns undefined if location rows not cached or good not found
|
|
1354
|
+
*/
|
|
1355
|
+
getSupply(goodId: UInt16Type): UInt16 | undefined;
|
|
1356
|
+
/**
|
|
1357
|
+
* Get all available goods at this location (goods with supply > 0)
|
|
1358
|
+
* Returns undefined if location rows not cached
|
|
1359
|
+
*/
|
|
1360
|
+
get availableGoods(): Types.supply_row[] | undefined;
|
|
1361
|
+
/**
|
|
1362
|
+
* Check if a specific good is available (has supply)
|
|
1363
|
+
* Returns false if location rows not cached
|
|
1364
|
+
*/
|
|
1365
|
+
hasGood(goodId: UInt16Type): boolean;
|
|
1366
|
+
/**
|
|
1367
|
+
* Get the epoch for cached location data
|
|
1368
|
+
*/
|
|
1369
|
+
get epoch(): UInt64 | undefined;
|
|
1370
|
+
/**
|
|
1371
|
+
* Check if cached data exists
|
|
1372
|
+
*/
|
|
1373
|
+
get hasCachedData(): boolean;
|
|
1374
|
+
/**
|
|
1375
|
+
* Check if supply data is cached
|
|
1376
|
+
*/
|
|
1377
|
+
get hasSupplyData(): boolean;
|
|
1378
|
+
/**
|
|
1379
|
+
* Clear all cached data
|
|
1380
|
+
*/
|
|
1381
|
+
clearCache(): void;
|
|
1382
|
+
/**
|
|
1383
|
+
* Create optimistic Location with updated supply after purchase/sale.
|
|
1384
|
+
* Matches contract: update_location_supply (delta can be positive or negative)
|
|
1385
|
+
* Contract reference: market.cpp:53, 123-151
|
|
1386
|
+
*
|
|
1387
|
+
* @param goodId - Good ID to update supply for
|
|
1388
|
+
* @param quantityDelta - Change in supply (negative for purchase, positive for sale)
|
|
1389
|
+
* @returns New Location with updated supply in cached data
|
|
1390
|
+
*
|
|
1391
|
+
* @example
|
|
1392
|
+
* // After buying 10 units (supply decreases)
|
|
1393
|
+
* const newLocation = location.withUpdatedSupply(1, -10)
|
|
1394
|
+
*
|
|
1395
|
+
* // After selling 5 units (supply increases)
|
|
1396
|
+
* const newLocation = location.withUpdatedSupply(1, 5)
|
|
1397
|
+
*/
|
|
1398
|
+
withUpdatedSupply(goodId: UInt16Type, quantityDelta: number): Location;
|
|
628
1399
|
}
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
1400
|
+
/**
|
|
1401
|
+
* Helper function to convert various coordinate types to Location
|
|
1402
|
+
*/
|
|
1403
|
+
declare function toLocation(coords: CoordinatesType | Location): Location;
|
|
1404
|
+
|
|
1405
|
+
declare class LocationsManager extends BaseManager {
|
|
1406
|
+
getMarketPrice(location: CoordinatesType, goodId: number): Promise<GoodPrice>;
|
|
1407
|
+
getMarketPrices(location: CoordinatesType): Promise<GoodPrice[]>;
|
|
1408
|
+
getMarketPricesWithSupply(location: CoordinatesType): Promise<GoodPrice[]>;
|
|
1409
|
+
hasSystem(location: CoordinatesType): Promise<boolean>;
|
|
1410
|
+
findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
|
|
1411
|
+
getSupplyRows(location: CoordinatesType): Promise<any[]>;
|
|
1412
|
+
getLocationWithPrices(coords: CoordinatesType): Promise<Location>;
|
|
1413
|
+
getLocationWithSupply(coords: CoordinatesType): Promise<Location>;
|
|
1414
|
+
getLocationComplete(coords: CoordinatesType): Promise<Location>;
|
|
1415
|
+
getLocationEntity(id: UInt64Type): Promise<Types.location_row | undefined>;
|
|
1416
|
+
getLocationEntityAt(coords: CoordinatesType): Promise<Types.location_row | undefined>;
|
|
1417
|
+
getAllLocationEntities(): Promise<Types.location_row[]>;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
interface MovementCapability {
|
|
1421
|
+
engines: Types.movement_stats;
|
|
1422
|
+
generator: Types.energy_stats;
|
|
1423
|
+
}
|
|
1424
|
+
interface EnergyCapability {
|
|
1425
|
+
energy: UInt16;
|
|
1426
|
+
}
|
|
1427
|
+
interface StorageCapability {
|
|
1428
|
+
capacity: UInt32;
|
|
1429
|
+
cargomass: UInt32;
|
|
1430
|
+
cargo: Types.cargo_item[];
|
|
1431
|
+
}
|
|
1432
|
+
interface LoaderCapability {
|
|
1433
|
+
loaders: Types.loader_stats;
|
|
1434
|
+
}
|
|
1435
|
+
interface TradeCapability {
|
|
1436
|
+
trade: Types.trade_stats;
|
|
1437
|
+
}
|
|
1438
|
+
interface ExtractorCapability {
|
|
1439
|
+
extractor: Types.extractor_stats;
|
|
1440
|
+
}
|
|
1441
|
+
interface MassCapability {
|
|
1442
|
+
hullmass: UInt32;
|
|
1443
|
+
}
|
|
1444
|
+
interface ScheduleCapability {
|
|
1445
|
+
schedule?: Types.schedule;
|
|
1446
|
+
}
|
|
1447
|
+
interface EntityCapabilities {
|
|
1448
|
+
hullmass?: UInt32;
|
|
1449
|
+
capacity?: UInt32;
|
|
1450
|
+
engines?: Types.movement_stats;
|
|
1451
|
+
generator?: Types.energy_stats;
|
|
1452
|
+
loaders?: Types.loader_stats;
|
|
1453
|
+
trade?: Types.trade_stats;
|
|
1454
|
+
extractor?: Types.extractor_stats;
|
|
1455
|
+
}
|
|
1456
|
+
interface EntityState {
|
|
1457
|
+
owner: Name;
|
|
1458
|
+
location: Types.coordinates;
|
|
1459
|
+
energy?: UInt16;
|
|
1460
|
+
cargomass: UInt32;
|
|
1461
|
+
cargo: Types.cargo_item[];
|
|
1462
|
+
}
|
|
1463
|
+
declare function capsHasMovement(caps: EntityCapabilities): boolean;
|
|
1464
|
+
declare function capsHasStorage(caps: EntityCapabilities): boolean;
|
|
1465
|
+
declare function capsHasLoaders(caps: EntityCapabilities): boolean;
|
|
1466
|
+
declare function capsHasTrade(caps: EntityCapabilities): boolean;
|
|
1467
|
+
declare function capsHasExtractor(caps: EntityCapabilities): boolean;
|
|
1468
|
+
declare function capsHasMass(caps: EntityCapabilities): boolean;
|
|
1469
|
+
|
|
1470
|
+
type Schedule = Types.schedule;
|
|
1471
|
+
type Task$1 = Types.task;
|
|
1472
|
+
interface ScheduleData {
|
|
1473
|
+
schedule?: Schedule;
|
|
1474
|
+
}
|
|
1475
|
+
interface Scheduleable extends ScheduleData {
|
|
1476
|
+
hasSchedule: boolean;
|
|
1477
|
+
isIdle: boolean;
|
|
1478
|
+
tasks: Task$1[];
|
|
1479
|
+
scheduleDuration(): number;
|
|
1480
|
+
scheduleElapsed(now: Date): number;
|
|
1481
|
+
scheduleRemaining(now: Date): number;
|
|
1482
|
+
scheduleComplete(now: Date): boolean;
|
|
1483
|
+
currentTaskIndex(now: Date): number;
|
|
1484
|
+
currentTask(now: Date): Task$1 | undefined;
|
|
1485
|
+
currentTaskType(now: Date): TaskType | undefined;
|
|
1486
|
+
getTaskStartTime(index: number): number;
|
|
1487
|
+
getTaskElapsed(index: number, now: Date): number;
|
|
1488
|
+
getTaskRemaining(index: number, now: Date): number;
|
|
1489
|
+
isTaskComplete(index: number, now: Date): boolean;
|
|
1490
|
+
isTaskInProgress(index: number, now: Date): boolean;
|
|
1491
|
+
currentTaskProgress(now: Date): number;
|
|
1492
|
+
scheduleProgress(now: Date): number;
|
|
1493
|
+
}
|
|
1494
|
+
declare function hasSchedule$1(entity: ScheduleData): boolean;
|
|
1495
|
+
declare function isIdle(entity: ScheduleData): boolean;
|
|
1496
|
+
declare function getTasks(entity: ScheduleData): Task$1[];
|
|
1497
|
+
declare function scheduleDuration(entity: ScheduleData): number;
|
|
1498
|
+
declare function scheduleElapsed(entity: ScheduleData, now: Date): number;
|
|
1499
|
+
declare function scheduleRemaining(entity: ScheduleData, now: Date): number;
|
|
1500
|
+
declare function scheduleComplete(entity: ScheduleData, now: Date): boolean;
|
|
1501
|
+
declare function currentTaskIndex(entity: ScheduleData, now: Date): number;
|
|
1502
|
+
declare function currentTask(entity: ScheduleData, now: Date): Task$1 | undefined;
|
|
1503
|
+
declare function currentTaskType(entity: ScheduleData, now: Date): TaskType | undefined;
|
|
1504
|
+
declare function getTaskStartTime(entity: ScheduleData, index: number): number;
|
|
1505
|
+
declare function getTaskElapsed(entity: ScheduleData, index: number, now: Date): number;
|
|
1506
|
+
declare function getTaskRemaining(entity: ScheduleData, index: number, now: Date): number;
|
|
1507
|
+
declare function isTaskComplete(entity: ScheduleData, index: number, now: Date): boolean;
|
|
1508
|
+
declare function isTaskInProgress(entity: ScheduleData, index: number, now: Date): boolean;
|
|
1509
|
+
declare function currentTaskProgress(entity: ScheduleData, now: Date): number;
|
|
1510
|
+
declare function scheduleProgress(entity: ScheduleData, now: Date): number;
|
|
1511
|
+
declare function isTaskType(entity: ScheduleData, taskType: TaskType, now: Date): boolean;
|
|
1512
|
+
declare function isInFlight(entity: ScheduleData, now: Date): boolean;
|
|
1513
|
+
declare function isRecharging(entity: ScheduleData, now: Date): boolean;
|
|
1514
|
+
declare function isLoading(entity: ScheduleData, now: Date): boolean;
|
|
1515
|
+
declare function isUnloading(entity: ScheduleData, now: Date): boolean;
|
|
1516
|
+
declare function isExtracting(entity: ScheduleData, now: Date): boolean;
|
|
1517
|
+
|
|
1518
|
+
type schedule_ScheduleData = ScheduleData;
|
|
1519
|
+
type schedule_Scheduleable = Scheduleable;
|
|
1520
|
+
declare const schedule_isIdle: typeof isIdle;
|
|
1521
|
+
declare const schedule_getTasks: typeof getTasks;
|
|
1522
|
+
declare const schedule_scheduleDuration: typeof scheduleDuration;
|
|
1523
|
+
declare const schedule_scheduleElapsed: typeof scheduleElapsed;
|
|
1524
|
+
declare const schedule_scheduleRemaining: typeof scheduleRemaining;
|
|
1525
|
+
declare const schedule_scheduleComplete: typeof scheduleComplete;
|
|
1526
|
+
declare const schedule_currentTaskIndex: typeof currentTaskIndex;
|
|
1527
|
+
declare const schedule_currentTask: typeof currentTask;
|
|
1528
|
+
declare const schedule_currentTaskType: typeof currentTaskType;
|
|
1529
|
+
declare const schedule_getTaskStartTime: typeof getTaskStartTime;
|
|
1530
|
+
declare const schedule_getTaskElapsed: typeof getTaskElapsed;
|
|
1531
|
+
declare const schedule_getTaskRemaining: typeof getTaskRemaining;
|
|
1532
|
+
declare const schedule_isTaskComplete: typeof isTaskComplete;
|
|
1533
|
+
declare const schedule_isTaskInProgress: typeof isTaskInProgress;
|
|
1534
|
+
declare const schedule_currentTaskProgress: typeof currentTaskProgress;
|
|
1535
|
+
declare const schedule_scheduleProgress: typeof scheduleProgress;
|
|
1536
|
+
declare const schedule_isTaskType: typeof isTaskType;
|
|
1537
|
+
declare const schedule_isInFlight: typeof isInFlight;
|
|
1538
|
+
declare const schedule_isRecharging: typeof isRecharging;
|
|
1539
|
+
declare const schedule_isLoading: typeof isLoading;
|
|
1540
|
+
declare const schedule_isUnloading: typeof isUnloading;
|
|
1541
|
+
declare const schedule_isExtracting: typeof isExtracting;
|
|
1542
|
+
declare namespace schedule {
|
|
1543
|
+
export {
|
|
1544
|
+
schedule_ScheduleData as ScheduleData,
|
|
1545
|
+
schedule_Scheduleable as Scheduleable,
|
|
1546
|
+
hasSchedule$1 as hasSchedule,
|
|
1547
|
+
schedule_isIdle as isIdle,
|
|
1548
|
+
schedule_getTasks as getTasks,
|
|
1549
|
+
schedule_scheduleDuration as scheduleDuration,
|
|
1550
|
+
schedule_scheduleElapsed as scheduleElapsed,
|
|
1551
|
+
schedule_scheduleRemaining as scheduleRemaining,
|
|
1552
|
+
schedule_scheduleComplete as scheduleComplete,
|
|
1553
|
+
schedule_currentTaskIndex as currentTaskIndex,
|
|
1554
|
+
schedule_currentTask as currentTask,
|
|
1555
|
+
schedule_currentTaskType as currentTaskType,
|
|
1556
|
+
schedule_getTaskStartTime as getTaskStartTime,
|
|
1557
|
+
schedule_getTaskElapsed as getTaskElapsed,
|
|
1558
|
+
schedule_getTaskRemaining as getTaskRemaining,
|
|
1559
|
+
schedule_isTaskComplete as isTaskComplete,
|
|
1560
|
+
schedule_isTaskInProgress as isTaskInProgress,
|
|
1561
|
+
schedule_currentTaskProgress as currentTaskProgress,
|
|
1562
|
+
schedule_scheduleProgress as scheduleProgress,
|
|
1563
|
+
schedule_isTaskType as isTaskType,
|
|
1564
|
+
schedule_isInFlight as isInFlight,
|
|
1565
|
+
schedule_isRecharging as isRecharging,
|
|
1566
|
+
schedule_isLoading as isLoading,
|
|
1567
|
+
schedule_isUnloading as isUnloading,
|
|
1568
|
+
schedule_isExtracting as isExtracting,
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
interface ProjectedEntity {
|
|
1573
|
+
location: Coordinates;
|
|
1574
|
+
energy: UInt16;
|
|
1575
|
+
cargoMass: UInt64;
|
|
1576
|
+
shipMass: UInt32;
|
|
1577
|
+
capacity?: UInt64;
|
|
1578
|
+
engines?: Types.movement_stats;
|
|
1579
|
+
loaders?: Types.loader_stats;
|
|
1580
|
+
generator?: Types.energy_stats;
|
|
1581
|
+
trade?: Types.trade_stats;
|
|
1582
|
+
readonly totalMass: UInt64;
|
|
1583
|
+
hasMovement(): boolean;
|
|
1584
|
+
hasStorage(): boolean;
|
|
1585
|
+
hasLoaders(): boolean;
|
|
1586
|
+
hasTrade(): boolean;
|
|
1587
|
+
capabilities(): EntityCapabilities;
|
|
1588
|
+
state(): EntityState;
|
|
1589
|
+
}
|
|
1590
|
+
interface Projectable extends ScheduleData {
|
|
1591
|
+
coordinates: Coordinates | Types.coordinates;
|
|
1592
|
+
energy?: UInt16;
|
|
1593
|
+
hullmass?: UInt32;
|
|
1594
|
+
generator?: Types.energy_stats;
|
|
1595
|
+
engines?: Types.movement_stats;
|
|
1596
|
+
loaders?: Types.loader_stats;
|
|
1597
|
+
trade?: Types.trade_stats;
|
|
1598
|
+
capacity?: UInt32;
|
|
1599
|
+
cargo: Types.cargo_item[];
|
|
1600
|
+
cargomass: UInt32;
|
|
1601
|
+
owner?: Name;
|
|
1602
|
+
}
|
|
1603
|
+
declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
|
|
1604
|
+
declare function projectEntity(entity: Projectable): ProjectedEntity;
|
|
1605
|
+
declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
|
|
1606
|
+
|
|
1607
|
+
type Task = Types.task;
|
|
1608
|
+
declare class ScheduleAccessor {
|
|
1609
|
+
private entity;
|
|
1610
|
+
constructor(entity: ScheduleData);
|
|
1611
|
+
get hasSchedule(): boolean;
|
|
1612
|
+
get isIdle(): boolean;
|
|
1613
|
+
get tasks(): Task[];
|
|
1614
|
+
duration(): number;
|
|
1615
|
+
elapsed(now: Date): number;
|
|
1616
|
+
remaining(now: Date): number;
|
|
1617
|
+
complete(now: Date): boolean;
|
|
1618
|
+
currentTaskIndex(now: Date): number;
|
|
1619
|
+
currentTask(now: Date): Task | undefined;
|
|
1620
|
+
currentTaskType(now: Date): TaskType | undefined;
|
|
1621
|
+
taskStartTime(index: number): number;
|
|
1622
|
+
taskElapsed(index: number, now: Date): number;
|
|
1623
|
+
taskRemaining(index: number, now: Date): number;
|
|
1624
|
+
taskComplete(index: number, now: Date): boolean;
|
|
1625
|
+
taskInProgress(index: number, now: Date): boolean;
|
|
1626
|
+
currentTaskProgress(now: Date): number;
|
|
1627
|
+
progress(now: Date): number;
|
|
1628
|
+
}
|
|
1629
|
+
declare function createScheduleAccessor(entity: ScheduleData): ScheduleAccessor;
|
|
1630
|
+
|
|
1631
|
+
declare class EntityInventory extends Types.cargo_item {
|
|
1632
|
+
private _good?;
|
|
1633
|
+
get good(): Good;
|
|
1634
|
+
get name(): string;
|
|
1635
|
+
get unitMass(): UInt32;
|
|
1636
|
+
get totalMass(): UInt64;
|
|
1637
|
+
get totalCost(): UInt64;
|
|
1638
|
+
get hasCargo(): boolean;
|
|
1639
|
+
get isEmpty(): boolean;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
interface HasCargo {
|
|
1643
|
+
cargo: Types.cargo_item[];
|
|
1644
|
+
}
|
|
1645
|
+
interface HasCapacity {
|
|
1646
|
+
capacity: UInt32;
|
|
633
1647
|
}
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
declare function
|
|
638
|
-
declare function
|
|
639
|
-
declare function
|
|
640
|
-
declare function
|
|
1648
|
+
interface HasCargomass {
|
|
1649
|
+
cargomass: UInt32;
|
|
1650
|
+
}
|
|
1651
|
+
declare function calcCargoMass(entity: HasCargo): UInt64;
|
|
1652
|
+
declare function calcCargoValue(entity: HasCargo): UInt64;
|
|
1653
|
+
declare function availableCapacity$1(entity: StorageCapability): UInt64;
|
|
1654
|
+
declare function availableCapacityFromMass(capacity: UInt64Type, cargoMass: UInt64Type): UInt64;
|
|
1655
|
+
declare function hasSpace$1(entity: StorageCapability, goodMass: UInt64, quantity: number): boolean;
|
|
1656
|
+
declare function hasSpaceForMass(capacity: UInt64Type, currentMass: UInt64Type, additionalMass: UInt64Type): boolean;
|
|
1657
|
+
declare function isFull$1(entity: HasCapacity & HasCargomass): boolean;
|
|
1658
|
+
declare function isFullFromMass(capacity: UInt64Type, cargoMass: UInt64Type): boolean;
|
|
1659
|
+
|
|
1660
|
+
declare class InventoryAccessor {
|
|
1661
|
+
private readonly entity;
|
|
1662
|
+
private _items?;
|
|
1663
|
+
constructor(entity: HasCargo);
|
|
1664
|
+
get items(): EntityInventory[];
|
|
1665
|
+
get totalMass(): UInt64;
|
|
1666
|
+
get totalValue(): UInt64;
|
|
1667
|
+
forGood(goodId: UInt64Type): EntityInventory | undefined;
|
|
1668
|
+
get sellable(): EntityInventory[];
|
|
1669
|
+
get hasSellable(): boolean;
|
|
1670
|
+
get sellableCount(): number;
|
|
1671
|
+
}
|
|
1672
|
+
declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
|
|
1673
|
+
|
|
1674
|
+
interface CargoData {
|
|
1675
|
+
cargo: EntityInventory[];
|
|
1676
|
+
}
|
|
1677
|
+
declare function totalCargoMass(cargo: EntityInventory[]): UInt64;
|
|
1678
|
+
declare function cargoValue(cargo: EntityInventory[]): UInt64;
|
|
1679
|
+
declare function getCargoForGood(cargo: EntityInventory[], goodId: UInt64Type): EntityInventory | undefined;
|
|
1680
|
+
declare function hasSpace(currentMass: UInt64, maxCapacity: UInt64, goodMass: UInt64, quantity: number): boolean;
|
|
1681
|
+
declare function availableCapacity(currentMass: UInt64, maxCapacity: UInt64): UInt64;
|
|
1682
|
+
declare function isFull(currentMass: UInt64, maxCapacity: UInt64): boolean;
|
|
1683
|
+
interface SaleValue {
|
|
1684
|
+
revenue: UInt64;
|
|
1685
|
+
profit: UInt64;
|
|
1686
|
+
cost: UInt64;
|
|
1687
|
+
}
|
|
1688
|
+
declare function calculateSaleValue(cargo: Types.cargo_item[], prices: Map<number, UInt64>): SaleValue;
|
|
1689
|
+
declare function calculateSaleValueFromArray(cargo: Types.cargo_item[], prices: UInt64[]): SaleValue;
|
|
1690
|
+
declare function afterSellGoods(cargo: Types.cargo_item[], goodsToSell: Array<{
|
|
1691
|
+
goodId: number;
|
|
1692
|
+
quantity: number;
|
|
1693
|
+
}>): EntityInventory[];
|
|
1694
|
+
declare function afterSellAllGoods(cargo: Types.cargo_item[]): EntityInventory[];
|
|
641
1695
|
|
|
642
|
-
|
|
1696
|
+
type cargoUtils_CargoData = CargoData;
|
|
1697
|
+
declare const cargoUtils_totalCargoMass: typeof totalCargoMass;
|
|
1698
|
+
declare const cargoUtils_cargoValue: typeof cargoValue;
|
|
1699
|
+
declare const cargoUtils_getCargoForGood: typeof getCargoForGood;
|
|
1700
|
+
declare const cargoUtils_hasSpace: typeof hasSpace;
|
|
1701
|
+
declare const cargoUtils_availableCapacity: typeof availableCapacity;
|
|
1702
|
+
declare const cargoUtils_isFull: typeof isFull;
|
|
1703
|
+
type cargoUtils_SaleValue = SaleValue;
|
|
1704
|
+
declare const cargoUtils_calculateSaleValue: typeof calculateSaleValue;
|
|
1705
|
+
declare const cargoUtils_calculateSaleValueFromArray: typeof calculateSaleValueFromArray;
|
|
1706
|
+
declare const cargoUtils_afterSellGoods: typeof afterSellGoods;
|
|
1707
|
+
declare const cargoUtils_afterSellAllGoods: typeof afterSellAllGoods;
|
|
1708
|
+
declare namespace cargoUtils {
|
|
1709
|
+
export {
|
|
1710
|
+
cargoUtils_CargoData as CargoData,
|
|
1711
|
+
cargoUtils_totalCargoMass as totalCargoMass,
|
|
1712
|
+
cargoUtils_cargoValue as cargoValue,
|
|
1713
|
+
cargoUtils_getCargoForGood as getCargoForGood,
|
|
1714
|
+
cargoUtils_hasSpace as hasSpace,
|
|
1715
|
+
cargoUtils_availableCapacity as availableCapacity,
|
|
1716
|
+
cargoUtils_isFull as isFull,
|
|
1717
|
+
cargoUtils_SaleValue as SaleValue,
|
|
1718
|
+
cargoUtils_calculateSaleValue as calculateSaleValue,
|
|
1719
|
+
cargoUtils_calculateSaleValueFromArray as calculateSaleValueFromArray,
|
|
1720
|
+
cargoUtils_afterSellGoods as afterSellGoods,
|
|
1721
|
+
cargoUtils_afterSellAllGoods as afterSellAllGoods,
|
|
1722
|
+
};
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
interface ShipStateInput {
|
|
1726
|
+
id: UInt64Type;
|
|
1727
|
+
owner: string;
|
|
1728
|
+
name: string;
|
|
1729
|
+
coordinates: CoordinatesType | {
|
|
1730
|
+
x: number;
|
|
1731
|
+
y: number;
|
|
1732
|
+
z?: number;
|
|
1733
|
+
};
|
|
1734
|
+
hullmass: number;
|
|
1735
|
+
capacity: number;
|
|
1736
|
+
energy: number;
|
|
1737
|
+
engines: Types.movement_stats;
|
|
1738
|
+
generator: Types.energy_stats;
|
|
1739
|
+
loaders: Types.loader_stats;
|
|
1740
|
+
schedule?: Types.schedule;
|
|
1741
|
+
cargo?: Types.cargo_item[];
|
|
1742
|
+
}
|
|
1743
|
+
declare class Ship extends Types.entity_info {
|
|
1744
|
+
private _sched?;
|
|
1745
|
+
private _inv?;
|
|
1746
|
+
get name(): string;
|
|
1747
|
+
get inv(): InventoryAccessor;
|
|
1748
|
+
get inventory(): EntityInventory[];
|
|
1749
|
+
get sched(): ScheduleAccessor;
|
|
643
1750
|
get maxDistance(): UInt32;
|
|
644
|
-
get
|
|
645
|
-
|
|
646
|
-
|
|
1751
|
+
get isIdle(): boolean;
|
|
1752
|
+
getFlightOrigin(flightTaskIndex: number): Coordinates;
|
|
1753
|
+
destinationLocation(): Coordinates | undefined;
|
|
1754
|
+
positionAt(now: Date): Coordinates;
|
|
1755
|
+
isInFlight(now: Date): boolean;
|
|
1756
|
+
isRecharging(now: Date): boolean;
|
|
1757
|
+
isLoading(now: Date): boolean;
|
|
1758
|
+
isUnloading(now: Date): boolean;
|
|
1759
|
+
isExtracting(now: Date): boolean;
|
|
1760
|
+
get hasExtractor(): boolean;
|
|
1761
|
+
project(): ProjectedEntity;
|
|
1762
|
+
projectAt(now: Date): ProjectedEntity;
|
|
1763
|
+
get location(): Location;
|
|
1764
|
+
get totalCargoMass(): UInt64;
|
|
1765
|
+
get cargoValue(): UInt64;
|
|
1766
|
+
get totalMass(): UInt64;
|
|
1767
|
+
get maxCapacity(): UInt64;
|
|
1768
|
+
hasSpace(goodMass: UInt64, quantity: number): boolean;
|
|
1769
|
+
get availableCapacity(): UInt64;
|
|
1770
|
+
getCargoForGood(goodId: UInt64Type): EntityInventory | undefined;
|
|
1771
|
+
get sellableCargo(): EntityInventory[];
|
|
1772
|
+
get hasSellableCargo(): boolean;
|
|
1773
|
+
get sellableGoodsCount(): number;
|
|
1774
|
+
get isFull(): boolean;
|
|
1775
|
+
get energyPercent(): number;
|
|
1776
|
+
get needsRecharge(): boolean;
|
|
1777
|
+
hasEnergyFor(distance: UInt64): boolean;
|
|
1778
|
+
calculateSaleValue(prices: Map<number, UInt64>): SaleValue;
|
|
1779
|
+
calculateSaleValueFromArray(prices: UInt64[]): SaleValue;
|
|
1780
|
+
afterSellGoods(goodsToSell: Array<{
|
|
1781
|
+
goodId: number;
|
|
1782
|
+
quantity: number;
|
|
1783
|
+
}>): EntityInventory[];
|
|
1784
|
+
afterSellAllGoods(): EntityInventory[];
|
|
647
1785
|
}
|
|
648
1786
|
|
|
649
|
-
|
|
650
|
-
|
|
1787
|
+
/**
|
|
1788
|
+
* Travel calculations for ship movement, energy usage, and flight times.
|
|
1789
|
+
*
|
|
1790
|
+
* Functions prefixed with `calc_` are contract-parity functions that mirror
|
|
1791
|
+
* the C++ implementation in the server contract (schedule.cpp, ship.cpp).
|
|
1792
|
+
* These use snake_case intentionally to match the contract naming convention
|
|
1793
|
+
* and signal that they must produce identical results to the on-chain code.
|
|
1794
|
+
*
|
|
1795
|
+
* Functions prefixed with `calculate` are higher-level SDK helpers that may
|
|
1796
|
+
* combine multiple contract calculations for convenience.
|
|
1797
|
+
*/
|
|
1798
|
+
|
|
1799
|
+
declare function calc_orbital_altitude(mass: number): number;
|
|
651
1800
|
declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
|
|
652
1801
|
declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
|
|
653
1802
|
declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
|
|
654
1803
|
declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
|
|
655
1804
|
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
1805
|
declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
|
|
659
|
-
declare function calc_ship_rechargetime(ship:
|
|
660
|
-
declare function calc_ship_loadtime(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt32;
|
|
1806
|
+
declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
|
|
661
1807
|
declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
|
|
662
|
-
declare function calc_loader_flighttime(ship:
|
|
663
|
-
declare function calc_loader_acceleration(ship:
|
|
664
|
-
declare function calc_ship_flighttime(ship:
|
|
665
|
-
declare function calc_ship_acceleration(ship:
|
|
1808
|
+
declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
|
|
1809
|
+
declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
|
|
1810
|
+
declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
|
|
1811
|
+
declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
|
|
666
1812
|
declare function calc_acceleration(thrust: number, mass: number): number;
|
|
667
|
-
declare function calc_ship_mass(ship:
|
|
1813
|
+
declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
|
|
668
1814
|
declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
|
|
1815
|
+
declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
|
|
1816
|
+
declare function calculateRefuelingTime(ship: ShipLike): UInt32;
|
|
1817
|
+
declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
|
|
1818
|
+
interface LoadTimeBreakdown {
|
|
1819
|
+
unloadTime: number;
|
|
1820
|
+
loadTime: number;
|
|
1821
|
+
totalTime: number;
|
|
1822
|
+
unloadMass: number;
|
|
1823
|
+
loadMass: number;
|
|
1824
|
+
}
|
|
1825
|
+
declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
|
|
1826
|
+
interface EstimatedTravelTime {
|
|
1827
|
+
flightTime: UInt32;
|
|
1828
|
+
rechargeTime: UInt32;
|
|
1829
|
+
loadTime: UInt32;
|
|
1830
|
+
unloadTime: UInt32;
|
|
1831
|
+
total: UInt32;
|
|
1832
|
+
}
|
|
1833
|
+
interface EstimateTravelTimeOptions {
|
|
1834
|
+
needsRecharge?: boolean;
|
|
1835
|
+
loadMass?: UInt32Type;
|
|
1836
|
+
unloadMass?: UInt32Type;
|
|
1837
|
+
}
|
|
1838
|
+
declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
|
|
1839
|
+
declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
|
|
1840
|
+
declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
|
|
1841
|
+
interface TransferEntity {
|
|
1842
|
+
location: {
|
|
1843
|
+
z?: {
|
|
1844
|
+
toNumber(): number;
|
|
1845
|
+
} | number;
|
|
1846
|
+
};
|
|
1847
|
+
loaders?: {
|
|
1848
|
+
thrust: {
|
|
1849
|
+
toNumber(): number;
|
|
1850
|
+
} | number;
|
|
1851
|
+
mass: {
|
|
1852
|
+
toNumber(): number;
|
|
1853
|
+
} | number;
|
|
1854
|
+
quantity: {
|
|
1855
|
+
toNumber(): number;
|
|
1856
|
+
} | number;
|
|
1857
|
+
};
|
|
1858
|
+
}
|
|
1859
|
+
interface HasScheduleAndLocation {
|
|
1860
|
+
coordinates: ActionParams.Type.coordinates;
|
|
1861
|
+
schedule?: Types.schedule;
|
|
1862
|
+
}
|
|
1863
|
+
declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
|
|
1864
|
+
declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
|
|
1865
|
+
declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
|
|
1866
|
+
declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
|
|
1867
|
+
|
|
1868
|
+
/**
|
|
1869
|
+
* Trading deal interface representing a profitable trade opportunity
|
|
1870
|
+
*/
|
|
1871
|
+
interface Deal {
|
|
1872
|
+
/** Origin location */
|
|
1873
|
+
origin: Location;
|
|
1874
|
+
/** Destination location */
|
|
1875
|
+
destination: Location;
|
|
1876
|
+
/** Good to trade */
|
|
1877
|
+
good: GoodPrice;
|
|
1878
|
+
/** Distance between origin and destination */
|
|
1879
|
+
distance: UInt64;
|
|
1880
|
+
/** Available supply at origin */
|
|
1881
|
+
supply: UInt16;
|
|
1882
|
+
/** Buy price at origin */
|
|
1883
|
+
buyPrice: UInt32;
|
|
1884
|
+
/** Sell price at destination */
|
|
1885
|
+
sellPrice: UInt32;
|
|
1886
|
+
/** Profit per unit */
|
|
1887
|
+
profitPerUnit: UInt32;
|
|
1888
|
+
/** Maximum quantity that can be traded */
|
|
1889
|
+
maxQuantity: UInt32;
|
|
1890
|
+
/** Total profit for max quantity */
|
|
1891
|
+
totalProfit: Int64;
|
|
1892
|
+
/** Estimated travel time in seconds */
|
|
1893
|
+
travelTime: UInt32;
|
|
1894
|
+
/** Detailed breakdown of travel time components */
|
|
1895
|
+
travelTimeBreakdown: EstimatedTravelTime;
|
|
1896
|
+
/** Profit per second (floating point for UI display) */
|
|
1897
|
+
profitPerSecond: number;
|
|
1898
|
+
/** Profit margin percentage (floating point for UI display) */
|
|
1899
|
+
marginPercent: number;
|
|
1900
|
+
}
|
|
1901
|
+
/**
|
|
1902
|
+
* Options for finding deals
|
|
1903
|
+
*/
|
|
1904
|
+
interface FindDealsOptions {
|
|
1905
|
+
/** Maximum number of deals to return */
|
|
1906
|
+
maxDeals?: number;
|
|
1907
|
+
/** Maximum search distance */
|
|
1908
|
+
maxDistance?: number;
|
|
1909
|
+
/** Player's current balance (for affordability filtering) */
|
|
1910
|
+
playerBalance?: UInt64Type;
|
|
1911
|
+
/** Minimum profit per second threshold */
|
|
1912
|
+
minProfitPerSecond?: number;
|
|
1913
|
+
/** Minimum profit margin percentage */
|
|
1914
|
+
minMarginPercent?: number;
|
|
1915
|
+
/** Override available cargo space (in mass units). If provided, uses this instead of calculating from ship's current cargo. */
|
|
1916
|
+
availableSpace?: number;
|
|
1917
|
+
}
|
|
1918
|
+
/**
|
|
1919
|
+
* Calculate deals for a ship from a specific origin location
|
|
1920
|
+
*/
|
|
1921
|
+
declare function findDealsForShip(ship: Ship, originLocation: Coordinates, getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>, getMarketPrices: (location: Coordinates) => Promise<GoodPrice[]>, options?: FindDealsOptions): Promise<Deal[]>;
|
|
1922
|
+
/**
|
|
1923
|
+
* Find the single best deal for a ship from a specific origin location
|
|
1924
|
+
*/
|
|
1925
|
+
declare function findBestDeal(ship: Ship, originLocation: Coordinates, getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>, getMarketPrices: (location: Coordinates) => Promise<GoodPrice[]>, options?: FindDealsOptions): Promise<Deal | undefined>;
|
|
1926
|
+
|
|
1927
|
+
/**
|
|
1928
|
+
* Types of collect actions available to the player
|
|
1929
|
+
*/
|
|
1930
|
+
type CollectActionType = 'sell-and-trade' | 'sell-and-reposition' | 'travel-to-sell' | 'sell-and-stay' | 'explore' | 'orbit';
|
|
1931
|
+
/**
|
|
1932
|
+
* Represents a single collect option presented to the player
|
|
1933
|
+
*/
|
|
1934
|
+
interface CollectOption {
|
|
1935
|
+
/** Unique identifier for this option */
|
|
1936
|
+
id: string;
|
|
1937
|
+
/** Type of action sequence */
|
|
1938
|
+
type: CollectActionType;
|
|
1939
|
+
/** Human-readable title */
|
|
1940
|
+
title: string;
|
|
1941
|
+
/** Detailed description of what will happen */
|
|
1942
|
+
description: string;
|
|
1943
|
+
/** Brief explanation of why this option is worth considering */
|
|
1944
|
+
reason: string;
|
|
1945
|
+
/** Whether this is the recommended option (best profitPerSecond with quality threshold) */
|
|
1946
|
+
recommended: boolean;
|
|
1947
|
+
/** Whether this option has the highest absolute profit (may differ from recommended) */
|
|
1948
|
+
highestProfit: boolean;
|
|
1949
|
+
/** Estimated profit/loss from this action */
|
|
1950
|
+
estimatedProfit: UInt64;
|
|
1951
|
+
/** Revenue from selling cargo (if applicable) */
|
|
1952
|
+
saleRevenue?: UInt64;
|
|
1953
|
+
/** Cost of purchasing new cargo (if applicable) */
|
|
1954
|
+
purchaseCost?: UInt64;
|
|
1955
|
+
/** Expected profit from the next trade (if applicable) */
|
|
1956
|
+
nextTradeProfit?: UInt64;
|
|
1957
|
+
/** Profit per second for this option (floating point for display) */
|
|
1958
|
+
profitPerSecond?: number;
|
|
1959
|
+
/** Margin percentage for the deal (floating point for display) */
|
|
1960
|
+
marginPercent?: number;
|
|
1961
|
+
/** Destination location (if traveling) */
|
|
1962
|
+
destination?: Location;
|
|
1963
|
+
/** Deal to execute (if buying goods) */
|
|
1964
|
+
deal?: Deal;
|
|
1965
|
+
/** Sale location if different from current */
|
|
1966
|
+
saleLocation?: Location;
|
|
1967
|
+
/** Price per unit at sale location */
|
|
1968
|
+
salePrice?: UInt32;
|
|
1969
|
+
/** Price per unit at current location (for comparison) */
|
|
1970
|
+
currentPrice?: UInt32;
|
|
1971
|
+
/** Estimated travel time in seconds (undefined = instant/no travel) */
|
|
1972
|
+
travelTime?: UInt32;
|
|
1973
|
+
/** Detailed breakdown of travel time components */
|
|
1974
|
+
travelTimeBreakdown?: EstimatedTravelTime;
|
|
1975
|
+
/** Info about a discounted good at the destination (for explore options) */
|
|
1976
|
+
discountedGood?: DiscountedGoodInfo;
|
|
1977
|
+
/** Top potential deals available at destination (for explore options) */
|
|
1978
|
+
potentialDeals?: PotentialDeal[];
|
|
1979
|
+
/** Details of cargo being sold (if selling cargo) */
|
|
1980
|
+
cargoSale?: CargoSaleItem[];
|
|
1981
|
+
/** Total profit/loss from selling cargo */
|
|
1982
|
+
cargoProfitLoss?: Int64;
|
|
1983
|
+
}
|
|
1984
|
+
/**
|
|
1985
|
+
* Analysis result for collect options
|
|
1986
|
+
*/
|
|
1987
|
+
interface CollectAnalysis {
|
|
1988
|
+
/** Current location where ship arrived */
|
|
1989
|
+
arrivedAt: Coordinates;
|
|
1990
|
+
/** Ship being analyzed */
|
|
1991
|
+
ship: Ship;
|
|
1992
|
+
/** Current cargo on ship */
|
|
1993
|
+
cargo: EntityInventory[];
|
|
1994
|
+
/** Value of cargo if sold at current location */
|
|
1995
|
+
cargoValueHere: UInt64;
|
|
1996
|
+
/** All available options, sorted by estimated profit */
|
|
1997
|
+
options: CollectOption[];
|
|
1998
|
+
/** Whether any profitable options exist */
|
|
1999
|
+
hasProfitableOptions: boolean;
|
|
2000
|
+
}
|
|
2001
|
+
/**
|
|
2002
|
+
* Options for analyzing collect choices
|
|
2003
|
+
*/
|
|
2004
|
+
interface CollectAnalysisOptions {
|
|
2005
|
+
/** Player's current balance (defaults to Infinity) */
|
|
2006
|
+
playerBalance?: number;
|
|
2007
|
+
/** Maximum distance to search (defaults to ship's max range) */
|
|
2008
|
+
maxDistance?: number;
|
|
2009
|
+
/** Minimum profit improvement to suggest traveling elsewhere to sell */
|
|
2010
|
+
minSaleImprovement?: number;
|
|
2011
|
+
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Find locations where current cargo could be sold for more
|
|
2014
|
+
*/
|
|
2015
|
+
interface BetterSaleLocation {
|
|
2016
|
+
location: Location;
|
|
2017
|
+
/** Price per unit at this location */
|
|
2018
|
+
price: UInt32;
|
|
2019
|
+
/** Total revenue if sold here */
|
|
2020
|
+
revenue: UInt64;
|
|
2021
|
+
/** Difference vs selling at current location */
|
|
2022
|
+
improvement: Int64;
|
|
2023
|
+
/** Best deal available at this location after selling */
|
|
2024
|
+
bestDealAfterSale?: Deal;
|
|
2025
|
+
/** Distance to this location */
|
|
2026
|
+
distance: UInt64;
|
|
2027
|
+
/** Estimated travel time */
|
|
2028
|
+
travelTime: UInt32;
|
|
2029
|
+
/** Detailed breakdown of travel time components */
|
|
2030
|
+
travelTimeBreakdown?: EstimatedTravelTime;
|
|
2031
|
+
}
|
|
2032
|
+
/**
|
|
2033
|
+
* Find locations with good deals when current location has none
|
|
2034
|
+
*/
|
|
2035
|
+
interface RepositionLocation {
|
|
2036
|
+
location: Location;
|
|
2037
|
+
/** Best deal available at this location */
|
|
2038
|
+
bestDeal: Deal;
|
|
2039
|
+
/** Distance to this location */
|
|
2040
|
+
distance: UInt64;
|
|
2041
|
+
/** Estimated travel time */
|
|
2042
|
+
travelTime: UInt32;
|
|
2043
|
+
/** Detailed breakdown of travel time components */
|
|
2044
|
+
travelTimeBreakdown?: EstimatedTravelTime;
|
|
2045
|
+
}
|
|
2046
|
+
/**
|
|
2047
|
+
* Analyze cargo sale value at a specific location
|
|
2048
|
+
*/
|
|
2049
|
+
declare function analyzeCargoSale(cargo: EntityInventory[], prices: Map<number, UInt64>): {
|
|
2050
|
+
revenue: UInt64;
|
|
2051
|
+
cost: UInt64;
|
|
2052
|
+
profit: Int64;
|
|
2053
|
+
};
|
|
2054
|
+
/**
|
|
2055
|
+
* Create a "Sell & Trade" option (full loop)
|
|
2056
|
+
*/
|
|
2057
|
+
declare function createSellAndTradeOption(saleRevenue: UInt64, saleCost: UInt64, deal: Deal, cargoSale?: CargoSaleItem[], unloadTime?: UInt32): CollectOption;
|
|
2058
|
+
/**
|
|
2059
|
+
* Create a "Travel to Sell" option (better market elsewhere)
|
|
2060
|
+
*/
|
|
2061
|
+
declare function createTravelToSellOption(currentRevenue: UInt64, cargoCost: UInt64, betterSale: BetterSaleLocation, cargo: EntityInventory[], destPrices?: Map<number, UInt64>): CollectOption;
|
|
2062
|
+
/**
|
|
2063
|
+
* Create a "Sell & Reposition" option (sell here, travel empty to deals)
|
|
2064
|
+
*/
|
|
2065
|
+
declare function createSellAndRepositionOption(saleRevenue: UInt64, saleCost: UInt64, reposition: RepositionLocation, cargoSale?: CargoSaleItem[]): CollectOption;
|
|
2066
|
+
/**
|
|
2067
|
+
* Create a "Sell & Stay" option (just sell, stay idle)
|
|
2068
|
+
*/
|
|
2069
|
+
declare function createSellAndStayOption(saleRevenue: UInt64, saleCost: UInt64, cargoSale?: CargoSaleItem[], unloadTime?: UInt32): CollectOption;
|
|
2070
|
+
/**
|
|
2071
|
+
* Details about a cargo item being sold
|
|
2072
|
+
*/
|
|
2073
|
+
interface CargoSaleItem {
|
|
2074
|
+
goodId: UInt16;
|
|
2075
|
+
goodName: string;
|
|
2076
|
+
quantity: UInt32;
|
|
2077
|
+
/** Price per unit at sale location */
|
|
2078
|
+
pricePerUnit: UInt32;
|
|
2079
|
+
/** Total revenue from this item */
|
|
2080
|
+
revenue: UInt64;
|
|
2081
|
+
/** Original cost (paid) per unit */
|
|
2082
|
+
costPerUnit: UInt64;
|
|
2083
|
+
/** Profit/loss on this item */
|
|
2084
|
+
profit: Int64;
|
|
2085
|
+
}
|
|
2086
|
+
/**
|
|
2087
|
+
* Info about a discounted good for explore options
|
|
2088
|
+
*/
|
|
2089
|
+
interface DiscountedGoodInfo {
|
|
2090
|
+
goodId: number;
|
|
2091
|
+
name: string;
|
|
2092
|
+
rarity: string;
|
|
2093
|
+
discountPercent: number;
|
|
2094
|
+
}
|
|
2095
|
+
/**
|
|
2096
|
+
* A potential deal available at a destination (for explore options)
|
|
2097
|
+
*/
|
|
2098
|
+
interface PotentialDeal {
|
|
2099
|
+
goodId: number;
|
|
2100
|
+
goodName: string;
|
|
2101
|
+
destinationCoords: Coordinates;
|
|
2102
|
+
marginPercent: number;
|
|
2103
|
+
profitPerSecond: number;
|
|
2104
|
+
}
|
|
2105
|
+
/**
|
|
2106
|
+
* Create an "Explore" option (travel to find opportunities)
|
|
2107
|
+
*/
|
|
2108
|
+
declare function createExploreOption(destination: Location, travelTime?: UInt32, discountedGood?: DiscountedGoodInfo, travelTimeBreakdown?: EstimatedTravelTime, potentialDeals?: PotentialDeal[]): CollectOption;
|
|
2109
|
+
/**
|
|
2110
|
+
* Callbacks for collect analysis (provided by manager)
|
|
2111
|
+
*/
|
|
2112
|
+
interface CollectAnalysisCallbacks {
|
|
2113
|
+
getNearbyLocations: (origin: Coordinates, maxDistance: number) => Promise<Location[]>;
|
|
2114
|
+
getMarketPrices: (location: Coordinates) => Promise<GoodPrice[]>;
|
|
2115
|
+
getGameSeed?: () => Checksum256Type;
|
|
2116
|
+
getState?: () => Types.state_row;
|
|
2117
|
+
}
|
|
2118
|
+
/**
|
|
2119
|
+
* Analyze all collect options for a ship that has arrived at its destination.
|
|
2120
|
+
* Returns all available options sorted by estimated profit.
|
|
2121
|
+
*/
|
|
2122
|
+
declare function analyzeCollectOptions(ship: Ship, arrivedAt: Coordinates, callbacks: CollectAnalysisCallbacks, options?: CollectAnalysisOptions): Promise<CollectAnalysis>;
|
|
2123
|
+
|
|
2124
|
+
declare class TradesManager extends BaseManager {
|
|
2125
|
+
private priceCache;
|
|
2126
|
+
private priceCacheEpoch;
|
|
2127
|
+
private makePriceCacheKey;
|
|
2128
|
+
private createCallbacks;
|
|
2129
|
+
clearPriceCache(): void;
|
|
2130
|
+
findDeals(ship: Ship, originLocation?: Coordinates, options?: FindDealsOptions): Promise<Deal[]>;
|
|
2131
|
+
findBestDeal(ship: Ship, originLocation?: Coordinates, options?: FindDealsOptions): Promise<Deal | undefined>;
|
|
2132
|
+
getCollectOptions(ship: Ship, arrivedAt?: Coordinates, options?: CollectAnalysisOptions): Promise<CollectAnalysis>;
|
|
2133
|
+
}
|
|
2134
|
+
|
|
2135
|
+
declare class EpochsManager extends BaseManager {
|
|
2136
|
+
getCurrentHeight(): Promise<UInt64>;
|
|
2137
|
+
getCurrent(): Promise<EpochInfo>;
|
|
2138
|
+
getByHeight(height: UInt64Type): Promise<EpochInfo>;
|
|
2139
|
+
getTimeRemaining(): Promise<number>;
|
|
2140
|
+
getProgress(): Promise<number>;
|
|
2141
|
+
fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
|
|
2142
|
+
}
|
|
2143
|
+
|
|
2144
|
+
interface SellableCargo {
|
|
2145
|
+
good_id: {
|
|
2146
|
+
toNumber(): number;
|
|
2147
|
+
} | number;
|
|
2148
|
+
quantity: {
|
|
2149
|
+
toNumber(): number;
|
|
2150
|
+
} | number;
|
|
2151
|
+
hasCargo: boolean;
|
|
2152
|
+
}
|
|
2153
|
+
type EntityRefInput = {
|
|
2154
|
+
entityType: EntityTypeName;
|
|
2155
|
+
entityId: UInt64Type;
|
|
2156
|
+
};
|
|
2157
|
+
declare class ActionsManager extends BaseManager {
|
|
2158
|
+
travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
|
|
2159
|
+
grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
|
|
2160
|
+
resolve(entityId: UInt64Type, entityType?: EntityTypeName): Action;
|
|
2161
|
+
cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
|
|
2162
|
+
recharge(shipId: UInt64Type): Action;
|
|
2163
|
+
transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type): Action;
|
|
2164
|
+
buyGoods(entityId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type, entityType?: EntityTypeName): Action;
|
|
2165
|
+
sellGoods(entityId: UInt64Type, goodId: UInt64Type, quantity: UInt64Type, entityType?: EntityTypeName): Action;
|
|
2166
|
+
buyShip(account: NameType, name: string): Action;
|
|
2167
|
+
buyWarehouse(account: NameType, shipId: UInt64Type, name: string): Action;
|
|
2168
|
+
buyContainer(account: NameType, shipId: UInt64Type, name: string): Action;
|
|
2169
|
+
takeLoan(account: NameType, amount: UInt64Type): Action;
|
|
2170
|
+
payLoan(account: NameType, amount: UInt64Type): Action;
|
|
2171
|
+
foundCompany(account: NameType, name: string): Action;
|
|
2172
|
+
join(account: NameType): Action;
|
|
2173
|
+
extract(shipId: UInt64Type): Action;
|
|
2174
|
+
joinGame(account: NameType, companyName: string): Action[];
|
|
2175
|
+
sellAllCargo(ship: Ship | UInt64Type, cargo?: SellableCargo[]): Action[];
|
|
2176
|
+
}
|
|
2177
|
+
|
|
2178
|
+
declare class GameContext {
|
|
2179
|
+
readonly client: APIClient;
|
|
2180
|
+
readonly server: Contract$2;
|
|
2181
|
+
readonly platform: Contract$2;
|
|
2182
|
+
private _entities?;
|
|
2183
|
+
private _players?;
|
|
2184
|
+
private _locations?;
|
|
2185
|
+
private _trades?;
|
|
2186
|
+
private _epochs?;
|
|
2187
|
+
private _actions?;
|
|
2188
|
+
private _gameCache?;
|
|
2189
|
+
private _stateCache?;
|
|
2190
|
+
constructor(client: APIClient, server: Contract$2, platform: Contract$2);
|
|
2191
|
+
get entities(): EntitiesManager;
|
|
2192
|
+
get players(): PlayersManager;
|
|
2193
|
+
get locations(): LocationsManager;
|
|
2194
|
+
get trades(): TradesManager;
|
|
2195
|
+
get epochs(): EpochsManager;
|
|
2196
|
+
get actions(): ActionsManager;
|
|
2197
|
+
getGame(reload?: boolean): Promise<Types$1.game_row>;
|
|
2198
|
+
getState(reload?: boolean): Promise<GameState>;
|
|
2199
|
+
get cachedGame(): Types$1.game_row | undefined;
|
|
2200
|
+
get cachedState(): GameState | undefined;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
declare abstract class BaseManager {
|
|
2204
|
+
protected readonly context: GameContext;
|
|
2205
|
+
constructor(context: GameContext);
|
|
2206
|
+
protected get client(): _wharfkit_antelope.APIClient;
|
|
2207
|
+
protected get server(): _wharfkit_contract.Contract;
|
|
2208
|
+
protected get platform(): _wharfkit_contract.Contract;
|
|
2209
|
+
protected getGame(): Promise<Types$1.game_row>;
|
|
2210
|
+
protected getState(): Promise<GameState>;
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
interface WarehouseStateInput {
|
|
2214
|
+
id: UInt64Type;
|
|
2215
|
+
owner: string;
|
|
2216
|
+
name: string;
|
|
2217
|
+
coordinates: CoordinatesType | {
|
|
2218
|
+
x: number;
|
|
2219
|
+
y: number;
|
|
2220
|
+
z?: number;
|
|
2221
|
+
};
|
|
2222
|
+
capacity: number;
|
|
2223
|
+
loaders: Types.loader_stats;
|
|
2224
|
+
schedule?: Types.schedule;
|
|
2225
|
+
cargo?: Types.cargo_item[];
|
|
2226
|
+
}
|
|
2227
|
+
declare class Warehouse extends Types.entity_info {
|
|
2228
|
+
private _sched?;
|
|
2229
|
+
private _inv?;
|
|
2230
|
+
get name(): string;
|
|
2231
|
+
get inv(): InventoryAccessor;
|
|
2232
|
+
get inventory(): EntityInventory[];
|
|
2233
|
+
get sched(): ScheduleAccessor;
|
|
2234
|
+
get isIdle(): boolean;
|
|
2235
|
+
isLoading(now: Date): boolean;
|
|
2236
|
+
isUnloading(now: Date): boolean;
|
|
2237
|
+
get location(): Location;
|
|
2238
|
+
get totalCargoMass(): UInt64;
|
|
2239
|
+
get cargoValue(): UInt64;
|
|
2240
|
+
get maxCapacity(): UInt64;
|
|
2241
|
+
get availableCapacity(): UInt64;
|
|
2242
|
+
hasSpace(goodMass: UInt64, quantity: number): boolean;
|
|
2243
|
+
get isFull(): boolean;
|
|
2244
|
+
getCargoForGood(goodId: UInt64Type): EntityInventory | undefined;
|
|
2245
|
+
get orbitalAltitude(): number;
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2248
|
+
interface ContainerStateInput {
|
|
2249
|
+
id: UInt64Type;
|
|
2250
|
+
owner: string;
|
|
2251
|
+
name: string;
|
|
2252
|
+
coordinates: CoordinatesType | {
|
|
2253
|
+
x: number;
|
|
2254
|
+
y: number;
|
|
2255
|
+
z?: number;
|
|
2256
|
+
};
|
|
2257
|
+
hullmass: number;
|
|
2258
|
+
capacity: number;
|
|
2259
|
+
cargomass?: number;
|
|
2260
|
+
schedule?: Types.schedule;
|
|
2261
|
+
}
|
|
2262
|
+
declare class Container extends Types.entity_info {
|
|
2263
|
+
private _sched?;
|
|
2264
|
+
get name(): string;
|
|
2265
|
+
get sched(): ScheduleAccessor;
|
|
2266
|
+
get isIdle(): boolean;
|
|
2267
|
+
isLoading(now: Date): boolean;
|
|
2268
|
+
isUnloading(now: Date): boolean;
|
|
2269
|
+
get location(): Location;
|
|
2270
|
+
get totalMass(): UInt64;
|
|
2271
|
+
get maxCapacity(): UInt64;
|
|
2272
|
+
get availableCapacity(): UInt64;
|
|
2273
|
+
hasSpace(additionalMass: UInt64): boolean;
|
|
2274
|
+
get isFull(): boolean;
|
|
2275
|
+
get orbitalAltitude(): number;
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
type EntityType = 'ship' | 'warehouse' | 'container' | 'location';
|
|
2279
|
+
declare class EntitiesManager extends BaseManager {
|
|
2280
|
+
getEntity(type: EntityType, id: UInt64Type): Promise<Ship | Warehouse | Container>;
|
|
2281
|
+
getEntities(owner: NameType | Types.player_row, type?: EntityType): Promise<(Ship | Warehouse | Container)[]>;
|
|
2282
|
+
getSummaries(owner: NameType | Types.player_row, type?: EntityType): Promise<Types.entity_summary[]>;
|
|
2283
|
+
getShip(id: UInt64Type): Promise<Ship>;
|
|
2284
|
+
getWarehouse(id: UInt64Type): Promise<Warehouse>;
|
|
2285
|
+
getContainer(id: UInt64Type): Promise<Container>;
|
|
2286
|
+
getShips(owner: NameType | Types.player_row): Promise<Ship[]>;
|
|
2287
|
+
getWarehouses(owner: NameType | Types.player_row): Promise<Warehouse[]>;
|
|
2288
|
+
getContainers(owner: NameType | Types.player_row): Promise<Container[]>;
|
|
2289
|
+
getShipSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
|
|
2290
|
+
getWarehouseSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
|
|
2291
|
+
getContainerSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
|
|
2292
|
+
private wrapEntity;
|
|
2293
|
+
private resolveOwner;
|
|
2294
|
+
}
|
|
669
2295
|
|
|
670
2296
|
interface ShiploadOptions {
|
|
671
2297
|
platformContractName?: string;
|
|
@@ -677,26 +2303,186 @@ interface ShiploadConstructorOptions extends ShiploadOptions {
|
|
|
677
2303
|
serverContract?: Contract$2;
|
|
678
2304
|
}
|
|
679
2305
|
declare class Shipload {
|
|
680
|
-
|
|
681
|
-
server: Contract$2;
|
|
682
|
-
platform: Contract$2;
|
|
683
|
-
game: Types$1.game_row | undefined;
|
|
2306
|
+
private readonly _context;
|
|
684
2307
|
constructor(chain: ChainDefinition, constructorOptions?: ShiploadConstructorOptions);
|
|
685
2308
|
static load(chain: ChainDefinition, shiploadOptions?: ShiploadOptions): Promise<Shipload>;
|
|
2309
|
+
get client(): APIClient;
|
|
2310
|
+
get server(): Contract$2;
|
|
2311
|
+
get platform(): Contract$2;
|
|
2312
|
+
get entities(): EntitiesManager;
|
|
2313
|
+
get players(): PlayersManager;
|
|
2314
|
+
get locations(): LocationsManager;
|
|
2315
|
+
get trades(): TradesManager;
|
|
2316
|
+
get epochs(): EpochsManager;
|
|
2317
|
+
get actions(): ActionsManager;
|
|
686
2318
|
getGame(reload?: boolean): Promise<Types$1.game_row>;
|
|
687
|
-
getState(): Promise<
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
2319
|
+
getState(reload?: boolean): Promise<GameState>;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
declare function makeShip(state: ShipStateInput): Ship;
|
|
2323
|
+
declare function makeWarehouse(state: WarehouseStateInput): Warehouse;
|
|
2324
|
+
declare function makeContainer(state: ContainerStateInput): Container;
|
|
2325
|
+
|
|
2326
|
+
declare const goodIds: number[];
|
|
2327
|
+
declare function getGood(goodId: UInt16Type): Good;
|
|
2328
|
+
declare function getGoods(): Good[];
|
|
2329
|
+
|
|
2330
|
+
declare enum Rarities {
|
|
2331
|
+
legendary = "LEGENDARY",
|
|
2332
|
+
epic = "EPIC",
|
|
2333
|
+
rare = "RARE",
|
|
2334
|
+
uncommon = "UNCOMMON",
|
|
2335
|
+
common = "COMMON",
|
|
2336
|
+
trash = "TRASH"
|
|
2337
|
+
}
|
|
2338
|
+
interface Rarity {
|
|
2339
|
+
rarity: Rarities;
|
|
2340
|
+
minMultiplier: number;
|
|
2341
|
+
maxMultiplier: number;
|
|
2342
|
+
}
|
|
2343
|
+
declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: CoordinatesType, goodId: UInt16Type): Rarity;
|
|
2344
|
+
declare function marketPrice(location: ActionParams.Type.coordinates, goodId: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice;
|
|
2345
|
+
declare function marketPrices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice[];
|
|
2346
|
+
|
|
2347
|
+
declare function getLocationType(gameSeed: Checksum256Type, coordinates: CoordinatesType): LocationType;
|
|
2348
|
+
declare function isExtractableLocation(locationType: LocationType): boolean;
|
|
2349
|
+
declare function getSystemName(gameSeed: Checksum256Type, location: CoordinatesType): string;
|
|
2350
|
+
declare function hasSystem(gameSeed: Checksum256Type, coordinates: CoordinatesType): boolean;
|
|
2351
|
+
declare function deriveLocationStatic(gameSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_static;
|
|
2352
|
+
declare function deriveLocationEpoch(epochSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_epoch;
|
|
2353
|
+
declare function deriveLocation(gameSeed: Checksum256Type, epochSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_derived;
|
|
2354
|
+
declare function deriveLocationMixture(location: Types.location_derived, epochSeed: Checksum256Type): Types.mixture_info;
|
|
2355
|
+
|
|
2356
|
+
declare function hash(seed: Checksum256Type, string: string): Checksum256;
|
|
2357
|
+
declare function hash512(seed: Checksum256Type, string: string): Checksum512;
|
|
2358
|
+
|
|
2359
|
+
/**
|
|
2360
|
+
* Trade calculation result
|
|
2361
|
+
*/
|
|
2362
|
+
interface TradeCalculation {
|
|
2363
|
+
maxQuantity: number;
|
|
2364
|
+
totalCost: number;
|
|
2365
|
+
totalMass: UInt64;
|
|
2366
|
+
affordableQuantity: number;
|
|
2367
|
+
spaceForQuantity: number;
|
|
2368
|
+
}
|
|
2369
|
+
/**
|
|
2370
|
+
* Calculate updated weighted average cargo cost after purchase.
|
|
2371
|
+
* Matches contract logic: (paid * owned + cost) / (owned + quantity)
|
|
2372
|
+
*
|
|
2373
|
+
* @param currentPaid - Current average cost per unit (from cargo.paid)
|
|
2374
|
+
* @param currentOwned - Current owned quantity
|
|
2375
|
+
* @param purchaseCost - Total cost of new purchase (price * quantity)
|
|
2376
|
+
* @param purchaseQuantity - Quantity being purchased
|
|
2377
|
+
* @returns New weighted average cost per unit
|
|
2378
|
+
*
|
|
2379
|
+
* @example
|
|
2380
|
+
* // Owned 10 units at 100 each, buying 5 more at 120 each
|
|
2381
|
+
* const newPaid = calculateUpdatedCargoCost(
|
|
2382
|
+
* UInt64.from(100),
|
|
2383
|
+
* UInt32.from(10),
|
|
2384
|
+
* UInt64.from(600),
|
|
2385
|
+
* UInt32.from(5)
|
|
2386
|
+
* )
|
|
2387
|
+
* // Result: (100*10 + 600) / (10+5) = 106.67 per unit
|
|
2388
|
+
*/
|
|
2389
|
+
declare function calculateUpdatedCargoCost(currentPaid: UInt64, currentOwned: UInt32, purchaseCost: UInt64, purchaseQuantity: UInt32): UInt64;
|
|
2390
|
+
/**
|
|
2391
|
+
* Calculate the maximum quantity of a good a ship can buy
|
|
2392
|
+
* considering both space and player balance
|
|
2393
|
+
*/
|
|
2394
|
+
declare function calculateMaxTradeQuantity(ship: Ship, player: Player, goodPrice: GoodPrice): TradeCalculation;
|
|
2395
|
+
/**
|
|
2396
|
+
* Trade profit calculation result
|
|
2397
|
+
*/
|
|
2398
|
+
interface TradeProfitResult {
|
|
2399
|
+
revenue: UInt64;
|
|
2400
|
+
cost: UInt64;
|
|
2401
|
+
profit: Int64;
|
|
2402
|
+
margin: number;
|
|
2403
|
+
}
|
|
2404
|
+
/**
|
|
2405
|
+
* Calculate profit for a trade route
|
|
2406
|
+
*/
|
|
2407
|
+
declare function calculateTradeProfit(quantity: UInt32Type, buyPrice: UInt32Type, sellPrice: UInt32Type): TradeProfitResult;
|
|
2408
|
+
/**
|
|
2409
|
+
* Calculate profit per unit of mass
|
|
2410
|
+
*/
|
|
2411
|
+
declare function calculateProfitPerMass(quantity: number, buyPrice: number, sellPrice: number, massPerUnit: number): number;
|
|
2412
|
+
/**
|
|
2413
|
+
* Calculate profit per second for a trade route
|
|
2414
|
+
*/
|
|
2415
|
+
declare function calculateProfitPerSecond(profit: Int64Type, travelTimeSeconds: UInt32Type): number;
|
|
2416
|
+
/**
|
|
2417
|
+
* Find the best good to trade between two locations
|
|
2418
|
+
*/
|
|
2419
|
+
declare function findBestGoodToTrade(ship: Ship, player: Player, originPrices: GoodPrice[], destPrices: GoodPrice[], travelTimeSeconds: UInt32Type): {
|
|
2420
|
+
good: GoodPrice;
|
|
2421
|
+
quantity: number;
|
|
2422
|
+
profit: number;
|
|
2423
|
+
profitPerSecond: number;
|
|
2424
|
+
margin: number;
|
|
2425
|
+
} | null;
|
|
2426
|
+
/**
|
|
2427
|
+
* Calculate break-even price for selling cargo
|
|
2428
|
+
*/
|
|
2429
|
+
declare function calculateBreakEvenPrice(costPaid: number, quantity: number): number;
|
|
2430
|
+
/**
|
|
2431
|
+
* Check if a trade is profitable
|
|
2432
|
+
*/
|
|
2433
|
+
declare function isProfitable(buyPrice: UInt32Type, sellPrice: UInt32Type): boolean;
|
|
2434
|
+
/**
|
|
2435
|
+
* Calculate return on investment percentage
|
|
2436
|
+
*/
|
|
2437
|
+
declare function calculateROI(cost: number, profit: number): number;
|
|
2438
|
+
|
|
2439
|
+
interface Entity {
|
|
2440
|
+
id: UInt64;
|
|
2441
|
+
type: Name;
|
|
2442
|
+
owner: Name;
|
|
2443
|
+
entity_name: string;
|
|
2444
|
+
location: Coordinates | Types.coordinates;
|
|
2445
|
+
}
|
|
2446
|
+
type ShipEntity = Entity & MovementCapability & EnergyCapability & StorageCapability & LoaderCapability & MassCapability & ScheduleCapability & {
|
|
2447
|
+
trade?: Types.trade_stats;
|
|
2448
|
+
extractor?: Types.extractor_stats;
|
|
2449
|
+
};
|
|
2450
|
+
type WarehouseEntity = Entity & StorageCapability & LoaderCapability & ScheduleCapability;
|
|
2451
|
+
type ContainerEntity = Entity & StorageCapability & MassCapability & ScheduleCapability;
|
|
2452
|
+
type AnyEntity = ShipEntity | WarehouseEntity | ContainerEntity;
|
|
2453
|
+
|
|
2454
|
+
declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCapability;
|
|
2455
|
+
declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
|
|
2456
|
+
declare function hasStorage(e: Entity): e is Entity & StorageCapability;
|
|
2457
|
+
declare function hasLoaders(e: Entity): e is Entity & LoaderCapability;
|
|
2458
|
+
declare function hasTrade(e: Entity): e is Entity & TradeCapability;
|
|
2459
|
+
declare function hasMass(e: Entity): e is Entity & MassCapability;
|
|
2460
|
+
declare function hasSchedule(e: Entity): e is Entity & ScheduleCapability;
|
|
2461
|
+
declare function hasExtractor(e: Entity): e is Entity & ExtractorCapability;
|
|
2462
|
+
|
|
2463
|
+
declare function maxTravelDistance(entity: MovementCapability): UInt32;
|
|
2464
|
+
declare function calcEnergyUsage(entity: MovementCapability, distance: UInt64): UInt64;
|
|
2465
|
+
declare function energyPercent(entity: MovementCapability & EnergyCapability): number;
|
|
2466
|
+
declare function needsRecharge(entity: MovementCapability & EnergyCapability): boolean;
|
|
2467
|
+
|
|
2468
|
+
declare function calcLoadDuration(entity: LoaderCapability, cargoMass: UInt64): UInt32;
|
|
2469
|
+
|
|
2470
|
+
declare function calc_extraction_duration(extractor: Types.extractor_stats, loaders: Types.loader_stats, shipZ: number, batchMass: number): UInt32;
|
|
2471
|
+
declare function calc_extraction_energy(extractor: Types.extractor_stats, duration: number): UInt16;
|
|
2472
|
+
|
|
2473
|
+
type movement_stats = Types.movement_stats;
|
|
2474
|
+
type energy_stats = Types.energy_stats;
|
|
2475
|
+
type loader_stats = Types.loader_stats;
|
|
2476
|
+
type task = Types.task;
|
|
2477
|
+
type cargo_item = Types.cargo_item;
|
|
2478
|
+
type warehouse_row = Types.warehouse_row;
|
|
2479
|
+
type container_row = Types.container_row;
|
|
2480
|
+
type extractor_stats = Types.extractor_stats;
|
|
2481
|
+
type mixture_info = Types.mixture_info;
|
|
2482
|
+
type mixture_component = Types.mixture_component;
|
|
2483
|
+
type location_static = Types.location_static;
|
|
2484
|
+
type location_epoch = Types.location_epoch;
|
|
2485
|
+
type location_derived = Types.location_derived;
|
|
2486
|
+
type location_row = Types.location_row;
|
|
2487
|
+
|
|
2488
|
+
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, Deal, DiscountedGoodInfo, 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, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, GameState, Good, GoodPrice, 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_GOOD_QUANTITY, INSUFFICIENT_GOOD_SUPPLY, INVALID_AMOUNT, InventoryAccessor, LoadTimeBreakdown, LoaderCapability, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MassCapability, MovementCapability, 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, ScheduleAccessor, ScheduleCapability, ScheduleData, Scheduleable, server as ServerContract, Ship, ShipEntity, ShipLike, ShipStateInput, Shipload, StorageCapability, 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, deriveLocation, deriveLocationEpoch, deriveLocationMixture, deriveLocationStatic, distanceBetweenCoordinates, distanceBetweenPoints, energyPercent, energy_stats, estimateDealTravelTime, estimateTravelTime, extractor_stats, findBestDeal, findBestGoodToTrade, findDealsForShip, findNearbyPlanets, getCurrentEpoch, getDestinationLocation, getEpochInfo, getFlightOrigin, getGood, getGoods, getLocationType, getPositionAt, getRarity, getSystemName, goodIds, hasEnergy, hasEnergyForDistance, hasExtractor, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hasTrade, hash, hash512, isExtractableLocation, isFull$1 as isFull, isFullFromMass, isProfitable, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, marketPrice, marketPrices, maxTravelDistance, mixture_component, mixture_info, movement_stats, needsRecharge, projectEntity, projectEntityAt, rotation, schedule, task, toLocation, warehouse_row };
|