Files
mtgodot-poc/tools/server/support-skills/install.sh
T
shenleiandClaude Opus 5.5 f8bbfc7fb3 server: support skills at max level on a character's first login
support_skills_max.quest sets 121/122/124/126-129/131 to their skill_proto
max, the horse to level 30 (skill 130) and the horse skills 137-139 (140 for
assassins), once per character. install.sh adds it to locale_list and
pc.set_skill_level to quest_functions (qc rejects it otherwise), then make.py.

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

36 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
# Installs quest support_skills_max (README.md): run on the server from this directory, then restart game.
# Adds the quest (GBK) to the locale's quest directory and locale_list, pc.set_skill_level to quest_functions,
# and recompiles all quests.
set -eu
SERVER=${SERVER:-/usr/metin2/server}
LOCALE=${LOCALE:-newcibn}
QUEST="$SERVER/share/locale/$LOCALE/quest"
HERE=$(cd "$(dirname "$0")" && pwd)
BACKUP=/root/backup-support-skills/$(date +%Y%m%d-%H%M%S)
export LC_ALL=C
mkdir -p "$BACKUP"
cp -p "$QUEST/locale_list" "$QUEST/quest_functions" "$BACKUP/"
echo "backup: $BACKUP"
iconv -f UTF-8 -t GBK "$HERE/support_skills_max.quest" > "$BACKUP/support_skills_max.gbk"
# A GBK trail byte 0x5C would be a backslash to qc.
if grep -q '\\' "$BACKUP/support_skills_max.gbk"; then echo "backslash byte in GBK" >&2; exit 1; fi
cat "$BACKUP/support_skills_max.gbk" > "$QUEST/support_skills_max.quest"
# qc only accepts functions listed in quest_functions; game registers pc.set_skill_level (questlua_pc.cpp)
# but the list does not have it.
grep -qx pc.set_skill_level "$QUEST/quest_functions" || echo pc.set_skill_level >> "$QUEST/quest_functions"
# make.py strips only the LF of a locale_list line (203's has no newline after the last line).
sed -i '' '/^support_skills_max\.quest/d' "$QUEST/locale_list"
[ -z "$(tail -c 1 "$QUEST/locale_list")" ] || echo >> "$QUEST/locale_list"
echo support_skills_max.quest >> "$QUEST/locale_list"
# 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 object/notarget/login 2>/dev/null | grep support_skills_max || ls -R object | grep support_skills_max
echo "done; restart game"