#########################
#    Common settings    #
#########################

# Game Type (JS, DJ, FN, GD, LH, FF, DS, AR, M2, LA, N1, H2, ...)
GAME_TYPE="H2"

# Country Code(ISO 3166-1, UPPER CASE)for example: "TW"
COUNTRY_CODE_DISPLAY="EROLABS"
COUNTRY_CODE="EROLABS"

# Mobile Game or not
MOBILE="1"

# Unity Engine or not
UNITY="0"

# SDK App Key
SDK_APP_KEY="100221"

# HTTPAgent URL
XLURL="xhg-api.himefun.com/api/m_api.php"

# Language number
LANGUAGE="X"

# Hostname for this machine(This will automatically change on every server)
HOST_NAME="TEST"

# Servers working directory(DO NOT CHANGE)
WORKING_DIRECTORY="$HOME"

# The username to login the live servers
LOGINUSER="$USER"

# The username to login the test servers
TEST_SERVER_LOGINUSER="$USER"

# NTP time server
NTP_SERVER="time1.google.com"

# NTP check
NTP_CHECK="0"

# Web root directory
WEB_ROOT_DIRECTORY="$HOME/www/"

# Webtool root directory
WEBTOOL_ROOT_DIRECTORY="$WEB_ROOT_DIRECTORY/webtool_goauth2/"

# Do not ask y/n on these command:
DONT_ASK_YES_NO="LIVEStatus IP start stop LogRotate Build CheckAlive Channels GMList LIVEBackup GMCmds GMToolCmds DiskSpace WZTraffic status Build BuildIfNotExist DBConnCheck APEXLogPack dbbackup item2db GCPFW"

# Database name
ACCOUNT_DB_NAME="${GAME_TYPE}Account"
MEMBER_DB_NAME="${GAME_TYPE}Member"
GAME_DB_NAME="${GAME_TYPE}DB"
GLOBAL_DB_NAME="${GAME_TYPE}Global"
SOCIETY_DB_NAME="${GAME_TYPE}Society"
WORLD_DB_NAME="${GAME_TYPE}World"

# Channel name prefix
CHANNEL_PREFIX="Ch"

# Channel name suffix
CHANNEL_SUFFIX=""

# Country Code (lower case)
COUNTRY_CODE_LOWER="`tr '[:upper:]' '[:lower:]' <<< $COUNTRY_CODE`"

# Game Type (lower case)
GAME_TYPE_LOWER="`tr '[:upper:]' '[:lower:]' <<< $GAME_TYPE`"

# Patch variables
REMOTE_PATCH_SERVER="35.229.212.147"
REMOTE_PATCH_DIRS="~/$COUNTRY_CODE"
LOCAL_PATCH_DIR="$WORKING_DIRECTORY/patch"
PATCH_TARGET_SERVER_DIR="$WORKING_DIRECTORY/common"
PATCH_TARGET_CLIENT_DIR="$WEB_ROOT_DIRECTORY/$GAME_TYPE"
PATCH_TARGET_H5_DIR="$WEB_ROOT_DIRECTORY/H5"
CLIENT_PATCH_DIR="$GAME_TYPE"

# Push TEST client patch to CDN(This will run with "TestCtrl patch ...")
TEST_PATCH_CDN_SYNC_CMDLINE=""

# Push LIVE client patch to CDN(This will run with "Ctrl gmsync")
LIVE_PATCH_CDN_SYNC_CMDLINE=""

# Push the translation files to CDN(This will run with "Ctrl synctranslate")
LIVE_TRANSLATE_CDN_SYNC_CMDLINE=""

# Server data common directories
SERVER_DATA_COMMON_DIRECTORIES="bin Data db"

# Core dump backup path
CORE_DUMP_BACKUP_PATH_LIVE="$TEST_SERVER_LOGINUSER@TEST:~/www/core/"
CORE_DUMP_BACKUP_PATH_TEST="$TEST_SERVER_LOGINUSER@TEST:~/www/core/test/"

# Server stop timeout in seconds. If timeout, send SIGTERM instead.
SERVER_STOP_TIMEOUT="20"

# Colors on command line prompt (0=black, 1=red, 2=green, 3=yellow,
# 4=blue, 5=magenta, 6=cyan, 7=white)
SHELL_PROMPT_GAME_TYPE_COLOR="1"
SHELL_PROMPT_COUNTRY_CODE_COLOR="3"

