@shipload/sdk 0.7.1 → 2.0.0-rc1
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 +1651 -226
- package/lib/shipload.js +4958 -1971
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +4787 -1940
- package/lib/shipload.m.js.map +1 -1
- package/package.json +5 -4
- package/src/contracts/server.ts +585 -203
- package/src/data/goods.json +23 -0
- package/src/data/syllables.json +1184 -0
- package/src/entities/cargo-utils.ts +47 -0
- package/src/entities/entity-inventory.ts +39 -0
- package/src/entities/gamestate.ts +152 -0
- package/src/entities/location.ts +241 -0
- package/src/entities/player.ts +287 -0
- package/src/entities/ship.ts +559 -0
- package/src/entities/warehouse.ts +205 -0
- package/src/errors.ts +46 -9
- package/src/index-module.ts +119 -7
- package/src/managers/actions.ts +168 -0
- package/src/managers/base.ts +25 -0
- package/src/managers/context.ts +104 -0
- package/src/managers/entities.ts +86 -0
- package/src/managers/epochs.ts +47 -0
- package/src/managers/index.ts +9 -0
- package/src/managers/locations.ts +103 -0
- package/src/managers/players.ts +13 -0
- package/src/managers/trades.ts +119 -0
- package/src/market/goods.ts +31 -0
- package/src/{market.ts → market/market.ts} +32 -37
- package/src/{rolls.ts → market/rolls.ts} +3 -3
- package/src/{epoch.ts → scheduling/epoch.ts} +1 -1
- package/src/scheduling/projection.ts +218 -0
- package/src/scheduling/schedule.ts +155 -0
- package/src/shipload.ts +39 -157
- package/src/trading/collect.ts +939 -0
- package/src/trading/deal.ts +208 -0
- package/src/trading/trade.ts +203 -0
- package/src/travel/travel.ts +425 -0
- package/src/types.ts +60 -25
- package/src/utils/system.ts +27 -0
- package/src/goods.ts +0 -124
- package/src/ship.ts +0 -36
- package/src/state.ts +0 -0
- package/src/syllables.ts +0 -1184
- package/src/system.ts +0 -37
- package/src/travel.ts +0 -259
- /package/src/{hash.ts → utils/hash.ts} +0 -0
package/src/ship.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {UInt32} from '@wharfkit/antelope'
|
|
2
|
-
import {ServerContract} from './contracts'
|
|
3
|
-
import {PRECISION} from './types'
|
|
4
|
-
import {travelplanDuration} from './travel'
|
|
5
|
-
|
|
6
|
-
export class Ship extends ServerContract.Types.ship_row {
|
|
7
|
-
get maxDistance(): UInt32 {
|
|
8
|
-
return this.stats.capacity.dividing(this.stats.drain).multiplying(PRECISION)
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
get traveling(): boolean {
|
|
12
|
-
return !!this.travelplan
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
get arrived(): boolean {
|
|
16
|
-
if (!this.travelplan) {
|
|
17
|
-
throw new Error('Ship is not traveling')
|
|
18
|
-
}
|
|
19
|
-
const depart = this.travelplan.departure.toDate()
|
|
20
|
-
const arrive = new Date(
|
|
21
|
-
depart.getTime() + Number(travelplanDuration(this.travelplan)) * 1000
|
|
22
|
-
)
|
|
23
|
-
return new Date() >= arrive
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get eta(): number {
|
|
27
|
-
if (!this.travelplan) {
|
|
28
|
-
throw new Error('Ship is not traveling')
|
|
29
|
-
}
|
|
30
|
-
const depart = this.travelplan.departure.toDate()
|
|
31
|
-
const arrive = new Date(
|
|
32
|
-
depart.getTime() + Number(travelplanDuration(this.travelplan)) * 1000
|
|
33
|
-
)
|
|
34
|
-
return arrive.getTime() - new Date().getTime()
|
|
35
|
-
}
|
|
36
|
-
}
|
package/src/state.ts
DELETED
|
File without changes
|