Files
mtgodot-poc/tools/server/npc-shops/README.md
T
shenleiandClaude Opus 5.5 42e4cf1a9f server: unlimited teleport ring 70058, sold in a two-page item mall
ring-warp/: ring_warp.quest without use count or cooldown (the ring is never
used up) + install.sh (GBK, make.py, item name 移动戒指).
npc-shops: [page] lines in items.tsv make an extended shop written to
shop_table_ex.txt; item-mall is now 增益 (29) + 道具 (12, incl. 70058 at 1 gold).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 08:18:56 +09:00

95 lines
5.4 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.
# NPC 商店(203 服务端)
在三个村(a1 / b1 / c1)放按金币卖东西的 NPC 商店。每个商店一个目录:
- `shop.conf`:商店 vnum、名称、NPC vnum、每个村的 NPC 位置(`VILLAGES`,一行一个「地图 x y 朝向」),
可选的 `NPC_NAME`(NPC 头顶显示的名字,UTF-8)。
- `items.tsv`:vnum、数量、价格、名称,一行一件。最多 40 件(`SHOP_HOST_ITEM_MAX_NUM`,5×8 格)。
客户端按 vnum 从小到大排列。
- 多页商店:`items.tsv` 里的 `[页名]` 行开始新的一页(最多 3 页,每页最多 39 件,按文件顺序摆放),
`shop.conf` 的 `TAB_VNUMS` 给第 2、3 页的商店 vnum。这种商店不走 DB 的 `shop` / `shop_item`,
而是写进 `share/locale/newcibn/shop_table_ex.txt`(game 的 `CShopManager::ReadShopTableEx`,价格就在文件里);
同一个 NPC 不能同时有 DB 商店,所以 install.sh 会删掉 DB 里对应的行。目前这个文件只归 `item-mall` 用。
| 目录 | 商店 | NPC | 位置 |
|---|---|---|---|
| `item-mall/` | 14 / 16 `item_mall`(两页:增益、道具) | 9010 百店老板娘 | 杂货店 9003 旁 |
| `mount/` | 15 `mount` | 20368 坐骑商人(原「铁算盘」,未使用的货郎模型) | 马夫 20349 旁 |
`install.sh` 对一个商店做这些事:
- 在 item_proto 的 `gold` 列写售价(`item_proto.txt` 第 10 列 / DB `item_proto.gold`)。
- 把 NPC 在 mob_proto 里的 `on_click` 设为 1(ON_CLICK_SHOP,见 game `trigger.cpp`)。只有这个值会打开商店;
9010 原来是 2,点击后没有反应。
- 写 `shop` / `shop_item` 表。
- 如果给了 `NPC_NAME`,就把名字写进 `mob_names.txt`(转成 GB2312)。
- 如果某个村还没有这个 NPC,就在该村的 `npc.txt` 里加上。
## 商城(item-mall)
系统菜单里的「商城」按钮发 `/in_game_mall`,服务端回 `mall <url>`。203 没有网页商城,所以把商城物品放进 9010 的商店。
客户端的 PORT 模块 `mt_mallhint` 会把这个按钮改成提示玩家去找百店老板娘。`item_mall.quest` 只在测试服下给 9010
加对话选项,正式服不受影响。这些物品的 `shop_buy_price` 是 0,卖回给 NPC 拿不到钱。
| 物品 | 价格(金币) |
|---|---|
| 红龙 / 蓝龙的祝福(全部 8 种) | 1 |
| 经验戒指、小偷的手套、幸运金币 30 分 / 3 小时 / 10 小时 | 5 万 / 25 万 / 70 万 |
| 丝绸包囊 30 分 / 3 小时 / 10 小时 | 3 万 / 15 万 / 40 万 |
| 第三只手、兵法六统 15 分 / 30 分 / 3 小时 | 2 万 / 4 万 / 20 万 |
| 仓库扩张卷 15 分 / 30 分 / 3 小时 | 1 万 / 2 万 / 10 万 |
| 龙神的攻击 / 防御 / 生命 / 智力 | 各 10 万 |
| 双倍伤害丸、无视防御丸 | 各 15 万 |
| 经验药水、夺宝手套 | 各 20 万 |
| 物品属性转换秘籍 | 50 万 |
| 移动戒指(不限次数、无冷却,见 `../ring-warp`) | 1 |
| 追加物品属性秘籍、龙神的祝福书 | 各 100 万 |
## 坐骑(mount)
坐骑券都由 ride 系列 quest 处理(`pc.mount`)。骑乘时长 = 物品 socket 2 × 60 秒,道具创建时由 value0 填入。
| 物品 | 骑乘时长 | 价格(金币) |
|---|---|---|
| 野猪 / 狼 / 虎 / 狮坐骑券(黄),75–85 级,用后消失 | 5 小时 | 5 万 / 8 万 / 10 万 / 15 万 |
| 野猪 / 狼 / 虎 / 狮坐骑券(蓝),75–85 级,可反复使用 | 每次 24 小时 | 200 万 / 300 万 / 400 万 / 500 万 |
| 万圣黑马、彗星驯鹿、战甲白熊、战甲熊猫、白独角兽、梦魇 | 3 小时 | 各 3 万 |
| 白狮坐骑券 | 40 小时 | 30 万 |
| 黑马召唤券 | 180 / 360 / 720 / 1440 小时 | 50 万 / 90 万 / 160 万 / 300 万 |
| 战野猪 / 战狼 / 风暴虎 / 战狮坐骑券(20 级) | 480 小时 | 各 150 万 |
| 皇虎召唤券(蓝 / 红 / 金 / 绿 / 灰 / 白) | 480 小时 | 各 150 万 |
| 勇猛狼 / 狮 / 虎 / 驯鹿(公、母)/ 石龙子召唤牌,攻击 +100 | 1 年;召唤牌本身 7 天后消失 | 各 500 万 |
定价思路:短时券便宜,方便试骑;按小时算,长时券更划算;蓝券可以反复使用,所以定价约为黄券的 40 倍;
带属性加成的勇猛召唤牌最贵。
## 安装
```sh
scp -r tools/server/npc-shops root@<server>:/root/
ssh root@<server> 'cd /root/npc-shops && sh install.sh item-mall && sh install.sh mount'
ssh root@<server> 'cd /usr/metin2/server && sh close.sh; sleep 8; echo 1 | sh start.sh'
```
db 只在启动时读取 item_proto、mob_proto 和商店表,game 只在启动时读取 npc.txt 和 mob_names.txt,所以装完必须重启。
脚本可以重复运行:价格、名字和商店每次都按目录内容重写;已经放了这个 NPC 的村不会再加一个。
改价格就编辑 `items.tsv`,然后重新安装。
## 回滚
每次运行都会备份到 `/root/backup-npcshop/<商店名>-<时间>/`:
```sh
B=/root/backup-npcshop/<商店名>-<时间>
cp $B/item_proto.txt $B/mob_proto.txt $B/mob_names.txt /usr/metin2/server/share/conf/
for m in metin2_map_a1 metin2_map_b1 metin2_map_c1; do
cp $B/$m.npc.txt /usr/metin2/server/share/locale/newcibn/map/$m/npc.txt
done
mysql -uroot player < $B/player-shop.sql
```
回滚后同样要重启。第一次改动之前的状态:
- 商城:`/root/backup-itemmall/20260929-162714`。这份还没备份 mob_proto;9010 原来的 on_click 是 2。
- 坐骑:`/root/backup-npcshop/mount-20260929-172630`。更早的 mount 备份里还没有 mob_names.txt;20368 原名是 Peddler。