# Max Character Numbers
# You will need to do "Ctrl LIVEBuild noreset nosync" once after change this.
MAX_CHARACTER_NUMBER="5"

# Reserve days after deleting characters
RESERVE_DELETED_CHAR_DAYS="90"

# TicketServer port(If left empty will use default 7777)
TICKETSERVER_PORT=""

# GatewayServer port(If left empty, will use default 5560)
GATEWAYSERVER_PORT=""

# HTTPAgent port(If left empty, will use default 1234)
HTTPAGENT_PORT=""

# AccountDBServer port(If left empty, will use default 7553)
ACCOUNTDBSERVER_PORT=""

# GameAgent port(If left empty, will use default 6969)
GAMEAGENT_PORT=""

# Delete DB backup files that total size excced $MAX_DB_BACKUP_TOTAL_SIZE(in MB)
# This setting will keep old backup files generated every Friday
MAX_DB_BACKUP_TOTAL_SIZE="20000"

# Delete DB backup files that total size excced $MAX_DB_BACKUP_TOTAL_SIZE_HARD_LIMIT(in MB)
MAX_DB_BACKUP_TOTAL_SIZE_HARD_LIMIT="30000"

# DBbackup backup custom format only?
DBBACKUP_BACKUP_CUSTOM_FORMAT_ONLY="1"

# Do not backup custom format
DBBACKUP_DO_NOT_BACKUP_CUSTOM_FORMAT=""

# CGI Key
CGI_KEY="0KjaM85BjfqjA"

# Check PostgreSQL error log with pg_error_log?
POSTGRESQL_ERROR_CHECK_ON_LOGIN="0"

# Use xz instead of gzip for log rotate?
USE_XZ_INSTEAD_OF_GZIP="1"

# Disable setup.ini check between TEST and LIVE
DISABLE_SETUP_INI_CHECK_AFTER_GMSYNC="0"

# Disable S_RootCmds.ini check between TEST and LIVE
DISABLE_SROOTCMD_INI_CHECK_AFTER_GMSYNC="0"

# Enable VersionDef.h check between Prevous and Current Patch
ENABLE_VERSIONDEF_CHECK="0"

# Enable Society
ENABLE_SOCIETY="1"

# Split ID has 3 modes:
# 0 = Disable all
# 1 = Enable all
# 2 = Selection mode for variables ( ENABLE_CROSS_SID_TEST & ENABLE_CROSS_SID_LIVE )
ENABLE_SPLIT_ID="0"

# Node Stream
NODE_STREAM_IDS=""

# Enable Perf Monitor
ENABLE_PERF_MONITOR="0"

# Enable CertServer
ENABLE_CERT_SERVER="0"

# CertServer IP
CertServerIP=""

# Web Socket Proxy Domain
WEB_SOCKET_PROXY_DOMAIN=""

# Web Socket Proxy Allow CIDR Lists
WEB_SOCKET_PROXY_ALLOW_CIDR_LISTS="10.150.15.0"

# HOSTS v.s. Server Related
HOSTS_SERVERS_RELATED="TICKET LOGIN HTTPA ACCTDBS LWEBSPS GDS MS CHATS RANKS WS WHS WWEBSPS"

# HOSTS v.s. DB Related
HOSTS_DBS_RELATED="ACCOUNTDB GAMEDB WORLDDB"

# LIVEStart & LIVEStop Parameters for fast
WAIT_INTERVAL_SEC="20"
WAIT_TIMEOUT_SEC="600"

# MaintenanceDate
MaintenanceDate="3"

###########################
# Cloud Services Settings #
###########################
# Servers has only one network interface
ONLY_ONE_NETWORK_INTERFACE="1"

# GCP Bucket Path
# See the URL https://console.cloud.google.com/storage/browser from YOUR GCP PROJECT
GCP_BUCKET_STORAGE_NAME="xlegend-backup"
GCP_BUCKET_PATH="$GCP_BUCKET_STORAGE_NAME/DBbackup/$GAME_TYPE/$COUNTRY_CODE_DISPLAY/"

# RSYNC Directory in CTRL
GCP_DBBACKUP_DIR="$HOME/DBbackup2GCP"

# DBbackup files reserved days' setting
CTRL_DBBACKUP_CUR_RESERVED_DAYS="7"
CTRL_DBBACKUP_OLD_RESERVED_DAYS="14"

