@shipload/sdk 2.0.0-rc2 → 2.0.0-rc21

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 (84) hide show
  1. package/README.md +1 -349
  2. package/lib/shipload.d.ts +1729 -1127
  3. package/lib/shipload.js +7944 -3165
  4. package/lib/shipload.js.map +1 -1
  5. package/lib/shipload.m.js +7487 -2840
  6. package/lib/shipload.m.js.map +1 -1
  7. package/package.json +6 -4
  8. package/src/capabilities/crafting.ts +22 -0
  9. package/src/capabilities/gathering.ts +36 -0
  10. package/src/capabilities/guards.ts +3 -8
  11. package/src/capabilities/hauling.ts +22 -0
  12. package/src/capabilities/index.ts +4 -1
  13. package/src/capabilities/modules.ts +86 -0
  14. package/src/capabilities/storage.ts +101 -9
  15. package/src/contracts/server.ts +785 -293
  16. package/src/data/capabilities.ts +408 -0
  17. package/src/data/categories.ts +55 -0
  18. package/src/data/colors.ts +71 -0
  19. package/src/data/entities.json +50 -0
  20. package/src/data/item-ids.ts +75 -0
  21. package/src/data/items.json +252 -0
  22. package/src/data/locations.ts +53 -0
  23. package/src/data/metadata.ts +208 -0
  24. package/src/data/nebula-adjectives.json +211 -0
  25. package/src/data/nebula-nouns.json +151 -0
  26. package/src/data/recipes-runtime.ts +65 -0
  27. package/src/data/recipes.json +878 -0
  28. package/src/data/syllables.json +1386 -780
  29. package/src/data/tiers.ts +45 -0
  30. package/src/derivation/crafting.ts +348 -0
  31. package/src/derivation/index.ts +30 -0
  32. package/src/derivation/location-size.ts +15 -0
  33. package/src/derivation/resources.ts +112 -0
  34. package/src/derivation/stats.ts +146 -0
  35. package/src/derivation/stratum.ts +134 -0
  36. package/src/derivation/tiers.ts +54 -0
  37. package/src/entities/cargo-utils.ts +10 -68
  38. package/src/entities/container.ts +37 -0
  39. package/src/entities/entity-inventory.ts +13 -13
  40. package/src/entities/inventory-accessor.ts +2 -6
  41. package/src/entities/location.ts +5 -200
  42. package/src/entities/makers.ts +144 -17
  43. package/src/entities/player.ts +1 -274
  44. package/src/entities/ship-deploy.ts +258 -0
  45. package/src/entities/ship.ts +28 -34
  46. package/src/entities/warehouse.ts +35 -7
  47. package/src/errors.ts +59 -5
  48. package/src/format.ts +12 -0
  49. package/src/index-module.ts +188 -50
  50. package/src/managers/actions.ts +138 -88
  51. package/src/managers/context.ts +19 -9
  52. package/src/managers/index.ts +0 -1
  53. package/src/managers/locations.ts +2 -85
  54. package/src/market/items.ts +41 -0
  55. package/src/nft/description.ts +176 -0
  56. package/src/nft/deserializers.ts +83 -0
  57. package/src/nft/index.ts +2 -0
  58. package/src/resolution/describe-module.ts +165 -0
  59. package/src/resolution/display-name.ts +43 -0
  60. package/src/resolution/resolve-item.ts +358 -0
  61. package/src/scheduling/projection.ts +200 -67
  62. package/src/scheduling/schedule.ts +2 -2
  63. package/src/shipload.ts +10 -5
  64. package/src/subscriptions/connection.ts +154 -0
  65. package/src/subscriptions/debug.ts +17 -0
  66. package/src/subscriptions/index.ts +5 -0
  67. package/src/subscriptions/manager.ts +240 -0
  68. package/src/subscriptions/mappers.ts +28 -0
  69. package/src/subscriptions/types.ts +143 -0
  70. package/src/travel/travel.ts +37 -23
  71. package/src/types/capabilities.ts +11 -14
  72. package/src/types/entity-traits.ts +3 -4
  73. package/src/types/entity.ts +9 -6
  74. package/src/types.ts +72 -72
  75. package/src/utils/system.ts +66 -53
  76. package/src/capabilities/extraction.ts +0 -37
  77. package/src/data/goods.json +0 -23
  78. package/src/managers/trades.ts +0 -119
  79. package/src/market/goods.ts +0 -31
  80. package/src/market/market.ts +0 -208
  81. package/src/market/rolls.ts +0 -8
  82. package/src/trading/collect.ts +0 -938
  83. package/src/trading/deal.ts +0 -207
  84. package/src/trading/trade.ts +0 -203
