@shipload/sdk 1.0.0-next.34 → 1.0.0-next.36
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 +398 -51
- package/lib/shipload.js +1481 -400
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +1442 -401
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +101 -20
- package/lib/testing.js +201 -57
- package/lib/testing.js.map +1 -1
- package/lib/testing.m.js +201 -57
- package/lib/testing.m.js.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/crafting.ts +2 -3
- package/src/capabilities/gathering.test.ts +16 -0
- package/src/capabilities/gathering.ts +8 -11
- package/src/contracts/server.ts +147 -29
- package/src/coordinates/address.ts +88 -0
- package/src/coordinates/constants.test.ts +15 -0
- package/src/coordinates/constants.ts +23 -0
- package/src/coordinates/index.ts +15 -0
- package/src/coordinates/memo.test.ts +47 -0
- package/src/coordinates/memo.ts +20 -0
- package/src/coordinates/permutation.ts +77 -0
- package/src/coordinates/regions.ts +48 -0
- package/src/coordinates/sectors.ts +115 -0
- package/src/data/capability-formulas.ts +0 -1
- package/src/data/entities.json +4 -4
- package/src/data/items.json +5 -5
- package/src/data/recipes.json +39 -65
- package/src/derivation/capabilities.test.ts +133 -0
- package/src/derivation/capabilities.ts +66 -14
- package/src/derivation/rollups.test.ts +55 -0
- package/src/derivation/rollups.ts +56 -0
- package/src/derivation/wormhole.ts +115 -0
- package/src/entities/makers.ts +30 -3
- package/src/errors.ts +2 -0
- package/src/index-module.ts +38 -2
- package/src/managers/actions.ts +79 -5
- package/src/managers/construction.ts +6 -4
- package/src/managers/context.ts +9 -0
- package/src/managers/coordinates.ts +14 -0
- package/src/managers/plot.ts +2 -4
- package/src/nft/description.ts +25 -6
- package/src/planner/index.ts +127 -0
- package/src/planner/planner.test.ts +319 -0
- package/src/resolution/resolve-item.ts +4 -1
- package/src/scheduling/availability.ts +1 -1
- package/src/scheduling/cancel.test.ts +348 -0
- package/src/scheduling/cancel.ts +209 -0
- package/src/scheduling/lanes.test.ts +249 -0
- package/src/scheduling/lanes.ts +140 -2
- package/src/scheduling/projection.ts +75 -16
- package/src/scheduling/schedule.ts +3 -1
- package/src/shipload.ts +5 -0
- package/src/testing/projection-parity.ts +26 -2
- package/src/travel/travel.ts +116 -105
- package/src/types/capabilities.ts +23 -6
- package/src/types/entity.ts +3 -3
- package/src/types.ts +2 -1
- package/src/utils/system.ts +11 -0
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {UInt32} from '@wharfkit/antelope'
|
|
2
2
|
import {CRAFT_ENERGY_DIVISOR} from '../types'
|
|
3
|
-
import type {EntityCapabilities} from '../types/capabilities'
|
|
4
|
-
import type {ServerContract} from '../contracts'
|
|
3
|
+
import type {CrafterStats, EntityCapabilities} from '../types/capabilities'
|
|
5
4
|
|
|
6
5
|
export interface CrafterCapability {
|
|
7
|
-
crafter:
|
|
6
|
+
crafter: CrafterStats
|
|
8
7
|
}
|
|
9
8
|
|
|
10
9
|
export function capsHasCrafter(caps: EntityCapabilities): boolean {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {expect, test} from 'bun:test'
|
|
2
|
+
import type {GathererStats} from '../types/capabilities'
|
|
3
|
+
import {calc_gather_energy} from './gathering'
|
|
4
|
+
|
|
5
|
+
function gatherer(drain: number): GathererStats {
|
|
6
|
+
return {
|
|
7
|
+
yield: {toNumber: () => 1},
|
|
8
|
+
drain: {toNumber: () => drain},
|
|
9
|
+
depth: {toNumber: () => 0, toString: () => '0'},
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
test('calc_gather_energy does not clamp above the old uint16 ceiling', () => {
|
|
14
|
+
const energy = calc_gather_energy(gatherer(30), 400_000_000)
|
|
15
|
+
expect(Number(energy)).toBeGreaterThan(65535)
|
|
16
|
+
})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import {UInt32} from '@wharfkit/antelope'
|
|
2
|
+
import type {GathererStats} from '../types/capabilities'
|
|
3
3
|
import {PRECISION} from '../types'
|
|
4
4
|
|
|
5
5
|
const GATHER_TIME_SCALE = 100
|
|
6
|
-
const GATHER_MASS_DIVISOR = 228
|
|
6
|
+
export const GATHER_MASS_DIVISOR = 228
|
|
7
7
|
const DEPTH_PENALTY_DIVISOR = 5000
|
|
8
8
|
|
|
9
9
|
function gather_duration_raw(
|
|
10
|
-
gatherer:
|
|
10
|
+
gatherer: GathererStats,
|
|
11
11
|
itemMass: number,
|
|
12
12
|
quantity: number,
|
|
13
13
|
stratum: number,
|
|
@@ -24,7 +24,7 @@ function gather_duration_raw(
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
export function calc_gather_duration(
|
|
27
|
-
gatherer:
|
|
27
|
+
gatherer: GathererStats,
|
|
28
28
|
itemMass: number,
|
|
29
29
|
quantity: number,
|
|
30
30
|
stratum: number,
|
|
@@ -36,7 +36,7 @@ export function calc_gather_duration(
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export function calc_gather_rate(
|
|
39
|
-
gatherer:
|
|
39
|
+
gatherer: GathererStats,
|
|
40
40
|
itemMass: number,
|
|
41
41
|
stratum: number,
|
|
42
42
|
richness: number
|
|
@@ -47,10 +47,7 @@ export function calc_gather_rate(
|
|
|
47
47
|
return {unitsPerSec, unitsPerMin: unitsPerSec * 60, secPerUnit}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
export function calc_gather_energy(
|
|
51
|
-
gatherer: ServerContract.Types.gatherer_stats,
|
|
52
|
-
duration: number
|
|
53
|
-
): UInt16 {
|
|
50
|
+
export function calc_gather_energy(gatherer: GathererStats, duration: number): UInt32 {
|
|
54
51
|
const energy = Math.floor((duration * gatherer.drain.toNumber()) / PRECISION)
|
|
55
|
-
return
|
|
52
|
+
return UInt32.from(energy)
|
|
56
53
|
}
|