Provide non-obvious business rules and constraints for economy, inventory, quest, moderation, trade, and trivia modules to reduce context-gathering overhead for AI tools. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1.4 KiB
1.4 KiB
Quest Module
- Quests are event-driven. The
handleEventmethod is called by system event listeners (not by commands directly). It matches events by exact name or prefix (e.g., triggerITEM_COLLECTmatches eventITEM_COLLECT:101), enabling both generic and specific quest triggers. - Max active quests is controlled by
gameSettingsService, not hardcoded. Default is 3. assignQuestusesonConflictDoNothing-- re-assigning an already-assigned quest silently no-ops. This is intentional to avoid duplicate quest entries.- Quest progress is a simple integer counter. The
weightparameter inhandleEventallows a single event to advance progress by more than 1 (useful for bulk actions). - Quest completion is automatic: when progress >= target during
handleEvent,completeQuestis called within the same transaction. There is no manual "turn in" step. - Rewards (xp and balance) are distributed via
economyServiceandlevelingServiceinside the completion transaction. TheQUEST.COMPLETEDevent is emitted withsystemEvents.emit(fire-and-forget, not async) for bot-layer notifications. requirementsandrewardsare stored as JSON columns. Always expect{ target: number }for requirements and{ xp?: number, balance?: number }for rewards.- Completed quests are never deleted -- they stay in
userQuestswith acompletedAttimestamp.getAvailableQuestsexcludes any quest the user has ever been assigned (completed or not).