@@ -0,0 +1,151 @@
1
+ [
2
+ "Abyss",
3
+ "Anchor",
4
+ "Anvil",
5
+ "Apex",
6
+ "Arch",
7
+ "Aurora",
8
+ "Basin",
9
+ "Beacon",
10
+ "Bloom",
11
+ "Bough",
12
+ "Briar",
13
+ "Brine",
14
+ "Bulwark",
15
+ "Cairn",
16
+ "Caldera",
17
+ "Canopy",
18
+ "Cascade",
19
+ "Chalice",
20
+ "Chasm",
21
+ "Chorus",
22
+ "Cistern",
23
+ "Citadel",
24
+ "Cloak",
25
+ "Cloud",
26
+ "Coil",
27
+ "Column",
28
+ "Core",
29
+ "Corona",
30
+ "Cradle",
31
+ "Crest",
32
+ "Crown",
33
+ "Crucible",
34
+ "Current",
35
+ "Curtain",
36
+ "Drift",
37
+ "Dusk",
38
+ "Echo",
39
+ "Eddy",
40
+ "Ember",
41
+ "Expanse",
42
+ "Eye",
43
+ "Fathom",
44
+ "Fissure",
45
+ "Fjord",
46
+ "Flare",
47
+ "Fold",
48
+ "Forge",
49
+ "Frontier",
50
+ "Furrow",
51
+ "Gate",
52
+ "Glade",
53
+ "Gorge",
54
+ "Grip",
55
+ "Grotto",
56
+ "Gulf",
57
+ "Gyre",
58
+ "Halo",
59
+ "Haven",
60
+ "Heart",
61
+ "Hearth",
62
+ "Helix",
63
+ "Hollow",
64
+ "Horn",
65
+ "Husk",
66
+ "Inlet",
67
+ "Iris",
68
+ "Jaw",
69
+ "Keel",
70
+ "Knot",
71
+ "Lantern",
72
+ "Lattice",
73
+ "Loom",
74
+ "Mantle",
75
+ "Marrow",
76
+ "Maw",
77
+ "Meridian",
78
+ "Mirage",
79
+ "Monolith",
80
+ "Mote",
81
+ "Nave",
82
+ "Nebula",
83
+ "Nexus",
84
+ "Obelisk",
85
+ "Orbit",
86
+ "Pall",
87
+ "Passage",
88
+ "Petal",
89
+ "Pillar",
90
+ "Pinnacle",
91
+ "Plume",
92
+ "Prism",
93
+ "Prow",
94
+ "Pulse",
95
+ "Pyre",
96
+ "Reach",
97
+ "Remnant",
98
+ "Rib",
99
+ "Ridge",
100
+ "Rift",
101
+ "Root",
102
+ "Sanctum",
103
+ "Seal",
104
+ "Seam",
105
+ "Shard",
106
+ "Shoal",
107
+ "Shroud",
108
+ "Sigil",
109
+ "Sink",
110
+ "Skull",
111
+ "Span",
112
+ "Spar",
113
+ "Spine",
114
+ "Spire",
115
+ "Spoke",
116
+ "Spur",
117
+ "Steeple",
118
+ "Storm",
119
+ "Strand",
120
+ "Surge",
121
+ "Talon",
122
+ "Tendril",
123
+ "Thicket",
124
+ "Thorn",
125
+ "Thread",
126
+ "Threshold",
127
+ "Throat",
128
+ "Tide",
129
+ "Tomb",
130
+ "Torrent",
131
+ "Trench",
132
+ "Trough",
133
+ "Vault",
134
+ "Veil",
135
+ "Vestige",
136
+ "Vigil",
137
+ "Void",
138
+ "Vortex",
139
+ "Wake",
140
+ "Ward",
141
+ "Warden",
142
+ "Weave",
143
+ "Web",
144
+ "Well",
145
+ "Wellspring",
146
+ "Whisper",
147
+ "Wisp",
148
+ "Wraith",
149
+ "Wreath",
150
+ "Zenith"
151
+ ]
@@ -0,0 +1,65 @@
1
+ import items from './items.json'
2
+ import recipes from './recipes.json'
3
+ import entities from './entities.json'
4
+
5
+ import {getItem} from '../market/items'
6
+ import {Item, ModuleType, ResourceCategory} from '../types'
7
+
8
+ export interface RecipeInputItemId {
9
+ itemId: number
10
+ quantity: number
11
+ }
12
+ export interface RecipeInputCategory {
13
+ category: ResourceCategory
14
+ tier: number
15
+ quantity: number
16
+ }
17
+ export type RecipeInput = RecipeInputItemId | RecipeInputCategory
18
+
19
+ export interface StatSlot {
20
+ sources: {inputIndex: number; statIndex: number}[]
21
+ }
22
+
23
+ export interface Recipe {
24
+ outputItemId: number
25
+ outputMass: number
26
+ inputs: RecipeInput[]
27
+ statSlots: StatSlot[]
28
+ blendWeights: number[]
29
+ }
30
+
31
+ export interface EntitySlot {
32
+ type: ModuleType
33
+ }
34
+
35
+ export interface EntityLayout {
36
+ entityItemId: number
37
+ slots: EntitySlot[]
38
+ }
39
+
40
+ const recipesById = new Map<number, Recipe>()
41
+ for (const r of recipes as any[]) recipesById.set(r.outputItemId, r as Recipe)
42
+
43
+ const entitiesById = new Map<number, EntityLayout>()
44
+ for (const e of entities as any[]) entitiesById.set(e.entityItemId, e as EntityLayout)
45
+
46
+ const resourceByCategoryTier = new Map<string, Item>()
47
+ for (const raw of items as any[]) {
48
+ if (raw.type === 'resource') {
49
+ resourceByCategoryTier.set(`${raw.category}:${raw.tier}`, getItem(raw.id))
50
+ }
51
+ }
52
+
53
+ export function getRecipe(outputItemId: number): Recipe | undefined {
54
+ return recipesById.get(outputItemId)
55
+ }
56
+
57
+ export function getEntityLayout(entityItemId: number): EntityLayout | undefined {
58
+ return entitiesById.get(entityItemId)
59
+ }
60
+
61
+ export function findItemByCategoryAndTier(category: ResourceCategory, tier: number): Item {
62
+ const item = resourceByCategoryTier.get(`${category}:${tier}`)
63
+ if (!item) throw new Error(`No resource found for category=${category} tier=${tier}`)
64
+ return item
65
+ }