From 6e6b4cbe1f75ac5fc1e4fa60941b5eb0b0eaa299 Mon Sep 17 00:00:00 2001 From: Razzmatazz Date: Mon, 18 Nov 2024 16:35:50 -0600 Subject: [PATCH 1/3] Fixes craft unlock task rewards --- .../jobs/update-crafts.mjs | 24 +++++++++++++++++-- .../jobs/update-quests.mjs | 11 ++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/tarkov-data-manager/jobs/update-crafts.mjs b/src/tarkov-data-manager/jobs/update-crafts.mjs index 38369040..dbba4682 100644 --- a/src/tarkov-data-manager/jobs/update-crafts.mjs +++ b/src/tarkov-data-manager/jobs/update-crafts.mjs @@ -7,6 +7,8 @@ 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 + '67092bbfc45f0546bf097a7e', // from Halloween 2024 quest line + '67093210d514d26f8408612b', // from Halloween 2024 quest line ]; class UpdateCraftsJob extends DataJob { @@ -187,9 +189,27 @@ 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; + } + if (unlock.level != level) { + 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({ diff --git a/src/tarkov-data-manager/jobs/update-quests.mjs b/src/tarkov-data-manager/jobs/update-quests.mjs index e0a26f70..91e6c04f 100644 --- a/src/tarkov-data-manager/jobs/update-quests.mjs +++ b/src/tarkov-data-manager/jobs/update-quests.mjs @@ -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`], From 60988f4c8d74c93300d47f538767869c72742059 Mon Sep 17 00:00:00 2001 From: Razzmatazz Date: Mon, 18 Nov 2024 16:47:28 -0600 Subject: [PATCH 2/3] fix armor craft unlocks --- src/tarkov-data-manager/jobs/update-crafts.mjs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/tarkov-data-manager/jobs/update-crafts.mjs b/src/tarkov-data-manager/jobs/update-crafts.mjs index dbba4682..9c171279 100644 --- a/src/tarkov-data-manager/jobs/update-crafts.mjs +++ b/src/tarkov-data-manager/jobs/update-crafts.mjs @@ -7,6 +7,7 @@ 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 Halloween 2024 quest line '67093210d514d26f8408612b', // from Halloween 2024 quest line ]; @@ -194,15 +195,12 @@ class UpdateCraftsJob extends DataJob { return false; } for (const unlock of craftUnlocks) { - if (unlock.items.some(i => i.id !== endProduct.id)) { + if (!unlock.items.some(i => i.id === endProduct.id)) { continue; } if (unlock.station_id !== craftData.station_id) { continue; } - if (unlock.level != level) { - continue; - } return true; } return false; From 90f3f1f3debf7158baee37e9d21306adc7f1cf4d Mon Sep 17 00:00:00 2001 From: Razzmatazz Date: Mon, 18 Nov 2024 16:52:00 -0600 Subject: [PATCH 3/3] improve comments --- src/tarkov-data-manager/jobs/update-crafts.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tarkov-data-manager/jobs/update-crafts.mjs b/src/tarkov-data-manager/jobs/update-crafts.mjs index 9c171279..e2268fad 100644 --- a/src/tarkov-data-manager/jobs/update-crafts.mjs +++ b/src/tarkov-data-manager/jobs/update-crafts.mjs @@ -8,8 +8,8 @@ const skipCrafts = [ '6617cdb6b24b0ea24505f618', // from event quest Radio Club 6605a079ab236c96120c92c1 '661e6c26750e453380391f55', // from event quest Getting to the Core 66042b8bab236c96120c929f '670932d7b564327a0e023fcb', // event flash drive craft - '67092bbfc45f0546bf097a7e', // from Halloween 2024 quest line - '67093210d514d26f8408612b', // from Halloween 2024 quest line + '67092bbfc45f0546bf097a7e', // from event quest Radical Treatment + '67093210d514d26f8408612b', // from event quest Clear Conscience ]; class UpdateCraftsJob extends DataJob {