@shipload/sdk 2.0.0-rc12 → 2.0.0-rc14
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 +137 -57
- package/lib/shipload.js +636 -335
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +626 -334
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/modules.ts +3 -3
- package/src/capabilities/storage.ts +6 -9
- package/src/contracts/server.ts +37 -34
- package/src/data/colors.ts +19 -1
- package/src/data/recipes.ts +3 -3
- package/src/derivation/crafting.ts +46 -32
- package/src/derivation/stratum.ts +12 -0
- package/src/entities/container.ts +1 -0
- package/src/entities/makers.ts +126 -11
- package/src/entities/ship-deploy.ts +9 -14
- package/src/entities/ship.ts +16 -4
- package/src/entities/warehouse.ts +36 -1
- package/src/index-module.ts +22 -5
- package/src/managers/actions.ts +48 -8
- package/src/nft/description.ts +31 -30
- package/src/nft/deserializers.ts +8 -8
- package/src/resolution/describe-module.ts +165 -0
- package/src/resolution/resolve-item.ts +60 -37
- package/src/scheduling/projection.ts +17 -4
- package/src/types/capabilities.ts +5 -0
package/lib/shipload.d.ts
CHANGED
|
@@ -174,18 +174,18 @@ declare namespace Types {
|
|
|
174
174
|
reveal: string;
|
|
175
175
|
commit: Checksum256;
|
|
176
176
|
}
|
|
177
|
-
class
|
|
177
|
+
class packed_module extends Struct {
|
|
178
178
|
item_id: UInt16;
|
|
179
|
-
|
|
179
|
+
stats: UInt64;
|
|
180
180
|
}
|
|
181
181
|
class module_entry extends Struct {
|
|
182
182
|
type: UInt8;
|
|
183
|
-
installed?:
|
|
183
|
+
installed?: packed_module;
|
|
184
184
|
}
|
|
185
185
|
class cargo_item extends Struct {
|
|
186
186
|
item_id: UInt16;
|
|
187
187
|
quantity: UInt32;
|
|
188
|
-
|
|
188
|
+
stats: UInt64;
|
|
189
189
|
modules: module_entry[];
|
|
190
190
|
}
|
|
191
191
|
class blend extends Struct {
|
|
@@ -215,7 +215,7 @@ declare namespace Types {
|
|
|
215
215
|
entity_id: UInt64;
|
|
216
216
|
item_id: UInt64;
|
|
217
217
|
quantity: UInt64;
|
|
218
|
-
|
|
218
|
+
stats: UInt64;
|
|
219
219
|
modules: module_entry[];
|
|
220
220
|
}
|
|
221
221
|
class cleanrsvp extends Struct {
|
|
@@ -303,14 +303,14 @@ declare namespace Types {
|
|
|
303
303
|
entity_type: Name;
|
|
304
304
|
id: UInt64;
|
|
305
305
|
packed_item_id: UInt16;
|
|
306
|
-
|
|
306
|
+
stats: UInt64;
|
|
307
307
|
entity_name: string;
|
|
308
308
|
}
|
|
309
309
|
class descentity extends Struct {
|
|
310
310
|
item_id: UInt16;
|
|
311
|
-
|
|
311
|
+
hull_stats: UInt64;
|
|
312
312
|
module_items: UInt16[];
|
|
313
|
-
|
|
313
|
+
module_stats: UInt64[];
|
|
314
314
|
}
|
|
315
315
|
class enable extends Struct {
|
|
316
316
|
enabled: boolean;
|
|
@@ -393,8 +393,8 @@ declare namespace Types {
|
|
|
393
393
|
participants: entity_ref[];
|
|
394
394
|
}
|
|
395
395
|
class gather extends Struct {
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
source: entity_ref;
|
|
397
|
+
destination: entity_ref;
|
|
398
398
|
stratum: UInt16;
|
|
399
399
|
quantity: UInt32;
|
|
400
400
|
}
|
|
@@ -666,7 +666,7 @@ declare namespace Types {
|
|
|
666
666
|
id: UInt64;
|
|
667
667
|
owner: Name;
|
|
668
668
|
name: string;
|
|
669
|
-
|
|
669
|
+
stats: UInt64;
|
|
670
670
|
coordinates: coordinates;
|
|
671
671
|
hullmass?: UInt32;
|
|
672
672
|
capacity?: UInt32;
|
|
@@ -690,14 +690,14 @@ declare namespace Types {
|
|
|
690
690
|
class spawnpacked extends Struct {
|
|
691
691
|
entity_id: UInt64;
|
|
692
692
|
item_id: UInt16;
|
|
693
|
-
|
|
694
|
-
installed:
|
|
693
|
+
hull_stats: UInt64;
|
|
694
|
+
installed: packed_module[];
|
|
695
695
|
}
|
|
696
696
|
class spawnseeded extends Struct {
|
|
697
697
|
entity_id: UInt64;
|
|
698
698
|
item_id: UInt64;
|
|
699
699
|
quantity: UInt64;
|
|
700
|
-
|
|
700
|
+
stats: UInt64;
|
|
701
701
|
}
|
|
702
702
|
class state_row extends Struct {
|
|
703
703
|
enabled: boolean;
|
|
@@ -726,6 +726,7 @@ declare namespace Types {
|
|
|
726
726
|
dest_type: Name;
|
|
727
727
|
dest_id: UInt64;
|
|
728
728
|
item_id: UInt16;
|
|
729
|
+
stats: UInt64;
|
|
729
730
|
quantity: UInt32;
|
|
730
731
|
}
|
|
731
732
|
class travel extends Struct {
|
|
@@ -744,7 +745,7 @@ declare namespace Types {
|
|
|
744
745
|
id: UInt64;
|
|
745
746
|
owner: Name;
|
|
746
747
|
name: string;
|
|
747
|
-
|
|
748
|
+
stats: UInt64;
|
|
748
749
|
coordinates: coordinates;
|
|
749
750
|
hullmass?: UInt32;
|
|
750
751
|
capacity?: UInt32;
|
|
@@ -808,16 +809,16 @@ declare namespace ActionParams {
|
|
|
808
809
|
interface cargo_item {
|
|
809
810
|
item_id: UInt16Type;
|
|
810
811
|
quantity: UInt32Type;
|
|
811
|
-
|
|
812
|
+
stats: UInt64Type;
|
|
812
813
|
modules: Type.module_entry[];
|
|
813
814
|
}
|
|
814
815
|
interface module_entry {
|
|
815
816
|
type: UInt8Type;
|
|
816
|
-
installed?: Type.
|
|
817
|
+
installed?: Type.packed_module;
|
|
817
818
|
}
|
|
818
|
-
interface
|
|
819
|
+
interface packed_module {
|
|
819
820
|
item_id: UInt16Type;
|
|
820
|
-
|
|
821
|
+
stats: UInt64Type;
|
|
821
822
|
}
|
|
822
823
|
interface game_config {
|
|
823
824
|
version: UInt32Type;
|
|
@@ -928,21 +929,21 @@ declare namespace ActionParams {
|
|
|
928
929
|
entity_type: NameType;
|
|
929
930
|
id: UInt64Type;
|
|
930
931
|
packed_item_id: UInt16Type;
|
|
931
|
-
|
|
932
|
+
stats: UInt64Type;
|
|
932
933
|
entity_name: string;
|
|
933
934
|
}
|
|
934
935
|
interface descentity {
|
|
935
936
|
item_id: UInt16Type;
|
|
936
|
-
|
|
937
|
+
hull_stats: UInt64Type;
|
|
937
938
|
module_items: UInt16Type[];
|
|
938
|
-
|
|
939
|
+
module_stats: UInt64Type[];
|
|
939
940
|
}
|
|
940
941
|
interface enable {
|
|
941
942
|
enabled: boolean;
|
|
942
943
|
}
|
|
943
944
|
interface gather {
|
|
944
|
-
|
|
945
|
-
|
|
945
|
+
source: Type.entity_ref;
|
|
946
|
+
destination: Type.entity_ref;
|
|
946
947
|
stratum: UInt16Type;
|
|
947
948
|
quantity: UInt32Type;
|
|
948
949
|
}
|
|
@@ -1053,14 +1054,14 @@ declare namespace ActionParams {
|
|
|
1053
1054
|
interface spawnpacked {
|
|
1054
1055
|
entity_id: UInt64Type;
|
|
1055
1056
|
item_id: UInt16Type;
|
|
1056
|
-
|
|
1057
|
-
installed: Type.
|
|
1057
|
+
hull_stats: UInt64Type;
|
|
1058
|
+
installed: Type.packed_module[];
|
|
1058
1059
|
}
|
|
1059
1060
|
interface spawnseeded {
|
|
1060
1061
|
entity_id: UInt64Type;
|
|
1061
1062
|
item_id: UInt64Type;
|
|
1062
1063
|
quantity: UInt64Type;
|
|
1063
|
-
|
|
1064
|
+
stats: UInt64Type;
|
|
1064
1065
|
}
|
|
1065
1066
|
interface transfer {
|
|
1066
1067
|
source_type: NameType;
|
|
@@ -1068,6 +1069,7 @@ declare namespace ActionParams {
|
|
|
1068
1069
|
dest_type: NameType;
|
|
1069
1070
|
dest_id: UInt64Type;
|
|
1070
1071
|
item_id: UInt16Type;
|
|
1072
|
+
stats: UInt64Type;
|
|
1071
1073
|
quantity: UInt32Type;
|
|
1072
1074
|
}
|
|
1073
1075
|
interface travel {
|
|
@@ -1475,16 +1477,17 @@ declare class ActionsManager extends BaseManager {
|
|
|
1475
1477
|
resolve(entityId: UInt64Type, entityType?: EntityTypeName): Action;
|
|
1476
1478
|
cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
|
|
1477
1479
|
recharge(shipId: UInt64Type): Action;
|
|
1478
|
-
transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type,
|
|
1480
|
+
transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, itemId: UInt64Type, stats: UInt64Type, quantity: UInt64Type): Action;
|
|
1479
1481
|
foundCompany(account: NameType, name: string): Action;
|
|
1480
1482
|
join(account: NameType): Action;
|
|
1481
|
-
gather(
|
|
1483
|
+
gather(source: EntityRefInput, destination: EntityRefInput, stratum: UInt16Type, quantity: UInt32Type): Action;
|
|
1482
1484
|
warp(shipId: UInt64Type, destination: CoordinatesType): Action;
|
|
1483
1485
|
craft(entityType: EntityTypeName, entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
|
|
1484
1486
|
blend(entityType: EntityTypeName, entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
|
|
1485
|
-
deploy(entityType: EntityTypeName, entityId: UInt64Type, packedItemId: number,
|
|
1487
|
+
deploy(entityType: EntityTypeName, entityId: UInt64Type, packedItemId: number, stats: bigint, entityName: string): Action;
|
|
1486
1488
|
addmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, moduleCargoId: UInt64Type, targetCargoId?: UInt64Type): Action;
|
|
1487
1489
|
rmmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, targetCargoId?: UInt64Type): Action;
|
|
1490
|
+
wrap(owner: NameType, entityType: EntityTypeName, entityId: UInt64Type, cargoId: UInt64Type, quantity: UInt64Type): Action;
|
|
1488
1491
|
joinGame(account: NameType, companyName: string): Action[];
|
|
1489
1492
|
}
|
|
1490
1493
|
|
|
@@ -1553,6 +1556,7 @@ interface EntityCapabilities {
|
|
|
1553
1556
|
loaders?: Types.loader_stats;
|
|
1554
1557
|
gatherer?: Types.gatherer_stats;
|
|
1555
1558
|
crafter?: Types.crafter_stats;
|
|
1559
|
+
hauler?: Types.hauler_stats;
|
|
1556
1560
|
}
|
|
1557
1561
|
interface EntityState {
|
|
1558
1562
|
owner: Name;
|
|
@@ -1566,6 +1570,7 @@ declare function capsHasStorage(caps: EntityCapabilities): boolean;
|
|
|
1566
1570
|
declare function capsHasLoaders(caps: EntityCapabilities): boolean;
|
|
1567
1571
|
declare function capsHasGatherer(caps: EntityCapabilities): boolean;
|
|
1568
1572
|
declare function capsHasMass(caps: EntityCapabilities): boolean;
|
|
1573
|
+
declare function capsHasHauler(caps: EntityCapabilities): boolean;
|
|
1569
1574
|
|
|
1570
1575
|
interface HasCargo {
|
|
1571
1576
|
cargo: Types.cargo_item[];
|
|
@@ -1593,7 +1598,7 @@ declare function isFullFromMass(capacity: UInt64Type, cargoMass: UInt64Type): bo
|
|
|
1593
1598
|
interface CargoStack {
|
|
1594
1599
|
item_id: UInt16;
|
|
1595
1600
|
quantity: UInt32;
|
|
1596
|
-
|
|
1601
|
+
stats: UInt64;
|
|
1597
1602
|
modules: Types.module_entry[];
|
|
1598
1603
|
}
|
|
1599
1604
|
declare function cargoItemToStack(item: Types.cargo_item): CargoStack;
|
|
@@ -1737,7 +1742,10 @@ interface Projectable extends ScheduleData {
|
|
|
1737
1742
|
owner?: Name;
|
|
1738
1743
|
}
|
|
1739
1744
|
declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
|
|
1740
|
-
|
|
1745
|
+
interface ProjectionOptions {
|
|
1746
|
+
upToTaskIndex?: number;
|
|
1747
|
+
}
|
|
1748
|
+
declare function projectEntity(entity: Projectable, options?: ProjectionOptions): ProjectedEntity;
|
|
1741
1749
|
declare function validateSchedule(entity: Projectable): void;
|
|
1742
1750
|
declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
|
|
1743
1751
|
|
|
@@ -1806,6 +1814,10 @@ declare class InventoryAccessor {
|
|
|
1806
1814
|
}
|
|
1807
1815
|
declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
|
|
1808
1816
|
|
|
1817
|
+
interface PackedModuleInput {
|
|
1818
|
+
itemId: UInt16Type;
|
|
1819
|
+
stats: UInt64Type;
|
|
1820
|
+
}
|
|
1809
1821
|
interface ShipStateInput {
|
|
1810
1822
|
id: UInt64Type;
|
|
1811
1823
|
owner: string;
|
|
@@ -1818,16 +1830,17 @@ interface ShipStateInput {
|
|
|
1818
1830
|
hullmass?: number;
|
|
1819
1831
|
capacity?: number;
|
|
1820
1832
|
energy?: number;
|
|
1821
|
-
|
|
1822
|
-
generator?: Types.energy_stats;
|
|
1823
|
-
loaders?: Types.loader_stats;
|
|
1833
|
+
modules?: PackedModuleInput[];
|
|
1824
1834
|
schedule?: Types.schedule;
|
|
1825
1835
|
cargo?: Types.cargo_item[];
|
|
1826
1836
|
}
|
|
1827
1837
|
declare class Ship extends Types.entity_info {
|
|
1828
1838
|
private _sched?;
|
|
1829
1839
|
private _inv?;
|
|
1840
|
+
private _modules;
|
|
1830
1841
|
get name(): string;
|
|
1842
|
+
get modules(): Types.module_entry[];
|
|
1843
|
+
setModules(modules: Types.module_entry[]): void;
|
|
1831
1844
|
get inv(): InventoryAccessor;
|
|
1832
1845
|
get inventory(): EntityInventory[];
|
|
1833
1846
|
get sched(): ScheduleAccessor;
|
|
@@ -1874,14 +1887,17 @@ interface WarehouseStateInput {
|
|
|
1874
1887
|
};
|
|
1875
1888
|
hullmass?: number;
|
|
1876
1889
|
capacity: number;
|
|
1877
|
-
|
|
1890
|
+
modules?: PackedModuleInput[];
|
|
1878
1891
|
schedule?: Types.schedule;
|
|
1879
1892
|
cargo?: Types.cargo_item[];
|
|
1880
1893
|
}
|
|
1881
1894
|
declare class Warehouse extends Types.entity_info {
|
|
1882
1895
|
private _sched?;
|
|
1883
1896
|
private _inv?;
|
|
1897
|
+
private _modules;
|
|
1884
1898
|
get name(): string;
|
|
1899
|
+
get modules(): Types.module_entry[];
|
|
1900
|
+
setModules(modules: Types.module_entry[]): void;
|
|
1885
1901
|
get inv(): InventoryAccessor;
|
|
1886
1902
|
get inventory(): EntityInventory[];
|
|
1887
1903
|
get sched(): ScheduleAccessor;
|
|
@@ -1898,6 +1914,16 @@ declare class Warehouse extends Types.entity_info {
|
|
|
1898
1914
|
get orbitalAltitude(): number;
|
|
1899
1915
|
get totalMass(): UInt64;
|
|
1900
1916
|
}
|
|
1917
|
+
declare function computeWarehouseCapabilities(modules: {
|
|
1918
|
+
itemId: number;
|
|
1919
|
+
stats: bigint;
|
|
1920
|
+
}[]): {
|
|
1921
|
+
loaders?: {
|
|
1922
|
+
mass: number;
|
|
1923
|
+
thrust: number;
|
|
1924
|
+
quantity: number;
|
|
1925
|
+
};
|
|
1926
|
+
};
|
|
1901
1927
|
|
|
1902
1928
|
interface ContainerStateInput {
|
|
1903
1929
|
id: UInt64Type;
|
|
@@ -1911,6 +1937,7 @@ interface ContainerStateInput {
|
|
|
1911
1937
|
hullmass: number;
|
|
1912
1938
|
capacity: number;
|
|
1913
1939
|
cargomass?: number;
|
|
1940
|
+
cargo?: Types.cargo_item[];
|
|
1914
1941
|
schedule?: Types.schedule;
|
|
1915
1942
|
}
|
|
1916
1943
|
declare class Container extends Types.entity_info {
|
|
@@ -2009,6 +2036,18 @@ interface ResourceStats {
|
|
|
2009
2036
|
stat3: number;
|
|
2010
2037
|
}
|
|
2011
2038
|
declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
|
|
2039
|
+
/**
|
|
2040
|
+
* Derives the three stat values for a raw resource from a deposit's
|
|
2041
|
+
* entropy seed (hash-based, weibull-transformed).
|
|
2042
|
+
*
|
|
2043
|
+
* **Use only on deposit seeds** — the bigint returned by `deriveStratum`
|
|
2044
|
+
* or carried on a `MassDeposit`. Do NOT call this on a cargo item's
|
|
2045
|
+
* `stats` field; cargo stats are bit-packed and must be read via
|
|
2046
|
+
* `decodeStat` (or `decodeStackStats` for category-mapped output).
|
|
2047
|
+
*
|
|
2048
|
+
* Passing a cargo `stats` value here produces meaningless output
|
|
2049
|
+
* (hash of the packed bits, unrelated to the actual stats).
|
|
2050
|
+
*/
|
|
2012
2051
|
declare function deriveResourceStats(seed: bigint): ResourceStats;
|
|
2013
2052
|
|
|
2014
2053
|
declare function deriveLocationSize(loc: Types.location_static): number;
|
|
@@ -2070,9 +2109,9 @@ interface CategoryStacks {
|
|
|
2070
2109
|
stacks: StackInput[];
|
|
2071
2110
|
}
|
|
2072
2111
|
declare function encodeStats(values: number[]): bigint;
|
|
2073
|
-
declare function decodeStat(
|
|
2074
|
-
declare function decodeStats(
|
|
2075
|
-
declare function decodeCraftedItemStats(itemId: number,
|
|
2112
|
+
declare function decodeStat(stats: bigint, index: number): number;
|
|
2113
|
+
declare function decodeStats(stats: bigint, count: number): number[];
|
|
2114
|
+
declare function decodeCraftedItemStats(itemId: number, stats: bigint): Record<string, number>;
|
|
2076
2115
|
declare function blendStacks(stacks: StackInput[], statKey: string): number;
|
|
2077
2116
|
declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
|
|
2078
2117
|
key: string;
|
|
@@ -2097,17 +2136,28 @@ declare function blendCrossGroup(sources: {
|
|
|
2097
2136
|
}[]): number;
|
|
2098
2137
|
declare function blendCargoStacks(itemId: number, stacks: {
|
|
2099
2138
|
quantity: number;
|
|
2100
|
-
|
|
2139
|
+
stats: UInt64;
|
|
2101
2140
|
}[]): UInt64;
|
|
2102
2141
|
interface RecipeSlotInput {
|
|
2103
2142
|
itemId: number;
|
|
2104
2143
|
category: ResourceCategory | undefined;
|
|
2105
2144
|
stacks: {
|
|
2106
2145
|
quantity: number;
|
|
2107
|
-
|
|
2146
|
+
stats: bigint;
|
|
2108
2147
|
}[];
|
|
2109
2148
|
}
|
|
2110
|
-
declare function
|
|
2149
|
+
declare function computeCraftedOutputStats(outputItemId: number, slotInputs: RecipeSlotInput[]): UInt64;
|
|
2150
|
+
/**
|
|
2151
|
+
* Mirrors the contract's gather-time transform. Takes a deposit's entropy
|
|
2152
|
+
* seed (bigint from deriveStratum), derives stats via weibull hashing, and
|
|
2153
|
+
* returns a UInt64 whose bit-packed form matches what the contract writes
|
|
2154
|
+
* to cargo_item.stats on gather.
|
|
2155
|
+
*
|
|
2156
|
+
* Use this whenever off-chain code simulates a gather (testmap, player
|
|
2157
|
+
* scanners that project cargo outcomes) and needs a value that matches
|
|
2158
|
+
* what on-chain cargo would carry.
|
|
2159
|
+
*/
|
|
2160
|
+
declare function encodeGatheredCargoStats(depositSeed: bigint): UInt64;
|
|
2111
2161
|
|
|
2112
2162
|
declare function hash(seed: Checksum256Type, string: string): Checksum256;
|
|
2113
2163
|
declare function hash512(seed: Checksum256Type, string: string): Checksum512;
|
|
@@ -2284,13 +2334,13 @@ declare const MODULE_CRAFTER = 6;
|
|
|
2284
2334
|
declare const MODULE_LAUNCHER = 7;
|
|
2285
2335
|
declare const MODULE_STORAGE = 8;
|
|
2286
2336
|
declare const MODULE_HAULER = 9;
|
|
2287
|
-
interface
|
|
2337
|
+
interface PackedModule {
|
|
2288
2338
|
itemId: number;
|
|
2289
|
-
|
|
2339
|
+
stats: bigint;
|
|
2290
2340
|
}
|
|
2291
2341
|
interface ModuleEntry {
|
|
2292
2342
|
type: number;
|
|
2293
|
-
installed?:
|
|
2343
|
+
installed?: PackedModule;
|
|
2294
2344
|
}
|
|
2295
2345
|
declare function moduleAccepts(slotType: number, moduleType: number): boolean;
|
|
2296
2346
|
declare function getModuleCapabilityType(itemId: number): number;
|
|
@@ -2301,10 +2351,13 @@ declare function computeHaulerDrain(distance: number, drain: number, haulCount:
|
|
|
2301
2351
|
|
|
2302
2352
|
declare const categoryColors: Record<ResourceCategory, string>;
|
|
2303
2353
|
declare const tierColors: Record<ResourceTier, string>;
|
|
2354
|
+
declare const tierLabels: Record<ResourceTier, string>;
|
|
2304
2355
|
declare const categoryIcons: Record<ResourceCategory, string>;
|
|
2356
|
+
type CategoryIconShape = 'hex' | 'diamond' | 'star' | 'circle' | 'square';
|
|
2357
|
+
declare const categoryIconShapes: Record<ResourceCategory, CategoryIconShape>;
|
|
2305
2358
|
declare const componentIcon = "\u25A3";
|
|
2306
2359
|
declare const moduleIcon = "\u2B22";
|
|
2307
|
-
declare const
|
|
2360
|
+
declare const itemAbbreviations: Record<number, string>;
|
|
2308
2361
|
|
|
2309
2362
|
type CraftedItemCategory = 'component' | 'module' | 'entity' | 'resource';
|
|
2310
2363
|
declare const ITEM_TYPE_RESOURCE = 0;
|
|
@@ -2518,7 +2571,7 @@ interface ShipCapabilities {
|
|
|
2518
2571
|
}
|
|
2519
2572
|
declare function computeShipCapabilities(modules: {
|
|
2520
2573
|
itemId: number;
|
|
2521
|
-
|
|
2574
|
+
stats: bigint;
|
|
2522
2575
|
}[]): ShipCapabilities;
|
|
2523
2576
|
|
|
2524
2577
|
interface ResolvedItemStat {
|
|
@@ -2550,6 +2603,7 @@ interface ResolvedItem {
|
|
|
2550
2603
|
itemId: number;
|
|
2551
2604
|
name: string;
|
|
2552
2605
|
icon: string;
|
|
2606
|
+
abbreviation: string | null;
|
|
2553
2607
|
category?: ResourceCategory;
|
|
2554
2608
|
tier: ResourceTier;
|
|
2555
2609
|
mass: number;
|
|
@@ -2558,11 +2612,37 @@ interface ResolvedItem {
|
|
|
2558
2612
|
attributes?: ResolvedAttributeGroup[];
|
|
2559
2613
|
moduleSlots?: ResolvedModuleSlot[];
|
|
2560
2614
|
}
|
|
2561
|
-
declare function resolveItem(itemId: UInt16Type,
|
|
2615
|
+
declare function resolveItem(itemId: UInt16Type, stats?: UInt64Type, modules?: Types.module_entry[]): ResolvedItem;
|
|
2616
|
+
|
|
2617
|
+
interface TextSpan {
|
|
2618
|
+
text: string;
|
|
2619
|
+
highlight?: boolean;
|
|
2620
|
+
}
|
|
2621
|
+
interface CapabilityInput {
|
|
2622
|
+
capability: string;
|
|
2623
|
+
attributes: {
|
|
2624
|
+
label: string;
|
|
2625
|
+
value: number;
|
|
2626
|
+
}[];
|
|
2627
|
+
}
|
|
2628
|
+
interface ModuleDescription {
|
|
2629
|
+
id: string;
|
|
2630
|
+
template: string;
|
|
2631
|
+
params: Readonly<Record<string, number | string>>;
|
|
2632
|
+
highlightKeys: readonly string[];
|
|
2633
|
+
}
|
|
2634
|
+
interface RenderDescriptionOptions {
|
|
2635
|
+
translate?: (id: string, fallback: string) => string;
|
|
2636
|
+
formatNumber?: (n: number) => string;
|
|
2637
|
+
}
|
|
2638
|
+
declare function describeModule(input: CapabilityInput): ModuleDescription | null;
|
|
2639
|
+
declare function describeModuleForItem(resolved: ResolvedItem): ModuleDescription | null;
|
|
2640
|
+
declare function describeModuleForSlot(slot: ResolvedModuleSlot): ModuleDescription | null;
|
|
2641
|
+
declare function renderDescription(desc: ModuleDescription, options?: RenderDescriptionOptions): TextSpan[];
|
|
2562
2642
|
|
|
2563
2643
|
interface NFTInstalledModule {
|
|
2564
2644
|
item_id: number;
|
|
2565
|
-
|
|
2645
|
+
stats: string;
|
|
2566
2646
|
}
|
|
2567
2647
|
interface NFTModuleSlot {
|
|
2568
2648
|
type: number;
|
|
@@ -2571,12 +2651,12 @@ interface NFTModuleSlot {
|
|
|
2571
2651
|
interface NFTCargoItem {
|
|
2572
2652
|
item_id: number;
|
|
2573
2653
|
quantity: number;
|
|
2574
|
-
|
|
2654
|
+
stats: string;
|
|
2575
2655
|
modules?: NFTModuleSlot[];
|
|
2576
2656
|
}
|
|
2577
2657
|
interface NFTCommonBase {
|
|
2578
2658
|
quantity: number;
|
|
2579
|
-
|
|
2659
|
+
stats: string;
|
|
2580
2660
|
origin_x: string;
|
|
2581
2661
|
origin_y: string;
|
|
2582
2662
|
}
|
|
@@ -2588,9 +2668,9 @@ declare const deserializeModule: typeof deserializeScalar;
|
|
|
2588
2668
|
declare function deserializeEntity(data: Record<string, any>, itemId: number): NFTCargoItem;
|
|
2589
2669
|
declare function deserializeAsset(data: Record<string, any>, itemId: number): NFTCargoItem;
|
|
2590
2670
|
|
|
2591
|
-
declare function computeBaseHullmass(
|
|
2592
|
-
declare function computeBaseCapacityShip(
|
|
2593
|
-
declare function computeBaseCapacityWarehouse(
|
|
2671
|
+
declare function computeBaseHullmass(stats: bigint): number;
|
|
2672
|
+
declare function computeBaseCapacityShip(stats: bigint): number;
|
|
2673
|
+
declare function computeBaseCapacityWarehouse(stats: bigint): number;
|
|
2594
2674
|
declare const computeEngineThrust: (vol: number) => number;
|
|
2595
2675
|
declare const computeEngineDrain: (thm: number) => number;
|
|
2596
2676
|
declare const computeGeneratorCap: (res: number) => number;
|
|
@@ -2605,8 +2685,8 @@ declare const computeCrafterSpeed: (rea: number) => number;
|
|
|
2605
2685
|
declare const computeCrafterDrain: (clr: number) => number;
|
|
2606
2686
|
declare function entityDisplayName(itemId: number): string;
|
|
2607
2687
|
declare function moduleDisplayName(itemId: number): string;
|
|
2608
|
-
declare function formatModuleLine(slot: number, itemId: number,
|
|
2609
|
-
declare function buildEntityDescription(itemId: number,
|
|
2688
|
+
declare function formatModuleLine(slot: number, itemId: number, stats: bigint): string;
|
|
2689
|
+
declare function buildEntityDescription(itemId: number, hullStats: bigint, moduleItems: number[], moduleStats: bigint[]): string;
|
|
2610
2690
|
|
|
2611
2691
|
type index_NFTInstalledModule = NFTInstalledModule;
|
|
2612
2692
|
type index_NFTModuleSlot = NFTModuleSlot;
|
|
@@ -2686,4 +2766,4 @@ type location_epoch = Types.location_epoch;
|
|
|
2686
2766
|
type location_derived = Types.location_derived;
|
|
2687
2767
|
type location_row = Types.location_row;
|
|
2688
2768
|
|
|
2689
|
-
export { ActionsManager, AnyEntity, BASE_ORBITAL_MASS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CapabilityAttribute, CargoData, CargoMassInfo,
|
|
2769
|
+
export { ActionsManager, AnyEntity, BASE_ORBITAL_MASS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CapabilityAttribute, CapabilityInput, CargoData, CargoMassInfo, CargoStack, CategoryIconShape, CategoryInfo, CategoryStacks, ComponentDefinition, ComponentStat, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, CraftableItem, CraftedItemCategory, CrafterCapability, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, Distance, ENTITY_CAPACITY_EXCEEDED, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityInventory, EntityRecipe, EntityRefInput, EntityState, EntityType, EntityTypeName, EpochInfo, EpochsManager, EstimateTravelTimeOptions, EstimatedTravelTime, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, GathererCapability, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CARGO_LINING_T2, ITEM_CONTAINER_T1_PACKED, ITEM_CONTAINER_T2_PACKED, ITEM_DOES_NOT_EXIST, ITEM_ENGINE_T1, ITEM_FOCUSING_ARRAY, ITEM_GATHERER_T1, ITEM_GENERATOR_T1, ITEM_HAULER_T1, ITEM_HULL_PLATES, ITEM_HULL_PLATES_T2, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1, ITEM_MATTER_CONDUIT, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_SURVEY_PROBE, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, InventoryAccessor, Item, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MODULE_ANY, MODULE_CRAFTER, MODULE_ENGINE, MODULE_GATHERER, MODULE_GENERATOR, MODULE_HAULER, MODULE_LAUNCHER, MODULE_LOADER, MODULE_STORAGE, MODULE_WARP, MassCapability, ModuleDescription, ModuleEntry, ModuleRecipe, ModuleSlot, MovementCapability, index as NFT, NFTCargoItem, NFTCommonBase, NFTInstalledModule, NFTModuleSlot, 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, PackedModule, PackedModuleInput, PlanetSubtypeInfo, platform as PlatformContract, Player, PlayerStateInput, PlayersManager, Projectable, ProjectedEntity, ProjectionOptions, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RecipeInput, RecipeSlotInput, RenderDescriptionOptions, ReserveTier, ResolvedAttributeGroup, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedModuleSlot, 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, ShipCapabilities, ShipEntity, ShipLike, ShipStateInput, Shipload, StackInput, StatDefinition, StatMapping, StorageCapability, StratumInfo, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, TextSpan, TierRange, TransferEntity, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, Warehouse, WarehouseEntity, WarehouseStateInput, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildEntityDescription, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcLoadDuration, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, 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, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItemToStack, cargoUtils, cargo_item, categoryColors, categoryIconShapes, categoryIcons, categoryItemMass, componentIcon, components, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityStats, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerDrain, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeManufacturingCapabilities, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseCapabilities, computeWarehouseHullCapabilities, container_row, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, distanceBetweenCoordinates, distanceBetweenPoints, encodeGatheredCargoStats, encodeStats, energyPercent, energy_stats, entityDisplayName, entityRecipes, estimateDealTravelTime, estimateTravelTime, findNearbyPlanets, formatModuleLine, gatherer_stats, getAllCraftableItems, getCapabilityAttributes, getCategoryInfo, getComponentById, getComponentsForCategory, getComponentsForStat, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityRecipe, getEntityRecipeByItemId, getEntitySlotLayout, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getLocationTypeName, getModuleCapabilityType, getModuleRecipe, getModuleRecipeByItemId, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getResourceTier, getResourceWeight, getStatDefinitions, getStatMappings, getStatMappingsForCapability, getStatMappingsForStat, getStatName, getSystemName, hasEnergy, hasEnergyForDistance, hasGatherer, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, isCraftedItem, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isModuleItem, isRelatedItem, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, lerp, loader_stats, location_derived, location_epoch, location_row, location_static, makeContainer, makeShip, makeWarehouse, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleRecipes, movement_stats, needsRecharge, projectEntity, projectEntityAt, readCommonBase, removeFromStacks, renderDescription, resolveItem, resolveStats, rollTier, rollWithinTier, rotation, schedule, stackKey, stackToCargoItem, stacksEqual, statMappings, task, tierColors, tierLabels, toLocation, validateSchedule, warehouse_row };
|