# Google Chat Webhook
#GOOGLE_CHAT_WEBHOOK_URL="https://chat.googleapis.com/v1/spaces/AAAA7hXAOCM/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=YupvEeDhNq2aF9ldCAf8TeJw8kmafVAXpj3xJWIzRGw%3D"
GOOGLE_CHAT_WEBHOOK_URL="https://chat.googleapis.com/v1/spaces/AAQAII1T1Ww/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=TUkJSUAK-Q3O8DgBoT9OzwHUBCZsop0bGNsEL7cSCco"
#GOOGLE_CHAT_WEBHOOK_URL_THREAD="https://chat.googleapis.com/v1/spaces/AAAA7hXAOCM/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=YupvEeDhNq2aF9ldCAf8TeJw8kmafVAXpj3xJWIzRGw%3D&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD"
GOOGLE_CHAT_WEBHOOK_URL_THREAD="https://chat.googleapis.com/v1/spaces/AAQAII1T1Ww/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=TUkJSUAK-Q3O8DgBoT9OzwHUBCZsop0bGNsEL7cSCco&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD"

#GOOGLE_CHAT_WEBHOOK_URL_THREAD_WARNING="https://chat.googleapis.com/v1/spaces/AAQA0HA0yAk/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=QWl-z3ILJy6RKraC7SMk66kPauVGe8z7YSXsIlw1LC4&messageReplyOption=REPLY_MESSAGE_FALLBACK_TO_NEW_THREAD"

GOOGLE_CHAT_WEBHOOK_URL_TEST="https://chat.googleapis.com/v1/spaces/AAAA7hXAOCM/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=YupvEeDhNq2aF9ldCAf8TeJw8kmafVAXpj3xJWIzRGw%3D"

TEST_SERVER_DOMAIN="h2-cb-deb13-test.himefun.com"

#################################
# Server ID generating settings #
#################################
# T = Zone Category Number ( CAT ) 1-30
# Z = Zone Number 0-9
# C = Channel number 01-99
# Order = T -> Z -> C
# S = T + Z
### N1 ##
SERVER_ID_FORMAT="ZCC"
### N1 ##

# Set number of set 1 show on server ID
### N1 ##
SET_NUMBER_SEQUENCE_START_WITH="10"
### N1 ##


#################################
# Promotion file/table settings #
#################################
# Promotion FILE location(Itemmall/Lottery/Fortune Bag/....)
### N1 ##
# 上架表
#ITEMMALL_FILE="Data/itemmall/itemmall"
# 福袋表
#FORTUNE_BAG_FILE="Data/itemmall/fortune_bag"
# 每日簽到表
#CHECK_DAILY_FILE="Data/itemmall/checkdaily"
# 試衣間表
#DRESSROOM_FILE="Data/itemmall/dressroom"
# 煉金表
#LOTTERY_FILE="Data/itemmall/lottery"
# 天井福袋表
#SKY_FORTUNE_BAG_FILE="Data/itemmall/sky_fortune_bag"
# trendnews
#TRENDNEWS_FILE="Data/itemmall/trendnews"
### N1 ###

# What promotion FILES to update to the test server?
### N1 ###
PROMOTION_FILES_APPLY_TO_TEST=""
### N1 ###

# What is the mode to apply promotion data?
# 1 = Database table(on TEST) -->  Database table(on LIVE)
# 2 = File(on TEST)           -->  Database table(on LIVE)
# 3 = File(on LIVE)           -->  Database table(on LIVE)
PROMOTION_DATA_APPLY_TO_LIVE_MODE="1"

