返回提交历史
Modified
package-lock.json
+4
-4
Modified
package.json
+1
-1
Modified
src/services/missionInventoryUpdateService.ts
+34
-21
XFEstudio/XFESpaceNinjaServer
feat: rewards for enemy caches & rathuum (#384)
f106f6a1
代码差异
3 个文件
+39
-26
@@ -12,7 +12,7 @@
12
12
"copyfiles": "^2.4.1",
13
13
"express": "^5.0.0-beta.3",
14
14
"mongoose": "^8.1.1",
15
"warframe-public-export-plus": "^0.3.0",
15
"warframe-public-export-plus": "^0.3.2",
16
16
"warframe-riven-info": "^0.1.0",
17
17
"winston": "^3.11.0",
18
18
"winston-daily-rotate-file": "^4.7.1"
@@ -3669,9 +3669,9 @@
3669
3669
}
3670
3670
},
3671
3671
"node_modules/warframe-public-export-plus": {
3672
"version": "0.3.0",
3673
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.0.tgz",
3674
"integrity": "sha512-BYkTkCq9jsA8NzSiWsTW48ezK7kI/op2NrLf+j4j3bJi2cNjoSLf/D4bMEui6yCADjcoV89ramRTFbPjn6UpLA=="
3672
"version": "0.3.2",
3673
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.2.tgz",
3674
"integrity": "sha512-0jAStLLrMaz0zm7wfY1/3SWLPmMJcYNNErVTPo8YqBZlot1aikVuDNu+crVmN+LWDDLrn01T7f83EYaw7TYo6w=="
3675
3675
},
3676
3676
"node_modules/warframe-riven-info": {
3677
3677
"version": "0.1.0",
@@ -16,7 +16,7 @@
16
16
"copyfiles": "^2.4.1",
17
17
"express": "^5.0.0-beta.3",
18
18
"mongoose": "^8.1.1",
19
"warframe-public-export-plus": "^0.3.0",
19
"warframe-public-export-plus": "^0.3.2",
20
20
"warframe-riven-info": "^0.1.0",
21
21
"winston": "^3.11.0",
22
22
"winston-daily-rotate-file": "^4.7.1"
@@ -23,33 +23,46 @@ const getRewards = ({
23
23
return { InventoryChanges: {}, MissionRewards: [] };
24
24
}
25
25
26
const rewardManifests = ExportRegions[RewardInfo.node]?.rewardManifests ?? [];
27
if (rewardManifests.length == 0) {
28
return { InventoryChanges: {}, MissionRewards: [] };
29
}
26
const drops: IReward[] = [];
27
if (RewardInfo.node in ExportRegions) {
28
const region = ExportRegions[RewardInfo.node];
29
const rewardManifests = region.rewardManifests ?? [];
30
if (rewardManifests.length == 0) {
31
return { InventoryChanges: {}, MissionRewards: [] };
32
}
30
33
31
let rotations: number[] = [];
32
if (RewardInfo.VaultsCracked) {
33
// For Spy missions, e.g. 3 vaults cracked = A, B, C
34
for (let i = 0; i != RewardInfo.VaultsCracked; ++i) {
35
rotations.push(i);
34
let rotations: number[] = [];
35
if (RewardInfo.VaultsCracked) {
36
// For Spy missions, e.g. 3 vaults cracked = A, B, C
37
for (let i = 0; i != RewardInfo.VaultsCracked; ++i) {
38
rotations.push(i);
39
}
40
} else {
41
const rotationCount = RewardInfo.rewardQualifications?.length || 0;
42
rotations = getRotations(rotationCount);
36
43
}
37
} else {
38
const rotationCount = RewardInfo.rewardQualifications?.length || 0;
39
rotations = getRotations(rotationCount);
40
}
41
const drops: IReward[] = [];
42
rewardManifests
43
.map(name => ExportRewards[name])
44
.forEach(table => {
45
for (const rotation of rotations) {
46
const rotationRewards = table[rotation];
47
const drop = getRandomRewardByChance(rotationRewards);
44
rewardManifests
45
.map(name => ExportRewards[name])
46
.forEach(table => {
47
for (const rotation of rotations) {
48
const rotationRewards = table[rotation];
49
const drop = getRandomRewardByChance(rotationRewards);
50
if (drop) {
51
drops.push(drop);
52
}
53
}
54
});
55
56
if (region.cacheRewardManifest && RewardInfo.EnemyCachesFound) {
57
const deck = ExportRewards[region.cacheRewardManifest];
58
for (let rotation = 0; rotation != RewardInfo.EnemyCachesFound; ++rotation) {
59
const drop = getRandomRewardByChance(deck[rotation]);
48
60
if (drop) {
49
61
drops.push(drop);
50
62
}
51
63
}
52
});
64
}
65
}
53
66
54
67
logger.debug("Mission rewards:", drops);
55
68
return formatRewardsToInventoryType(drops);