Files
mtgodot-poc/tools/server/ring-warp/install.sh
T
shenleiandClaude Opus 5.5 f345bd5d3b Ring 70058: usable from level 1, tooltip says unlimited and no cooldown
The item_proto limit (LEVEL 30) kept new characters from using the warp
ring. ring-warp/install.sh now clears it in share/conf/item_proto.txt and
the player.item_proto mirror. The client proto gets the same limit through
a new item_limits_server.tsv fed to locale_proto_patch, and the zh
itemdesc overlay replaces the "50 uses" text.

Verified on 203: a fresh level-1 character opened the warp menu four times
in a row (one real warp in between), ring still in the bag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-30 20:59:21 +09:00

45 lines
2.3 KiB
Bash
Executable File

#!/bin/sh
# Installs the unlimited 移动戒指 (README.md): run on the server from this directory, then restart db + game.
# Replaces quest ring_warp with ./ring_warp.quest (GBK), recompiles all quests with make.py, and names
# item 70058 移动戒指 on the server (item_names.txt and item_proto.locale_name; the client has its own name), and
# drops its level 30 limit in item_proto.txt (CHARACTER::CanUseItem refuses it to lower characters).
set -eu
SERVER=${SERVER:-/usr/metin2/server}
LOCALE=${LOCALE:-newcibn}
QUEST="$SERVER/share/locale/$LOCALE/quest"
NAMES="$SERVER/share/conf/item_names.txt"
PROTO="$SERVER/share/conf/item_proto.txt"
HERE=$(cd "$(dirname "$0")" && pwd)
BACKUP=/root/backup-ringwarp/$(date +%Y%m%d-%H%M%S)
export LC_ALL=C
mkdir -p "$BACKUP"
cp -p "$QUEST/ring_warp.quest" "$NAMES" "$PROTO" "$BACKUP/"
echo "backup: $BACKUP"
# A GBK trail byte 0x5C would be a backslash to qc.
iconv -f UTF-8 -t GBK "$HERE/ring_warp.quest" > "$BACKUP/ring_warp.gbk"
if grep -q '\\' "$BACKUP/ring_warp.gbk"; then echo "ring_warp.quest: backslash byte in GBK" >&2; exit 1; fi
cat "$BACKUP/ring_warp.gbk" > "$QUEST/ring_warp.quest"
name=$(printf '移动戒指' | iconv -f UTF-8 -t GB2312)
awk -F'\t' -v OFS='\t' -v name="$name" '$1 == 70058 { $2 = name; n++ } { print }
END { if (n != 1) { print "item_names.txt: 70058 not found" > "/dev/stderr"; exit 1 } }' \
"$NAMES" > "$BACKUP/item_names.new"
cat "$BACKUP/item_names.new" > "$NAMES"
mysql -uroot player -e "UPDATE item_proto SET locale_name = '$name' WHERE vnum = 70058"
# LIMIT_TYPE0 / LIMIT_VALUE0 (columns 15, 16): LEVEL 30 -> none. The db process loads item_proto.txt at boot
# and mirrors it into the item_proto table.
awk -F'\t' -v OFS='\t' '$1 == 70058 { if ($15 == "LEVEL") { $15 = "LIMIT_NONE"; $16 = 0 }; n++ } { print }
END { if (n != 1) { print "item_proto.txt: 70058 not found" > "/dev/stderr"; exit 1 } }' \
"$PROTO" > "$BACKUP/item_proto.new"
cat "$BACKUP/item_proto.new" > "$PROTO"
mysql -uroot player -e "UPDATE item_proto SET limittype0 = 0, limitvalue0 = 0 WHERE vnum = 70058 AND limittype0 = 1"
# make.py's shebang (/usr/local/bin/python) does not exist on 203.
cd "$QUEST" && /usr/local/bin/python2.7 make.py > "$BACKUP/make.log" 2>&1 || { tail "$BACKUP/make.log" >&2; exit 1; }
ls "$QUEST/object/10031/sig_use"
echo "done; restart db and game"