@shipload/item-renderer 1.0.0-next.0 → 1.0.0-next.2
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/package.json +9 -1
- package/test/fixtures/cargo-items.ts +122 -0
package/package.json
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipload/item-renderer",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.2",
|
|
4
4
|
"description": "Deterministic SVG rendering for Shipload items",
|
|
5
|
+
"homepage": "https://github.com/shipload/toolkit/tree/master/packages/item-renderer",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/shipload/toolkit.git",
|
|
9
|
+
"directory": "packages/item-renderer"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
5
12
|
"type": "module",
|
|
6
13
|
"main": "./src/index.ts",
|
|
7
14
|
"types": "./src/index.ts",
|
|
@@ -26,6 +33,7 @@
|
|
|
26
33
|
},
|
|
27
34
|
"files": [
|
|
28
35
|
"src",
|
|
36
|
+
"test/fixtures/cargo-items.ts",
|
|
29
37
|
"!src/**/*.test.ts"
|
|
30
38
|
],
|
|
31
39
|
"scripts": {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import {ServerContract} from '@shipload/sdk'
|
|
2
|
+
|
|
3
|
+
export const ITEM_ORE_T1 = 101
|
|
4
|
+
export const ITEM_GAS_T2 = 302
|
|
5
|
+
export const ITEM_ENGINE_T1 = 10100
|
|
6
|
+
export const ITEM_GENERATOR_T1 = 10101
|
|
7
|
+
export const ITEM_GATHERER_T1 = 10102
|
|
8
|
+
export const ITEM_LOADER_T1 = 10103
|
|
9
|
+
export const ITEM_MANUFACTURING_T1 = 10104
|
|
10
|
+
export const ITEM_STORAGE_T1 = 10105
|
|
11
|
+
export const ITEM_HAULER_T1 = 10106
|
|
12
|
+
export const ITEM_SHIP_T1_PACKED = 10201
|
|
13
|
+
|
|
14
|
+
export const MODULE_ENGINE = 1
|
|
15
|
+
export const MODULE_GENERATOR = 2
|
|
16
|
+
|
|
17
|
+
export function cargoOreT1(stats = '0x123456789ABCDEF', quantity = 1) {
|
|
18
|
+
return ServerContract.Types.cargo_item.from({
|
|
19
|
+
item_id: ITEM_ORE_T1,
|
|
20
|
+
quantity,
|
|
21
|
+
stats,
|
|
22
|
+
modules: [],
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function cargoShipT1Packed(opts?: {
|
|
27
|
+
stats?: string
|
|
28
|
+
engineStats?: string
|
|
29
|
+
generatorStats?: string
|
|
30
|
+
onlyEngine?: boolean
|
|
31
|
+
}) {
|
|
32
|
+
const o = opts ?? {}
|
|
33
|
+
const modules: unknown[] = []
|
|
34
|
+
modules.push({
|
|
35
|
+
type: MODULE_ENGINE,
|
|
36
|
+
installed: {item_id: ITEM_ENGINE_T1, stats: o.engineStats ?? '0x2A4F6B8C'},
|
|
37
|
+
})
|
|
38
|
+
if (!o.onlyEngine) {
|
|
39
|
+
modules.push({
|
|
40
|
+
type: MODULE_GENERATOR,
|
|
41
|
+
installed: {item_id: ITEM_GENERATOR_T1, stats: o.generatorStats ?? '0x1B2D4F'},
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
return ServerContract.Types.cargo_item.from({
|
|
45
|
+
item_id: ITEM_SHIP_T1_PACKED,
|
|
46
|
+
quantity: 1,
|
|
47
|
+
stats: o.stats ?? '0',
|
|
48
|
+
modules,
|
|
49
|
+
})
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export const ITEM_HULL_PLATES = 10001
|
|
53
|
+
|
|
54
|
+
export const FIXTURES = {
|
|
55
|
+
oreT1: cargoOreT1('0x123456789ABCDEF'),
|
|
56
|
+
oreT1StackOf50: cargoOreT1('0x123456789ABCDEF', 50),
|
|
57
|
+
oreT1ZeroStats: cargoOreT1('0'),
|
|
58
|
+
gasT2: ServerContract.Types.cargo_item.from({
|
|
59
|
+
item_id: ITEM_GAS_T2,
|
|
60
|
+
quantity: 1,
|
|
61
|
+
stats: '0xDEADBEEF1234',
|
|
62
|
+
modules: [],
|
|
63
|
+
}),
|
|
64
|
+
hullPlates: ServerContract.Types.cargo_item.from({
|
|
65
|
+
item_id: ITEM_HULL_PLATES,
|
|
66
|
+
quantity: 1,
|
|
67
|
+
stats: '0x7FFF',
|
|
68
|
+
modules: [],
|
|
69
|
+
}),
|
|
70
|
+
engineT1: ServerContract.Types.cargo_item.from({
|
|
71
|
+
item_id: ITEM_ENGINE_T1,
|
|
72
|
+
quantity: 1,
|
|
73
|
+
stats: '358800',
|
|
74
|
+
modules: [],
|
|
75
|
+
}),
|
|
76
|
+
generatorT1: ServerContract.Types.cargo_item.from({
|
|
77
|
+
item_id: ITEM_GENERATOR_T1,
|
|
78
|
+
quantity: 1,
|
|
79
|
+
stats: '683908',
|
|
80
|
+
modules: [],
|
|
81
|
+
}),
|
|
82
|
+
gathererT1: ServerContract.Types.cargo_item.from({
|
|
83
|
+
item_id: ITEM_GATHERER_T1,
|
|
84
|
+
quantity: 1,
|
|
85
|
+
stats: '138255128433040',
|
|
86
|
+
modules: [],
|
|
87
|
+
}),
|
|
88
|
+
loaderT1: ServerContract.Types.cargo_item.from({
|
|
89
|
+
item_id: ITEM_LOADER_T1,
|
|
90
|
+
quantity: 1,
|
|
91
|
+
stats: '512750',
|
|
92
|
+
modules: [],
|
|
93
|
+
}),
|
|
94
|
+
crafterT1: ServerContract.Types.cargo_item.from({
|
|
95
|
+
item_id: ITEM_MANUFACTURING_T1,
|
|
96
|
+
quantity: 1,
|
|
97
|
+
stats: '512600',
|
|
98
|
+
modules: [],
|
|
99
|
+
}),
|
|
100
|
+
storageT1: ServerContract.Types.cargo_item.from({
|
|
101
|
+
item_id: ITEM_STORAGE_T1,
|
|
102
|
+
quantity: 1,
|
|
103
|
+
stats: '537605632700',
|
|
104
|
+
modules: [],
|
|
105
|
+
}),
|
|
106
|
+
haulerT1: ServerContract.Types.cargo_item.from({
|
|
107
|
+
item_id: ITEM_HAULER_T1,
|
|
108
|
+
quantity: 1,
|
|
109
|
+
stats: '0x3E8',
|
|
110
|
+
modules: [],
|
|
111
|
+
}),
|
|
112
|
+
shipT1NoModules: ServerContract.Types.cargo_item.from({
|
|
113
|
+
item_id: ITEM_SHIP_T1_PACKED,
|
|
114
|
+
quantity: 1,
|
|
115
|
+
stats: '0',
|
|
116
|
+
modules: [],
|
|
117
|
+
}),
|
|
118
|
+
shipT1TwoModules: cargoShipT1Packed(),
|
|
119
|
+
shipT1OnlyEngine: cargoShipT1Packed({onlyEngine: true}),
|
|
120
|
+
} as const
|
|
121
|
+
|
|
122
|
+
export type FixtureName = keyof typeof FIXTURES
|