feat: rewards for enemy caches & rathuum (#384)

This commit is contained in:
Sainan 2024-06-23 15:12:32 +02:00 committed by GitHub
parent 8aae246b48
commit f106f6a1d7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 40 additions and 27 deletions

8
package-lock.json generated
View File

@ -12,7 +12,7 @@
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"express": "^5.0.0-beta.3", "express": "^5.0.0-beta.3",
"mongoose": "^8.1.1", "mongoose": "^8.1.1",
"warframe-public-export-plus": "^0.3.0", "warframe-public-export-plus": "^0.3.2",
"warframe-riven-info": "^0.1.0", "warframe-riven-info": "^0.1.0",
"winston": "^3.11.0", "winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1" "winston-daily-rotate-file": "^4.7.1"
@ -3669,9 +3669,9 @@
} }
}, },
"node_modules/warframe-public-export-plus": { "node_modules/warframe-public-export-plus": {
"version": "0.3.0", "version": "0.3.2",
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.0.tgz", "resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.2.tgz",
"integrity": "sha512-BYkTkCq9jsA8NzSiWsTW48ezK7kI/op2NrLf+j4j3bJi2cNjoSLf/D4bMEui6yCADjcoV89ramRTFbPjn6UpLA==" "integrity": "sha512-0jAStLLrMaz0zm7wfY1/3SWLPmMJcYNNErVTPo8YqBZlot1aikVuDNu+crVmN+LWDDLrn01T7f83EYaw7TYo6w=="
}, },
"node_modules/warframe-riven-info": { "node_modules/warframe-riven-info": {
"version": "0.1.0", "version": "0.1.0",

View File

@ -16,7 +16,7 @@
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"express": "^5.0.0-beta.3", "express": "^5.0.0-beta.3",
"mongoose": "^8.1.1", "mongoose": "^8.1.1",
"warframe-public-export-plus": "^0.3.0", "warframe-public-export-plus": "^0.3.2",
"warframe-riven-info": "^0.1.0", "warframe-riven-info": "^0.1.0",
"winston": "^3.11.0", "winston": "^3.11.0",
"winston-daily-rotate-file": "^4.7.1" "winston-daily-rotate-file": "^4.7.1"

View File

@ -23,7 +23,10 @@ const getRewards = ({
return { InventoryChanges: {}, MissionRewards: [] }; return { InventoryChanges: {}, MissionRewards: [] };
} }
const rewardManifests = ExportRegions[RewardInfo.node]?.rewardManifests ?? []; const drops: IReward[] = [];
if (RewardInfo.node in ExportRegions) {
const region = ExportRegions[RewardInfo.node];
const rewardManifests = region.rewardManifests ?? [];
if (rewardManifests.length == 0) { if (rewardManifests.length == 0) {
return { InventoryChanges: {}, MissionRewards: [] }; return { InventoryChanges: {}, MissionRewards: [] };
} }
@ -38,7 +41,6 @@ const getRewards = ({
const rotationCount = RewardInfo.rewardQualifications?.length || 0; const rotationCount = RewardInfo.rewardQualifications?.length || 0;
rotations = getRotations(rotationCount); rotations = getRotations(rotationCount);
} }
const drops: IReward[] = [];
rewardManifests rewardManifests
.map(name => ExportRewards[name]) .map(name => ExportRewards[name])
.forEach(table => { .forEach(table => {
@ -51,6 +53,17 @@ const getRewards = ({
} }
}); });
if (region.cacheRewardManifest && RewardInfo.EnemyCachesFound) {
const deck = ExportRewards[region.cacheRewardManifest];
for (let rotation = 0; rotation != RewardInfo.EnemyCachesFound; ++rotation) {
const drop = getRandomRewardByChance(deck[rotation]);
if (drop) {
drops.push(drop);
}
}
}
}
logger.debug("Mission rewards:", drops); logger.debug("Mission rewards:", drops);
return formatRewardsToInventoryType(drops); return formatRewardsToInventoryType(drops);
}; };