---
name: Achievements, Daily Tasks, and Shared World
description: Achievement system, daily/weekly task system, and shared world foundation added 2026-03-27
type: project
---

Achievements, daily/weekly tasks, and shared world presence added in migration 000011.

**Achievements**: 9 seeded achievements tracked via hero stat columns (total_kills, elite_kills, total_deaths, kills_since_death, legendary_drops). CheckAndUnlock runs after every kill in processVictoryRewards. Rewards auto-applied (gold/potions).
**Why:** Spec sections 10.3, player engagement loop.
**How to apply:** New achievement conditions require adding to model.CheckAchievementCondition and seeding in migration.

**Daily/Weekly Tasks**: 4 daily + 3 weekly tasks. Lazy initialization via EnsureHeroTasks on first access each period. Progress incremented in processVictoryRewards (kill_count, elite_kill, collect_gold) and ActivateBuff (use_buff). Period boundaries: daily=UTC midnight, weekly=Monday UTC.
**Why:** Spec sections 10.1, 10.2.
**How to apply:** New objective types need handler hooks and DailyTaskStore.IncrementTaskProgress calls.

**Shared World**: last_online_at column + idx_heroes_online index. UpdateOnlineStatus called on ReportVictory. GetNearbyHeroes uses Euclidean distance with 2-min freshness cutoff.
**Why:** Spec section 2.3.
**How to apply:** Any endpoint where the hero is "active" should call UpdateOnlineStatus or set LastOnlineAt.

Key files: storage/achievement_store.go, storage/daily_task_store.go, handler/achievement.go, handler/daily_task.go, model/achievement.go, model/daily_task.go.