# Mode 1: What promotion TABLES will sync from TEST to LIVE?
### N1 ###
PROMOTION_TABLES_APPLY_TO_LIVE="activity_battle_pass activity_battle_pass_group activity_consume activity_consume_daily_mission activity_consume_mission activity_days_mission_store_group activity_days_mission_store_mission activity_days_mission_store_store activity_mission_store_group activity_mission_store_mission activity_mission_store_store activity_rank_event_mission activity_rank_event_reward activity_rank_event_schedule activity_rank_event_store activity_wheel_accumulation activity_wheel_mission activity_wheel_prob activity_wheel_schedule activity_wheel_selection activity_wheel_store fortune_bag itemmall_item store_grocery store_limited store_pack store_stargem store_rank_event1 store_rank_event2 store_guild store_farm activity_mission_battle_pass_group activity_mission_battle_pass_mission activity_mission_battle_pass_reward suggestbuy activity_minigame_classify_reward activity_minigame_wheel_schedule activity_minigame_wheel_prob activity_minigame_wheel_accumulation activity_minigame_wheel_selection activity_minigame_wheel_store activity_minigame_wheel_exchangestore activity_dailylogin_schedule activity_dailylogin_reward activity_dailylogin_store activity_gemwheel_level activity_gemwheel_prob activity_gemwheel_schedule store_pvp activity_minigame_pass_group activity_minigame_pass_reward activity_minigame_pass_accumulation activity_minigame_wheel_mission activity_minigame_pass_rankaward activity_wheel_limitstore activity_rank_event_limitstore activity_minigame_wheel_limitstore store_pvpmedal store_pvpmedalgrocery activity_days_mission_store_stage activity_accruebuy_schedule activity_accruebuy_store store_starsoul activity_bingo_cost activity_bingo_reward activity_bingo_schedule activity_lottery_accumulation activity_lottery_mission activity_lottery_prob activity_lottery_reward activity_lottery_schedule activity_lottery_store store_guildrace activity_specialfortunebag_schedule activity_specialfortunebag_store cheat_detection_rankstage store_weekly_reward activity_mergeparty_wheel_store activity_mergeparty_wheel_selection activity_mergeparty_wheel_prob activity_mergeparty_wheel_accumulation activity_mergeparty_schedule activity_mergeparty_pass_reward activity_mergeparty_pass_group activity_mergeparty_pass_accumulation activity_mergeparty_mission activity_mergeparty_fm_consume activity_mergeparty_dailylogin_reward activity_mergeparty_consume activity_mergeparty_addfriend_reward activity_guild_rank_event_store activity_guild_rank_event_schedule activity_guild_rank_event_reward activity_guild_rank_event_mission store_museum activity_wheel2_store activity_wheel2_selection activity_wheel2_schedule activity_wheel2_prob activity_wheel2_mission activity_wheel2_accumulation activity_donation_total_accumulation activity_donation_schedule activity_donation_mission activity_donation_guild_rank activity_alchemy_wheel_store activity_alchemy_wheel_selection activity_alchemy_wheel_schedule activity_alchemy_wheel_round_reward activity_alchemy_wheel_mission activity_alchemy_wheel"
### N1 ###

# Mode 2/3: What promotion FILES to update to the LIVE server?
PROMOTION_FILES_APPLY_TO_LIVE=""


################################
# Test/Control server settings #
################################
# The password of database on test server
TEST_SERVER_DB_PASSWORD="gZ_I4bt}w#l!o7VxxGSRc6Q"

# Global IP of the TEST server
TEST_SERVER_GLOBAL_IP="131.186.42.157"

# Private IP of the TEST server
TEST_SERVER_PRIVATE_IP="10.150.15.2"

# Global IP of this control server(Deprecated)
CTRL_SERVER_GLOBAL_IP="$TEST_SERVER_GLOBAL_IP"

# Private IP of this control server(Deprecated)
CTRL_SERVER_PRIVATE_IP="$TEST_SERVER_PRIVATE_IP"

# The file name of TEST controller script
TEST_CONTROL_SCRIPT="TestCtrl"

# Client patch backup command line
CLIENT_PATCH_BACKUP_COMMAND_LINE="ibackup backup clientpatch"

# TEST server channels for each set
TEST_SERVER_CHANNELS="3"

# Set every character's privilege on TEST server(apply after patch)
SET_EVERY_CHARACTERS_PRIVILEGE_AFTER_PATCH="0"

# Set every characters privilege level(0~5)
SET_EVERY_CHARACTERS_PRIVILEGE_TO="5"

# CrossRouter Set ID on TEST
CROSS_ROUTER_SID_TEST=""

# Enable Cross Set IDs on TEST
ENABLE_CROSS_SID_TEST=""

# CentralServer Set ID on TEST
CENTRAL_SID_TEST="$CROSS_ROUTER_SID_TEST"


################################
#     LIVE server settings     #
################################
# The password of database on LIVE servers
# This better same as $TEST_SERVER_DB_PASSWORD
LIVE_SERVER_DB_PASSWORD="4nZ}MA!#c>{OIzrZSPahhed"

# The source of 'sync to live' (DO NOT EDIT WITHOUT X-LEGEND)
SOURCE_OF_SYNC_TO_LIVE="TEST"

# World/Zone servers external interface
WZ_EXT_IF="XXX"

# World/Zone servers internal interface
WZ_INT_IF="ens4"

# Servers under NAT or DMZ?
NAT="1"

# URL to get the external IP address(for NAT mode)
URL_TO_GET_NAT_EXT_IP="http://icanhazip.com"

