@shipload/sdk 0.5.1 → 0.7.0
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 +80 -7
- package/lib/shipload.js +1404 -41
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +1402 -43
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/contracts/server.ts +95 -1
- package/src/goods.ts +23 -23
- package/src/index-module.ts +1 -0
- package/src/market.ts +32 -13
- package/src/shipload.ts +18 -5
- package/src/syllables.ts +1184 -0
- package/src/system.ts +36 -0
- package/src/travel.ts +2 -10
- package/src/types.ts +23 -10
package/lib/shipload.d.ts
CHANGED
|
@@ -198,6 +198,7 @@ declare namespace Types {
|
|
|
198
198
|
class good_price extends Struct {
|
|
199
199
|
id: UInt16;
|
|
200
200
|
price: UInt64;
|
|
201
|
+
supply: UInt64;
|
|
201
202
|
}
|
|
202
203
|
class hash extends Struct {
|
|
203
204
|
value: string;
|
|
@@ -208,6 +209,11 @@ declare namespace Types {
|
|
|
208
209
|
class init extends Struct {
|
|
209
210
|
seed: Checksum256;
|
|
210
211
|
}
|
|
212
|
+
class jettison extends Struct {
|
|
213
|
+
ship_id: UInt64;
|
|
214
|
+
good_id: UInt16;
|
|
215
|
+
quantity: UInt64;
|
|
216
|
+
}
|
|
211
217
|
class join extends Struct {
|
|
212
218
|
account: Name;
|
|
213
219
|
}
|
|
@@ -216,6 +222,13 @@ declare namespace Types {
|
|
|
216
222
|
quantity: UInt16;
|
|
217
223
|
thrust: UInt32;
|
|
218
224
|
}
|
|
225
|
+
class location_row extends Struct {
|
|
226
|
+
id: UInt64;
|
|
227
|
+
coordinates: coordinates;
|
|
228
|
+
epoch: UInt64;
|
|
229
|
+
good_id: UInt16;
|
|
230
|
+
supply: UInt16;
|
|
231
|
+
}
|
|
219
232
|
class marketprice extends Struct {
|
|
220
233
|
location: coordinates;
|
|
221
234
|
good_id: UInt16;
|
|
@@ -223,6 +236,10 @@ declare namespace Types {
|
|
|
223
236
|
class marketprices extends Struct {
|
|
224
237
|
location: coordinates;
|
|
225
238
|
}
|
|
239
|
+
class payloan extends Struct {
|
|
240
|
+
account: Name;
|
|
241
|
+
amount: UInt64;
|
|
242
|
+
}
|
|
226
243
|
class player_row extends Struct {
|
|
227
244
|
owner: Name;
|
|
228
245
|
balance: UInt64;
|
|
@@ -280,9 +297,14 @@ declare namespace Types {
|
|
|
280
297
|
enabled: boolean;
|
|
281
298
|
epoch: UInt64;
|
|
282
299
|
salt: UInt64;
|
|
300
|
+
ships: UInt32;
|
|
283
301
|
seed: Checksum256;
|
|
284
302
|
commit: Checksum256;
|
|
285
303
|
}
|
|
304
|
+
class takeloan extends Struct {
|
|
305
|
+
account: Name;
|
|
306
|
+
amount: UInt64;
|
|
307
|
+
}
|
|
286
308
|
class travel extends Struct {
|
|
287
309
|
id: UInt64;
|
|
288
310
|
destination: coordinates;
|
|
@@ -313,6 +335,18 @@ declare namespace Types {
|
|
|
313
335
|
id: UInt64;
|
|
314
336
|
destination: coordinates;
|
|
315
337
|
}
|
|
338
|
+
class updatecredit extends Struct {
|
|
339
|
+
account: Name;
|
|
340
|
+
amount: Int64;
|
|
341
|
+
}
|
|
342
|
+
class updatedebt extends Struct {
|
|
343
|
+
account: Name;
|
|
344
|
+
amount: Int64;
|
|
345
|
+
}
|
|
346
|
+
class upgradeship extends Struct {
|
|
347
|
+
account: Name;
|
|
348
|
+
id: UInt64;
|
|
349
|
+
}
|
|
316
350
|
class wipe extends Struct {
|
|
317
351
|
}
|
|
318
352
|
class wipesequence extends Struct {
|
|
@@ -320,6 +354,7 @@ declare namespace Types {
|
|
|
320
354
|
}
|
|
321
355
|
declare const TableMap: {
|
|
322
356
|
cargo: typeof Types.cargo_row;
|
|
357
|
+
location: typeof Types.location_row;
|
|
323
358
|
player: typeof Types.player_row;
|
|
324
359
|
sequence: typeof Types.sequence_row;
|
|
325
360
|
ship: typeof Types.ship_row;
|
|
@@ -327,6 +362,7 @@ declare const TableMap: {
|
|
|
327
362
|
};
|
|
328
363
|
interface TableTypes {
|
|
329
364
|
cargo: Types.cargo_row;
|
|
365
|
+
location: Types.location_row;
|
|
330
366
|
player: Types.player_row;
|
|
331
367
|
sequence: Types.sequence_row;
|
|
332
368
|
ship: Types.ship_row;
|
|
@@ -377,6 +413,11 @@ declare namespace ActionParams {
|
|
|
377
413
|
interface init {
|
|
378
414
|
seed: Checksum256Type;
|
|
379
415
|
}
|
|
416
|
+
interface jettison {
|
|
417
|
+
ship_id: UInt64Type;
|
|
418
|
+
good_id: UInt16Type;
|
|
419
|
+
quantity: UInt64Type;
|
|
420
|
+
}
|
|
380
421
|
interface join {
|
|
381
422
|
account: NameType;
|
|
382
423
|
}
|
|
@@ -387,6 +428,10 @@ declare namespace ActionParams {
|
|
|
387
428
|
interface marketprices {
|
|
388
429
|
location: Type.coordinates;
|
|
389
430
|
}
|
|
431
|
+
interface payloan {
|
|
432
|
+
account: NameType;
|
|
433
|
+
amount: UInt64Type;
|
|
434
|
+
}
|
|
390
435
|
interface salt {
|
|
391
436
|
salt: UInt64Type;
|
|
392
437
|
}
|
|
@@ -395,6 +440,10 @@ declare namespace ActionParams {
|
|
|
395
440
|
good_id: UInt64Type;
|
|
396
441
|
quantity: UInt64Type;
|
|
397
442
|
}
|
|
443
|
+
interface takeloan {
|
|
444
|
+
account: NameType;
|
|
445
|
+
amount: UInt64Type;
|
|
446
|
+
}
|
|
398
447
|
interface travel {
|
|
399
448
|
id: UInt64Type;
|
|
400
449
|
destination: Type.coordinates;
|
|
@@ -410,6 +459,18 @@ declare namespace ActionParams {
|
|
|
410
459
|
id: UInt64Type;
|
|
411
460
|
destination: Type.coordinates;
|
|
412
461
|
}
|
|
462
|
+
interface updatecredit {
|
|
463
|
+
account: NameType;
|
|
464
|
+
amount: Int64Type;
|
|
465
|
+
}
|
|
466
|
+
interface updatedebt {
|
|
467
|
+
account: NameType;
|
|
468
|
+
amount: Int64Type;
|
|
469
|
+
}
|
|
470
|
+
interface upgradeship {
|
|
471
|
+
account: NameType;
|
|
472
|
+
id: UInt64Type;
|
|
473
|
+
}
|
|
413
474
|
interface wipe {
|
|
414
475
|
}
|
|
415
476
|
interface wipesequence {
|
|
@@ -426,14 +487,20 @@ interface ActionNameParams {
|
|
|
426
487
|
hash: ActionParams.hash;
|
|
427
488
|
hash512: ActionParams.hash512;
|
|
428
489
|
init: ActionParams.init;
|
|
490
|
+
jettison: ActionParams.jettison;
|
|
429
491
|
join: ActionParams.join;
|
|
430
492
|
marketprice: ActionParams.marketprice;
|
|
431
493
|
marketprices: ActionParams.marketprices;
|
|
494
|
+
payloan: ActionParams.payloan;
|
|
432
495
|
salt: ActionParams.salt;
|
|
433
496
|
sellgoods: ActionParams.sellgoods;
|
|
497
|
+
takeloan: ActionParams.takeloan;
|
|
434
498
|
travel: ActionParams.travel;
|
|
435
499
|
travelplan: ActionParams.travelplan;
|
|
436
500
|
traveltime: ActionParams.traveltime;
|
|
501
|
+
updatecredit: ActionParams.updatecredit;
|
|
502
|
+
updatedebt: ActionParams.updatedebt;
|
|
503
|
+
upgradeship: ActionParams.upgradeship;
|
|
437
504
|
wipe: ActionParams.wipe;
|
|
438
505
|
wipesequence: ActionParams.wipesequence;
|
|
439
506
|
}
|
|
@@ -518,7 +585,7 @@ interface Distance {
|
|
|
518
585
|
destination: ActionParams.Type.coordinates;
|
|
519
586
|
distance: UInt16;
|
|
520
587
|
}
|
|
521
|
-
|
|
588
|
+
declare class Good extends Struct {
|
|
522
589
|
id: UInt16;
|
|
523
590
|
name: string;
|
|
524
591
|
description: string;
|
|
@@ -532,9 +599,11 @@ interface GoodType {
|
|
|
532
599
|
base_price: UInt64Type;
|
|
533
600
|
mass: UInt64Type;
|
|
534
601
|
}
|
|
535
|
-
|
|
602
|
+
declare class GoodPrice extends Struct {
|
|
603
|
+
id: UInt16;
|
|
536
604
|
good: Good;
|
|
537
605
|
price: UInt64;
|
|
606
|
+
supply: UInt64;
|
|
538
607
|
}
|
|
539
608
|
interface Coordinates extends ActionParams.Type.coordinates {
|
|
540
609
|
}
|
|
@@ -546,6 +615,9 @@ declare function getGoods(): Good[];
|
|
|
546
615
|
declare function hash(seed: Checksum256Type, string: string): Checksum512;
|
|
547
616
|
declare function hash512(seed: Checksum256Type, string: string): Checksum512;
|
|
548
617
|
|
|
618
|
+
declare function getSystemName(gameSeed: Checksum256, location: Coordinates): string;
|
|
619
|
+
declare function hasSystem(gameSeed: Checksum256, coordinates: ActionParams.Type.coordinates): boolean;
|
|
620
|
+
|
|
549
621
|
declare enum Rarities {
|
|
550
622
|
legendary = "LEGENDARY",
|
|
551
623
|
epic = "EPIC",
|
|
@@ -563,8 +635,9 @@ declare function generateLocationSeed(epochSeed: Checksum256Type, location: Coor
|
|
|
563
635
|
declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): Rarity;
|
|
564
636
|
declare function getRarityMultiplier(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): number;
|
|
565
637
|
declare function getLocationMultiplier(gameSeed: Checksum256Type, location: Coordinates, good_id: UInt16Type): number;
|
|
566
|
-
declare function
|
|
567
|
-
declare function
|
|
638
|
+
declare function getSupply(gameSeed: Checksum256Type, state: Types.state_row, location: Coordinates, good_id: UInt16Type): number;
|
|
639
|
+
declare function marketprice(location: ActionParams.Type.coordinates, good_id: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice;
|
|
640
|
+
declare function marketprices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): GoodPrice[];
|
|
568
641
|
|
|
569
642
|
declare class Ship extends Types.ship_row {
|
|
570
643
|
get maxDistance(): UInt32;
|
|
@@ -579,7 +652,6 @@ declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinate
|
|
|
579
652
|
declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
|
|
580
653
|
declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
|
|
581
654
|
declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
|
|
582
|
-
declare function hasSystem(seed: Checksum256, coordinates: ActionParams.Type.coordinates): boolean;
|
|
583
655
|
declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
|
|
584
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;
|
|
585
657
|
declare function calc_mass_penalty(ship: Types.ship_row, mass: UInt64Type): UInt32;
|
|
@@ -615,7 +687,7 @@ declare class Shipload {
|
|
|
615
687
|
getState(): Promise<Types.state_row>;
|
|
616
688
|
getShip(ship_id: UInt64Type): Promise<Ship>;
|
|
617
689
|
getShips(player: NameType | Types.player_row): Promise<Ship[]>;
|
|
618
|
-
marketprice(location: ActionParams.Type.coordinates, good_id: number): Promise<
|
|
690
|
+
marketprice(location: ActionParams.Type.coordinates, good_id: number): Promise<GoodPrice>;
|
|
619
691
|
marketprices(location: ActionParams.Type.coordinates): Promise<GoodPrice[]>;
|
|
620
692
|
hasSystem(location: ActionParams.Type.coordinates): Promise<boolean>;
|
|
621
693
|
findNearbyPlanets(origin: ActionParams.Type.coordinates, maxDistance?: UInt16Type): Promise<Distance[]>;
|
|
@@ -624,6 +696,7 @@ declare class Shipload {
|
|
|
624
696
|
getCurrentEpochHeight(): Promise<UInt64>;
|
|
625
697
|
getCurrentEpoch(): Promise<EpochInfo>;
|
|
626
698
|
getEpoch(height: UInt64Type): Promise<EpochInfo>;
|
|
699
|
+
getLocation(location: Coordinates): Promise<any[]>;
|
|
627
700
|
}
|
|
628
701
|
|
|
629
|
-
export { CameraPosition, Coordinates, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, EpochInfo, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, GoodType, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, Rarities, Rarity, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Ship, TRAVEL_MAXMASS_PENALTY, calc_acceleration, calc_energyusage, calc_flighttime, calc_loader_acceleration, calc_loader_flighttime, calc_mass_penalty, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_loadtime, calc_ship_mass, calc_ship_rechargetime, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, generateLocationSeed, getCurrentEpoch, getEpochInfo, getGood, getGoods, getLocationMultiplier, getRarity, getRarityMultiplier, goodIds, hasSystem, hash, hash512, lerp, marketprice, marketprices, rotation, travelplan, travelplanDuration };
|
|
702
|
+
export { CameraPosition, Coordinates, Dimensions, Distance, ERROR_SYSTEM_NOT_INITIALIZED, EpochInfo, GOOD_DOES_NOT_EXIST, GOOD_NOT_AVAILABLE_AT_LOCATION, Good, GoodPrice, GoodType, INSUFFICIENT_BALANCE, INSUFFICIENT_GOOD_QUANTITY, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, REQUIRES_MORE_THAN_ONE, Rarities, Rarity, SHIP_CANNOT_BUY_TRAVELING, SHIP_NOT_FOUND, server as ServerContract, Ship, TRAVEL_MAXMASS_PENALTY, calc_acceleration, calc_energyusage, calc_flighttime, calc_loader_acceleration, calc_loader_flighttime, calc_mass_penalty, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_loadtime, calc_ship_mass, calc_ship_rechargetime, Shipload as default, distanceBetweenCoordinates, distanceBetweenPoints, distanceTraveled, findNearbyPlanets, generateLocationSeed, getCurrentEpoch, getEpochInfo, getGood, getGoods, getLocationMultiplier, getRarity, getRarityMultiplier, getSupply, getSystemName, goodIds, hasSystem, hash, hash512, lerp, marketprice, marketprices, rotation, travelplan, travelplanDuration };
|