@shipload/sdk 2.0.0-rc3 → 2.0.0-rc5
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 +81 -15
- package/lib/shipload.js +2091 -945
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +2082 -940
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/contracts/server.ts +71 -1
- package/src/data/items.json +15 -14
- package/src/data/nebula-adjectives.json +211 -0
- package/src/data/nebula-nouns.json +151 -0
- package/src/data/syllables.json +1386 -780
- package/src/derivation/index.ts +8 -6
- package/src/derivation/resources.ts +54 -53
- package/src/derivation/stats.ts +70 -0
- package/src/derivation/stratum.ts +20 -18
- package/src/index-module.ts +10 -7
- package/src/market/items.ts +1 -1
- package/src/market/market.ts +4 -17
- package/src/types.ts +3 -3
- package/src/utils/system.ts +44 -10
package/lib/shipload.d.ts
CHANGED
|
@@ -261,6 +261,7 @@ declare namespace Types {
|
|
|
261
261
|
ship_loaders: loader_stats;
|
|
262
262
|
ship_trade: trade_stats;
|
|
263
263
|
ship_extractor: extractor_stats;
|
|
264
|
+
ship_warp: warp_stats;
|
|
264
265
|
warehouse_capacity: UInt32;
|
|
265
266
|
warehouse_z: UInt16;
|
|
266
267
|
warehouse_loaders: loader_stats;
|
|
@@ -398,6 +399,11 @@ declare namespace Types {
|
|
|
398
399
|
}
|
|
399
400
|
class getstarter extends Struct {
|
|
400
401
|
}
|
|
402
|
+
class getstratum extends Struct {
|
|
403
|
+
x: Int64;
|
|
404
|
+
y: Int64;
|
|
405
|
+
stratum: UInt16;
|
|
406
|
+
}
|
|
401
407
|
class getsummaries extends Struct {
|
|
402
408
|
owner: Name;
|
|
403
409
|
entity_type?: Name;
|
|
@@ -438,6 +444,7 @@ declare namespace Types {
|
|
|
438
444
|
class location_derived extends Struct {
|
|
439
445
|
static_props: location_static;
|
|
440
446
|
epoch_props: location_epoch;
|
|
447
|
+
size: UInt16;
|
|
441
448
|
}
|
|
442
449
|
class location_item extends Struct {
|
|
443
450
|
id: UInt16;
|
|
@@ -535,6 +542,11 @@ declare namespace Types {
|
|
|
535
542
|
entitygroup?: UInt64;
|
|
536
543
|
group_members?: entity_ref[];
|
|
537
544
|
}
|
|
545
|
+
class resource_stats extends Struct {
|
|
546
|
+
stat1: UInt16;
|
|
547
|
+
stat2: UInt16;
|
|
548
|
+
stat3: UInt16;
|
|
549
|
+
}
|
|
538
550
|
class salt extends Struct {
|
|
539
551
|
salt: UInt64;
|
|
540
552
|
}
|
|
@@ -578,6 +590,16 @@ declare namespace Types {
|
|
|
578
590
|
seed: Checksum256;
|
|
579
591
|
commit: Checksum256;
|
|
580
592
|
}
|
|
593
|
+
class stratum_info extends Struct {
|
|
594
|
+
item_id: UInt16;
|
|
595
|
+
seed: UInt64;
|
|
596
|
+
richness: UInt16;
|
|
597
|
+
reserve: UInt32;
|
|
598
|
+
}
|
|
599
|
+
class stratum_data extends Struct {
|
|
600
|
+
stratum: stratum_info;
|
|
601
|
+
stats: resource_stats;
|
|
602
|
+
}
|
|
581
603
|
class supply_row extends Struct {
|
|
582
604
|
id: UInt64;
|
|
583
605
|
coordinates: coordinates;
|
|
@@ -631,6 +653,12 @@ declare namespace Types {
|
|
|
631
653
|
loaders: loader_stats;
|
|
632
654
|
schedule?: schedule;
|
|
633
655
|
}
|
|
656
|
+
class warp extends Struct {
|
|
657
|
+
entity_type: Name;
|
|
658
|
+
id: UInt64;
|
|
659
|
+
x: Int64;
|
|
660
|
+
y: Int64;
|
|
661
|
+
}
|
|
634
662
|
class wipe extends Struct {
|
|
635
663
|
}
|
|
636
664
|
class wipesequence extends Struct {
|
|
@@ -683,6 +711,7 @@ declare namespace ActionParams {
|
|
|
683
711
|
ship_loaders: Type.loader_stats;
|
|
684
712
|
ship_trade: Type.trade_stats;
|
|
685
713
|
ship_extractor: Type.extractor_stats;
|
|
714
|
+
ship_warp: Type.warp_stats;
|
|
686
715
|
warehouse_capacity: UInt32Type;
|
|
687
716
|
warehouse_z: UInt16Type;
|
|
688
717
|
warehouse_loaders: Type.loader_stats;
|
|
@@ -713,6 +742,9 @@ declare namespace ActionParams {
|
|
|
713
742
|
depth: UInt16Type;
|
|
714
743
|
drill: UInt16Type;
|
|
715
744
|
}
|
|
745
|
+
interface warp_stats {
|
|
746
|
+
range: UInt32Type;
|
|
747
|
+
}
|
|
716
748
|
interface item_def {
|
|
717
749
|
id: UInt16Type;
|
|
718
750
|
base_price: UInt32Type;
|
|
@@ -839,6 +871,11 @@ declare namespace ActionParams {
|
|
|
839
871
|
}
|
|
840
872
|
interface getstarter {
|
|
841
873
|
}
|
|
874
|
+
interface getstratum {
|
|
875
|
+
x: Int64Type;
|
|
876
|
+
y: Int64Type;
|
|
877
|
+
stratum: UInt16Type;
|
|
878
|
+
}
|
|
842
879
|
interface getsummaries {
|
|
843
880
|
owner: NameType;
|
|
844
881
|
entity_type?: NameType;
|
|
@@ -916,6 +953,12 @@ declare namespace ActionParams {
|
|
|
916
953
|
account: NameType;
|
|
917
954
|
amount: Int64Type;
|
|
918
955
|
}
|
|
956
|
+
interface warp {
|
|
957
|
+
entity_type: NameType;
|
|
958
|
+
id: UInt64Type;
|
|
959
|
+
x: Int64Type;
|
|
960
|
+
y: Int64Type;
|
|
961
|
+
}
|
|
919
962
|
interface wipe {
|
|
920
963
|
}
|
|
921
964
|
interface wipesequence {
|
|
@@ -943,6 +986,7 @@ interface ActionNameParams {
|
|
|
943
986
|
getnearby: ActionParams.getnearby;
|
|
944
987
|
getplayer: ActionParams.getplayer;
|
|
945
988
|
getstarter: ActionParams.getstarter;
|
|
989
|
+
getstratum: ActionParams.getstratum;
|
|
946
990
|
getsummaries: ActionParams.getsummaries;
|
|
947
991
|
grouptravel: ActionParams.grouptravel;
|
|
948
992
|
hash: ActionParams.hash;
|
|
@@ -961,6 +1005,7 @@ interface ActionNameParams {
|
|
|
961
1005
|
travel: ActionParams.travel;
|
|
962
1006
|
updatecredit: ActionParams.updatecredit;
|
|
963
1007
|
updatedebt: ActionParams.updatedebt;
|
|
1008
|
+
warp: ActionParams.warp;
|
|
964
1009
|
wipe: ActionParams.wipe;
|
|
965
1010
|
wipesequence: ActionParams.wipesequence;
|
|
966
1011
|
}
|
|
@@ -978,6 +1023,7 @@ interface ActionReturnValues {
|
|
|
978
1023
|
getnearby: Types.nearby_info;
|
|
979
1024
|
getplayer: Types.player_info;
|
|
980
1025
|
getstarter: Types.starter_info;
|
|
1026
|
+
getstratum: Types.stratum_data;
|
|
981
1027
|
getsummaries: Types.entity_summary[];
|
|
982
1028
|
grouptravel: Types.task_results;
|
|
983
1029
|
hash: Checksum256;
|
|
@@ -987,6 +1033,7 @@ interface ActionReturnValues {
|
|
|
987
1033
|
sellitems: Types.task_results;
|
|
988
1034
|
transfer: Types.task_results;
|
|
989
1035
|
travel: Types.task_results;
|
|
1036
|
+
warp: Types.task_results;
|
|
990
1037
|
}
|
|
991
1038
|
type ActionReturnNames = keyof ActionReturnValues;
|
|
992
1039
|
declare class Contract extends Contract$2 {
|
|
@@ -1150,8 +1197,8 @@ interface Distance {
|
|
|
1150
1197
|
destination: ActionParams.Type.coordinates;
|
|
1151
1198
|
distance: UInt16;
|
|
1152
1199
|
}
|
|
1153
|
-
type ResourceCategory = 'metal' | 'gas' | 'mineral' | 'organic';
|
|
1154
|
-
type
|
|
1200
|
+
type ResourceCategory = 'metal' | 'precious' | 'gas' | 'mineral' | 'organic';
|
|
1201
|
+
type ResourceTier = 't1' | 't2' | 't3' | 't4' | 't5';
|
|
1155
1202
|
declare class Item extends Struct {
|
|
1156
1203
|
id: UInt16;
|
|
1157
1204
|
name: string;
|
|
@@ -1159,7 +1206,7 @@ declare class Item extends Struct {
|
|
|
1159
1206
|
base_price: UInt32;
|
|
1160
1207
|
mass: UInt32;
|
|
1161
1208
|
category: ResourceCategory;
|
|
1162
|
-
|
|
1209
|
+
tier: ResourceTier;
|
|
1163
1210
|
color: string;
|
|
1164
1211
|
}
|
|
1165
1212
|
declare class ItemPrice extends Struct {
|
|
@@ -2441,6 +2488,7 @@ interface Rarity {
|
|
|
2441
2488
|
maxMultiplier: number;
|
|
2442
2489
|
}
|
|
2443
2490
|
declare function getRarity(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: CoordinatesType, goodId: UInt16Type): Rarity;
|
|
2491
|
+
declare function getRarityMultiplier(gameSeed: Checksum256Type, epochSeed: Checksum256Type, location: CoordinatesType, goodId: UInt16Type): number;
|
|
2444
2492
|
declare function marketPrice(location: ActionParams.Type.coordinates, goodId: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): ItemPrice;
|
|
2445
2493
|
declare function marketPrices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): ItemPrice[];
|
|
2446
2494
|
|
|
@@ -2459,21 +2507,20 @@ interface StratumInfo {
|
|
|
2459
2507
|
reserve: number;
|
|
2460
2508
|
}
|
|
2461
2509
|
interface ResourceStats {
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
resonance: number;
|
|
2510
|
+
stat1: number;
|
|
2511
|
+
stat2: number;
|
|
2512
|
+
stat3: number;
|
|
2466
2513
|
}
|
|
2467
2514
|
declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
|
|
2468
2515
|
declare function deriveResourceStats(seed: bigint): ResourceStats;
|
|
2469
2516
|
|
|
2470
2517
|
declare function deriveLocationSize(loc: Types.location_static): number;
|
|
2471
2518
|
|
|
2472
|
-
declare const
|
|
2473
|
-
declare const
|
|
2474
|
-
declare const
|
|
2475
|
-
declare const
|
|
2476
|
-
declare const
|
|
2519
|
+
declare const DEPTH_THRESHOLD_T1 = 0;
|
|
2520
|
+
declare const DEPTH_THRESHOLD_T2 = 2000;
|
|
2521
|
+
declare const DEPTH_THRESHOLD_T3 = 10000;
|
|
2522
|
+
declare const DEPTH_THRESHOLD_T4 = 30000;
|
|
2523
|
+
declare const DEPTH_THRESHOLD_T5 = 55000;
|
|
2477
2524
|
declare const LOCATION_MIN_DEPTH = 500;
|
|
2478
2525
|
declare const LOCATION_MAX_DEPTH = 65535;
|
|
2479
2526
|
declare const PLANET_SUBTYPE_GAS_GIANT = 0;
|
|
@@ -2482,13 +2529,32 @@ declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
|
|
|
2482
2529
|
declare const PLANET_SUBTYPE_ICY = 3;
|
|
2483
2530
|
declare const PLANET_SUBTYPE_OCEAN = 4;
|
|
2484
2531
|
declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
|
|
2485
|
-
declare function getDepthThreshold(
|
|
2486
|
-
declare function
|
|
2532
|
+
declare function getDepthThreshold(tier: ResourceTier): number;
|
|
2533
|
+
declare function getResourceTier(itemId: number): ResourceTier;
|
|
2487
2534
|
declare function getResourceWeight(itemId: number, stratum: number): number;
|
|
2488
2535
|
declare function getLocationCandidates(locationType: number, subtype: number): number[];
|
|
2489
2536
|
declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
|
|
2490
2537
|
declare function depthScaleFactor(stratum: number): number;
|
|
2491
2538
|
|
|
2539
|
+
interface StatDefinition {
|
|
2540
|
+
key: string;
|
|
2541
|
+
label: string;
|
|
2542
|
+
abbreviation: string;
|
|
2543
|
+
purpose: string;
|
|
2544
|
+
inverted?: boolean;
|
|
2545
|
+
}
|
|
2546
|
+
declare function getStatDefinitions(category: ResourceCategory): StatDefinition[];
|
|
2547
|
+
declare function getStatName(category: ResourceCategory, index: 0 | 1 | 2): StatDefinition;
|
|
2548
|
+
interface NamedStats {
|
|
2549
|
+
definitions: StatDefinition[];
|
|
2550
|
+
values: [number, number, number];
|
|
2551
|
+
}
|
|
2552
|
+
declare function resolveStats(category: ResourceCategory, stats: {
|
|
2553
|
+
stat1: number;
|
|
2554
|
+
stat2: number;
|
|
2555
|
+
stat3: number;
|
|
2556
|
+
}): NamedStats;
|
|
2557
|
+
|
|
2492
2558
|
declare function hash(seed: Checksum256Type, string: string): Checksum256;
|
|
2493
2559
|
declare function hash512(seed: Checksum256Type, string: string): Checksum512;
|
|
2494
2560
|
|
|
@@ -2619,4 +2685,4 @@ type location_epoch = Types.location_epoch;
|
|
|
2619
2685
|
type location_derived = Types.location_derived;
|
|
2620
2686
|
type location_row = Types.location_row;
|
|
2621
2687
|
|
|
2622
|
-
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,
|
|
2688
|
+
export { ActionsManager, AnyEntity, BetterSaleLocation, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, CargoData, CargoMassInfo, CargoSaleItem, CollectActionType, CollectAnalysis, CollectAnalysisCallbacks, CollectAnalysisOptions, CollectOption, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, Deal, DiscountedItemInfo, Distance, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityInventory, EntityRefInput, EntityState, EntityType, EntityTypeName, EpochInfo, EpochsManager, EstimateTravelTimeOptions, EstimatedTravelTime, ExtractorCapability, FindDealsOptions, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_EXTRACTOR_DRAIN, INITIAL_EXTRACTOR_EFFICIENCY, INITIAL_EXTRACTOR_RATE, INITIAL_LOADER_MASS, INITIAL_LOADER_QUANTITY, INITIAL_LOADER_THRUST, INITIAL_SHIP_CAPACITY, INITIAL_SHIP_DRAIN, INITIAL_SHIP_ENERGY, INITIAL_SHIP_GENERATOR_CAPACITY, INITIAL_SHIP_HULLMASS, INITIAL_SHIP_MASS, INITIAL_SHIP_RECHARGE, INITIAL_SHIP_THRUST, INITIAL_SHIP_Z, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_DOES_NOT_EXIST, ITEM_NOT_AVAILABLE_AT_LOCATION, InventoryAccessor, Item, ItemPrice, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MassCapability, MovementCapability, NO_SCHEDULE, NamedStats, PLANET_SUBTYPE_GAS_GIANT, PLANET_SUBTYPE_ICY, PLANET_SUBTYPE_INDUSTRIAL, PLANET_SUBTYPE_OCEAN, PLANET_SUBTYPE_ROCKY, PLANET_SUBTYPE_TERRESTRIAL, PLAYER_ALREADY_JOINED, PLAYER_NOT_FOUND, PRECISION, platform as PlatformContract, Player, PlayerStateInput, PlayersManager, PotentialDeal, Projectable, ProjectedEntity, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, Rarities, Rarity, RepositionLocation, ResourceCategory, ResourceStats, ResourceTier, SHIP_ALREADY_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, SHIP_CARGO_NOT_LOADED, SHIP_CARGO_NOT_OWNED, SHIP_INVALID_CARGO, SHIP_INVALID_DESTINATION, SHIP_INVALID_TRAVEL_DURATION, SHIP_NOT_ARRIVED, SHIP_NOT_ENOUGH_ENERGY, SHIP_NOT_ENOUGH_ENERGY_CAPACITY, SHIP_NOT_FOUND, SHIP_NOT_IDLE, SHIP_NOT_OWNED, SHIP_NO_COMPLETED_TASKS, SHIP_NO_TASKS_TO_CANCEL, ScheduleAccessor, ScheduleCapability, ScheduleData, Scheduleable, server as ServerContract, Ship, ShipEntity, ShipLike, ShipStateInput, Shipload, StatDefinition, StorageCapability, StratumInfo, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, TradeCalculation, TradeCapability, TradeProfitResult, TradesManager, TransferEntity, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, Warehouse, WarehouseEntity, WarehouseStateInput, analyzeCargoSale, analyzeCollectOptions, availableCapacity$1 as availableCapacity, availableCapacityFromMass, calcCargoMass, calcCargoValue, calcEnergyUsage, calcLoadDuration, calc_acceleration, calc_energyusage, calc_extraction_duration, calc_extraction_energy, calc_flighttime, calc_loader_acceleration, calc_loader_flighttime, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calculateBreakEvenPrice, calculateFlightTime, calculateLoadTimeBreakdown, calculateMaxTradeQuantity, calculateProfitPerMass, calculateProfitPerSecond, calculateROI, calculateRefuelingTime, calculateTradeProfit, calculateTransferTime, calculateUpdatedCargoCost, canMove, capsHasExtractor, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, capsHasTrade, cargoUtils, cargo_item, container_row, coordsToLocationId, createExploreOption, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, createSellAndRepositionOption, createSellAndStayOption, createSellAndTradeOption, createTravelToSellOption, Shipload as default, depthScaleFactor, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, distanceBetweenCoordinates, distanceBetweenPoints, energyPercent, energy_stats, estimateDealTravelTime, estimateTravelTime, extractor_stats, findBestDeal, findBestItemToTrade, findDealsForShip, findNearbyPlanets, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getPositionAt, getRarity, getRarityMultiplier, getResourceTier, getResourceWeight, getStatDefinitions, getStatName, getSystemName, hasEnergy, hasEnergyForDistance, hasExtractor, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hasTrade, hash, hash512, isExtractableLocation, isFull$1 as isFull, isFullFromMass, isProfitable, itemIds, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, marketPrice, marketPrices, maxTravelDistance, movement_stats, needsRecharge, projectEntity, projectEntityAt, resolveStats, rotation, schedule, task, toLocation, warehouse_row };
|