# Do not try to get the external IP from the URL above
DONT_GET_NAT_EXT_IP="0"

# How many LoginServer will you run?
LIVE_LOGIN_SERVERS="4"

# Webtool remapping command line
WEBTOOL_REMAPPING_CMDLINE="wget -O/dev/null -q http://127.0.0.1/fn_admin/install2.php"

# Kick bots(1 = Real kick, 0 = Demo mode)(Deprecated)
KICK_BOTTING="0"

# Do not run DBbackup when dbpatch
DO_NOT_RUN_DBBACKUP_BEFORE_DBPATCH="1"

# Do not run DBvacuum when dbpatch
DO_NOT_RUN_DBVACUUM_AFTER_DBPATCH="0"

# DBbackup routine delete
DBBACKUP_ROUTINE_DEL="1"

# PvP channel WZ number
PVP_CHANNEL_WZ_NUMBER=""

# PvP channel name prefix
PVP_CHANNEL_NAME_PREFIX=""

# PvP channel name suffix
PVP_CHANNEL_NAME_SUFFIX="(PvP)"

# CrossRouter Set ID on LIVE
CROSS_ROUTER_SID_LIVE=""

# Enable Cross Set IDs on LIVE
ENABLE_CROSS_SID_LIVE=""

# CentralServer Set ID on LIVE
CENTRAL_SID_LIVE="$CROSS_ROUTER_SID_LIVE"

# Client Patch NFS Start Number
CLIENT_PATCH_NFS_START=""

# Client Patch File Name Initial Lists
CLIENT_PATCH_FILENAME_LISTS="${GAME_TYPE,,}${COUNTRY_CODE_DISPLAY,,}.txt ${GAME_TYPE,,}_${COUNTRY_CODE_DISPLAY,,}.txt ${GAME_TYPE,,}_${COUNTRY_CODE_DISPLAY,,}01.txt"

# Client Patch Domain Name
CLIENT_PATCH_DOMAIN_NAME="patch.erolabs.h2.himefun.com"
#CLIENT_PATCH_DOMAIN_NAME="d1g3zovd6crtco.cloudfront.net"

# SetID Public ( is_commercial )
SET_ID_PUBLIC="1"

################################
#  Translation Tool Settings   #
################################
# The directory of the translated ini upload to
#TRANSLATED_INI_UPLOAD_DIR="/home/translate/localize/"
#TRANSLATED_INI_UPLOAD_DIR_JP="/home/translate/localize_jp/"

# The worlds that will apply the translated files (DO NOT EDIT WITHOUT X-LEGEND)
TRANSLATED_INI_APPLY_TO="TEST"
BANNER_APPLY_TO="TEST"

# What translations to run with localize2db?
LOCALIZE2DB_TRANSLATIONS="Title Mission Node Spell Item ItemMall"

# Which languages need to convert to powerupitem ( Item / Itemmall ): Log to DB
#TRANSLATED_LANG_TO_POWERUPITEM="JP"

# WebTool db info
WEBTOOL_DB_NAME="WebTool"
WEBTOOL_DB_USER="webtool"
WEBTOOL_DB_PASSWORD="eU-n#48Ku(_X!SMk~Z9H3)"


################################
#     Login Firewall(LGFW)     #
################################
# LGFW has 3 modes:
# 1 = IP Tables RESTORE/SAVE mode(by iptables-save and iptables-restore)
# 2 = Port/IP list mode
# 3 = /etc/init.d/iptables stop/start
LGFW_MODE="2"

# LGFW: IP Tables RESTORE/SAVE mode: LGFW OFF iptables-save file
IPTABLES_LGFW_OFF_CONFIG_FILE="/etc/sysconfig/iptables.public"
# LGFW: IP Tables RESTORE/SAVE mode: LGFW ON iptables-save file
IPTABLES_LGFW_ON_CONFIG_FILE="/etc/sysconfig/iptables.close"

# LGFW: Port/IP list mode: Login Server Ports (NOTE: stop and start LGFW after change)
LOGIN_SERVER_PORTS="8443 8444 8445 8446 6543 6544 6545 6546 8665 8666 8667 8668 8669 8670 8671 8672 8673"
# LGFW: Port/IP list mode: IPs for allow when under maintenance (NOTE: stop and start LGFW after change)
LOGIN_SERVER_ALLOW_IP="210.71.206.190 60.251.182.68 211.75.14.135 10.150.10.2 10.150.10.9"

