Files
mtgodot-poc/tools/server/ring-warp/install.sh
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

35 lines
1.6 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).
set -eu
SERVER=${SERVER:-/usr/metin2/server}
LOCALE=${LOCALE:-newcibn}
QUEST="$SERVER/share/locale/$LOCALE/quest"
NAMES="$SERVER/share/conf/item_names.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" "$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"
# 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"