feat: Implement Phase 5 Quest System (100% complete)
Add YAML-driven quest system with context-aware offering:
Core Implementation:
- Quest data models (Quest, QuestObjective, QuestReward, QuestTriggers)
- QuestService for YAML loading and caching
- QuestEligibilityService with level, location, and probability filtering
- LoreService stub (MockLoreService) ready for Phase 6 Weaviate integration
Quest Content:
- 5 example quests across difficulty tiers (2 easy, 2 medium, 1 hard)
- Quest-centric design: quests define their NPC givers
- Location-based probability weights for natural quest offering
AI Integration:
- Quest offering section in npc_dialogue.j2 template
- Response parser extracts [QUEST_OFFER:quest_id] markers
- AI naturally weaves quest offers into NPC conversations
API Endpoints:
- POST /api/v1/quests/accept - Accept quest offer
- POST /api/v1/quests/decline - Decline quest offer
- POST /api/v1/quests/progress - Update objective progress
- POST /api/v1/quests/complete - Complete quest, claim rewards
- POST /api/v1/quests/abandon - Abandon active quest
- GET /api/v1/characters/{id}/quests - List character quests
- GET /api/v1/quests/{quest_id} - Get quest details
Frontend:
- Quest tracker sidebar with HTMX integration
- Quest offer modal for accept/decline flow
- Quest detail modal for viewing progress
- Combat service integration for kill objective tracking
Testing:
- Unit tests for Quest models and serialization
- Integration tests for full quest lifecycle
- Comprehensive test coverage for eligibility service
Documentation:
- Reorganized docs into /docs/phases/ structure
- Added Phase 5-12 planning documents
- Updated ROADMAP.md with new structure
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
146
api/app/data/quests/hard/dungeon_depths.yaml
Normal file
146
api/app/data/quests/hard/dungeon_depths.yaml
Normal file
@@ -0,0 +1,146 @@
|
||||
# Dungeon Depths - Challenging dungeon crawl quest
|
||||
quest_id: quest_dungeon_depths
|
||||
name: "Secrets of the Old Mines"
|
||||
description: |
|
||||
The sealed entrance to Crossville's abandoned mines has been breached.
|
||||
Strange sounds and foul odors emanate from within, and livestock have
|
||||
begun to disappear. The mayor needs someone brave enough to investigate
|
||||
what ancient evil has awakened in the depths.
|
||||
difficulty: hard
|
||||
|
||||
# NPC Quest Givers
|
||||
quest_giver_npc_ids:
|
||||
- npc_mayor_aldric
|
||||
quest_giver_name: "Mayor Aldric Thornwood"
|
||||
|
||||
# Location context
|
||||
location_id: crossville_village
|
||||
region_id: crossville
|
||||
|
||||
# Offering conditions
|
||||
offering_triggers:
|
||||
location_types: ["town", "official"]
|
||||
specific_locations: ["crossville_village", "crossville_town_hall"]
|
||||
min_character_level: 6
|
||||
max_character_level: 15
|
||||
required_quests_completed:
|
||||
- quest_bandit_threat # Must have proven yourself
|
||||
probability_weights:
|
||||
town: 0.15
|
||||
official: 0.25
|
||||
|
||||
# NPC-specific offer dialogue
|
||||
npc_offer_dialogues:
|
||||
npc_mayor_aldric:
|
||||
dialogue: |
|
||||
*closes the door and speaks in hushed tones* What I'm about
|
||||
to tell you cannot leave this room. The Old Mines... they were
|
||||
sealed for a reason. My grandfather saw to it fifty years ago.
|
||||
Now something has broken through. I need someone I can trust
|
||||
to go down there and find out what we're dealing with.
|
||||
*pauses* And to ensure it stays buried.
|
||||
conditions:
|
||||
min_relationship: 60
|
||||
required_flags: ["completed_bandit_quest"]
|
||||
forbidden_flags: []
|
||||
|
||||
# What NPCs know
|
||||
npc_quest_knowledge:
|
||||
npc_mayor_aldric:
|
||||
- "The mines were sealed after a cave-in killed twenty miners"
|
||||
- "His grandfather's journal mentions 'that which must not wake'"
|
||||
- "The recent earthquakes may have disturbed ancient seals"
|
||||
- "He's being blackmailed by someone who knows the truth"
|
||||
- "The Thornwood family has guarded this secret for generations"
|
||||
|
||||
# Embedded lore
|
||||
lore_context:
|
||||
backstory: |
|
||||
Fifty years ago, miners in Crossville dug too deep and broke into
|
||||
ancient catacombs predating human settlement. What they found
|
||||
drove the survivors mad. The mines were sealed, the entrance
|
||||
buried, and the truth hidden. The Thornwood family has kept
|
||||
this secret ever since, fearing what might happen if the truth
|
||||
emerged.
|
||||
world_connections:
|
||||
- "The catacombs may predate the Five Kingdoms themselves"
|
||||
- "Similar sealed places exist across the realm - ancient evils best forgotten"
|
||||
- "The earthquakes affecting the region all seem centered on these old sites"
|
||||
regional_hints:
|
||||
- "Old-timers speak of the 'quiet years' after the mine closed"
|
||||
- "The Thornwood family rose to prominence around the same time"
|
||||
- "Some say the mayor's nightmares are why he never drinks"
|
||||
|
||||
# Narrative hooks
|
||||
dialogue_templates:
|
||||
narrative_hooks:
|
||||
- "speaks of family duty and burden"
|
||||
- "reveals more than intended when stressed"
|
||||
- "offers to share grandfather's journal"
|
||||
- "warns of dangers beyond mere monsters"
|
||||
ambient_hints:
|
||||
- "The mayor's hands shake when the mines are mentioned"
|
||||
- "Old maps on his wall show the mine entrance marked with warnings"
|
||||
- "A locked chest in the corner bears the Thornwood seal"
|
||||
|
||||
# Objectives
|
||||
objectives:
|
||||
- objective_id: enter_mines
|
||||
description: "Enter the Old Mines through the breached seal"
|
||||
objective_type: travel
|
||||
required_progress: 1
|
||||
target_location_id: old_mines_entrance
|
||||
|
||||
- objective_id: explore_depths
|
||||
description: "Explore the mine depths"
|
||||
objective_type: discover
|
||||
required_progress: 3
|
||||
target_location_id: mine_depths
|
||||
|
||||
- objective_id: defeat_guardians
|
||||
description: "Defeat the awakened guardians"
|
||||
objective_type: kill
|
||||
required_progress: 5
|
||||
target_enemy_type: ancient_guardian
|
||||
|
||||
- objective_id: find_crypt
|
||||
description: "Discover the ancient crypt"
|
||||
objective_type: discover
|
||||
required_progress: 1
|
||||
target_location_id: ancient_crypt
|
||||
|
||||
- objective_id: seal_evil
|
||||
description: "Reseal or destroy what lies within"
|
||||
objective_type: interact
|
||||
required_progress: 1
|
||||
target_npc_id: ancient_seal
|
||||
|
||||
# Rewards
|
||||
rewards:
|
||||
gold: 500
|
||||
experience: 750
|
||||
items:
|
||||
- ancient_medallion
|
||||
- thornwood_journal
|
||||
relationship_bonuses:
|
||||
npc_mayor_aldric: 30
|
||||
unlocks_quests: ["quest_ancient_truth"]
|
||||
reveals_locations: ["old_mines", "ancient_crypt"]
|
||||
|
||||
# Completion dialogue
|
||||
completion_dialogue:
|
||||
npc_mayor_aldric: |
|
||||
*sinks into his chair* It's done then? The seal holds?
|
||||
*long pause* You've done what my family couldn't for fifty
|
||||
years. You've seen what lies beneath our village. I trust
|
||||
you understand why this must remain secret.
|
||||
*slides a heavy chest across the desk*
|
||||
Your reward. And my eternal gratitude. The Thornwood family
|
||||
owes you a debt we can never fully repay. If you ever need
|
||||
anything... anything at all... my door is always open to you.
|
||||
|
||||
tags:
|
||||
- dungeon
|
||||
- combat
|
||||
- story
|
||||
- secret
|
||||
Reference in New Issue
Block a user