@shipload/sdk 1.0.0-next.3 → 1.0.0-next.4

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.
@@ -13,10 +13,10 @@ export function computeShipHullCapabilities(stats: Record<string, number>): {
13
13
  hullmass: number
14
14
  capacity: number
15
15
  } {
16
- const density = stats.density ?? 500
17
- const strength = stats.strength ?? 500
18
- const hardness = stats.hardness ?? 500
19
- const saturation = stats.saturation ?? 500
16
+ const density = stats.density
17
+ const strength = stats.strength
18
+ const hardness = stats.hardness
19
+ const saturation = stats.saturation
20
20
 
21
21
  const hullmass = 25000 + 75 * density
22
22
  const statSum = strength + hardness + saturation
@@ -30,8 +30,8 @@ export function computeEngineCapabilities(stats: Record<string, number>): {
30
30
  thrust: number
31
31
  drain: number
32
32
  } {
33
- const vol = stats.volatility ?? 500
34
- const thm = stats.thermal ?? 500
33
+ const vol = stats.volatility
34
+ const thm = stats.thermal
35
35
 
36
36
  return {
37
37
  thrust: 400 + Math.floor((vol * 3) / 4),
@@ -43,12 +43,12 @@ export function computeGeneratorCapabilities(stats: Record<string, number>): {
43
43
  capacity: number
44
44
  recharge: number
45
45
  } {
46
- const res = stats.resonance ?? 500
47
- const ref = stats.reflectivity ?? 500
46
+ const com = stats.composition
47
+ const fin = stats.fineness
48
48
 
49
49
  return {
50
- capacity: 300 + Math.floor(res / 6),
51
- recharge: 1 + Math.floor((ref * 3) / 1000),
50
+ capacity: 300 + Math.floor(com / 6),
51
+ recharge: 1 + Math.floor((fin * 3) / 1000),
52
52
  }
53
53
  }
54
54
 
@@ -58,10 +58,10 @@ export function computeGathererCapabilities(stats: Record<string, number>): {
58
58
  depth: number
59
59
  speed: number
60
60
  } {
61
- const str = stats.strength ?? 500
62
- const con = stats.conductivity ?? 500
63
- const ref = stats.reflectivity ?? 500
64
- const tol = stats.tolerance ?? 500
61
+ const str = stats.strength
62
+ const con = stats.conductivity
63
+ const ref = stats.reflectivity
64
+ const tol = stats.tolerance
65
65
 
66
66
  return {
67
67
  yield: 200 + str,
@@ -76,12 +76,12 @@ export function computeLoaderCapabilities(stats: Record<string, number>): {
76
76
  thrust: number
77
77
  quantity: number
78
78
  } {
79
- const hrd = stats.hardness ?? 500
80
- const pla = stats.plasticity ?? 500
79
+ const insulation = stats.insulation
80
+ const plasticity = stats.plasticity
81
81
 
82
82
  return {
83
- mass: Math.max(200, 2000 - Math.floor(hrd * 2)),
84
- thrust: 1 + Math.floor(pla / 500),
83
+ mass: Math.max(200, 2000 - Math.floor(insulation * 2)),
84
+ thrust: 1 + Math.floor(plasticity / 500),
85
85
  quantity: 1,
86
86
  }
87
87
  }
@@ -90,12 +90,12 @@ export function computeCrafterCapabilities(stats: Record<string, number>): {
90
90
  speed: number
91
91
  drain: number
92
92
  } {
93
- const rea = stats.reactivity ?? 500
94
- const com = stats.composition ?? 500
93
+ const rea = stats.reactivity
94
+ const fin = stats.fineness
95
95
 
96
96
  return {
97
97
  speed: 100 + Math.floor((rea * 4) / 5),
98
- drain: Math.max(5, 30 - Math.floor(com / 33)),
98
+ drain: Math.max(5, 30 - Math.floor(fin / 33)),
99
99
  }
100
100
  }
101
101
 
@@ -104,14 +104,14 @@ export function computeHaulerCapabilities(stats: Record<string, number>): {
104
104
  efficiency: number
105
105
  drain: number
106
106
  } {
107
- const res = stats.resonance ?? 500
108
- const con = stats.conductivity ?? 500
109
- const ref = stats.reflectivity ?? 500
107
+ const fineness = stats.fineness
108
+ const conductivity = stats.conductivity
109
+ const composition = stats.composition
110
110
 
111
111
  return {
112
- capacity: Math.max(1, 1 + Math.floor(res / 400)),
113
- efficiency: 2000 + con * 6,
114
- drain: Math.max(3, 15 - Math.floor(ref / 80)),
112
+ capacity: Math.max(1, 1 + Math.floor(fineness / 400)),
113
+ efficiency: 2000 + conductivity * 6,
114
+ drain: Math.max(3, 15 - Math.floor(composition / 80)),
115
115
  }
116
116
  }
117
117
 
@@ -121,11 +121,12 @@ export function computeStorageCapabilities(
121
121
  ): {
122
122
  capacityBonus: number
123
123
  } {
124
- const strength = stats.strength ?? 500
125
- const hardness = stats.hardness ?? 500
126
- const saturation = stats.saturation ?? 500
124
+ const strength = stats.strength
125
+ const density = stats.density
126
+ const hardness = stats.hardness
127
+ const saturation = stats.saturation
127
128
 
128
- const statSum = strength + hardness + saturation
129
+ const statSum = strength + density + hardness + saturation
129
130
  const capacityBonus = Math.floor(
130
131
  (baseCapacity * (10 + Math.floor((statSum * 10) / 2997))) / 100
131
132
  )
@@ -137,10 +138,10 @@ export function computeWarehouseHullCapabilities(stats: Record<string, number>):
137
138
  hullmass: number
138
139
  capacity: number
139
140
  } {
140
- const density = stats.density ?? 500
141
- const strength = stats.strength ?? 500
142
- const hardness = stats.hardness ?? 500
143
- const saturation = stats.saturation ?? 500
141
+ const density = stats.density
142
+ const strength = stats.strength
143
+ const hardness = stats.hardness
144
+ const saturation = stats.saturation
144
145
 
145
146
  const hullmass = 25000 + 75 * density
146
147
  const statSum = strength + hardness + saturation
@@ -202,14 +202,19 @@ export type {PlanetSubtypeInfo} from './data/locations'
202
202
  export {
203
203
  capabilityNames,
204
204
  capabilityAttributes,
205
- statMappings,
206
205
  isInvertedAttribute,
207
206
  getCapabilityAttributes,
207
+ } from './data/capabilities'
208
+ export type {CapabilityAttribute, StatMapping} from './data/capabilities'
209
+
210
+ export {
211
+ deriveStatMappings,
208
212
  getStatMappings,
209
213
  getStatMappingsForStat,
210
214
  getStatMappingsForCapability,
211
- } from './data/capabilities'
212
- export type {CapabilityAttribute, StatMapping} from './data/capabilities'
215
+ } from './derivation/capability-mappings'
216
+ export {SLOT_FORMULAS} from './data/capability-formulas'
217
+ export type {SlotConsumer, SlotConsumerKind} from './data/capability-formulas'
213
218
 
214
219
  export {
215
220
  encodeStats,
@@ -302,6 +307,7 @@ export {
302
307
  computeLoaderThrust,
303
308
  computeCrafterSpeed,
304
309
  computeCrafterDrain,
310
+ computeWarpRange,
305
311
  } from './nft/description'
306
312
 
307
313
  export {
@@ -44,17 +44,17 @@ export function computeBaseCapacityWarehouse(stats: bigint): number {
44
44
 
45
45
  export const computeEngineThrust = (vol: number): number => 400 + idiv(vol * 3, 4)
46
46
  export const computeEngineDrain = (thm: number): number => Math.max(30, 50 - idiv(thm, 70))
47
- export const computeGeneratorCap = (res: number): number => 300 + idiv(res, 6)
48
- export const computeGeneratorRech = (ref: number): number => 1 + idiv(ref * 3, 1000)
47
+ export const computeGeneratorCap = (com: number): number => 300 + idiv(com, 6)
48
+ export const computeGeneratorRech = (fin: number): number => 1 + idiv(fin * 3, 1000)
49
49
  export const computeGathererYield = (str: number): number => 200 + str
50
50
  export const computeGathererDrain = (con: number): number =>
51
51
  Math.max(250, 1250 - idiv(con * 25, 20))
52
52
  export const computeGathererDepth = (tol: number): number => 200 + idiv(tol * 3, 2)
53
53
  export const computeGathererSpeed = (ref: number): number => 100 + idiv(ref * 4, 5)
54
- export const computeLoaderMass = (fin: number): number => Math.max(200, 2000 - fin * 2)
54
+ export const computeLoaderMass = (ins: number): number => Math.max(200, 2000 - ins * 2)
55
55
  export const computeLoaderThrust = (pla: number): number => 1 + idiv(pla, 500)
56
56
  export const computeCrafterSpeed = (rea: number): number => 100 + idiv(rea * 4, 5)
57
- export const computeCrafterDrain = (com: number): number => Math.max(5, 30 - idiv(com, 33))
57
+ export const computeCrafterDrain = (fin: number): number => Math.max(5, 30 - idiv(fin, 33))
58
58
  export const computeWarpRange = (stat: number): number => 100 + stat * 3
59
59
 
60
60
  export function entityDisplayName(itemId: number): string {
@@ -223,10 +223,11 @@ function computeCapabilityGroup(
223
223
  }
224
224
  }
225
225
  case MODULE_STORAGE: {
226
- const str = stats.strength ?? 500
227
- const hrd = stats.hardness ?? 500
228
- const sat = stats.saturation ?? 500
229
- const statSum = str + hrd + sat
226
+ const str = stats.strength
227
+ const den = stats.density
228
+ const hrd = stats.hardness
229
+ const sat = stats.saturation
230
+ const statSum = str + den + hrd + sat
230
231
  const pct = 10 + Math.floor((statSum * 10) / 2997)
231
232
  return {capability: 'Storage', attributes: [{label: 'Capacity Bonus', value: pct}]}
232
233
  }