@shipload/sdk 2.0.0-rc4 → 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 +37 -19
- package/lib/shipload.js +216 -158
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +207 -153
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/contracts/server.ts +4 -6
- package/src/data/items.json +15 -14
- 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 +13 -13
- 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/lib/shipload.d.ts
CHANGED
|
@@ -543,10 +543,9 @@ declare namespace Types {
|
|
|
543
543
|
group_members?: entity_ref[];
|
|
544
544
|
}
|
|
545
545
|
class resource_stats extends Struct {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
resonance: UInt16;
|
|
546
|
+
stat1: UInt16;
|
|
547
|
+
stat2: UInt16;
|
|
548
|
+
stat3: UInt16;
|
|
550
549
|
}
|
|
551
550
|
class salt extends Struct {
|
|
552
551
|
salt: UInt64;
|
|
@@ -1198,8 +1197,8 @@ interface Distance {
|
|
|
1198
1197
|
destination: ActionParams.Type.coordinates;
|
|
1199
1198
|
distance: UInt16;
|
|
1200
1199
|
}
|
|
1201
|
-
type ResourceCategory = 'metal' | 'gas' | 'mineral' | 'organic';
|
|
1202
|
-
type
|
|
1200
|
+
type ResourceCategory = 'metal' | 'precious' | 'gas' | 'mineral' | 'organic';
|
|
1201
|
+
type ResourceTier = 't1' | 't2' | 't3' | 't4' | 't5';
|
|
1203
1202
|
declare class Item extends Struct {
|
|
1204
1203
|
id: UInt16;
|
|
1205
1204
|
name: string;
|
|
@@ -1207,7 +1206,7 @@ declare class Item extends Struct {
|
|
|
1207
1206
|
base_price: UInt32;
|
|
1208
1207
|
mass: UInt32;
|
|
1209
1208
|
category: ResourceCategory;
|
|
1210
|
-
|
|
1209
|
+
tier: ResourceTier;
|
|
1211
1210
|
color: string;
|
|
1212
1211
|
}
|
|
1213
1212
|
declare class ItemPrice extends Struct {
|
|
@@ -2489,6 +2488,7 @@ interface Rarity {
|
|
|
2489
2488
|
maxMultiplier: number;
|
|
2490
2489
|
}
|
|
2491
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;
|
|
2492
2492
|
declare function marketPrice(location: ActionParams.Type.coordinates, goodId: UInt16Type, gameSeed: Checksum256Type, state: Types.state_row): ItemPrice;
|
|
2493
2493
|
declare function marketPrices(location: ActionParams.Type.coordinates, gameSeed: Checksum256Type, state: Types.state_row): ItemPrice[];
|
|
2494
2494
|
|
|
@@ -2507,21 +2507,20 @@ interface StratumInfo {
|
|
|
2507
2507
|
reserve: number;
|
|
2508
2508
|
}
|
|
2509
2509
|
interface ResourceStats {
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
resonance: number;
|
|
2510
|
+
stat1: number;
|
|
2511
|
+
stat2: number;
|
|
2512
|
+
stat3: number;
|
|
2514
2513
|
}
|
|
2515
2514
|
declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
|
|
2516
2515
|
declare function deriveResourceStats(seed: bigint): ResourceStats;
|
|
2517
2516
|
|
|
2518
2517
|
declare function deriveLocationSize(loc: Types.location_static): number;
|
|
2519
2518
|
|
|
2520
|
-
declare const
|
|
2521
|
-
declare const
|
|
2522
|
-
declare const
|
|
2523
|
-
declare const
|
|
2524
|
-
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;
|
|
2525
2524
|
declare const LOCATION_MIN_DEPTH = 500;
|
|
2526
2525
|
declare const LOCATION_MAX_DEPTH = 65535;
|
|
2527
2526
|
declare const PLANET_SUBTYPE_GAS_GIANT = 0;
|
|
@@ -2530,13 +2529,32 @@ declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
|
|
|
2530
2529
|
declare const PLANET_SUBTYPE_ICY = 3;
|
|
2531
2530
|
declare const PLANET_SUBTYPE_OCEAN = 4;
|
|
2532
2531
|
declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
|
|
2533
|
-
declare function getDepthThreshold(
|
|
2534
|
-
declare function
|
|
2532
|
+
declare function getDepthThreshold(tier: ResourceTier): number;
|
|
2533
|
+
declare function getResourceTier(itemId: number): ResourceTier;
|
|
2535
2534
|
declare function getResourceWeight(itemId: number, stratum: number): number;
|
|
2536
2535
|
declare function getLocationCandidates(locationType: number, subtype: number): number[];
|
|
2537
2536
|
declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
|
|
2538
2537
|
declare function depthScaleFactor(stratum: number): number;
|
|
2539
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
|
+
|
|
2540
2558
|
declare function hash(seed: Checksum256Type, string: string): Checksum256;
|
|
2541
2559
|
declare function hash512(seed: Checksum256Type, string: string): Checksum512;
|
|
2542
2560
|
|
|
@@ -2667,4 +2685,4 @@ type location_epoch = Types.location_epoch;
|
|
|
2667
2685
|
type location_derived = Types.location_derived;
|
|
2668
2686
|
type location_row = Types.location_row;
|
|
2669
2687
|
|
|
2670
|
-
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 };
|