支持戒指、项链、珠宝等物品的同代码多图标变体 (ItemTypes VarInvGfx) #375

Closed
opened 2026-09-22 08:14:35 +00:00 by troytt · 0 comments
Owner

问题背景与需求

在暗黑破坏神 2 原版 1.13c 机制中,部分基础物品类型支持多种不同的外观贴图(同一个物品代码对应多个图标)。目前护身符(Charms: cm1、cm2、cm3 共 9 种变体)已在 Issue #149 落地支持,戒指、项链、珠宝等品类需后续跟进支持多图标随机变体。

原版 1.13c 规范 (Ground Truth)

依据 ItemTypes.txt 数据表定义:

  1. 戒指 (Ring / rin): VarInvGfx = 5,对应 5 种贴图变体(invrin1 ~ invrin5)
  2. 项链 (Amulet / amu): VarInvGfx = 3,对应 3 种贴图变体(invamu1 ~ invamu3)
  3. 珠宝 (Jewel / jewl): VarInvGfx = 6,对应 6 种贴图变体(invjw1 ~ invjw6)

在原版 D2 掉落与存档(.d2s)中,物品生成时由一个 3-bit 字段 graphic(0 ~ VarInvGfx-1)随机决定其具体外观变体。

待实现方案

  1. 离线图集打包 (scripts/pack-ui.ts):
    • 遍历 ItemTypes.txt 中的 InvGfx1 ~ InvGfx6,将 MPQ 内实际存在的 invrin1..5、invamu1..3、invjw1..6 全部收录并烘焙进 items-atlas.png。
  2. 物品生成与掉落 (src/game/drop.ts / items.ts):
    • 生成戒指、项链、珠宝时,根据 VarInvGfx 随机分配变体编号并赋予相应 invFile。
  3. UI 渲染解析 (src/ui/inventory.ts):
    • 在 resolveItemSpriteRect 中为戒指/项链/珠宝建立品类变体白名单与实例定向映射,未指定时默认回退至 1 号基准贴图。
### 问题背景与需求 在暗黑破坏神 2 原版 1.13c 机制中,部分基础物品类型支持多种不同的外观贴图(同一个物品代码对应多个图标)。目前护身符(Charms: `cm1`、`cm2`、`cm3` 共 9 种变体)已在 Issue #149 落地支持,戒指、项链、珠宝等品类需后续跟进支持多图标随机变体。 ### 原版 1.13c 规范 (Ground Truth) 依据 `ItemTypes.txt` 数据表定义: 1. **戒指 (Ring / `rin`)**: `VarInvGfx = 5`,对应 5 种贴图变体(`invrin1` ~ `invrin5`) 2. **项链 (Amulet / `amu`)**: `VarInvGfx = 3`,对应 3 种贴图变体(`invamu1` ~ `invamu3`) 3. **珠宝 (Jewel / `jewl`)**: `VarInvGfx = 6`,对应 6 种贴图变体(`invjw1` ~ `invjw6`) 在原版 D2 掉落与存档(`.d2s`)中,物品生成时由一个 3-bit 字段 `graphic`(0 ~ VarInvGfx-1)随机决定其具体外观变体。 ### 待实现方案 1. **离线图集打包 (`scripts/pack-ui.ts`)**: - 遍历 `ItemTypes.txt` 中的 `InvGfx1` ~ `InvGfx6`,将 MPQ 内实际存在的 `invrin1..5`、`invamu1..3`、`invjw1..6` 全部收录并烘焙进 `items-atlas.png`。 2. **物品生成与掉落 (`src/game/drop.ts` / `items.ts`)**: - 生成戒指、项链、珠宝时,根据 `VarInvGfx` 随机分配变体编号并赋予相应 `invFile`。 3. **UI 渲染解析 (`src/ui/inventory.ts`)**: - 在 `resolveItemSpriteRect` 中为戒指/项链/珠宝建立品类变体白名单与实例定向映射,未指定时默认回退至 1 号基准贴图。
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#375
No description provided.