@shipload/sdk 1.0.0-next.61 → 1.0.0-next.63
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 +1243 -59
- package/lib/shipload.js +3911 -1261
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +3812 -1265
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +391 -13
- package/lib/testing.js +1554 -114
- package/lib/testing.js.map +1 -1
- package/lib/testing.m.js +1555 -115
- package/lib/testing.m.js.map +1 -1
- package/package.json +2 -2
- package/src/contracts/fund.ts +201 -0
- package/src/contracts/platform.ts +73 -1
- package/src/contracts/server.ts +946 -26
- package/src/contracts.ts +1 -0
- package/src/data/charters.json +198 -0
- package/src/data/entities.json +36 -0
- package/src/data/item-ids.ts +2 -0
- package/src/data/items.json +12 -0
- package/src/data/kind-registry.json +20 -3
- package/src/data/kind-registry.ts +5 -0
- package/src/data/metadata.ts +14 -0
- package/src/data/recipes.json +0 -48
- package/src/derivation/capabilities.ts +14 -0
- package/src/derivation/recipe-usage.test.ts +0 -2
- package/src/format.ts +9 -0
- package/src/index-module.ts +34 -3
- package/src/influence/categories.ts +32 -0
- package/src/influence/charters.test.ts +126 -0
- package/src/influence/charters.ts +120 -0
- package/src/influence/citizenry.ts +31 -0
- package/src/influence/constants.ts +63 -0
- package/src/influence/decay.ts +20 -0
- package/src/influence/decomp.ts +95 -0
- package/src/influence/demand.ts +106 -0
- package/src/influence/duration.ts +36 -0
- package/src/influence/index.ts +63 -0
- package/src/influence/influence.test.ts +291 -0
- package/src/influence/quality.ts +25 -0
- package/src/influence/valuation.ts +154 -0
- package/src/managers/actions.ts +135 -0
- package/src/managers/construction.ts +11 -1
- package/src/managers/context.ts +18 -0
- package/src/managers/entities.ts +11 -0
- package/src/managers/index.ts +13 -0
- package/src/managers/influence.test.ts +58 -0
- package/src/managers/influence.ts +347 -0
- package/src/managers/jobs.test.ts +62 -0
- package/src/managers/jobs.ts +52 -0
- package/src/nft/description.ts +7 -0
- package/src/scheduling/jobs.test.ts +32 -0
- package/src/scheduling/jobs.ts +37 -0
- package/src/scheduling/task-cargo.ts +1 -0
- package/src/shipload.ts +10 -0
- package/src/types.ts +23 -4
package/src/shipload.ts
CHANGED
|
@@ -12,6 +12,8 @@ import type {EpochsManager} from './managers/epochs'
|
|
|
12
12
|
import type {ActionsManager} from './managers/actions'
|
|
13
13
|
import type {ClusterManager} from './managers/cluster'
|
|
14
14
|
import type {NftManager} from './managers/nft'
|
|
15
|
+
import type {JobsManager} from './managers/jobs'
|
|
16
|
+
import type {InfluenceManager} from './managers/influence'
|
|
15
17
|
import type {SubscriptionsManager} from './subscriptions/manager'
|
|
16
18
|
import type {GameState} from './entities/gamestate'
|
|
17
19
|
|
|
@@ -132,6 +134,14 @@ export class Shipload {
|
|
|
132
134
|
return this._context.nft
|
|
133
135
|
}
|
|
134
136
|
|
|
137
|
+
get jobs(): JobsManager {
|
|
138
|
+
return this._context.jobs
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
get influence(): InfluenceManager {
|
|
142
|
+
return this._context.influence
|
|
143
|
+
}
|
|
144
|
+
|
|
135
145
|
get subscriptions(): SubscriptionsManager {
|
|
136
146
|
return this._context.subscriptions
|
|
137
147
|
}
|
package/src/types.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
type UInt64Type,
|
|
9
9
|
} from '@wharfkit/antelope'
|
|
10
10
|
import {ServerContract} from './contracts'
|
|
11
|
+
import {COORD_MAX, COORD_MIN} from './coordinates/constants'
|
|
11
12
|
|
|
12
13
|
export const PRECISION = 10000
|
|
13
14
|
export const CRAFT_ENERGY_DIVISOR = 150000
|
|
@@ -70,6 +71,7 @@ export enum TaskType {
|
|
|
70
71
|
UPGRADE = 17,
|
|
71
72
|
SHUTTLE = 18,
|
|
72
73
|
REFIT = 19,
|
|
74
|
+
CONTRIBUTE = 20,
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
export enum RefitOp {
|
|
@@ -124,13 +126,30 @@ export class Coordinates extends ServerContract.Types.coordinates {
|
|
|
124
126
|
|
|
125
127
|
export function coordsToLocationId(coords: CoordinatesType): UInt64 {
|
|
126
128
|
const c = Coordinates.from(coords)
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
const x = BigInt(c.x.toString())
|
|
130
|
+
const y = BigInt(c.y.toString())
|
|
131
|
+
if (
|
|
132
|
+
x < BigInt(COORD_MIN) ||
|
|
133
|
+
x > BigInt(COORD_MAX) ||
|
|
134
|
+
y < BigInt(COORD_MIN) ||
|
|
135
|
+
y > BigInt(COORD_MAX)
|
|
136
|
+
) {
|
|
137
|
+
throw new Error('coordinate out of int32 bounds')
|
|
138
|
+
}
|
|
139
|
+
const offset = BigInt(2147483648)
|
|
140
|
+
const id = ((x + offset) << BigInt(32)) | (y + offset)
|
|
131
141
|
return UInt64.from(id)
|
|
132
142
|
}
|
|
133
143
|
|
|
144
|
+
export function locationIdToCoords(id: UInt64Type): {x: number; y: number} {
|
|
145
|
+
const value = BigInt(UInt64.from(id).toString())
|
|
146
|
+
const offset = BigInt(2147483648)
|
|
147
|
+
return {
|
|
148
|
+
x: Number((value >> BigInt(32)) - offset),
|
|
149
|
+
y: Number((value & BigInt('0xffffffff')) - offset),
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
134
153
|
export interface Distance {
|
|
135
154
|
origin: ServerContract.ActionParams.Type.coordinates
|
|
136
155
|
destination: ServerContract.ActionParams.Type.coordinates
|