@shipload/sdk 2.0.0-rc20 → 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.
- package/lib/shipload.d.ts +187 -117
- package/lib/shipload.js +2963 -1949
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +2908 -1936
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/modules.ts +36 -7
- package/src/capabilities/storage.ts +1 -1
- package/src/contracts/server.ts +69 -1
- package/src/data/entities.json +50 -0
- package/src/data/item-ids.ts +75 -0
- package/src/data/items.json +250 -15
- package/src/data/metadata.ts +208 -0
- package/src/data/recipes-runtime.ts +65 -0
- package/src/data/recipes.json +878 -0
- package/src/derivation/crafting.ts +172 -111
- package/src/derivation/resources.ts +14 -38
- package/src/entities/container.ts +4 -4
- package/src/entities/entity-inventory.ts +2 -2
- package/src/entities/makers.ts +18 -10
- package/src/entities/ship-deploy.ts +8 -8
- package/src/index-module.ts +2 -47
- package/src/market/items.ts +23 -75
- package/src/nft/description.ts +7 -7
- package/src/nft/deserializers.ts +6 -4
- package/src/resolution/display-name.ts +8 -4
- package/src/resolution/resolve-item.ts +80 -65
- package/src/scheduling/projection.ts +8 -28
- package/src/travel/travel.ts +8 -7
- package/src/types.ts +27 -33
- package/src/data/recipes.ts +0 -587
package/src/data/items.json
CHANGED
|
@@ -1,17 +1,252 @@
|
|
|
1
1
|
[
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
{
|
|
3
|
+
"id": 101,
|
|
4
|
+
"mass": 52000,
|
|
5
|
+
"type": "resource",
|
|
6
|
+
"tier": 1,
|
|
7
|
+
"category": "ore"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"id": 102,
|
|
11
|
+
"mass": 58000,
|
|
12
|
+
"type": "resource",
|
|
13
|
+
"tier": 2,
|
|
14
|
+
"category": "ore"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"id": 103,
|
|
18
|
+
"mass": 64000,
|
|
19
|
+
"type": "resource",
|
|
20
|
+
"tier": 3,
|
|
21
|
+
"category": "ore"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": 201,
|
|
25
|
+
"mass": 35000,
|
|
26
|
+
"type": "resource",
|
|
27
|
+
"tier": 1,
|
|
28
|
+
"category": "crystal"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"id": 202,
|
|
32
|
+
"mass": 35000,
|
|
33
|
+
"type": "resource",
|
|
34
|
+
"tier": 2,
|
|
35
|
+
"category": "crystal"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"id": 203,
|
|
39
|
+
"mass": 35000,
|
|
40
|
+
"type": "resource",
|
|
41
|
+
"tier": 3,
|
|
42
|
+
"category": "crystal"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"id": 301,
|
|
46
|
+
"mass": 15000,
|
|
47
|
+
"type": "resource",
|
|
48
|
+
"tier": 1,
|
|
49
|
+
"category": "gas"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": 302,
|
|
53
|
+
"mass": 13500,
|
|
54
|
+
"type": "resource",
|
|
55
|
+
"tier": 2,
|
|
56
|
+
"category": "gas"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"id": 303,
|
|
60
|
+
"mass": 12000,
|
|
61
|
+
"type": "resource",
|
|
62
|
+
"tier": 3,
|
|
63
|
+
"category": "gas"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"id": 401,
|
|
67
|
+
"mass": 22000,
|
|
68
|
+
"type": "resource",
|
|
69
|
+
"tier": 1,
|
|
70
|
+
"category": "regolith"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"id": 402,
|
|
74
|
+
"mass": 25000,
|
|
75
|
+
"type": "resource",
|
|
76
|
+
"tier": 2,
|
|
77
|
+
"category": "regolith"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"id": 403,
|
|
81
|
+
"mass": 28000,
|
|
82
|
+
"type": "resource",
|
|
83
|
+
"tier": 3,
|
|
84
|
+
"category": "regolith"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"id": 501,
|
|
88
|
+
"mass": 42000,
|
|
89
|
+
"type": "resource",
|
|
90
|
+
"tier": 1,
|
|
91
|
+
"category": "biomass"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": 502,
|
|
95
|
+
"mass": 37000,
|
|
96
|
+
"type": "resource",
|
|
97
|
+
"tier": 2,
|
|
98
|
+
"category": "biomass"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": 503,
|
|
102
|
+
"mass": 33000,
|
|
103
|
+
"type": "resource",
|
|
104
|
+
"tier": 3,
|
|
105
|
+
"category": "biomass"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"id": 10001,
|
|
109
|
+
"mass": 50000,
|
|
110
|
+
"type": "component",
|
|
111
|
+
"tier": 1
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"id": 10002,
|
|
115
|
+
"mass": 30000,
|
|
116
|
+
"type": "component",
|
|
117
|
+
"tier": 1
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"id": 10003,
|
|
121
|
+
"mass": 50000,
|
|
122
|
+
"type": "component",
|
|
123
|
+
"tier": 1
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"id": 10004,
|
|
127
|
+
"mass": 30000,
|
|
128
|
+
"type": "component",
|
|
129
|
+
"tier": 1
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"id": 10005,
|
|
133
|
+
"mass": 50000,
|
|
134
|
+
"type": "component",
|
|
135
|
+
"tier": 1
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"id": 10006,
|
|
139
|
+
"mass": 30000,
|
|
140
|
+
"type": "component",
|
|
141
|
+
"tier": 1
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": 10007,
|
|
145
|
+
"mass": 30000,
|
|
146
|
+
"type": "component",
|
|
147
|
+
"tier": 1
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": 10008,
|
|
151
|
+
"mass": 30000,
|
|
152
|
+
"type": "component",
|
|
153
|
+
"tier": 1
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"id": 10009,
|
|
157
|
+
"mass": 50000,
|
|
158
|
+
"type": "component",
|
|
159
|
+
"tier": 1
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"id": 10010,
|
|
163
|
+
"mass": 40000,
|
|
164
|
+
"type": "component",
|
|
165
|
+
"tier": 1
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"id": 10100,
|
|
169
|
+
"mass": 150000,
|
|
170
|
+
"type": "module",
|
|
171
|
+
"tier": 1,
|
|
172
|
+
"subtype": "engine"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"id": 10101,
|
|
176
|
+
"mass": 75000,
|
|
177
|
+
"type": "module",
|
|
178
|
+
"tier": 1,
|
|
179
|
+
"subtype": "generator"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"id": 10102,
|
|
183
|
+
"mass": 145000,
|
|
184
|
+
"type": "module",
|
|
185
|
+
"tier": 1,
|
|
186
|
+
"subtype": "gatherer"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"id": 10103,
|
|
190
|
+
"mass": 90000,
|
|
191
|
+
"type": "module",
|
|
192
|
+
"tier": 1,
|
|
193
|
+
"subtype": "loader"
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"id": 10104,
|
|
197
|
+
"mass": 120000,
|
|
198
|
+
"type": "module",
|
|
199
|
+
"tier": 1,
|
|
200
|
+
"subtype": "crafter"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"id": 10105,
|
|
204
|
+
"mass": 100000,
|
|
205
|
+
"type": "module",
|
|
206
|
+
"tier": 1,
|
|
207
|
+
"subtype": "storage"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"id": 10106,
|
|
211
|
+
"mass": 120000,
|
|
212
|
+
"type": "module",
|
|
213
|
+
"tier": 1,
|
|
214
|
+
"subtype": "hauler"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"id": 10200,
|
|
218
|
+
"mass": 80000,
|
|
219
|
+
"type": "entity",
|
|
220
|
+
"tier": 1
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"id": 10201,
|
|
224
|
+
"mass": 100000,
|
|
225
|
+
"type": "entity",
|
|
226
|
+
"tier": 1
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
"id": 10202,
|
|
230
|
+
"mass": 1300000,
|
|
231
|
+
"type": "entity",
|
|
232
|
+
"tier": 1
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"id": 20001,
|
|
236
|
+
"mass": 50000,
|
|
237
|
+
"type": "component",
|
|
238
|
+
"tier": 2
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"id": 20002,
|
|
242
|
+
"mass": 30000,
|
|
243
|
+
"type": "component",
|
|
244
|
+
"tier": 2
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"id": 20200,
|
|
248
|
+
"mass": 80000,
|
|
249
|
+
"type": "entity",
|
|
250
|
+
"tier": 2
|
|
251
|
+
}
|
|
17
252
|
]
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import items from './items.json'
|
|
2
|
+
|
|
3
|
+
export interface ItemMetadata {
|
|
4
|
+
name: string
|
|
5
|
+
description: string
|
|
6
|
+
color: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface EntityMetadata {
|
|
10
|
+
moduleSlotLabels?: string[]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const itemMetadata: Record<number, ItemMetadata> = {
|
|
14
|
+
// === Resources (raw) ===
|
|
15
|
+
101: {name: 'Ore', description: 'Crude metallic ore.', color: '#C26D3F'},
|
|
16
|
+
102: {name: 'Ore', description: 'Refined metallic ore with improved purity.', color: '#C26D3F'},
|
|
17
|
+
103: {
|
|
18
|
+
name: 'Ore',
|
|
19
|
+
description: 'High-grade metallic ore with exceptional density.',
|
|
20
|
+
color: '#C26D3F',
|
|
21
|
+
},
|
|
22
|
+
201: {name: 'Crystal', description: 'Raw resonant crystal.', color: '#4ADBFF'},
|
|
23
|
+
202: {
|
|
24
|
+
name: 'Crystal',
|
|
25
|
+
description: 'Refined resonant crystal with improved clarity.',
|
|
26
|
+
color: '#4ADBFF',
|
|
27
|
+
},
|
|
28
|
+
203: {
|
|
29
|
+
name: 'Crystal',
|
|
30
|
+
description: 'High-grade resonant crystal with exceptional purity.',
|
|
31
|
+
color: '#4ADBFF',
|
|
32
|
+
},
|
|
33
|
+
301: {name: 'Gas', description: 'Raw volatile gas.', color: '#B8E4A0'},
|
|
34
|
+
302: {
|
|
35
|
+
name: 'Gas',
|
|
36
|
+
description: 'Refined volatile gas with improved reactivity.',
|
|
37
|
+
color: '#B8E4A0',
|
|
38
|
+
},
|
|
39
|
+
303: {
|
|
40
|
+
name: 'Gas',
|
|
41
|
+
description: 'High-grade volatile gas with exceptional energy density.',
|
|
42
|
+
color: '#B8E4A0',
|
|
43
|
+
},
|
|
44
|
+
401: {name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B'},
|
|
45
|
+
402: {
|
|
46
|
+
name: 'Regolith',
|
|
47
|
+
description: 'Refined regolith with improved fineness.',
|
|
48
|
+
color: '#C4A57B',
|
|
49
|
+
},
|
|
50
|
+
403: {
|
|
51
|
+
name: 'Regolith',
|
|
52
|
+
description: 'High-grade regolith with exceptional uniformity.',
|
|
53
|
+
color: '#C4A57B',
|
|
54
|
+
},
|
|
55
|
+
501: {name: 'Biomass', description: 'Crude organic biomass.', color: '#5A8B3E'},
|
|
56
|
+
502: {
|
|
57
|
+
name: 'Biomass',
|
|
58
|
+
description: 'Refined biomass with improved plasticity.',
|
|
59
|
+
color: '#5A8B3E',
|
|
60
|
+
},
|
|
61
|
+
503: {
|
|
62
|
+
name: 'Biomass',
|
|
63
|
+
description: 'High-grade biomass with exceptional saturation.',
|
|
64
|
+
color: '#5A8B3E',
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
// === Components (T1) ===
|
|
68
|
+
10001: {
|
|
69
|
+
name: 'Hull Plates',
|
|
70
|
+
description: 'Structural plating formed from ore. Used in hulls, containers, and frames.',
|
|
71
|
+
color: '#7B8D9E',
|
|
72
|
+
},
|
|
73
|
+
10002: {
|
|
74
|
+
name: 'Cargo Lining',
|
|
75
|
+
description:
|
|
76
|
+
'Composite lining formed from fine regolith bound in biomass polymer. Dense enough to seal cargo holds, flexible enough to absorb vibration.',
|
|
77
|
+
color: '#C4A57B',
|
|
78
|
+
},
|
|
79
|
+
10003: {
|
|
80
|
+
name: 'Thruster Core',
|
|
81
|
+
description: 'High-energy propulsion component formed from volatile gases.',
|
|
82
|
+
color: '#E86344',
|
|
83
|
+
},
|
|
84
|
+
10004: {
|
|
85
|
+
name: 'Power Cell',
|
|
86
|
+
description:
|
|
87
|
+
'Crystalline energy storage matrix. Resonant lattices retain and release charge.',
|
|
88
|
+
color: '#4ADBFF',
|
|
89
|
+
},
|
|
90
|
+
10005: {
|
|
91
|
+
name: 'Matter Conduit',
|
|
92
|
+
description: 'Heavy-duty ore shaft used in gathering equipment.',
|
|
93
|
+
color: '#7B8D9E',
|
|
94
|
+
},
|
|
95
|
+
10006: {
|
|
96
|
+
name: 'Survey Probe',
|
|
97
|
+
description: 'Crystal-lattice sensor array for deep resource detection.',
|
|
98
|
+
color: '#4ADBFF',
|
|
99
|
+
},
|
|
100
|
+
10007: {
|
|
101
|
+
name: 'Cargo Arm',
|
|
102
|
+
description: 'Flexible biomass composite arm for cargo handling.',
|
|
103
|
+
color: '#5A8B3E',
|
|
104
|
+
},
|
|
105
|
+
10008: {
|
|
106
|
+
name: 'Tool Bit',
|
|
107
|
+
description: 'Dense regolith cutting head for crafting operations.',
|
|
108
|
+
color: '#C4A57B',
|
|
109
|
+
},
|
|
110
|
+
10009: {
|
|
111
|
+
name: 'Reaction Chamber',
|
|
112
|
+
description: 'Gas-pressurized vessel for controlled crafting reactions.',
|
|
113
|
+
color: '#B8E4A0',
|
|
114
|
+
},
|
|
115
|
+
10010: {
|
|
116
|
+
name: 'Focusing Array',
|
|
117
|
+
description:
|
|
118
|
+
"Precision-formed crystal lens array. Routes the haul beam's energy efficiently to the target lock.",
|
|
119
|
+
color: '#4ADBFF',
|
|
120
|
+
},
|
|
121
|
+
|
|
122
|
+
// === Modules (T1) ===
|
|
123
|
+
10100: {
|
|
124
|
+
name: 'Engine',
|
|
125
|
+
description: 'Basic propulsion system. Converts volatile gases into thrust.',
|
|
126
|
+
color: '#E86344',
|
|
127
|
+
},
|
|
128
|
+
10101: {
|
|
129
|
+
name: 'Generator',
|
|
130
|
+
description: 'Basic energy system. Stores and recharges energy from resonant crystals.',
|
|
131
|
+
color: '#4ADBFF',
|
|
132
|
+
},
|
|
133
|
+
10102: {
|
|
134
|
+
name: 'Gatherer',
|
|
135
|
+
description: 'Basic gathering system. Probes and conduits for raw resources.',
|
|
136
|
+
color: '#7B8D9E',
|
|
137
|
+
},
|
|
138
|
+
10103: {
|
|
139
|
+
name: 'Loader',
|
|
140
|
+
description: 'Basic cargo handling system. Loads and unloads cargo with articulated arms.',
|
|
141
|
+
color: '#5A8B3E',
|
|
142
|
+
},
|
|
143
|
+
10104: {
|
|
144
|
+
name: 'Crafter',
|
|
145
|
+
description:
|
|
146
|
+
'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
|
|
147
|
+
color: '#B8E4A0',
|
|
148
|
+
},
|
|
149
|
+
10105: {
|
|
150
|
+
name: 'Storage',
|
|
151
|
+
description: 'Expands cargo capacity based on hull material quality.',
|
|
152
|
+
color: '#8B7355',
|
|
153
|
+
},
|
|
154
|
+
10106: {
|
|
155
|
+
name: 'Hauler',
|
|
156
|
+
description:
|
|
157
|
+
'Projects a haul beam to lock onto and transport containers or warehouses through group travel.',
|
|
158
|
+
color: '#4ADBFF',
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
// === Entities (packed, T1) ===
|
|
162
|
+
10200: {
|
|
163
|
+
name: 'Container',
|
|
164
|
+
description: 'Passive floating cargo storage in space. Towed by ships.',
|
|
165
|
+
color: '#7B8D9E',
|
|
166
|
+
},
|
|
167
|
+
10201: {
|
|
168
|
+
name: 'Ship',
|
|
169
|
+
description: 'General-purpose vessel with 5 module slots.',
|
|
170
|
+
color: '#4AE898',
|
|
171
|
+
},
|
|
172
|
+
10202: {
|
|
173
|
+
name: 'Warehouse',
|
|
174
|
+
description: 'Massive stationary storage facility with a single loader module slot.',
|
|
175
|
+
color: '#EAB308',
|
|
176
|
+
},
|
|
177
|
+
|
|
178
|
+
// === Components (T2) ===
|
|
179
|
+
20001: {
|
|
180
|
+
name: 'Hull Plates',
|
|
181
|
+
description: 'Advanced structural plating reinforced with tier 2 ore.',
|
|
182
|
+
color: '#9BADB8',
|
|
183
|
+
},
|
|
184
|
+
20002: {
|
|
185
|
+
name: 'Cargo Lining',
|
|
186
|
+
description:
|
|
187
|
+
'Advanced composite lining reinforced with tier 2 regolith and biomass polymer.',
|
|
188
|
+
color: '#C4A57B',
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
// === Entities (packed, T2) ===
|
|
192
|
+
20200: {
|
|
193
|
+
name: 'Container',
|
|
194
|
+
description: 'Advanced cargo container with improved capacity formulas.',
|
|
195
|
+
color: '#9BADB8',
|
|
196
|
+
},
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export const entityMetadata: Record<number, EntityMetadata> = {
|
|
200
|
+
10201: {moduleSlotLabels: ['Engine', 'Generator', 'Gatherer', 'Loader', 'Storage']},
|
|
201
|
+
10202: {moduleSlotLabels: ['Loader', 'Storage', 'Storage', 'Storage', 'Storage']},
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
for (const item of items as Array<{id: number}>) {
|
|
205
|
+
if (!itemMetadata[item.id]) {
|
|
206
|
+
throw new Error(`Missing metadata for item ${item.id}. Add an entry to metadata.ts.`)
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -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
|
+
}
|