@shipload/sdk 0.3.4 → 0.3.5

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/lib/shipload.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt16, Int64, TimePoint, UInt8, Int64Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
1
+ import { Blob, ABI, Struct, Name, UInt64, Checksum256, UInt32, TimePointSec, Checksum256Type, UInt32Type, NameType, UInt64Type, Action, UInt16, Int64, TimePoint, UInt8, Float64, Int64Type, UInt16Type, Checksum512, APIClient } from '@wharfkit/antelope';
2
2
  import { Contract as Contract$2, PartialBy, ContractArgs, ActionOptions, Table } from '@wharfkit/contract';
3
3
  import { ChainDefinition } from '@wharfkit/session';
4
4
 
@@ -161,7 +161,6 @@ declare namespace Types {
161
161
  commit: Checksum256;
162
162
  }
163
163
  class arrive extends Struct {
164
- owner: Name;
165
164
  id: UInt64;
166
165
  }
167
166
  class buygoods extends Struct {
@@ -248,9 +247,14 @@ declare namespace Types {
248
247
  thrust: UInt64;
249
248
  }
250
249
  class travel_plan extends Struct {
251
- destination: coordinates;
252
250
  departure: TimePoint;
253
- duration: UInt32;
251
+ destination: coordinates;
252
+ flighttime: UInt32;
253
+ loadtime: UInt32;
254
+ rechargetime: UInt32;
255
+ mass: UInt64;
256
+ energyusage: UInt32;
257
+ distance: UInt64;
254
258
  }
255
259
  class ship_row extends Struct {
256
260
  id: UInt64;
@@ -272,7 +276,6 @@ declare namespace Types {
272
276
  commit: Checksum256;
273
277
  }
274
278
  class travel extends Struct {
275
- owner: Name;
276
279
  id: UInt64;
277
280
  destination: coordinates;
278
281
  recharge: boolean;
@@ -284,13 +287,19 @@ declare namespace Types {
284
287
  destination: coordinates;
285
288
  distance: UInt64;
286
289
  totalmass: UInt64;
287
- acceleration: UInt64;
290
+ acceleration: Float64;
288
291
  flighttime: UInt64;
289
292
  energyusage: UInt64;
290
293
  rechargetime: UInt64;
291
294
  loadtime: UInt64;
292
295
  time: UInt64;
293
296
  }
297
+ class travelplan extends Struct {
298
+ id: UInt64;
299
+ origin: coordinates;
300
+ destination: coordinates;
301
+ recharge: boolean;
302
+ }
294
303
  class traveltime extends Struct {
295
304
  id: UInt64;
296
305
  destination: coordinates;
@@ -326,7 +335,6 @@ declare namespace ActionParams {
326
335
  commit: Checksum256Type;
327
336
  }
328
337
  interface arrive {
329
- owner: NameType;
330
338
  id: UInt64Type;
331
339
  }
332
340
  interface buygoods {
@@ -373,11 +381,16 @@ declare namespace ActionParams {
373
381
  quantity: UInt64Type;
374
382
  }
375
383
  interface travel {
376
- owner: NameType;
377
384
  id: UInt64Type;
378
385
  destination: Type.coordinates;
379
386
  recharge: boolean;
380
387
  }
388
+ interface travelplan {
389
+ id: UInt64Type;
390
+ origin: Type.coordinates;
391
+ destination: Type.coordinates;
392
+ recharge: boolean;
393
+ }
381
394
  interface traveltime {
382
395
  id: UInt64Type;
383
396
  destination: Type.coordinates;
@@ -401,6 +414,7 @@ interface ActionNameParams {
401
414
  salt: ActionParams.salt;
402
415
  sellgoods: ActionParams.sellgoods;
403
416
  travel: ActionParams.travel;
417
+ travelplan: ActionParams.travelplan;
404
418
  traveltime: ActionParams.traveltime;
405
419
  wipe: ActionParams.wipe;
406
420
  }
@@ -410,6 +424,7 @@ interface ActionReturnValues {
410
424
  hash512: Checksum512;
411
425
  marketprice: Types.good_price;
412
426
  marketprices: Types.good_price[];
427
+ travelplan: Types.travel_plan;
413
428
  traveltime: Types.travel_summary;
414
429
  }
415
430
  type ActionReturnNames = keyof ActionReturnValues;
@@ -452,11 +467,12 @@ declare namespace server {
452
467
  };
453
468
  }
454
469
 
455
- declare function getCurrentEpoch(game: Types$1.game_row): Promise<number>;
470
+ declare function getCurrentEpoch(game: Types$1.game_row): number;
456
471
 
457
472
  declare function hash(seed: Checksum256Type, string: string): Checksum512;
458
473
  declare function hash512(seed: Checksum256Type, string: string): Checksum512;
459
474
 
475
+ declare const PRECISION = 10000;
460
476
  interface CameraPosition extends ActionParams.Type.coordinates {
461
477
  z: number;
462
478
  }
@@ -476,21 +492,42 @@ interface Good {
476
492
  base_price: UInt64;
477
493
  mass: UInt64;
478
494
  }
495
+ interface GoodType {
496
+ id: UInt16Type;
497
+ name: string;
498
+ description: string;
499
+ base_price: UInt64Type;
500
+ mass: UInt64Type;
501
+ }
479
502
  interface GoodPrice {
480
503
  good: Good;
481
504
  price: UInt64;
482
505
  }
483
506
 
484
- declare function distanceTraveled(ship: Types.ship_row): number;
485
- declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt16;
486
- declare function distanceBetweenPoints(x1: UInt64Type, y1: UInt64Type, x2: UInt64Type, y2: UInt64Type): UInt16;
507
+ declare function travelplanDuration(travelplan: Types.travel_plan): UInt32;
508
+ declare function distanceTraveled(ship: Types.ship_row, current?: Date): number;
509
+ declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
510
+ declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
487
511
  declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
488
512
  declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
489
- declare function hasPlanet(seed: Checksum256, coordinates: ActionParams.Type.coordinates): boolean;
490
- declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt16Type): Distance[];
513
+ declare function hasSystem(seed: Checksum256, coordinates: ActionParams.Type.coordinates): boolean;
514
+ declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
515
+ 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): Types.travel_plan;
516
+ declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
517
+ declare function calc_ship_rechargetime(ship: Types.ship_row): UInt32;
518
+ declare function calc_ship_loadtime(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt32;
519
+ declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
520
+ declare function calc_loader_flighttime(ship: Types.ship_row, mass: UInt64): UInt32;
521
+ declare function calc_loader_acceleration(ship: Types.ship_row, mass: UInt64): number;
522
+ declare function calc_ship_flighttime(ship: Types.ship_row, mass: UInt64, distance: UInt64): UInt32;
523
+ declare function calc_ship_acceleration(ship: Types.ship_row, mass: UInt64): number;
524
+ declare function calc_acceleration(thrust: number, mass: number): number;
525
+ declare function calc_ship_mass(ship: Types.ship_row, cargos: Types.cargo_row[]): UInt64;
526
+ declare function calc_energyusage(drain: UInt32Type, flighttime: UInt32Type): UInt32;
491
527
 
492
- declare const goods: Good[];
528
+ declare const goodIds: any[];
493
529
  declare function getGood(good_id: UInt16Type): Good;
530
+ declare function getGoods(): Good[];
494
531
 
495
532
  declare function marketprice(location: ActionParams.Type.coordinates, good_id: UInt16Type, gameSeed: Checksum256Type, epochSeed: Checksum256Type): Promise<UInt64>;
496
533
  declare function marketprices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, epochSeed: Checksum256Type): Promise<GoodPrice[]>;
@@ -525,8 +562,9 @@ declare class Shipload {
525
562
  getState(): Promise<Types.state_row>;
526
563
  marketprice(location: ActionParams.Type.coordinates, good_id: number): Promise<UInt64>;
527
564
  marketprices(location: ActionParams.Type.coordinates): Promise<GoodPrice[]>;
528
- hasPlanet(location: ActionParams.Type.coordinates): Promise<boolean>;
565
+ hasSystem(location: ActionParams.Type.coordinates): Promise<boolean>;
529
566
  findNearbyPlanets(origin: ActionParams.Type.coordinates, maxDistance?: UInt16Type): Promise<Distance[]>;
567
+ travelplan(ship: Types.ship_row, origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, recharge?: boolean): Promise<Types.travel_plan>;
530
568
  }
531
569
 
532
- export { CameraPosition, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, getCurrentEpoch, getGood, goods, hasPlanet, hash, hash512, lerp, marketprice, marketprices, priceFromRoll, rotation };
570
+ export { CameraPosition, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, GoodType, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, calc_acceleration, calc_energyusage, calc_flighttime, calc_loader_acceleration, calc_loader_flighttime, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_loadtime, calc_ship_mass, calc_ship_rechargetime, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, getCurrentEpoch, getGood, getGoods, goodIds, hasSystem, hash, hash512, lerp, marketprice, marketprices, priceFromRoll, rotation, travelplan, travelplanDuration };