显示层接线 properties.ts 数据驱动化及 Phase 4 剩余 1.13c 细节对齐 #133

Closed
opened 2026-09-19 10:53:29 +00:00 by troytt · 1 comment
Owner

问题描述 (Issue C1, C3 + Phase 4: A6, A8, A9, B4, B7)

  1. Phase 3 — 显示层接线 properties.ts 数据驱动化 (C1, C3):

    • src/game/properties.ts (801 行) 已经完整实现了 Properties.txt (268 行) 与 ItemStatCost.txt (359 行) 的解析(含 func1..7、stat1..7、descPriority、descFunc、descVal、dgrp、dgrpFunc、valShift 以及 resolveProperty),但 DropTables 与 item-tooltip.ts 尚未接线。
    • 同 descpriority 时原版按 ItemStatCost.txt 的 statId (ID 列) 排序(C3)。
  2. Phase 4 — 1.13c 溯源核实与细节对齐 (A6, A8, A9, B4, B7):

    • A6 (金币公式 D2Game!6FC319D0):1.13c 怪物金币掉落公式为 maxGold = nLevel * 6,随机范围 1 .. (nLevel * 6) 再乘以 goldMultiplier(gld,mul=N 的 N >> 8 或 N / 256)。
    • A8 (ilvl 与 D = max(0, ilvl - qlvl) 钳制 D2Game!6FC2FC40):在 ItemRatio 品质计算中,ilvl 上限为 99,且 D = Math.max(0, Math.min(99, ilvl) - qlvl)(当 ilvl < qlvl 时不得产生负数 D 反向减小 chance)。
    • A9 (effectiveMF mf <= 10 分支):经核实 D2Game!6FC2E130 汇编确有 cmp eax, 110; jle(即 mf + 100 <= 110 时直接返回 mf + 100),添加精确汇编注释说明。
    • B7 (Rare 词缀属性与稀有名 isRareNameEligible 复核):在 rollRareAffixes 中确保稀有前/后缀名严格通过 isRareNameEligible 且前缀名与后缀名文本不重复。

解决方案

  1. 在 DropTables (src/game/drop-pipeline.ts) 中新增 readonly properties?: PropertiesTable 与 readonly itemStatCost?: ItemStatCostTable,并在 loadDropTables 中调用 loadItemPropertiesAndStats(archives) 加载。
  2. 在 src/game/item-tooltip.ts 中导入并接线 properties.ts:
    • 支持注入或传入运行时 PropertiesTable + ItemStatCostTable(如 registerRuntimePropertyTables(properties, itemStatCost) 或 formatItemTooltip(item, options)),动态从 ItemStatCostTable 查询 descPriority、statId(作为同 descPriority 下的二级排序键 C3)、dgrp 与 descFunc!
    • 保留内置 PROP_DESC_PRIORITY 作为零 I/O 离线默认回退,并在 tests/parity-1.13c.test.ts 中新增「硬编码 PROP_DESC_PRIORITY === MPQ Properties.txt → ItemStatCost.txt 实时解析结果」的 100% 一致性校验测试。
  3. 对齐 A6 金币公式与 A8 D = Math.max(0, Math.min(99, ilvl) - qlvl) 钳制,并补充对应测试。
## 问题描述 (Issue C1, C3 + Phase 4: A6, A8, A9, B4, B7) 1. **Phase 3 — 显示层接线 `properties.ts` 数据驱动化 (C1, C3)**: - `src/game/properties.ts` (801 行) 已经完整实现了 `Properties.txt` (268 行) 与 `ItemStatCost.txt` (359 行) 的解析(含 `func1..7`、`stat1..7`、`descPriority`、`descFunc`、`descVal`、`dgrp`、`dgrpFunc`、`valShift` 以及 `resolveProperty`),但 `DropTables` 与 `item-tooltip.ts` 尚未接线。 - 同 `descpriority` 时原版按 `ItemStatCost.txt` 的 `statId` (ID 列) 排序(C3)。 2. **Phase 4 — 1.13c 溯源核实与细节对齐 (A6, A8, A9, B4, B7)**: - **A6 (金币公式 `D2Game!6FC319D0`)**:1.13c 怪物金币掉落公式为 `maxGold = nLevel * 6`,随机范围 `1 .. (nLevel * 6)` 再乘以 `goldMultiplier`(`gld,mul=N` 的 `N >> 8` 或 `N / 256`)。 - **A8 (`ilvl` 与 `D = max(0, ilvl - qlvl)` 钳制 `D2Game!6FC2FC40`)**:在 `ItemRatio` 品质计算中,`ilvl` 上限为 `99`,且 `D = Math.max(0, Math.min(99, ilvl) - qlvl)`(当 `ilvl < qlvl` 时不得产生负数 `D` 反向减小 `chance`)。 - **A9 (`effectiveMF` `mf <= 10` 分支)**:经核实 `D2Game!6FC2E130` 汇编确有 `cmp eax, 110; jle`(即 `mf + 100 <= 110` 时直接返回 `mf + 100`),添加精确汇编注释说明。 - **B7 (Rare 词缀属性与稀有名 `isRareNameEligible` 复核)**:在 `rollRareAffixes` 中确保稀有前/后缀名严格通过 `isRareNameEligible` 且前缀名与后缀名文本不重复。 ## 解决方案 1. 在 `DropTables` (`src/game/drop-pipeline.ts`) 中新增 `readonly properties?: PropertiesTable` 与 `readonly itemStatCost?: ItemStatCostTable`,并在 `loadDropTables` 中调用 `loadItemPropertiesAndStats(archives)` 加载。 2. 在 `src/game/item-tooltip.ts` 中导入并接线 `properties.ts`: - 支持注入或传入运行时 `PropertiesTable` + `ItemStatCostTable`(如 `registerRuntimePropertyTables(properties, itemStatCost)` 或 `formatItemTooltip(item, options)`),动态从 `ItemStatCostTable` 查询 `descPriority`、`statId`(作为同 `descPriority` 下的二级排序键 C3)、`dgrp` 与 `descFunc`! - 保留内置 `PROP_DESC_PRIORITY` 作为零 I/O 离线默认回退,并在 `tests/parity-1.13c.test.ts` 中新增「硬编码 `PROP_DESC_PRIORITY` === MPQ `Properties.txt` → `ItemStatCost.txt` 实时解析结果」的 100% 一致性校验测试。 3. 对齐 A6 金币公式与 A8 `D = Math.max(0, Math.min(99, ilvl) - qlvl)` 钳制,并补充对应测试。
Author
Owner

Fixed in commit fc63887 (merged into main). Verified with tests/parity-1.13c.test.ts (27 passed), tests/properties.test.ts (8 passed), and full drop/affix/tooltip test suites.

Fixed in commit fc63887 (merged into main). Verified with tests/parity-1.13c.test.ts (27 passed), tests/properties.test.ts (8 passed), and full drop/affix/tooltip test suites.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: troytt/diablo2-web#133
No description provided.