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:
121
api/app/data/quests/medium/bandit_threat.yaml
Normal file
121
api/app/data/quests/medium/bandit_threat.yaml
Normal file
@@ -0,0 +1,121 @@
|
||||
# Bandit Threat - Combat-focused medium quest
|
||||
quest_id: quest_bandit_threat
|
||||
name: "The Bandit Threat"
|
||||
description: |
|
||||
A gang of bandits has been terrorizing travelers on the roads
|
||||
near Crossville. Mayor Aldric is offering a substantial reward
|
||||
for anyone who can deal with the threat permanently.
|
||||
difficulty: medium
|
||||
|
||||
# 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: 3
|
||||
max_character_level: 8
|
||||
required_quests_completed: []
|
||||
probability_weights:
|
||||
town: 0.20
|
||||
official: 0.40
|
||||
|
||||
# NPC-specific offer dialogue
|
||||
npc_offer_dialogues:
|
||||
npc_mayor_aldric:
|
||||
dialogue: |
|
||||
*straightens his chain of office* Crossville faces a grave threat.
|
||||
Bandits have been attacking merchants on the eastern road. Trade
|
||||
is suffering, and I fear for our people's safety. The village
|
||||
will pay handsomely for someone who can... resolve this situation.
|
||||
conditions:
|
||||
min_relationship: 35
|
||||
required_flags: []
|
||||
forbidden_flags: ["failed_bandit_quest"]
|
||||
|
||||
# What NPCs know
|
||||
npc_quest_knowledge:
|
||||
npc_mayor_aldric:
|
||||
- "The bandits have a camp somewhere in the eastern forest"
|
||||
- "They're led by a man called 'Blackhand' - a former soldier"
|
||||
- "At least a dozen bandits, well-armed and organized"
|
||||
- "Three merchant caravans have been hit in the past month"
|
||||
- "The militia is too small to mount an assault"
|
||||
|
||||
# Embedded lore
|
||||
lore_context:
|
||||
backstory: |
|
||||
The bandit leader Blackhand was once a soldier in the King's
|
||||
army. After the war ended, he turned to brigandry rather than
|
||||
return to a life of farming. His military training makes his
|
||||
gang far more dangerous than common thieves.
|
||||
world_connections:
|
||||
- "Many veterans turned to banditry after the war - a kingdom-wide problem"
|
||||
- "The mayor may know more about Blackhand than he lets on"
|
||||
regional_hints:
|
||||
- "The eastern forest road is the main trade route to the capital"
|
||||
- "Without trade, Crossville's economy will suffer greatly"
|
||||
|
||||
# Narrative hooks
|
||||
dialogue_templates:
|
||||
narrative_hooks:
|
||||
- "speaks of the economic impact on the village"
|
||||
- "mentions concerned merchants refusing to travel"
|
||||
- "hints at political pressure from higher authorities"
|
||||
- "shows genuine worry for the common folk"
|
||||
ambient_hints:
|
||||
- "You notice fewer merchants in the market than expected"
|
||||
- "Guards at the village gate look nervous and understaffed"
|
||||
- "Wanted posters for 'Blackhand' are posted on walls"
|
||||
|
||||
# Objectives
|
||||
objectives:
|
||||
- objective_id: find_camp
|
||||
description: "Locate the bandit camp in the eastern forest"
|
||||
objective_type: discover
|
||||
required_progress: 1
|
||||
target_location_id: bandit_camp
|
||||
|
||||
- objective_id: defeat_bandits
|
||||
description: "Defeat the bandits"
|
||||
objective_type: kill
|
||||
required_progress: 8
|
||||
target_enemy_type: bandit
|
||||
|
||||
- objective_id: defeat_blackhand
|
||||
description: "Defeat or capture Blackhand"
|
||||
objective_type: kill
|
||||
required_progress: 1
|
||||
target_enemy_type: blackhand_leader
|
||||
|
||||
# Rewards
|
||||
rewards:
|
||||
gold: 200
|
||||
experience: 350
|
||||
items:
|
||||
- blackhand_sword
|
||||
relationship_bonuses:
|
||||
npc_mayor_aldric: 20
|
||||
unlocks_quests: ["quest_mayors_secret"]
|
||||
reveals_locations: ["bandit_camp"]
|
||||
|
||||
# Completion dialogue
|
||||
completion_dialogue:
|
||||
npc_mayor_aldric: |
|
||||
*visible relief* The bandits are dealt with? This is excellent
|
||||
news. You've done Crossville a great service. *hands over a
|
||||
heavy coin purse* Your reward, as promised. And... I may have
|
||||
other matters that require someone of your capabilities. We
|
||||
should speak again soon.
|
||||
|
||||
tags:
|
||||
- combat
|
||||
- exploration
|
||||
- story
|
||||
143
api/app/data/quests/medium/missing_shipment.yaml
Normal file
143
api/app/data/quests/medium/missing_shipment.yaml
Normal file
@@ -0,0 +1,143 @@
|
||||
# Missing Shipment - Investigation and exploration quest
|
||||
quest_id: quest_missing_shipment
|
||||
name: "The Missing Shipment"
|
||||
description: |
|
||||
A shipment of dwarven goods, including rare ale and tools, never
|
||||
arrived from the mountain passes. The merchant who was transporting
|
||||
it has not been seen in days. Something must have happened on the road.
|
||||
difficulty: medium
|
||||
|
||||
# NPC Quest Givers
|
||||
quest_giver_npc_ids:
|
||||
- npc_grom_ironbeard
|
||||
- npc_blacksmith_hilda
|
||||
quest_giver_name: "Grom Ironbeard"
|
||||
|
||||
# Location context
|
||||
location_id: crossville_tavern
|
||||
region_id: crossville
|
||||
|
||||
# Offering conditions
|
||||
offering_triggers:
|
||||
location_types: ["tavern", "shop"]
|
||||
specific_locations: ["crossville_tavern", "crossville_forge"]
|
||||
min_character_level: 4
|
||||
max_character_level: 10
|
||||
required_quests_completed:
|
||||
- quest_cellar_rats # Must have helped Grom before
|
||||
probability_weights:
|
||||
tavern: 0.30
|
||||
shop: 0.25
|
||||
|
||||
# NPC-specific offer dialogue
|
||||
npc_offer_dialogues:
|
||||
npc_grom_ironbeard:
|
||||
dialogue: |
|
||||
*polishes glass nervously* My cousin Durgin was supposed to
|
||||
arrive three days ago with a shipment from the mountain holds.
|
||||
Dwarven stout, quality ore, fine tools. He's never late.
|
||||
*voice drops* Something's happened on the mountain road.
|
||||
I'm too old to go myself, but I'll pay well for news of him.
|
||||
conditions:
|
||||
min_relationship: 50
|
||||
required_flags: ["completed_cellar_rats"]
|
||||
forbidden_flags: []
|
||||
|
||||
npc_blacksmith_hilda:
|
||||
dialogue: |
|
||||
*frowns at empty shelves* My shipment of dwarven ore never
|
||||
arrived. Durgin Stonefoot was bringing it - he's Grom's cousin.
|
||||
Without that ore, I can't forge anything worth selling.
|
||||
The mountain road can be dangerous... would you look into it?
|
||||
conditions:
|
||||
min_relationship: 40
|
||||
required_flags: []
|
||||
forbidden_flags: []
|
||||
|
||||
# What NPCs know
|
||||
npc_quest_knowledge:
|
||||
npc_grom_ironbeard:
|
||||
- "Durgin always takes the north pass - it's longer but safer"
|
||||
- "He travels with two guards and a pack mule"
|
||||
- "The shipment is worth at least 500 gold"
|
||||
- "There have been rumors of strange creatures in the mountains lately"
|
||||
npc_blacksmith_hilda:
|
||||
- "Durgin is reliable - never missed a delivery in 15 years"
|
||||
- "The ore he brings is from the deep mines - best quality"
|
||||
- "Grom is worried sick about his cousin"
|
||||
|
||||
# Embedded lore
|
||||
lore_context:
|
||||
backstory: |
|
||||
Durgin Stonefoot has been making the mountain crossing for years,
|
||||
bringing goods from the dwarven holds to the human settlements
|
||||
below. He's a seasoned traveler who knows every rock and crevice
|
||||
of the mountain road.
|
||||
world_connections:
|
||||
- "The mountain passes have seen increased monster activity"
|
||||
- "Trade routes between dwarves and humans are vital to both economies"
|
||||
regional_hints:
|
||||
- "The north pass winds through old ruins from the First Age"
|
||||
- "Travelers speak of hearing strange howls at night"
|
||||
|
||||
# Narrative hooks
|
||||
dialogue_templates:
|
||||
narrative_hooks:
|
||||
- "mentions family connection to the missing merchant"
|
||||
- "worries about more than just the lost goods"
|
||||
- "offers personal items as a bonus reward"
|
||||
- "knows something about the mountain dangers"
|
||||
ambient_hints:
|
||||
- "Empty barrels line the cellar where shipments should be"
|
||||
- "Other merchants discuss avoiding the mountain road"
|
||||
|
||||
# Objectives
|
||||
objectives:
|
||||
- objective_id: search_road
|
||||
description: "Search the mountain road for signs of the shipment"
|
||||
objective_type: travel
|
||||
required_progress: 1
|
||||
target_location_id: mountain_pass
|
||||
|
||||
- objective_id: find_durgin
|
||||
description: "Discover what happened to Durgin"
|
||||
objective_type: discover
|
||||
required_progress: 1
|
||||
target_location_id: durgin_campsite
|
||||
|
||||
- objective_id: recover_goods
|
||||
description: "Recover the missing goods (if possible)"
|
||||
objective_type: collect
|
||||
required_progress: 1
|
||||
target_item_id: dwarven_shipment
|
||||
|
||||
# Rewards
|
||||
rewards:
|
||||
gold: 150
|
||||
experience: 300
|
||||
items:
|
||||
- dwarven_ale_keg
|
||||
relationship_bonuses:
|
||||
npc_grom_ironbeard: 15
|
||||
npc_blacksmith_hilda: 10
|
||||
unlocks_quests: ["quest_mountain_menace"]
|
||||
reveals_locations: ["mountain_pass", "durgin_campsite"]
|
||||
|
||||
# Completion dialogue
|
||||
completion_dialogue:
|
||||
npc_grom_ironbeard: |
|
||||
*relief floods his face* Durgin is alive? Thank the ancestors!
|
||||
*takes the recovered goods* And you brought back what you could.
|
||||
You've done more than I could ask. Here's your payment, and...
|
||||
*pulls out a small flask* ...my personal reserve. Drink it in
|
||||
good health, friend.
|
||||
|
||||
npc_blacksmith_hilda: |
|
||||
*examines the recovered ore* This will do nicely. Thank you
|
||||
for finding out what happened. Poor Durgin - I hope he recovers.
|
||||
You've earned both coin and my gratitude.
|
||||
|
||||
tags:
|
||||
- investigation
|
||||
- exploration
|
||||
- story
|
||||
Reference in New Issue
Block a user