diff --git a/project/src/controllers/QuestController.ts b/project/src/controllers/QuestController.ts index fbfa3ed7..3ca9d3b0 100644 --- a/project/src/controllers/QuestController.ts +++ b/project/src/controllers/QuestController.ts @@ -79,7 +79,7 @@ export class QuestController for (const quest of allQuests) { // Player already accepted the quest, show it regardless of status - const questInProfile = profile.Quests.find((x) => x.qid === quest._id); + const questInProfile = profile.Quests.find((quest) => quest.qid === quest._id); if (questInProfile) { quest.sptStatus = questInProfile.status; diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index b6624d19..e85a5743 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -1415,8 +1415,9 @@ export class ItemHelper * Update a root items _id property value to be unique * @param itemWithChildren Item to update root items _id property * @param newId Optional: new id to use + * @returns New root id */ - public remapRootItemId(itemWithChildren: Item[], newId = this.hashUtil.generate()): void + public remapRootItemId(itemWithChildren: Item[], newId = this.hashUtil.generate()): string { const rootItemExistingId = itemWithChildren[0]._id; @@ -1436,6 +1437,8 @@ export class ItemHelper item.parentId = newId; } } + + return newId; } } diff --git a/project/src/helpers/QuestHelper.ts b/project/src/helpers/QuestHelper.ts index daa6b9ed..3fad154a 100644 --- a/project/src/helpers/QuestHelper.ts +++ b/project/src/helpers/QuestHelper.ts @@ -272,7 +272,7 @@ export class QuestHelper // Only process items with slots if (this.itemHelper.itemHasSlots(questReward.items[0]._tpl)) { - // Attempt to pull default preset from globals and add child items to reward + // Attempt to pull default preset from globals and add child items to reward (clones questReward.items) this.generateArmorRewardChildSlots(questReward.items[0], questReward); } } @@ -283,7 +283,8 @@ export class QuestHelper { item.upd = {}; } - // reward items are granted Found in Raid status + + // Reward items are granted Found in Raid status item.upd.SpawnedInSession = true; // Is root item, fix stacks @@ -349,10 +350,13 @@ export class QuestHelper if (defaultPreset) { // Preset exists, use mods to hydrate reward item - questReward.items = this.jsonUtil.clone(defaultPreset._items); + const presetAndMods: Item[] = this.itemHelper.replaceIDs(null, this.jsonUtil.clone(defaultPreset._items)); + const newRootId = this.itemHelper.remapRootItemId(presetAndMods); + + questReward.items = presetAndMods; // Remap target id to the new presets id - questReward.target = questReward.items.find((item) => item._tpl === originalRewardRootItem._tpl)._id; + questReward.target = newRootId; return; }