Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes craft unlock task rewards #582

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions src/tarkov-data-manager/jobs/update-crafts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ const skipCrafts = [
'660c2dbaa2a92e70cc074863', // from event quest Decryption Hurdles - Part 3 6604233fe73f456f6a07466b
'6617cdb6b24b0ea24505f618', // from event quest Radio Club 6605a079ab236c96120c92c1
'661e6c26750e453380391f55', // from event quest Getting to the Core 66042b8bab236c96120c929f
'670932d7b564327a0e023fcb', // event flash drive craft
'67092bbfc45f0546bf097a7e', // from event quest Radical Treatment
'67093210d514d26f8408612b', // from event quest Clear Conscience
];

class UpdateCraftsJob extends DataJob {
Expand Down Expand Up @@ -187,9 +190,24 @@ class UpdateCraftsJob extends DataJob {
}]
});
} else if (req.type === 'QuestComplete') {
const task = tasks.find(q => q.id === req.questId);
const rewardMatchesCraft = (craftUnlocks) => {
if (!craftUnlocks) {
return false;
}
for (const unlock of craftUnlocks) {
if (!unlock.items.some(i => i.id === endProduct.id)) {
continue;
}
if (unlock.station_id !== craftData.station_id) {
continue;
}
return true;
}
return false;
};
const task = tasks.find(q => rewardMatchesCraft(q.finishRewards.craftUnlock) || rewardMatchesCraft(q.startRewards.craftUnlock));
if (!task) {
this.logger.warn(`${id}: Unknown quest unlock ${en[`${req.questId} name`]} ${req.questId}`);
this.logger.warn(`${id}: Unknown quest unlock for ${endProduct.name} ${endProduct.id}`);
continue;
}
craftData.requirements.push({
Expand Down
11 changes: 10 additions & 1 deletion src/tarkov-data-manager/jobs/update-quests.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -904,8 +904,17 @@ class UpdateQuestsJob extends DataJob {
this.logger.warn(`Unrecognized hideout area type "${reward.traderId}" for ${rewardsType} reward ${reward.id} of ${questData.name}`);
continue;
}
const rewardItems = reward.items.reduce((combined, current) => {
const existingItem = combined.find(i => i._tpl === current._tpl);
if (existingItem) {
existingItem.upd.StackObjectsCount += current.upd.StackObjectsCount;
} else {
combined.push(current);
}
return combined;
}, []);
questData[rewardsType].craftUnlock.push({
items: reward.items.map(item => {
items: rewardItems.map(item => {
return {
id: item._tpl,
name: this.locales.en[`${item._tpl} Name`],
Expand Down
Loading