@shipload/sdk 1.0.0-next.22 → 1.0.0-next.24
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 +2 -5
- package/lib/shipload.js +38 -47
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +39 -46
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.js +12 -12
- package/lib/testing.m.js +12 -12
- package/package.json +1 -1
- package/src/capabilities/crafting.ts +1 -1
- package/src/data/colors.ts +1 -19
- package/src/data/metadata.ts +13 -13
- package/src/derivation/capabilities.ts +4 -4
- package/src/index-module.ts +0 -3
- package/src/managers/locations.ts +24 -10
- package/src/nft/description.ts +4 -4
- package/src/resolution/resolve-item.ts +2 -8
package/lib/testing.js
CHANGED
|
@@ -3248,24 +3248,24 @@ const itemMetadata = {
|
|
|
3248
3248
|
208: { name: 'Crystal', description: '', color: '#4ADBFF' },
|
|
3249
3249
|
209: { name: 'Crystal', description: '', color: '#4ADBFF' },
|
|
3250
3250
|
210: { name: 'Crystal', description: '', color: '#4ADBFF' },
|
|
3251
|
-
301: { name: 'Gas', description: 'Raw volatile gas.', color: '#
|
|
3251
|
+
301: { name: 'Gas', description: 'Raw volatile gas.', color: '#B877FF' },
|
|
3252
3252
|
302: {
|
|
3253
3253
|
name: 'Gas',
|
|
3254
3254
|
description: 'Refined volatile gas with improved reactivity.',
|
|
3255
|
-
color: '#
|
|
3255
|
+
color: '#B877FF',
|
|
3256
3256
|
},
|
|
3257
3257
|
303: {
|
|
3258
3258
|
name: 'Gas',
|
|
3259
3259
|
description: 'High-grade volatile gas with exceptional energy density.',
|
|
3260
|
-
color: '#
|
|
3260
|
+
color: '#B877FF',
|
|
3261
3261
|
},
|
|
3262
|
-
304: { name: 'Gas', description: '', color: '#
|
|
3263
|
-
305: { name: 'Gas', description: '', color: '#
|
|
3264
|
-
306: { name: 'Gas', description: '', color: '#
|
|
3265
|
-
307: { name: 'Gas', description: '', color: '#
|
|
3266
|
-
308: { name: 'Gas', description: '', color: '#
|
|
3267
|
-
309: { name: 'Gas', description: '', color: '#
|
|
3268
|
-
310: { name: 'Gas', description: '', color: '#
|
|
3262
|
+
304: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3263
|
+
305: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3264
|
+
306: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3265
|
+
307: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3266
|
+
308: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3267
|
+
309: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3268
|
+
310: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3269
3269
|
401: { name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B' },
|
|
3270
3270
|
402: {
|
|
3271
3271
|
name: 'Regolith',
|
|
@@ -3345,7 +3345,7 @@ const itemMetadata = {
|
|
|
3345
3345
|
10009: {
|
|
3346
3346
|
name: 'Reactor',
|
|
3347
3347
|
description: 'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
|
|
3348
|
-
color: '#
|
|
3348
|
+
color: '#B877FF',
|
|
3349
3349
|
},
|
|
3350
3350
|
10010: {
|
|
3351
3351
|
name: 'Emitter',
|
|
@@ -3375,7 +3375,7 @@ const itemMetadata = {
|
|
|
3375
3375
|
10104: {
|
|
3376
3376
|
name: 'Crafter',
|
|
3377
3377
|
description: 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
|
|
3378
|
-
color: '#
|
|
3378
|
+
color: '#B877FF',
|
|
3379
3379
|
},
|
|
3380
3380
|
10105: {
|
|
3381
3381
|
name: 'Storage',
|
package/lib/testing.m.js
CHANGED
|
@@ -3244,24 +3244,24 @@ const itemMetadata = {
|
|
|
3244
3244
|
208: { name: 'Crystal', description: '', color: '#4ADBFF' },
|
|
3245
3245
|
209: { name: 'Crystal', description: '', color: '#4ADBFF' },
|
|
3246
3246
|
210: { name: 'Crystal', description: '', color: '#4ADBFF' },
|
|
3247
|
-
301: { name: 'Gas', description: 'Raw volatile gas.', color: '#
|
|
3247
|
+
301: { name: 'Gas', description: 'Raw volatile gas.', color: '#B877FF' },
|
|
3248
3248
|
302: {
|
|
3249
3249
|
name: 'Gas',
|
|
3250
3250
|
description: 'Refined volatile gas with improved reactivity.',
|
|
3251
|
-
color: '#
|
|
3251
|
+
color: '#B877FF',
|
|
3252
3252
|
},
|
|
3253
3253
|
303: {
|
|
3254
3254
|
name: 'Gas',
|
|
3255
3255
|
description: 'High-grade volatile gas with exceptional energy density.',
|
|
3256
|
-
color: '#
|
|
3256
|
+
color: '#B877FF',
|
|
3257
3257
|
},
|
|
3258
|
-
304: { name: 'Gas', description: '', color: '#
|
|
3259
|
-
305: { name: 'Gas', description: '', color: '#
|
|
3260
|
-
306: { name: 'Gas', description: '', color: '#
|
|
3261
|
-
307: { name: 'Gas', description: '', color: '#
|
|
3262
|
-
308: { name: 'Gas', description: '', color: '#
|
|
3263
|
-
309: { name: 'Gas', description: '', color: '#
|
|
3264
|
-
310: { name: 'Gas', description: '', color: '#
|
|
3258
|
+
304: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3259
|
+
305: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3260
|
+
306: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3261
|
+
307: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3262
|
+
308: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3263
|
+
309: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3264
|
+
310: { name: 'Gas', description: '', color: '#B877FF' },
|
|
3265
3265
|
401: { name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B' },
|
|
3266
3266
|
402: {
|
|
3267
3267
|
name: 'Regolith',
|
|
@@ -3341,7 +3341,7 @@ const itemMetadata = {
|
|
|
3341
3341
|
10009: {
|
|
3342
3342
|
name: 'Reactor',
|
|
3343
3343
|
description: 'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
|
|
3344
|
-
color: '#
|
|
3344
|
+
color: '#B877FF',
|
|
3345
3345
|
},
|
|
3346
3346
|
10010: {
|
|
3347
3347
|
name: 'Emitter',
|
|
@@ -3371,7 +3371,7 @@ const itemMetadata = {
|
|
|
3371
3371
|
10104: {
|
|
3372
3372
|
name: 'Crafter',
|
|
3373
3373
|
description: 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
|
|
3374
|
-
color: '#
|
|
3374
|
+
color: '#B877FF',
|
|
3375
3375
|
},
|
|
3376
3376
|
10105: {
|
|
3377
3377
|
name: 'Storage',
|
package/package.json
CHANGED
|
@@ -18,5 +18,5 @@ export function calc_craft_duration(speed: number, totalInputMass: number): UInt
|
|
|
18
18
|
|
|
19
19
|
export function calc_craft_energy(drain: number, totalInputMass: number): UInt16 {
|
|
20
20
|
const raw = Math.floor((totalInputMass * drain) / CRAFT_ENERGY_DIVISOR)
|
|
21
|
-
return UInt16.from(Math.min(raw, 65535))
|
|
21
|
+
return UInt16.from(Math.min(Math.max(raw, 1), 65535))
|
|
22
22
|
}
|
package/src/data/colors.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type {ResourceCategory} from '../types'
|
|
|
3
3
|
export const categoryColors: Record<ResourceCategory, string> = {
|
|
4
4
|
ore: '#C26D3F',
|
|
5
5
|
crystal: '#4ADBFF',
|
|
6
|
-
gas: '#
|
|
6
|
+
gas: '#B877FF',
|
|
7
7
|
regolith: '#C4A57B',
|
|
8
8
|
biomass: '#5A8B3E',
|
|
9
9
|
}
|
|
@@ -21,24 +21,6 @@ export const tierColors: Record<number, string> = {
|
|
|
21
21
|
10: '#ffffff',
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
export const categoryIcons: Record<ResourceCategory, string> = {
|
|
25
|
-
ore: '⬡',
|
|
26
|
-
crystal: '◈',
|
|
27
|
-
gas: '◎',
|
|
28
|
-
regolith: '■',
|
|
29
|
-
biomass: '❋',
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export type CategoryIconShape = 'hex' | 'diamond' | 'star' | 'circle' | 'square'
|
|
33
|
-
|
|
34
|
-
export const categoryIconShapes: Record<ResourceCategory, CategoryIconShape> = {
|
|
35
|
-
ore: 'hex',
|
|
36
|
-
crystal: 'diamond',
|
|
37
|
-
gas: 'circle',
|
|
38
|
-
regolith: 'square',
|
|
39
|
-
biomass: 'star',
|
|
40
|
-
}
|
|
41
|
-
|
|
42
24
|
export const componentIcon = '▣'
|
|
43
25
|
export const moduleIcon = '⬢'
|
|
44
26
|
|
package/src/data/metadata.ts
CHANGED
|
@@ -48,24 +48,24 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
48
48
|
210: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
49
49
|
|
|
50
50
|
// === Resources / Gas ===
|
|
51
|
-
301: {name: 'Gas', description: 'Raw volatile gas.', color: '#
|
|
51
|
+
301: {name: 'Gas', description: 'Raw volatile gas.', color: '#B877FF'},
|
|
52
52
|
302: {
|
|
53
53
|
name: 'Gas',
|
|
54
54
|
description: 'Refined volatile gas with improved reactivity.',
|
|
55
|
-
color: '#
|
|
55
|
+
color: '#B877FF',
|
|
56
56
|
},
|
|
57
57
|
303: {
|
|
58
58
|
name: 'Gas',
|
|
59
59
|
description: 'High-grade volatile gas with exceptional energy density.',
|
|
60
|
-
color: '#
|
|
61
|
-
},
|
|
62
|
-
304: {name: 'Gas', description: '', color: '#
|
|
63
|
-
305: {name: 'Gas', description: '', color: '#
|
|
64
|
-
306: {name: 'Gas', description: '', color: '#
|
|
65
|
-
307: {name: 'Gas', description: '', color: '#
|
|
66
|
-
308: {name: 'Gas', description: '', color: '#
|
|
67
|
-
309: {name: 'Gas', description: '', color: '#
|
|
68
|
-
310: {name: 'Gas', description: '', color: '#
|
|
60
|
+
color: '#B877FF',
|
|
61
|
+
},
|
|
62
|
+
304: {name: 'Gas', description: '', color: '#B877FF'},
|
|
63
|
+
305: {name: 'Gas', description: '', color: '#B877FF'},
|
|
64
|
+
306: {name: 'Gas', description: '', color: '#B877FF'},
|
|
65
|
+
307: {name: 'Gas', description: '', color: '#B877FF'},
|
|
66
|
+
308: {name: 'Gas', description: '', color: '#B877FF'},
|
|
67
|
+
309: {name: 'Gas', description: '', color: '#B877FF'},
|
|
68
|
+
310: {name: 'Gas', description: '', color: '#B877FF'},
|
|
69
69
|
|
|
70
70
|
// === Resources / Regolith ===
|
|
71
71
|
401: {name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B'},
|
|
@@ -160,7 +160,7 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
160
160
|
name: 'Reactor',
|
|
161
161
|
description:
|
|
162
162
|
'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
|
|
163
|
-
color: '#
|
|
163
|
+
color: '#B877FF',
|
|
164
164
|
},
|
|
165
165
|
10010: {
|
|
166
166
|
name: 'Emitter',
|
|
@@ -194,7 +194,7 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
194
194
|
name: 'Crafter',
|
|
195
195
|
description:
|
|
196
196
|
'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
|
|
197
|
-
color: '#
|
|
197
|
+
color: '#B877FF',
|
|
198
198
|
},
|
|
199
199
|
10105: {
|
|
200
200
|
name: 'Storage',
|
|
@@ -23,7 +23,7 @@ export function computeEngineCapabilities(stats: Record<string, number>): {
|
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
25
|
thrust: 400 + Math.floor((vol * 3) / 4),
|
|
26
|
-
drain: Math.max(30, 50 - Math.floor(thm / 70)),
|
|
26
|
+
drain: 2 * Math.max(30, 50 - Math.floor(thm / 70)),
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -35,8 +35,8 @@ export function computeGeneratorCapabilities(stats: Record<string, number>): {
|
|
|
35
35
|
const ref = stats.reflectivity
|
|
36
36
|
|
|
37
37
|
return {
|
|
38
|
-
capacity:
|
|
39
|
-
recharge: 1 + Math.floor((ref * 3) / 1000),
|
|
38
|
+
capacity: 950 + Math.floor(res / 2),
|
|
39
|
+
recharge: 2 * (1 + Math.floor((ref * 3) / 1000)),
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -82,7 +82,7 @@ export function computeGathererCapabilities(
|
|
|
82
82
|
|
|
83
83
|
return {
|
|
84
84
|
yield: 200 + str,
|
|
85
|
-
drain: Math.max(250, 1250 - Math.floor((con * 25) / 20)),
|
|
85
|
+
drain: 2 * Math.max(250, 1250 - Math.floor((con * 25) / 20)),
|
|
86
86
|
depth: gathererDepthForTier(tol, tier),
|
|
87
87
|
}
|
|
88
88
|
}
|
package/src/index-module.ts
CHANGED
|
@@ -240,13 +240,10 @@ export * from './capabilities'
|
|
|
240
240
|
export {
|
|
241
241
|
categoryColors,
|
|
242
242
|
tierColors,
|
|
243
|
-
categoryIcons,
|
|
244
|
-
categoryIconShapes,
|
|
245
243
|
componentIcon,
|
|
246
244
|
moduleIcon,
|
|
247
245
|
itemAbbreviations,
|
|
248
246
|
} from './data/colors'
|
|
249
|
-
export type {CategoryIconShape} from './data/colors'
|
|
250
247
|
|
|
251
248
|
export {itemTier, itemOffset, itemCategory, isRelatedItem, isCraftedItem} from './data/tiers'
|
|
252
249
|
export type {CraftedItemCategory} from './data/tiers'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import {BlockTimestamp, type UInt16Type} from '@wharfkit/antelope'
|
|
2
2
|
import {BaseManager} from './base'
|
|
3
3
|
import type {CoordinatesType, Distance} from '../types'
|
|
4
4
|
import {hasSystem} from '../utils/system'
|
|
5
5
|
import {findNearbyPlanets} from '../travel/travel'
|
|
6
6
|
import type {ServerContract} from '../contracts'
|
|
7
|
-
import {type DerivedStratum, deriveStrata} from '../derivation'
|
|
7
|
+
import {type DerivedStratum, deriveStrata, getEffectiveReserve} from '../derivation'
|
|
8
8
|
|
|
9
9
|
export interface LocationStratum extends DerivedStratum {
|
|
10
10
|
reserveMax: number
|
|
@@ -24,7 +24,10 @@ export class LocationsManager extends BaseManager {
|
|
|
24
24
|
return findNearbyPlanets(game.config.seed, origin, maxDistance)
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
async getStrata(
|
|
27
|
+
async getStrata(
|
|
28
|
+
coords: CoordinatesType,
|
|
29
|
+
now: BlockTimestamp = BlockTimestamp.fromMilliseconds(Date.now())
|
|
30
|
+
): Promise<LocationStratum[]> {
|
|
28
31
|
const game = await this.getGame()
|
|
29
32
|
const state = await this.getState()
|
|
30
33
|
|
|
@@ -36,15 +39,26 @@ export class LocationsManager extends BaseManager {
|
|
|
36
39
|
y: coords.y,
|
|
37
40
|
})) as ServerContract.Types.stratum_remaining[]
|
|
38
41
|
|
|
39
|
-
const
|
|
42
|
+
const epochSeconds = Number(game.config.epochtime)
|
|
43
|
+
const overrideMap = new Map<number, ServerContract.Types.stratum_remaining>()
|
|
40
44
|
for (const o of overrides) {
|
|
41
|
-
overrideMap.set(Number(o.stratum),
|
|
45
|
+
overrideMap.set(Number(o.stratum), o)
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
return derived.map((s) =>
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
return derived.map((s) => {
|
|
49
|
+
const override = overrideMap.get(s.index)
|
|
50
|
+
const reserve = override
|
|
51
|
+
? getEffectiveReserve(
|
|
52
|
+
{
|
|
53
|
+
remaining: override.remaining,
|
|
54
|
+
max_reserve: s.reserve,
|
|
55
|
+
last_block: override.last_block,
|
|
56
|
+
},
|
|
57
|
+
now,
|
|
58
|
+
epochSeconds
|
|
59
|
+
)
|
|
60
|
+
: s.reserve
|
|
61
|
+
return {...s, reserveMax: s.reserve, reserve}
|
|
62
|
+
})
|
|
49
63
|
}
|
|
50
64
|
}
|
package/src/nft/description.ts
CHANGED
|
@@ -48,12 +48,12 @@ export function computeBaseCapacityWarehouse(stats: bigint): number {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export const computeEngineThrust = (vol: number): number => 400 + idiv(vol * 3, 4)
|
|
51
|
-
export const computeEngineDrain = (thm: number): number => Math.max(30, 50 - idiv(thm, 70))
|
|
52
|
-
export const computeGeneratorCap = (com: number): number =>
|
|
53
|
-
export const computeGeneratorRech = (fin: number): number => 1 + idiv(fin * 3, 1000)
|
|
51
|
+
export const computeEngineDrain = (thm: number): number => 2 * Math.max(30, 50 - idiv(thm, 70))
|
|
52
|
+
export const computeGeneratorCap = (com: number): number => 950 + idiv(com, 2)
|
|
53
|
+
export const computeGeneratorRech = (fin: number): number => 2 * (1 + idiv(fin * 3, 1000))
|
|
54
54
|
export const computeGathererYield = (str: number): number => 200 + str
|
|
55
55
|
export const computeGathererDrain = (con: number): number =>
|
|
56
|
-
Math.max(250, 1250 - idiv(con * 25, 20))
|
|
56
|
+
2 * Math.max(250, 1250 - idiv(con * 25, 20))
|
|
57
57
|
export const computeGathererDepth = (tol: number, tier: number): number =>
|
|
58
58
|
gathererDepthForTier(tol, tier)
|
|
59
59
|
export const computeLoaderMass = (ins: number): number => Math.max(200, 2000 - ins * 2)
|
|
@@ -29,13 +29,7 @@ import {
|
|
|
29
29
|
computeContainerCapabilities,
|
|
30
30
|
computeContainerT2Capabilities,
|
|
31
31
|
} from '../derivation/capabilities'
|
|
32
|
-
import {
|
|
33
|
-
categoryColors,
|
|
34
|
-
categoryIcons,
|
|
35
|
-
componentIcon,
|
|
36
|
-
itemAbbreviations,
|
|
37
|
-
moduleIcon,
|
|
38
|
-
} from '../data/colors'
|
|
32
|
+
import {categoryColors, componentIcon, itemAbbreviations, moduleIcon} from '../data/colors'
|
|
39
33
|
import type {ServerContract} from '../contracts'
|
|
40
34
|
import {
|
|
41
35
|
ITEM_CONTAINER_T1_PACKED,
|
|
@@ -111,7 +105,7 @@ function resolveResource(id: number, stats?: UInt64Type): ResolvedItem {
|
|
|
111
105
|
return {
|
|
112
106
|
itemId: id,
|
|
113
107
|
name: item.name,
|
|
114
|
-
icon:
|
|
108
|
+
icon: '',
|
|
115
109
|
abbreviation: null,
|
|
116
110
|
category: cat,
|
|
117
111
|
tier: item.tier,
|