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

3.7 KiB
Raw Blame History

E7.M2 — RewardAndUnlockRouter

Summary

Field Value
Module ID E7.M2
Epic Epic 7 — Quest / Faction
Stage target Prototype
Status Planned — Slice 2 backlog E7M2-prototype-backlog.md: E7M2-01 NEO-124E7M2-09 NEO-132. NEO-43 prep landed: MissionRewardSkillXpGrant for bundle skill XP (mission_reward). Upstream: E7.M1 Ready, E2.M2 grant stack, E3.M3 inventory.

Purpose

Route quest and encounter outputs to XP, items, unlocks, and flags with idempotent delivery (E7.M1 completion, E2.M2, E3.M3). Party: Per-character idempotent grants 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.

Epic 7 Slice 2reward_delivery, unlock_granted; no double-claim on replay. Backlog: E7M2-prototype-backlog.md.

Prototype Slice 2 freeze (E7M2-01)

completionRewardBundle on each frozen E7.M1 quest id. Grant kinds v1: item_grants + skill_xp_grants only (unlock/flag rows deferred).

Quest id Item grants Skill XP (mission_reward)
prototype_quest_gather_intro salvage 25
prototype_quest_refine_intro refine 25
prototype_quest_combat_intro salvage 25
prototype_quest_operator_chain survey_drone_kit ×1 salvage 50

Idempotency: {playerId}:quest_complete:{questId}. Encounter loot: E5.M3 direct grants unchanged in Slice 2.

Source anchors

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.

NEO-107 (E5.M3 producer hook): On encounter completion grant commit, EncounterCompletionOperations.TryCompleteAndGrant records EncounterCompleteEvent in IEncounterCompleteEventStore (idempotency key {playerId}:{encounterId}). Future E7.M2 QuestRewardBundle router consumes this record for reward_delivery quest credit beyond prototype contract_handoff_token item loot — comment-only hook stub; no runtime router yet. See NEO-107 implementation plan; server README — Encounter complete event (NEO-107).