# WSFW: Port/IP list mode: World Server Ports (NOTE: stop and start WSFW after change)
WORLD_SERVER_PORTS_RANGE="5567-5593"
# ZSFW: Port/IP list mode: Zone Server Ports (NOTE: stop and start ZSFW after change)
ZONE_SERVER_PORTS_RANGE="6112-6127"
# WZFW: Internal IP range
WZ_SERVER_IP_RANGE="10.150.15.0"

#################################
#      Log Rotate settings      #
#################################
# Choose the log type to delete
WORLD_TO_DELETE=""
ZONE_TO_DELETE=""
MISSION_TO_DELETE=""
LOGIN_TO_DELETE=""
GATEWAY_TO_DELETE=""

# Leave how many log files in directory and don't do gzip or delete
LOG_LEAVE_IN_DIR="4"

# How many days to check the log file date?
CHECK_LOG_FILE_DATE_IN_DAYS="3"


##########################################
#    GMTool Config Generator settings    #
##########################################
# Default game client install path
GAME_CLIENT_DEFAULT_INSTALL_PATH="C:\X-Legend\FNOnline"

# Log Data Limit
GM_TOOL_LOG_DATA_LIMIT="1000"


#####################################
#   Third-party Service Settings    #
#####################################
# Apex base path, which contains ax_itemsvr and ax_part
# (Not recommended to put into the "common" directory)
APEX_BASE_PATH="$HOME/ApexItemServer/"

# ApexItemServer path
APEXITEMSERVER_PATH="$HOME/ApexItemServer/ax_itemsvr/"

# ApexItemServer binary
APEXITEMSERVER_BIN="AHNetServer"

# XignCode Switch
XIGNCODE_ENABLE="1"

# XignCode Password
XIGNCODE_PASSWORLD="wellbia2025"

# XignCode Patch Root Original Tarball Directory
XIGNCODE_PATCH_ROOT_7ZIP_DIRECTORY="$HOME/patch/XIGNCODE/"

# XignCode Patch Root Source
XIGNCODE_PATCH_ROOT_SOURCE="$HOME/www/XIGNCODE/"

# XignCode Patch Root Directory Name
XIGNCODE_PATCH_ROOT_DIRECTORY_NAME="9dFcXbNstNacGL"

# XignCode Patch Root CDN
XIGNCODE_PATCH_ROOT_CDN="$HOME/www/CDN/${GAME_TYPE}-LIVE/XIGNCODE/"

# XignCode Patch Root CDN Machine
XIGNCODE_PATCH_ROOT_CDN_MACHINE="CTRL"

############################
#   Low Disk Space Check   #
############################
# Check disk space on login?
LOW_DISK_SPACE_CHECK_ON_LOGIN="0"

# Warning disk space too low for game server directory when under this setting.(in MB)
LOW_DISK_SPACE_WARNING_SERVER_DIR="20000"

# Warning disk space too low for /var when under this setting.(in MB)
LOW_DISK_SPACE_WARNING_VAR="1000"

# Warning disk space too low for PGDATA when under this setting.(in MB)
LOW_DISK_SPACE_WARNING_PGDATA="3000"

# Warning disk space size too low for TEST when under this setting.(in GB)
LOW_DISK_SPACE_WARNING_SIZE_TEST="5"

# Warning disk space percentage too low for TEST when under this setting.(in %)
LOW_DISK_SPACE_WARNING_PERCENTAGE_TEST="96"

# Warning disk space size too low for LIVE when under this setting.(in GB)
LOW_DISK_SPACE_WARNING_SIZE_LIVE="40"

# Warning disk space percentage too low for LIVE when under this setting.(in %)
LOW_DISK_SPACE_WARNING_PERCENTAGE_LIVE="90"

# Check the mounted directory
LOW_DISK_SPACE_WARNING_DIR="/"


##########################
#   Dealine Days Check   #
##########################
# Warning deadline when uder this setting.(in Days)
DEADLINE_DAY_NOTICE="30"

##########
# Others #
##########
# Item ID related Ingame Tables
ITEMID_RELATED_TABLES="inventory equipment bags storage elf_container mailitem auction collection family_storage elfinventory isle_storage elftablet sys_mail_queue sys_mail_queue_new"

# Enable to fix CPU ID for MissionServer
ENABLE_FIX_MS_CPU="0"

# Enable to fix CPU ID for WorldServer
ENABLE_FIX_WS_CPU="0"

