Files
Genarrative/server-rs/crates/module-runtime-item/README.md
kdletters cbc27bad4a
Some checks failed
CI / verify (push) Has been cancelled
init with react+axum+spacetimedb
2026-04-26 18:06:23 +08:00

34 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# module-runtime-item 运行时宝藏模块说明
日期:`2026-04-21`
## 1. package 职责
`module-runtime-item` 是运行时物品子域 crate当前已经承接宝藏奖励快照与背包桥接相关的纯领域能力
1. `TreasureResolveInput / TreasureRecordSnapshot / TreasureInteractionAction`
2. 宝藏奖励物品 `RuntimeItemRewardItemSnapshot` 的字段校验与归一化
3. `build_treasure_record_snapshot`
4. `build_inventory_item_snapshot_from_reward_item`
5.`crates/spacetime-module` 聚合表与 reducer 复用的纯 Rust 规则函数
## 2. 当前阶段说明
当前 crate 已经提供:
1. `treasure_record` 首版领域 contract
2. 运行时奖励物品到 `module-inventory::InventoryItemSnapshot` 的显式映射 helper
3. 中文错误语义与最小测试
4.`crates/spacetime-module``resolve_treasure_interaction` 中把宝藏奖励同步写入 `inventory_slot` 的桥接规则
补充说明:
1. 当前 crate 仍保持“纯领域规则”定位,不直接依赖 SpacetimeDB reducer context 或 Axum。
2. `spacetime-types` feature 只用于在 `spacetime-module` 中复用这些类型做表字段和 reducer 输入。
## 3. 边界约束
1. 当前 crate 只负责任务奖励/宝藏奖励与 inventory 的字段桥接,不承接 story 编排或前端 DTO。
2. 宝藏、任务、交易等不同奖励入口若要写入 `inventory_slot`,优先复用这里与 `module-inventory` 的桥接口径,而不是各自重新拼装物品字段。
3. 当前真实工程口径以 `docs/technical/M4_RUNTIME_ITEM_TREASURE_SPACETIMEDB_BASELINE_2026-04-21.md` 为准。