Show error when item not found in player inventory when handing over items for quest

This commit is contained in:
Dev 2023-12-21 10:15:57 +00:00
parent 0de6f201fe
commit f451920fb7

View File

@ -797,8 +797,8 @@ export class QuestController
let totalItemCountToRemove = 0; let totalItemCountToRemove = 0;
for (const itemHandover of handoverQuestRequest.items) for (const itemHandover of handoverQuestRequest.items)
{ {
const matchingItemInProfile = pmcData.Inventory.items.find((x) => x._id === itemHandover.id); const matchingItemInProfile = pmcData.Inventory.items.find((item) => item._id === itemHandover.id);
if (!handoverRequirements._props.target.includes(matchingItemInProfile._tpl)) if (!matchingItemInProfile || !handoverRequirements._props.target.includes(matchingItemInProfile._tpl))
{ {
// Item handed in by player doesnt match what was requested // Item handed in by player doesnt match what was requested
return this.showQuestItemHandoverMatchError( return this.showQuestItemHandoverMatchError(