# Enable to fix CPU ID for Specific Server
ENABLE_FIX_CPU_FOR_GAMESERVERS="0"

# Maxnum character numbers for each WorldServer on AccountDB > worlds
MAXNUM_CHARACTER_NUMBERS="0"

# Group Text Prefix on AccountDB > worlds
GROUP_TEXT_PREFIX="Zone"

# TimeZone mapping on AccountDB > worlds
WORLDS_TIMEZONE_MAPPING=("ASIA1 (UTC+8)" "ASIA2 (UTC+8)" "ASIA3 (UTC+8)")

# Tools Website ( Domain )
TOOLS_WEBSITE_URL="https://tools.cb.erolabs.n1.himefun.com"


########################
# Automation Functions #
########################
if ! type function_loaded &> /dev/null; then
	. $HOME/.functions
fi
[[ -f "$HOME/.gamerc.local_parameters" && -r "$HOME/.gamerc.local_parameters" ]] && source $HOME/.gamerc.local_parameters


######################
# setup.ini settings #
######################
# Redefine the function of generating setup.ini
generate_setup_ini () {
   if [ "$HOST_NAME" == "TEST" -o "$HOST_NAME" == "SUB" -o "$HOST_NAME" == "SUBMIT" -o "$HOST_NAME" == "DATA" -o "$HOST_NAME" == "DLC" -o "$HOST_NAME" == "TIME1" -o "$HOST_NAME" == "MEDIA" -o "$HOST_NAME" == "MERGE" ] ; then
      MISSIONSERVER_IP="$TEST_SERVER_PRIVATE_IP"
      GAMEDBSERVER_IP="$TEST_SERVER_PRIVATE_IP"
      RANKSERVER_IP="$TEST_SERVER_PRIVATE_IP"
      CHATSERVER_IP="$TEST_SERVER_PRIVATE_IP"
   else
      if [ "$SET_NUM" != "1" ]; then
	MISSIONSERVER_IP=$(grep -E " MS${SET_NUM} | MS${SET_NUM}$" /etc/hosts | awk -F" " '{print $1}')
	GAMEDBSERVER_IP=$(grep -E " GDS${SET_NUM} | GDS${SET_NUM}$" /etc/hosts | awk -F" " '{print $1}')
	RANKSERVER_IP=$(grep -E " RANKS${SET_NUM} | RANKS${SET_NUM}$" /etc/hosts | awk -F" " '{print $1}')
	CHATSERVER_IP=$(grep -E " CHATS${SET_NUM} | CHATS${SET_NUM}$" /etc/hosts | awk -F" " '{print $1}')
      fi
   fi

   sed "   s/__GameDBIP__/$GAME_DB_IP/g
           s/__GameDB__/$GAME_DB/g
	       s/__GameDBPassword__/$DATABASE_PASSWORD/g
	       s/__Language__/$LANGUAGE/g
           s/__AccountDBIP__/$ACCOUNT_DB_IP/g
           s/__AccountDBName__/$ACCOUNT_DB_NAME/g
           s/__AccountDBPW__/$DATABASE_PASSWORD/g
	       s/__AcctDBPort__/$ACCOUNTDBSERVER_PORT/g
           s/__TicketServerIP__/$TicketServerIP/g
	       s/__TicketServerPort__/$TICKETSERVER_PORT/g
           s/__NAT__/$NAT/g
           s/__MissionServerID__/$SET_NUM/g
           s/__SDKAppKey__/$SDK_APP_KEY/g
	       s/__GameDBSIP__/$GAMEDBSERVER_IP/g
	       s/__MissionServerIP__/$MISSIONSERVER_IP/g
	       s/__WorldDBIP__/$WORLD_DB_IP/g
	       s/__WorldDB__/$WORLD_DB/g
	       s/__WorldDBPassword__/$DATABASE_PASSWORD/g
	       s/__ReserveDeletedCharDays__/$RESERVE_DELETED_CHAR_DAYS/g
           s/__SocietyServerIP_Ext__/$SOCIETY_EXT_IPADDR/g
           s/__SocietyServerIP_Int__/$SOCIETY_INT_IPADDR/g
	       s/__RankServerIP__/$RANKSERVER_IP/g
	       s/__ChatServerIP__/$CHATSERVER_IP/g" \
    $HOME/bin/setup.ini_$GAME_TYPE_LOWER
}


########
# shrc #
########

#[ -f $HOME/.hosts ] && cat $HOME/.hosts $HOME/bin/hosts > /etc/hosts 2> /dev/null

