Files
mtgodot-poc/tools/server/inventory-5-pages/README.md
T
shenleiandClaude Opus 5.5 e33e41c12b 背包扩展到 5 页:服务端补丁 + DB 迁移 + 客户端 mt_inventory
- GameType.h: c_Inventory_Page_Count 2 -> 5; SQuickSlot.Position BYTE -> WORD
- quickslot 包/接口 pos 改为 WORD(CG/GC 5 字节),wire_classic 同步
- mt_inventory PORT 模块:inventorywindow.py 装备格 90 -> EQUIPMENT_SLOT_START 重映射、5 个小页签、
  自动药水高亮与 SelectItemWindow 扫描全部 5 页;40250 脚本保持不变
- tools/server/inventory-5-pages: server.patch(格子布局 +135、quickslot WORD)、migrate_db.py、README

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 22:37:44 +09:00

40 lines
2.2 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.
# 背包 5 页(服务端)
40250 背包是 2 页 × 45 格(`INVENTORY_MAX_NUM = 90`)。本补丁改为 5 页 225 格,客户端对应改动见
`src/port/UserInterface/GameType.h`(`c_Inventory_Page_Count`)和 `src/platform/ScriptLib/InventoryPagesScript.inc`。
## 格子布局
| 区段 | 40250 | 5 页 |
| --- | --- | --- |
| 背包 | 0..89 | 0..224 |
| 穿戴(32) | 90..121 | 225..256 |
| 龙魂装备(12) | 122..133 | 257..268 |
| 龙魂预留(18) | 134..151 | 269..286 |
| 腰带背包(16) | 152..167 | 287..302 |
背包之后的格子整体 +135,超过 255,所以 `TQuickslot.pos` 从 BYTE 改成 WORD(快捷栏封包变成 5 字节,
`player.quickslot` 从 72 字节变成 108 字节)。**旧客户端不兼容**,必须和新客户端一起上线。
## 文件
- `server.patch`:对 40250 `src/server` 的改动(`common/length.h`、`common/tables.h`、`game/src` 里把格子号存成 BYTE 的地方、
`exchange.cpp` 的每页空间检查)。在 `/usr/metin2/src` 下 `patch -p1 < server.patch`。源码是 EUC-KR + CRLF,补丁按字节保存。
- `migrate_db.py`:DB 迁移,停服后运行一次(`python3.9 migrate_db.py [--dry-run] [mysql 参数]`,默认 `-uroot player`)。
腰带物品(`window='INVENTORY'` 且 `pos` 152..167)+135;`player`/`player_deleted` 的 `quickslot` 转成 WORD 布局,
指向腰带格的物品快捷栏同样 +135。结果记入 `mt_migration` 表,重复运行不会再改。穿戴/龙魂装备按 EQUIPMENT 窗口的相对位置存,不受影响。
## 构建与部署(203,FreeBSD 13.2 i386)
Makefile 默认把二进制移到 `share/bin`(线上正在用),构建时要改输出目录:
```sh
cd /usr/metin2/src/server/game/src && gmake -j2 GAMEDIR=/root/inv5-out/new
cd ../../db/src && gmake -j2 DBDIR=/root/inv5-out/new
```
部署顺序:`close.sh` → 备份 `player` 库 → `migrate_db.py` → 覆盖 `share/bin/{game,db}` → `echo 1 | sh start.sh`。
auth 用的也是 `game` 二进制;`TPlayerTable` 含快捷栏数组,所以 game 和 db 必须一起换。
2026-09-29 已在 203 部署。备份在 `/root/backup-inv5/`(源码 tgz、原 game/db、迁移前的 player 库)。回滚:停服,恢复这三样。