Server (tools/server/hunt-set, deployed on 203): game patch adds quest function item.set_attribute (CItem::SetForceAttribute); quest hunt_set turns the unused ITEM_QUEST 50307 into a per-class box of eight +9 pieces with five max-value attributes each. Item mall sells it for 2,000,000. Client locale: name overlay plus whole-row overlays for item_list.txt (gift-box icon) and itemdesc.txt (build_zh_locale.py ROW_FILES). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
48 lines
2.4 KiB
Bash
48 lines
2.4 KiB
Bash
#!/bin/sh
|
|
# Installs quest hunt_set, the 小狩猎套装礼包 50307 (README.md): run on the server from this directory after
|
|
# game is built with server.patch, then restart db + game. Adds the quest (GBK) to the locale's quest directory
|
|
# and locale_list, the functions it calls to quest_functions, names item 50307 on the server (item_names.txt
|
|
# and item_proto.locale_name; the client has its own name), and recompiles all quests.
|
|
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-hunt-set/$(date +%Y%m%d-%H%M%S)
|
|
export LC_ALL=C
|
|
|
|
mkdir -p "$BACKUP"
|
|
cp -p "$QUEST/locale_list" "$QUEST/quest_functions" "$NAMES" "$BACKUP/"
|
|
echo "backup: $BACKUP"
|
|
|
|
iconv -f UTF-8 -t GBK "$HERE/hunt_set.quest" > "$BACKUP/hunt_set.gbk"
|
|
# A GBK trail byte 0x5C would be a backslash to qc.
|
|
if grep -q '\\' "$BACKUP/hunt_set.gbk"; then echo "hunt_set.quest: backslash byte in GBK" >&2; exit 1; fi
|
|
cat "$BACKUP/hunt_set.gbk" > "$QUEST/hunt_set.quest"
|
|
|
|
# qc only accepts functions listed in quest_functions: item.set_attribute is new (server.patch), game has the
|
|
# other two (questlua_pc.cpp) but the list does not.
|
|
[ -z "$(tail -c 1 "$QUEST/quest_functions")" ] || echo >> "$QUEST/quest_functions"
|
|
for f in item.set_attribute pc.get_empty_inventory_count pc.count_item; do
|
|
grep -qx "$f" "$QUEST/quest_functions" || echo "$f" >> "$QUEST/quest_functions"
|
|
done
|
|
|
|
# make.py strips only the LF of a locale_list line (203's has no newline after the last line).
|
|
sed -i '' '/^hunt_set\.quest/d' "$QUEST/locale_list"
|
|
[ -z "$(tail -c 1 "$QUEST/locale_list")" ] || echo >> "$QUEST/locale_list"
|
|
echo hunt_set.quest >> "$QUEST/locale_list"
|
|
|
|
name=$(printf '小狩猎套装礼包' | iconv -f UTF-8 -t GB2312)
|
|
awk -F'\t' -v OFS='\t' -v name="$name" '$1 == 50307 { $2 = name; n++ } { print }
|
|
END { if (n != 1) { print "item_names.txt: 50307 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 = 50307"
|
|
|
|
# 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/50307/use
|
|
echo "done; restart db and game"
|