@shipload/sdk 2.0.0-rc10 → 2.0.0-rc12
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 +144 -72
- package/lib/shipload.js +2537 -2238
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +2505 -2224
- package/lib/shipload.m.js.map +1 -1
- package/package.json +2 -2
- package/src/capabilities/gathering.ts +36 -0
- package/src/capabilities/guards.ts +3 -3
- package/src/capabilities/index.ts +1 -1
- package/src/capabilities/modules.ts +4 -4
- package/src/capabilities/storage.ts +92 -2
- package/src/contracts/server.ts +53 -16
- package/src/data/capabilities.ts +28 -28
- package/src/data/categories.ts +1 -1
- package/src/data/colors.ts +1 -0
- package/src/data/recipes.ts +25 -25
- package/src/derivation/crafting.ts +76 -0
- package/src/derivation/index.ts +3 -1
- package/src/derivation/resources.ts +1 -7
- package/src/derivation/stratum.ts +21 -17
- package/src/derivation/tiers.ts +54 -0
- package/src/entities/location.ts +3 -3
- package/src/entities/ship-deploy.ts +17 -17
- package/src/entities/ship.ts +4 -4
- package/src/errors.ts +5 -0
- package/src/index-module.ts +22 -13
- package/src/managers/actions.ts +6 -3
- package/src/market/items.ts +69 -10
- package/src/nft/description.ts +11 -11
- package/src/resolution/resolve-item.ts +7 -7
- package/src/scheduling/projection.ts +86 -77
- package/src/scheduling/schedule.ts +2 -2
- package/src/types/capabilities.ts +5 -5
- package/src/types/entity.ts +1 -1
- package/src/types.ts +3 -2
- package/src/utils/system.ts +14 -1
- package/src/capabilities/extraction.ts +0 -36
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {UInt16, UInt32} from '@wharfkit/antelope'
|
|
2
|
-
import {ServerContract} from '../contracts'
|
|
3
|
-
import {PRECISION} from '../types'
|
|
4
|
-
|
|
5
|
-
const EXTRACTION_TIME_SCALE = 100
|
|
6
|
-
const DEPTH_PENALTY_DIVISOR = 5000
|
|
7
|
-
const DRILL_TIME_SCALE = 300
|
|
8
|
-
|
|
9
|
-
export function calc_extraction_duration(
|
|
10
|
-
extractor: ServerContract.Types.extractor_stats,
|
|
11
|
-
itemMass: number,
|
|
12
|
-
quantity: number,
|
|
13
|
-
stratum: number,
|
|
14
|
-
richness: number
|
|
15
|
-
): UInt32 {
|
|
16
|
-
const rate = extractor.rate.toNumber()
|
|
17
|
-
const drill = extractor.drill.toNumber()
|
|
18
|
-
|
|
19
|
-
if (rate === 0 || drill === 0 || richness === 0) return UInt32.from(0)
|
|
20
|
-
|
|
21
|
-
const massFactor = Math.sqrt(itemMass)
|
|
22
|
-
const depthPenalty = 1 + stratum / DEPTH_PENALTY_DIVISOR
|
|
23
|
-
const richnessMul = richness / 1000
|
|
24
|
-
const extractionTime =
|
|
25
|
-
(quantity * massFactor * EXTRACTION_TIME_SCALE * depthPenalty) / (rate * richnessMul)
|
|
26
|
-
const drillTime = DRILL_TIME_SCALE * Math.log(1 + stratum / drill)
|
|
27
|
-
return UInt32.from(Math.floor(extractionTime + drillTime))
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export function calc_extraction_energy(
|
|
31
|
-
extractor: ServerContract.Types.extractor_stats,
|
|
32
|
-
duration: number
|
|
33
|
-
): UInt16 {
|
|
34
|
-
const energy = Math.floor((duration * extractor.drain.toNumber()) / PRECISION)
|
|
35
|
-
return UInt16.from(energy)
|
|
36
|
-
}
|