MAX_LEN=200; HOST_ABBR=$(if (( ${#HOST_NAME} > MAX_LEN )); then echo "$HOST_NAME" | tr '_' '\n' | grep 'DB' | paste -sd'_' || echo "${HOST_NAME:0:$MAX_LEN}"; else echo "$HOST_NAME"; fi)

if [ "$UID" == "0" ] ; then
	ulimit -n 1048576
	ulimit -c unlimited
fi
export LS_COLORS='no=00:fi=00:di=01;33:ln=00;36:pi=40;33:so=00;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=00;32:*.cmd=00;32:*.exe=00;32:*.com=00;32:*.btm=00;32:*.bat=00;32:*.sh=00;32:*.csh=00;32:*.tar=00;31:*.tgz=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.zip=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.bz=00;31:*.tz=00;31:*.rpm=00;31:*.cpio=00;31:*.jpg=00;35:*.gif=00;35:*.bmp=00;35:*.xbm=00;35:*.xpm=00;35:*.png=00;35:*.tif=00;35:*.xz=49;35;01:*.txz=49;35;01:*.lzma=49;35;01:*.tlz=49;35;01'
export PATH="$PATH:$HOME/bin/:$HOME/:/sbin/"
export HISTSIZE="1000000"
export HISTFILESIZE="1000000000"
export HISTTIMEFORMAT="%Y-%m-%dT%H:%M:%S "
unset HISTCONTROL
shopt -s histappend
shopt -s expand_aliases
#export PAGER="less"
#export LESS="-S -g -f -i -N -p[^|]*"
export EDITOR="vi"
alias rm="rm -i"
alias ssh="ssh -o StrictHostKeyChecking=no"
alias ssh-no-ask="ssh -o StrictHostKeyChecking=no"
alias pl="ps -Ao pid,lstart,cmd f|grep '[A-Za-z]\+Server'|grep -v SKServer"
alias pa='sendscript allall nosave <<< "cat /proc/loadavg;ps -Ao pid,lstart,pcpu,s,cmd f|grep \"[A-Za-z]\+Server\"|grep -v SKServer"'
alias xz="$HOME/bin/xz"
export PGUSER="spiritking"

if [ "$HOST_NAME" == "TEST" -o "$HOST_NAME" == "SUB" -o "$HOST_NAME" == "SUBMIT" -o "$HOST_NAME" == "DATA" -o "$HOST_NAME" == "DLC" -o "$HOST_NAME" == "TIME1" -o "$HOST_NAME" == "MEDIA" -o "$HOST_NAME" == "MERGE" ] ; then
   export PGPASSWORD="$TEST_SERVER_DB_PASSWORD"
   PS1="\
\[\033[1;31m\]\$?\
\[\033[1;32m\]\!\
\[\033[1;34m\]\D{%H:%M:%S}\
\[\033[1;36m\]\u\
\[\033[1;30m\]@\
\[\033[1;32m\]\${HOST_NAME}\
\[\033[1;30m\]:\
\[\033[1;35m\]\w\
\[\033[1;30m\][\
\[\033[1;3"${SHELL_PROMPT_GAME_TYPE_COLOR}"m\]\${GAME_TYPE}\
\[\033[1;30m\]-\
\[\033[1;3"${SHELL_PROMPT_COUNTRY_CODE_COLOR}"m\]\${COUNTRY_CODE_DISPLAY}\
\[\033[1;30m\]]\
\[\033[1;34m\]\\$\[\033[0m\] "
else
   export PGPASSWORD="$LIVE_SERVER_DB_PASSWORD"
   PS1="\
\[\033[1;31m\]\$?\
\[\033[1;32m\]\!\
\[\033[1;34m\]\D{%H:%M:%S}\
\[\033[1;31m\]\u\
\[\033[1;30m\]@\
\[\033[1;31m\]\${HOST_NAME}\
\[\033[1;30m\]:\
\[\033[1;35m\]\w\
\[\033[1;30m\][\
\[\033[1;3"${SHELL_PROMPT_GAME_TYPE_COLOR}"m\]\${GAME_TYPE}\
\[\033[1;30m\]-\
\[\033[1;3"${SHELL_PROMPT_COUNTRY_CODE_COLOR}"m\]\${COUNTRY_CODE_DISPLAY}\
\[\033[1;33m\]LIVE\
\[\033[1;30m\]]\
\[\033[1;31m\]\\$\[\033[0m\] "
fi

