@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.
Files changed (47) hide show
  1. package/lib/shipload.d.ts +1651 -226
  2. package/lib/shipload.js +4958 -1971
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +4787 -1940
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +5 -4
  7. package/src/contracts/server.ts +585 -203
  8. package/src/data/goods.json +23 -0
  9. package/src/data/syllables.json +1184 -0
  10. package/src/entities/cargo-utils.ts +47 -0
  11. package/src/entities/entity-inventory.ts +39 -0
  12. package/src/entities/gamestate.ts +152 -0
  13. package/src/entities/location.ts +241 -0
  14. package/src/entities/player.ts +287 -0
  15. package/src/entities/ship.ts +559 -0
  16. package/src/entities/warehouse.ts +205 -0
  17. package/src/errors.ts +46 -9
  18. package/src/index-module.ts +119 -7
  19. package/src/managers/actions.ts +168 -0
  20. package/src/managers/base.ts +25 -0
  21. package/src/managers/context.ts +104 -0
  22. package/src/managers/entities.ts +86 -0
  23. package/src/managers/epochs.ts +47 -0
  24. package/src/managers/index.ts +9 -0
  25. package/src/managers/locations.ts +103 -0
  26. package/src/managers/players.ts +13 -0
  27. package/src/managers/trades.ts +119 -0
  28. package/src/market/goods.ts +31 -0
  29. package/src/{market.ts → market/market.ts} +32 -37
  30. package/src/{rolls.ts → market/rolls.ts} +3 -3
  31. package/src/{epoch.ts → scheduling/epoch.ts} +1 -1
  32. package/src/scheduling/projection.ts +218 -0
  33. package/src/scheduling/schedule.ts +155 -0
  34. package/src/shipload.ts +39 -157
  35. package/src/trading/collect.ts +939 -0
  36. package/src/trading/deal.ts +208 -0
  37. package/src/trading/trade.ts +203 -0
  38. package/src/travel/travel.ts +425 -0
  39. package/src/types.ts +60 -25
  40. package/src/utils/system.ts +27 -0
  41. package/src/goods.ts +0 -124
  42. package/src/ship.ts +0 -36
  43. package/src/state.ts +0 -0
  44. package/src/syllables.ts +0 -1184
  45. package/src/system.ts +0 -37
  46. package/src/travel.ts +0 -259
  47. /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