feat: rewards for enemy caches & rathuum (#384)
This commit is contained in:
parent
8aae246b48
commit
f106f6a1d7
8
package-lock.json
generated
8
package-lock.json
generated
@ -12,7 +12,7 @@
|
||||
"copyfiles": "^2.4.1",
|
||||
"express": "^5.0.0-beta.3",
|
||||
"mongoose": "^8.1.1",
|
||||
"warframe-public-export-plus": "^0.3.0",
|
||||
"warframe-public-export-plus": "^0.3.2",
|
||||
"warframe-riven-info": "^0.1.0",
|
||||
"winston": "^3.11.0",
|
||||
"winston-daily-rotate-file": "^4.7.1"
|
||||
@ -3669,9 +3669,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/warframe-public-export-plus": {
|
||||
"version": "0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.0.tgz",
|
||||
"integrity": "sha512-BYkTkCq9jsA8NzSiWsTW48ezK7kI/op2NrLf+j4j3bJi2cNjoSLf/D4bMEui6yCADjcoV89ramRTFbPjn6UpLA=="
|
||||
"version": "0.3.2",
|
||||
"resolved": "https://registry.npmjs.org/warframe-public-export-plus/-/warframe-public-export-plus-0.3.2.tgz",
|
||||
"integrity": "sha512-0jAStLLrMaz0zm7wfY1/3SWLPmMJcYNNErVTPo8YqBZlot1aikVuDNu+crVmN+LWDDLrn01T7f83EYaw7TYo6w=="
|
||||
},
|
||||
"node_modules/warframe-riven-info": {
|
||||
"version": "0.1.0",
|
||||
|
@ -16,7 +16,7 @@
|
||||
"copyfiles": "^2.4.1",
|
||||
"express": "^5.0.0-beta.3",
|
||||
"mongoose": "^8.1.1",
|
||||
"warframe-public-export-plus": "^0.3.0",
|
||||
"warframe-public-export-plus": "^0.3.2",
|
||||
"warframe-riven-info": "^0.1.0",
|
||||
"winston": "^3.11.0",
|
||||
"winston-daily-rotate-file": "^4.7.1"
|
||||
|
@ -23,33 +23,46 @@ const getRewards = ({
|
||||
return { InventoryChanges: {}, MissionRewards: [] };
|
||||
}
|
||||
|
||||
const rewardManifests = ExportRegions[RewardInfo.node]?.rewardManifests ?? [];
|
||||
if (rewardManifests.length == 0) {
|
||||
return { InventoryChanges: {}, MissionRewards: [] };
|
||||
}
|
||||
|
||||
let rotations: number[] = [];
|
||||
if (RewardInfo.VaultsCracked) {
|
||||
// For Spy missions, e.g. 3 vaults cracked = A, B, C
|
||||
for (let i = 0; i != RewardInfo.VaultsCracked; ++i) {
|
||||
rotations.push(i);
|
||||
}
|
||||
} else {
|
||||
const rotationCount = RewardInfo.rewardQualifications?.length || 0;
|
||||
rotations = getRotations(rotationCount);
|
||||
}
|
||||
const drops: IReward[] = [];
|
||||
rewardManifests
|
||||
.map(name => ExportRewards[name])
|
||||
.forEach(table => {
|
||||
for (const rotation of rotations) {
|
||||
const rotationRewards = table[rotation];
|
||||
const drop = getRandomRewardByChance(rotationRewards);
|
||||
if (RewardInfo.node in ExportRegions) {
|
||||
const region = ExportRegions[RewardInfo.node];
|
||||
const rewardManifests = region.rewardManifests ?? [];
|
||||
if (rewardManifests.length == 0) {
|
||||
return { InventoryChanges: {}, MissionRewards: [] };
|
||||
}
|
||||
|
||||
let rotations: number[] = [];
|
||||
if (RewardInfo.VaultsCracked) {
|
||||
// For Spy missions, e.g. 3 vaults cracked = A, B, C
|
||||
for (let i = 0; i != RewardInfo.VaultsCracked; ++i) {
|
||||
rotations.push(i);
|
||||
}
|
||||
} else {
|
||||
const rotationCount = RewardInfo.rewardQualifications?.length || 0;
|
||||
rotations = getRotations(rotationCount);
|
||||
}
|
||||
rewardManifests
|
||||
.map(name => ExportRewards[name])
|
||||
.forEach(table => {
|
||||
for (const rotation of rotations) {
|
||||
const rotationRewards = table[rotation];
|
||||
const drop = getRandomRewardByChance(rotationRewards);
|
||||
if (drop) {
|
||||
drops.push(drop);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
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);
|
||||
return formatRewardsToInventoryType(drops);
|
||||
|
Loading…
x
Reference in New Issue
Block a user