Commit Graph

6 Commits

Author SHA1 Message Date
troytt c09e237ff8 fix(drop): unify monster and inventory ground drops on 16x8 sub-tile lattice with bilingual metadata parity
1. Sub-Tile Scatter Spacing (D2Common.dll COLLISION_GetFreeCoordinatesImpl 0x6FD9D140):
   - Unify GameEngine.triggerMonsterDrop, GameEngine.dropItem, GameEngine.dropGold,
     and net-scene monster drops on findIsometricDropPosition (16x8 sub-tile diamond
     lattice, 16px orthogonal / 8px vertical spacing) instead of 80x40px macro cells.
   - Derive GroundItemEntity (cellX, cellY) from final scattered (finalX, finalY)
     via worldToCell rather than overwriting with stale origin cell coordinates.

2. Monster vs. Inventory Drop Metadata & Bilingual Name Parity:
   - Add formatBilingualGroundItemName in src/game/ground-items.ts using
     translateItemName / translateMagicName / translateRareName so raw monster-dropped
     Item objects receive identical '中文名 (English Name)' nameZh as UiInventoryItem.
   - Detect runes via isRuneCode in resolveItemQualityString so monster-dropped runes
     render with #ff9c18 orange labels matching inventory-dropped runes.
   - Preserve flippyFile, dropSound, and dropSfxFrame in itemToUiInventoryItem, fix
     socket count resolution so unsocketed items do not inherit base.gemsockets, and
     add embedded drop table fallback in resolveGroundItemMetadata.

3. Anti-Stacking for Sequential Player Inventory/Body Drops:
   - Simplify act-scene onDropItemToGround / onDropGoldToGround to delegate directly
     to engine.dropItem / engine.dropGold at (player.x, player.y) so every dropped
     item checks engine.groundItems.all and scatters to a unique sub-tile slot.

Fixes #479
2026-09-26 04:51:32 +00:00
troytt 92966abdee feat(skills): complete 1.13c D2MOO parity for Assassin and Universal skills (#154-#374) 2026-09-25 22:13:38 +00:00
troytt e3ca14c357 refactor(lockstep): 按项目规范彻底移除 any 约束逃逸并优化哈希分配性能 (refs #7)
此提交响应了进一步集成的代码质量与内存性能审查反馈:
1. 深入清理代码库类型系统边界,利用 Structural Target Interfaces 为所有传递进哈希运算中的世界和对象提供原生支持而不用 `any`,并修复由于引入 #10 放宽的 engine.ts 的 syncEngineState 缺失的 `EngineViewState` 严谨签名;
2. 提升了数据解析健壮性:在 save.ts 中增加严格的运行时验证(利用 Type Guard: `asserts value is GameSnapshot`),取消一切断言强转;
3. 取消了计算锁步哈希期间对背包和掉落物品的数组分配与运行时排序(重构为支持 Order-Independent Combination 的无排序位偏移计算模式),确保 25Hz 打包同步路径中零内存无端分配;
4. 并修正了 net-scene 等多个测试的静态数据映射与严格的突变检测。
2026-09-14 13:05:18 +00:00
troytt 45b6a2caa7 feat(lockstep): 接入实际组件状态哈希并修复场景验证死区 (refs #7)
替换了 net-scene 中的闭包测试用 digestWorld 状态逻辑,通过真实注入的 inventories, quests, groundLoot 清单确保联机场景具备全覆盖的一致性锁步哈希验证。增加了 integration 测实验证 pickup 产生的完整分歧,确保从引擎层面而非独立计算侧暴露漏洞。
2026-09-14 12:55:16 +00:00
troytt a80ee2cafc fix(render): 修复 SpriteRenderer 显存泄漏与补充 WebGL 上下文保护 (fixes #9)
- 优化 createProgram:Shader 链接后立即 detach 并 deleteShader,链接失败自动清理 Program
- 新增 deleteAtlas:支持释放指定 GPU 纹理显存,并在活跃批次解绑时安全 flush
- 新增 dispose 与 isDisposed:释放全部托管纹理、VAO、VBO、Program 与事件监听,支持幂等和 context-lost 防御
- 补充 WebGL context lost/restored 监听与自动恢复提示
- act-scene/map-scene/net-scene/walk 接入生命周期管理与 beforeunload 资源释放
- 新增 verify:renderer 单元生命周期验证套件 (26 项断言全部通过)
2026-09-14 07:54:51 +00:00
troytt 897b3735d6 初始提交:从零实现的暗黑破坏神 II WebGL2 引擎(TypeScript + Vite,零运行时依赖)
内容概览
- 归档层:MPQ v1 容器(hash/block 表、Storm 加密、分扇区编解码),含 PKWARE
  implode/explode 移植;支持 HTTP Range 只读取所需字节。
- 格式层:dc6 / ds1 / dt1 / pal / pl2 / cel / pcx / tbl / sprite,以及 dcc / cof / bitstream。
- 地图层:等距投影场景构建(地板/墙/屋顶分层、逐格瓦片变体加权随机、sub-tile 碰撞),
  资源包(索引色 PNG 图集 + scene.json)离线烘焙与逐像素差分校验。
- 角色层:DCC + COF 合成(8 方向),法师行走/站立替换占位棋子。
- 页面:acts.html 全屏画布 + 三级选择器(章节 / 场景 / 细分场景),资源包优先、
  可回退到直读归档(?live=1)。
- 验证脚本:verify:all / implode / acts / d2 / packs / dcc / deploy / listfile /
  object-lookup / alignment / tiles / generators 等,均带断言与退出码。

数据与许可
- 游戏数据(samples/)与第三方参考源码(reference/)不入库:体积大且无再分发许可,
  见 THIRD_PARTY_NOTICES.md。
- 生成关卡(70 迷宫 + 31 野外)尚未烘焙,现状与修复清单见 HANDOVER.md §4f。
2026-09-13 18:10:28 +08:00