From 3fcb27dd4ddbf1743624fad2edf2e6f0647f6c1f Mon Sep 17 00:00:00 2001 From: shenlei Date: Wed, 30 Sep 2026 11:01:36 +0900 Subject: [PATCH] Server: hunt set once per character, rebuild.sh for patch build/deploy/rollback Co-Authored-By: Claude Opus 5.5 --- data/zh_40250/itemdesc_zh_overlay.txt | 2 +- tools/server/README.md | 16 +++++ tools/server/hunt-set/README.md | 14 ++-- tools/server/hunt-set/hunt_set.quest | 8 ++- tools/server/rebuild.sh | 96 +++++++++++++++++++++++++++ 5 files changed, 124 insertions(+), 12 deletions(-) create mode 100644 tools/server/rebuild.sh diff --git a/data/zh_40250/itemdesc_zh_overlay.txt b/data/zh_40250/itemdesc_zh_overlay.txt index 5b45d89c..71d656fb 100644 --- a/data/zh_40250/itemdesc_zh_overlay.txt +++ b/data/zh_40250/itemdesc_zh_overlay.txt @@ -1,2 +1,2 @@ # vnum name description: whole itemdesc.txt rows (build_zh_locale.py ROW_FILES) -50307 小狩猎套装礼包 打开后按职业获得一套1级+9装备:武器、盔甲、头盔、盾牌、手镯、鞋子、项链、耳环,每件5条满值属性。需留15格背包空位。 +50307 小狩猎套装礼包 打开后按职业获得一套1级+9装备:武器、盔甲、头盔、盾牌、手镯、鞋子、项链、耳环,每件5条满值属性。需留15格背包空位,每个角色限开一次。 diff --git a/tools/server/README.md b/tools/server/README.md index 7b8ea5c2..97a37c6e 100644 --- a/tools/server/README.md +++ b/tools/server/README.md @@ -94,3 +94,19 @@ NPC safebox checkin/checkout/move、mall checkout、Cube open/add/delete/make。 - `service.h` 默认定义 `_IMPROVED_PACKET_ENCRYPTION_`;classic 客户端必须走 DH2 + CTR,不能用“明文配置项”绕过。若专门做明文诊断,必须复制源码、重新 编译 game,并把它视为与 shipped server 不同的测试构建。 + +## 203 上的补丁构建、部署与回滚(rebuild.sh) + +203 的 game/db 在 40250 源码上打了两个补丁(`inventory-5-pages`、`hunt-set`,按此顺序)。把整个 +`tools/server` 复制到服务器(如 `/root/mt-tools`)后: + +```sh +sh rebuild.sh check # 每个补丁:applied / missing / conflict +sh rebuild.sh build # 补上缺的补丁,编译 game + db 到 /root/rebuild/<时间>(不动线上) +sh rebuild.sh deploy <目录> # 停服、备份 share/bin/{game,db} 到 /root/backup-bin/<时间>、替换、开服 +sh rebuild.sh rollback <备份目录> # 停服、放回备份、开服 +sh rebuild.sh data # 重跑数据安装(传送戒指、辅助技能、狩猎礼包、商城/坐骑商店),重启 +``` + +换服务器时:先按上文准备 40250 源码与数据库,做一次 `inventory-5-pages/README.md` 的数据库迁移, +再 `build` → `deploy` → `data`。2026-09-30 在 203 实测 check/build/deploy。 diff --git a/tools/server/hunt-set/README.md b/tools/server/hunt-set/README.md index d2c4d23a..2a5d4672 100644 --- a/tools/server/hunt-set/README.md +++ b/tools/server/hunt-set/README.md @@ -24,7 +24,8 @@ | 耳环 | 移速 20%、掉宝 20%、对兽人/秘教/不死 各 20% | 属性都是 `item_attr` 表里该部位允许的类型、5 级的值。背包空格(`CountEmptyInventory`,按格数算)少于 15 -时不打开;确认前可以取消,礼包不消耗。 +时不打开;确认前可以取消,礼包不消耗。每个角色只能打开一次(任务标记 `hunt_set.opened`), +再用礼包只提示、不扣除。 ## 文件 @@ -41,16 +42,9 @@ ## 构建与部署 -```sh -cd /usr/metin2/src && patch -p1 < server.patch -cd server/game/src && gmake -j2 GAMEDIR=/root/hunt-out/new # 不覆盖线上 share/bin/game -cd /usr/metin2/server && sh close.sh -cp share/bin/game <备份>; cp /root/hunt-out/new/game share/bin/game -sh install.sh # 本目录 -sh ../npc-shops/install.sh ../npc-shops/item-mall -echo 1 | sh start.sh -``` +用 `../rebuild.sh`:`build`(打补丁并编译)→ `deploy <目录>` → `data`(含本目录 install.sh 和商城商店)。 2026-09-30 已在 203 部署。备份在 `/root/backup-hunt-set/`:`questlua_item.cpp.orig`、`bin-<时间>/game` (旧二进制)、`<时间>/`(locale_list、quest_functions、item_names.txt)。用 GM 角色(武士)实测:礼包打开后 8 件装备属性与上表一致,重新登录后仍在,礼包已扣除;从百店老板娘处以 0 两买到礼包,金钱不变。 +限次改动(2026-09-30):同一角色第二次使用礼包不弹对话框,礼包保留。 diff --git a/tools/server/hunt-set/hunt_set.quest b/tools/server/hunt-set/hunt_set.quest index ba5a220f..13a809f5 100644 --- a/tools/server/hunt-set/hunt_set.quest +++ b/tools/server/hunt-set/hunt_set.quest @@ -28,6 +28,11 @@ quest hunt_set begin local STEAL_HP, REFLECT_MELEE, EXP, GOLD, DROP = 23, 39, 43, 44, 45 local IMMUNE_STUN, IMMUNE_SLOW, ATT_GRADE = 48, 49, 53 + -- One set per character (quest flag hunt_set.opened); the box stays in the bag. + if pc.getqf("opened") == 1 then + syschat("每个角色只能打开一次小狩猎套装礼包。") + return + end if pc.get_empty_inventory_count() < 15 then syschat("背包空位不足,请至少留出15格再打开礼包。") return @@ -60,7 +65,7 @@ quest hunt_set begin return end -- The dialog waited; check again that the box is still there and the bag has room. - if pc.count_item(50307) < 1 or pc.get_empty_inventory_count() < 15 then + if pc.getqf("opened") == 1 or pc.count_item(50307) < 1 or pc.get_empty_inventory_count() < 15 then syschat("背包空位不足,请至少留出15格再打开礼包。") return end @@ -70,6 +75,7 @@ quest hunt_set begin local helmets = { 12209, 12349, 12489, 12629 } local main, armor, helmet = mains[job + 1], armors[job + 1], helmets[job + 1] + pc.setqf("opened", 1) pc.remove_item(50307, 1) hunt_set.give(weapon, { { CRITICAL, 10 }, { PENETRATE, 10 }, { main, 12 }, { DEVIL, 20 }, { UNDEAD, 20 } }) hunt_set.give(armor, { { MAX_HP, 2000 }, { STEAL_HP, 10 }, { ATT_GRADE, 50 }, { REFLECT_MELEE, 10 }, { CAST_SPEED, 20 } }) diff --git a/tools/server/rebuild.sh b/tools/server/rebuild.sh new file mode 100644 index 00000000..8b3165be --- /dev/null +++ b/tools/server/rebuild.sh @@ -0,0 +1,96 @@ +#!/bin/sh +# Rebuilds the 203 game/db from the 40250 source with our server patches, deploys it, or rolls it back. +# Run on the server from tools/server (all of tools/server copied there): +# +# sh rebuild.sh check which patches the source has +# sh rebuild.sh build apply missing patches, build game + db into /root/rebuild/