@shipload/sdk 2.0.0-rc4 → 2.0.0-rc5
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 +37 -19
- package/lib/shipload.js +216 -158
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +207 -153
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/contracts/server.ts +4 -6
- package/src/data/items.json +15 -14
- package/src/derivation/index.ts +8 -6
- package/src/derivation/resources.ts +54 -53
- package/src/derivation/stats.ts +70 -0
- package/src/derivation/stratum.ts +13 -13
- package/src/index-module.ts +10 -7
- package/src/market/items.ts +1 -1
- package/src/market/market.ts +4 -17
- package/src/types.ts +3 -3
package/src/market/market.ts
CHANGED
|
@@ -14,9 +14,9 @@ export enum Rarities {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export interface Rarity {
|
|
17
|
-
rarity: Rarities
|
|
18
|
-
minMultiplier: number
|
|
19
|
-
maxMultiplier: number
|
|
17
|
+
rarity: Rarities
|
|
18
|
+
minMultiplier: number
|
|
19
|
+
maxMultiplier: number
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export function getRarity(
|
|
@@ -29,77 +29,66 @@ export function getRarity(
|
|
|
29
29
|
const rarityRoll = roll(gameSeed, seed)
|
|
30
30
|
|
|
31
31
|
if (rarityRoll < 13) {
|
|
32
|
-
// (Orange) ~0.02% chance = incredibly high value
|
|
33
32
|
return {
|
|
34
33
|
rarity: Rarities.legendary,
|
|
35
34
|
minMultiplier: 2.25,
|
|
36
35
|
maxMultiplier: 3.0,
|
|
37
36
|
}
|
|
38
37
|
} else if (rarityRoll < 176) {
|
|
39
|
-
// (Purple) ~0.25% chance = super high value
|
|
40
38
|
return {
|
|
41
39
|
rarity: Rarities.epic,
|
|
42
40
|
minMultiplier: 1.75,
|
|
43
41
|
maxMultiplier: 2.25,
|
|
44
42
|
}
|
|
45
43
|
} else if (rarityRoll < 996) {
|
|
46
|
-
// (Blue) ~1.25% chance = very high value
|
|
47
44
|
return {
|
|
48
45
|
rarity: Rarities.rare,
|
|
49
46
|
minMultiplier: 1.4,
|
|
50
47
|
maxMultiplier: 1.75,
|
|
51
48
|
}
|
|
52
49
|
} else if (rarityRoll < 2966) {
|
|
53
|
-
// (Green) ~3.00% chance = high value
|
|
54
50
|
return {
|
|
55
51
|
rarity: Rarities.uncommon,
|
|
56
52
|
minMultiplier: 1.225,
|
|
57
53
|
maxMultiplier: 1.4,
|
|
58
54
|
}
|
|
59
55
|
} else if (rarityRoll < 19568) {
|
|
60
|
-
// (White) ~25.33% chance = slightly higher value
|
|
61
56
|
return {
|
|
62
57
|
rarity: Rarities.common,
|
|
63
58
|
minMultiplier: 1.07,
|
|
64
59
|
maxMultiplier: 1.225,
|
|
65
60
|
}
|
|
66
61
|
} else if (rarityRoll < 45988) {
|
|
67
|
-
// ~40.30% chance = no value change
|
|
68
62
|
return {
|
|
69
63
|
rarity: Rarities.trash,
|
|
70
64
|
minMultiplier: 1,
|
|
71
65
|
maxMultiplier: 1.07,
|
|
72
|
-
}
|
|
66
|
+
}
|
|
73
67
|
} else if (rarityRoll < 62508) {
|
|
74
|
-
// (White) ~25.33% chance = slightly lower value
|
|
75
68
|
return {
|
|
76
69
|
rarity: Rarities.common,
|
|
77
70
|
minMultiplier: 0.925,
|
|
78
71
|
maxMultiplier: 1,
|
|
79
72
|
}
|
|
80
73
|
} else if (rarityRoll < 64518) {
|
|
81
|
-
// (Green) ~3.00% chance = low value
|
|
82
74
|
return {
|
|
83
75
|
rarity: Rarities.uncommon,
|
|
84
76
|
minMultiplier: 0.77,
|
|
85
77
|
maxMultiplier: 0.925,
|
|
86
78
|
}
|
|
87
79
|
} else if (rarityRoll < 65437) {
|
|
88
|
-
// (Blue) ~1.25% chance = very low value
|
|
89
80
|
return {
|
|
90
81
|
rarity: Rarities.rare,
|
|
91
82
|
minMultiplier: 0.595,
|
|
92
83
|
maxMultiplier: 0.77,
|
|
93
84
|
}
|
|
94
85
|
} else if (rarityRoll < 65523) {
|
|
95
|
-
// (Purple) ~0.25% chance = super low value
|
|
96
86
|
return {
|
|
97
87
|
rarity: Rarities.epic,
|
|
98
88
|
minMultiplier: 0.41,
|
|
99
89
|
maxMultiplier: 0.595,
|
|
100
90
|
}
|
|
101
91
|
} else {
|
|
102
|
-
// (Orange) ~0.02% chance = incredibly low value
|
|
103
92
|
return {
|
|
104
93
|
rarity: Rarities.legendary,
|
|
105
94
|
minMultiplier: 0.285,
|
|
@@ -178,8 +167,6 @@ export function marketPrice(
|
|
|
178
167
|
const item = getItem(goodId)
|
|
179
168
|
let price = Number(item.base_price)
|
|
180
169
|
|
|
181
|
-
// Rarity multiplier of the deal (changes with epoch)
|
|
182
|
-
// Large impact range on price, from 0.285x to 3.0x
|
|
183
170
|
const rarityMultiplier = getRarityMultiplier(gameSeed, state.seed, location, goodId)
|
|
184
171
|
price *= rarityMultiplier
|
|
185
172
|
|
package/src/types.ts
CHANGED
|
@@ -132,8 +132,8 @@ export interface Distance {
|
|
|
132
132
|
distance: UInt16
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
export type ResourceCategory = 'metal' | 'gas' | 'mineral' | 'organic'
|
|
136
|
-
export type
|
|
135
|
+
export type ResourceCategory = 'metal' | 'precious' | 'gas' | 'mineral' | 'organic'
|
|
136
|
+
export type ResourceTier = 't1' | 't2' | 't3' | 't4' | 't5'
|
|
137
137
|
|
|
138
138
|
@Struct.type('item')
|
|
139
139
|
export class Item extends Struct {
|
|
@@ -150,7 +150,7 @@ export class Item extends Struct {
|
|
|
150
150
|
@Struct.field('string')
|
|
151
151
|
category!: ResourceCategory
|
|
152
152
|
@Struct.field('string')
|
|
153
|
-
|
|
153
|
+
tier!: ResourceTier
|
|
154
154
|
@Struct.field('string')
|
|
155
155
|
color!: string
|
|
156
156
|
}
|