neon-sprawl/docs/decomposition/modules/E7_M2_RewardAndUnlockRouter.md

51 lines
1.9 KiB
Markdown

# E7.M2 — RewardAndUnlockRouter
## Summary
| Field | Value |
|--------|--------|
| **Module ID** | E7.M2 |
| **Epic** | [Epic 7 — Quest / Faction](../epics/epic_07_quest_faction.md) |
| **Stage target** | Prototype |
| **Status** | Planned (see [dependency register](module_dependency_register.md)) |
## Purpose
Route quest and encounter outputs to XP, items, unlocks, and flags with **idempotent** delivery ([E7.M1](E7_M1_QuestStateMachine.md) completion, [E2.M2](E2_M2_XpAwardAndLevelEngine.md), [E3.M3](E3_M3_ItemizationAndInventorySchema.md)). **Party:** [Per-character idempotent grants](quest_scope_and_party.md#rewards-e7m2) when party credit completes multiple characters.
## Responsibilities
- Apply `QuestRewardBundle`; grant `UnlockGrant`; emit `RewardDeliveryEvent` for audit.
## Key contracts
| Contract | Role |
|----------|------|
| `QuestRewardBundle` | Composite rewards for a step or completion. |
| `UnlockGrant` | Blueprints, gates, cosmetics. |
| `RewardDeliveryEvent` | Idempotency key and outcome. |
## Module dependencies
- **E2.M2** — XpAwardAndLevelEngine.
- **E3.M3** — ItemizationAndInventorySchema.
- **E7.M1** — QuestStateMachine.
## Dependents (by design)
- **E5.M3** — EncounterAndRewardTables.
- **E6.M4** — RewardParityEnforcer.
## Related implementation slices
Epic 7 **Slice 2**`reward_delivery`, `unlock_granted`; no double-claim on replay.
## Source anchors
- Master plan: [`neon_sprawl_vision.plan.md`](../../../neon_sprawl_vision.plan.md) — Epic 7.
- [Module dependency register](module_dependency_register.md)
## Implementation anchor (server)
**NEO-43:** When applying scripted **skill XP** from a mission/quest reward bundle, call **`MissionRewardSkillXpGrant.GrantFromMissionReward`** (`server/NeonSprawl.Server/Game/Skills/`) — fixed **`sourceKind: mission_reward`**, **`skillId`** and **`amount`** from reward data — [NEO-43 implementation plan](../../plans/NEO-43-implementation-plan.md).