feat: Implement flexible quest event matching to allow generic triggers to match specific event instances.

This commit is contained in:
syntaxbullet
2026-01-15 15:22:20 +01:00
parent 7d541825d8
commit eb108695d3
2 changed files with 68 additions and 3 deletions

View File

@@ -46,9 +46,12 @@ export const questService = {
}
});
const relevant = activeUserQuests.filter(uq =>
uq.quest.triggerEvent === eventName && !uq.completedAt
);
const relevant = activeUserQuests.filter(uq => {
const trigger = uq.quest.triggerEvent;
// Exact match or prefix match (e.g. ITEM_COLLECT matches ITEM_COLLECT:101)
const isMatch = eventName === trigger || eventName.startsWith(trigger + ":");
return isMatch && !uq.completedAt;
});
for (const uq of relevant) {
const requirements = uq.quest.requirements as { target?: number };