#!/bin/sh
# Level cap 120 on the sbtest cluster (../sbtest/README.md): unsigned exp columns in player_sb and
# MAX_LEVEL 120 in channel5's CONFIG (CONFIG.livedb stays at 105, so rollback.sh brings back 105).
# The game binary must already carry the new exp table (constants.cpp).
# Usage (on the server): sh install_sbtest.sh
set -eu
STAGE=$(cd "$1" && pwd)
C5=/usr/metin2/server/channel5/first
grep -q '^DB_PORT: 15040' $C5/CONFIG || { echo "channel5 is not on the sbtest db" >&2; exit 1; }
mysql -uroot player_sb < $STAGE/exp_unsigned.sql
mysql -uroot -N -e "select table_name,column_type from information_schema.columns where table_schema='player_sb' and column_name='exp' and table_name like 'player%'"
sed -i '' 's/^MAX_LEVEL: .*/MAX_LEVEL: 120/' $C5/CONFIG
grep '^MAX_LEVEL' $C5/CONFIG