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:
2025-11-29 15:42:55 -06:00
parent e7e329e6ed
commit df26abd207
42 changed files with 8421 additions and 2227 deletions

View File

@@ -2139,3 +2139,526 @@
margin-top: 0.5rem;
}
}
/* ===== QUEST MODAL STYLES ===== */
/* Quest Offer Modal */
.quest-offer-modal {
max-width: 550px;
}
.quest-offer-header-info,
.quest-detail-header-info {
display: flex;
align-items: center;
gap: 0.75rem;
flex: 1;
}
.quest-offer-body,
.quest-detail-body {
display: flex;
flex-direction: column;
gap: 1rem;
}
/* Quest Giver Section */
.quest-offer-giver,
.quest-detail-giver {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem;
background: var(--bg-tertiary);
border-radius: 6px;
}
.quest-giver-icon {
font-size: 1.25rem;
}
.quest-giver-name {
font-weight: 600;
color: var(--accent-gold);
}
.quest-giver-says {
color: var(--text-muted);
font-size: var(--text-sm);
}
.quest-giver-label {
color: var(--text-muted);
font-size: var(--text-sm);
}
/* Quest Dialogue */
.quest-offer-dialogue {
padding: 1rem;
background: rgba(243, 156, 18, 0.1);
border-left: 3px solid var(--accent-gold);
border-radius: 0 6px 6px 0;
}
.quest-dialogue-text {
margin: 0;
color: var(--text-secondary);
font-style: italic;
line-height: 1.5;
}
/* Quest Description */
.quest-offer-description,
.quest-detail-description {
color: var(--text-secondary);
line-height: 1.6;
}
.quest-offer-description p,
.quest-detail-description p {
margin: 0;
}
/* Quest Sections */
.quest-offer-section,
.quest-detail-section {
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.quest-section-title {
font-size: var(--text-sm);
font-weight: 600;
color: var(--text-primary);
margin: 0;
padding-bottom: 0.375rem;
border-bottom: 1px solid var(--play-border);
}
/* Quest Objectives in Modal */
.quest-offer-objectives {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 0.5rem;
}
.quest-offer-objective {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem;
background: var(--bg-input);
border-radius: 4px;
}
.objective-bullet {
color: var(--accent-gold);
font-size: 1.25rem;
}
.objective-text {
flex: 1;
color: var(--text-secondary);
}
.objective-count {
font-size: var(--text-xs);
color: var(--text-muted);
}
/* Quest Detail Objectives with Progress */
.quest-detail-objectives {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.quest-detail-objective {
padding: 0.75rem;
background: var(--bg-input);
border-radius: 6px;
}
.quest-detail-objective.objective-complete {
background: rgba(16, 185, 129, 0.1);
border: 1px solid rgba(16, 185, 129, 0.3);
}
.objective-header {
display: flex;
align-items: center;
gap: 0.5rem;
margin-bottom: 0.5rem;
}
.objective-check {
width: 18px;
height: 18px;
display: flex;
align-items: center;
justify-content: center;
border: 2px solid var(--play-border);
border-radius: 50%;
font-size: 12px;
color: var(--text-muted);
}
.objective-complete .objective-check {
background: #10b981;
border-color: #10b981;
color: white;
}
.text-complete,
.text-strikethrough {
text-decoration: line-through;
color: var(--text-muted);
}
/* Progress Bar */
.objective-progress {
display: flex;
align-items: center;
gap: 0.75rem;
}
.progress-bar {
flex: 1;
height: 8px;
background: var(--bg-tertiary);
border-radius: 4px;
overflow: hidden;
}
.progress-fill {
height: 100%;
background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-hover));
border-radius: 4px;
transition: width 0.3s ease;
}
.progress-text {
font-size: var(--text-xs);
color: var(--text-muted);
min-width: 40px;
text-align: right;
}
/* Quest Rewards Grid */
.quest-rewards-grid {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
}
.quest-reward-item {
display: flex;
align-items: center;
gap: 0.375rem;
padding: 0.5rem 0.75rem;
background: var(--bg-input);
border-radius: 4px;
}
.reward-icon {
font-size: 1rem;
}
.reward-icon--xp {
color: #10b981;
}
.reward-icon--gold {
color: var(--accent-gold);
}
.reward-icon--item {
color: #8b5cf6;
}
.reward-value {
font-size: var(--text-sm);
color: var(--text-secondary);
}
/* Quest Status Bar */
.quest-status-bar {
display: flex;
align-items: center;
gap: 0.75rem;
padding: 0.75rem 1rem;
border-radius: 6px;
margin-bottom: 0.5rem;
}
.quest-status-bar--active {
background: rgba(59, 130, 246, 0.15);
border: 1px solid rgba(59, 130, 246, 0.3);
}
.quest-status-bar--ready {
background: rgba(16, 185, 129, 0.15);
border: 1px solid rgba(16, 185, 129, 0.3);
}
.status-icon {
font-size: 1.25rem;
}
.quest-status-bar--active .status-icon {
color: #3b82f6;
}
.quest-status-bar--ready .status-icon {
color: #10b981;
}
.status-text {
font-weight: 600;
color: var(--text-primary);
}
.status-hint {
font-size: var(--text-sm);
color: var(--text-muted);
margin-left: auto;
}
/* Quest Warning */
.quest-offer-warning {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.75rem 1rem;
background: rgba(239, 68, 68, 0.15);
border: 1px solid rgba(239, 68, 68, 0.3);
border-radius: 6px;
color: #ef4444;
}
.warning-icon {
font-size: 1.25rem;
}
.warning-text {
font-size: var(--text-sm);
}
/* Quest Meta Info */
.quest-detail-meta {
display: flex;
gap: 0.5rem;
font-size: var(--text-xs);
color: var(--text-muted);
padding-top: 0.5rem;
border-top: 1px solid var(--play-border);
}
/* Quest Footer Actions */
.quest-offer-footer,
.quest-detail-footer {
display: flex;
gap: 0.75rem;
justify-content: flex-end;
}
/* Quest Success/Complete/Abandon Modals */
.quest-success-modal,
.quest-complete-modal,
.quest-abandon-modal,
.quest-error-modal {
max-width: 400px;
text-align: center;
}
.quest-success-text,
.quest-complete-title {
font-size: var(--text-lg);
margin-bottom: 0.5rem;
}
.quest-success-hint {
color: var(--text-muted);
font-size: var(--text-sm);
}
.quest-level-up {
padding: 0.75rem;
background: rgba(243, 156, 18, 0.2);
border: 1px solid var(--accent-gold);
border-radius: 6px;
color: var(--accent-gold);
font-weight: 600;
margin: 0.75rem 0;
}
.quest-rewards-received {
text-align: left;
padding: 1rem;
background: var(--bg-input);
border-radius: 6px;
}
.quest-rewards-received h4 {
margin: 0 0 0.5rem 0;
font-size: var(--text-sm);
color: var(--text-primary);
}
.quest-rewards-received ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
gap: 0.375rem;
}
.quest-rewards-received li {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: var(--text-sm);
color: var(--text-secondary);
}
.quest-error-text {
color: #ef4444;
}
/* ===== ENHANCED SIDEBAR QUEST STYLES ===== */
/* Clickable Quest Items */
.quest-item {
cursor: pointer;
transition: all 0.2s ease;
border: 1px solid transparent;
}
.quest-item:hover {
border-color: var(--accent-gold);
transform: translateX(2px);
}
.quest-item:focus {
outline: 2px solid var(--accent-gold);
outline-offset: 2px;
}
.quest-item:active {
transform: translateX(1px);
}
/* Ready to Complete State */
.quest-item--ready {
border: 1px solid rgba(16, 185, 129, 0.5);
background: rgba(16, 185, 129, 0.1);
}
.quest-item--ready:hover {
border-color: #10b981;
}
/* Ready Banner in Sidebar */
.quest-ready-banner {
display: flex;
align-items: center;
gap: 0.375rem;
padding: 0.375rem 0.5rem;
background: rgba(16, 185, 129, 0.2);
border-radius: 4px;
margin-bottom: 0.5rem;
}
.ready-icon {
color: #10b981;
font-size: var(--text-sm);
}
.ready-text {
color: #10b981;
font-size: var(--text-xs);
font-weight: 600;
}
/* Overall Quest Progress Bar */
.quest-overall-progress {
display: flex;
align-items: center;
gap: 0.5rem;
margin-top: 0.5rem;
padding-top: 0.5rem;
border-top: 1px solid var(--play-border);
}
.mini-progress-bar {
flex: 1;
height: 4px;
background: var(--bg-tertiary);
border-radius: 2px;
overflow: hidden;
}
.mini-progress-fill {
height: 100%;
background: var(--accent-gold);
border-radius: 2px;
transition: width 0.3s ease;
}
.mini-progress-text {
font-size: var(--text-xs);
color: var(--text-muted);
}
/* Empty Quest State */
.quest-empty {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
padding: 1.5rem 1rem;
}
.empty-icon {
font-size: 2rem;
opacity: 0.5;
}
.empty-text {
margin: 0;
color: var(--text-secondary);
font-size: var(--text-sm);
}
.empty-hint {
margin: 0;
color: var(--text-muted);
font-size: var(--text-xs);
}
/* Difficulty Epic (for future quests) */
.quest-difficulty--epic {
background: rgba(139, 92, 246, 0.2);
color: #8b5cf6;
}
/* Danger Button for Abandon */
.btn--danger {
background: rgba(239, 68, 68, 0.2);
color: #ef4444;
border: 1px solid #ef4444;
}
.btn--danger:hover {
background: #ef4444;
color: white;
}