Просмотр исходного кода

feat(newserver): Chivalry: Medieval Warfare (#2880)

Co-authored-by: Daniel Gibbs <me@danielgibbs.co.uk>
Christian 6 лет назад
Родитель
Сommit
6fcd8d78f4

+ 175 - 0
lgsm/config-default/config-lgsm/cmwserver/_default.cfg

@@ -0,0 +1,175 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT, ANY CHANGES WILL BE OVERWRITTEN!
+# Copy settings from here and use them in either:
+# common.cfg - applies settings to every instance.
+# [instance].cfg - applies settings to a specific instance.
+
+#### Game Server Settings ####
+
+## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters
+ip="0.0.0.0"
+port="7777"
+queryport="7779"
+defaultmap="AOCTD-Frigid_p"
+
+
+## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+fn_parms(){
+
+parms="${defaultmap}?steamsockets -multihome=${ip} -Port=${port} -QueryPort=${queryport} -seekfreeloadingserver -configsubdir=${gamelogdir} -log=${gamelog}"
+
+}
+
+#### LinuxGSM Settings ####
+
+## LinuxGSM Stats
+# Send useful stats to LinuxGSM developers.
+# https://docs.linuxgsm.com/configuration/linuxgsm-stats
+# (on|off)
+stats="off"
+
+## Notification Alerts
+# (on|off)
+
+# Display IP | https://docs.linuxgsm.com/alerts#display-ip
+displayip=""
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://termbin.com"
+
+# Discord Alerts | https://docs.linuxgsm.com/alerts/discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://docs.linuxgsm.com/alerts/email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://docs.linuxgsm.com/alerts/ifttt
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://docs.linuxgsm.com/alerts/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://docs.linuxgsm.com/alerts/pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://docs.linuxgsm.com/alerts/pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Slack Alerts | https://docs.linuxgsm.com/alerts/slack
+slackalert="off"
+slackwebhook="webhook"
+
+# Telegram Alerts | https://docs.linuxgsm.com/alerts/telegram
+# You can add a custom cURL string eg proxy (useful in Russia) or else in "curlcustomstring".
+# like a "--socks5 ipaddr:port" for socks5 proxy see more in "curl --help", if you not need
+# any custom string in curl - simple ignore this parameter.
+telegramalert="off"
+telegramtoken="accesstoken"
+telegramchatid=""
+curlcustomstring=""
+
+## Updating | https://docs.linuxgsm.com/commands/update
+updateonstart="off"
+
+## Backup | https://docs.linuxgsm.com/commands/backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://docs.linuxgsm.com/features/logging
+consolelogging="on"
+logdays="7"
+
+## Monitor | https://docs.linuxgsm.com/commands/monitor
+# Query delay time
+querydelay="1"
+
+## ANSI Colors | https://docs.linuxgsm.com/features/ansi-colors
+ansi="on"
+
+#### Advanced Settings ####
+
+## Message Display Time | https://docs.linuxgsm.com/features/message-display-time
+sleeptime="0.5"
+
+## SteamCMD Settings | https://docs.linuxgsm.com/steamcmd
+# Server appid
+appid="220070"
+# SteamCMD Branch | https://docs.linuxgsm.com/steamcmd/branch
+branch=""
+# Master Server | https://docs.linuxgsm.com/steamcmd/steam-master-server
+steammaster="false"
+
+## Stop Mode | https://docs.linuxgsm.com/features/stop-mode
+# 1: tmux kill
+# 2: CTRL+c
+# 3: quit
+# 4: quit 120s
+# 5: stop
+# 6: q
+# 7: exit
+# 8: 7 Days to Die
+# 9: GoldSrc
+# 10: Avorion
+stopmode="2"
+
+## Query mode
+# 1: session only
+# 2: gamedig + gsquery
+# 3: gamedig
+# 4: gsquery
+# 5: tcp
+querymode="2"
+querytype="protocol-valve"
+
+## Game Server Details
+# Do not edit
+gamename="Chivalry: Medieval Warfare"
+engine="unreal3"
+glibc="2.15"
+
+#### Directories ####
+# Edit with care
+## Game Server Directories
+systemdir="${serverfiles}"
+executabledir="${systemdir}/Binaries/Linux"
+executable="./UDKGameServer-Linux"
+servercfgdir="${systemdir}/UDKGame/Config/${selfname}"
+servercfg="PCServer-UDKGame.ini"
+servercfgdefault="PCServer-UDKGame.ini"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${lgsmdir}/backup"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${systemdir}/Saved/Logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+gamelog="${gamelogdir}/${selfname}-game.log"
+lgsmlog="${lgsmlogdir}/${selfname}-script.log"
+consolelog="${consolelogdir}/${selfname}-console.log"
+alertlog="${lgsmlogdir}/${selfname}-alert.log"
+postdetailslog="${lgsmlogdir}/${selfname}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${selfname}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${selfname}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"
+gamelogdate="${gamelogdir}/${selfname}-game-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -14,6 +14,7 @@ bs,bsserver,Blade Symphony
 bt,btserver,Barotrauma
 bt1944,bt1944server,Battalion 1944
 cc,ccserver,Codename CURE
+cmw,cmwserver,Chivalry: Medieval Warfare
 cod,codserver,Call of Duty
 cod2,cod2server,Call of Duty 2
 cod4,cod4server,Call of Duty 4

+ 2 - 2
lgsm/functions/command_dev_query_raw.sh

@@ -35,7 +35,7 @@ fi
 query_gamedig.sh
 echo -e "${gamedigcmd}"
 echo""
-echo -e "${gamedigraw}" | jq
+echo "${gamedigraw}" | jq
 
 echo -e ""
 echo -e "gsquery Raw Output"
@@ -44,7 +44,7 @@ echo -e ""
 echo -e "./query_gsquery.py -a \"${ip}\" -p \"${queryport}\" -e \"${querytype}\""
 echo -e ""
 if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
-	fn_fetch_file_git "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
+	fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
 fi
 "${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${querytype}"
 

+ 1 - 1
lgsm/functions/command_monitor.sh

@@ -84,7 +84,7 @@ fn_monitor_check_queryport(){
 
 fn_query_gsquery(){
 	if [ ! -f "${functionsdir}/query_gsquery.py" ]; then
-		fn_fetch_file_git "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
+		fn_fetch_file_github "lgsm/functions" "query_gsquery.py" "${functionsdir}" "chmodx" "norun" "noforce" "nomd5"
 	fi
 	"${functionsdir}"/query_gsquery.py -a "${ip}" -p "${queryport}" -e "${querytype}" > /dev/null 2>&1
 	querystatus="$?"

+ 1 - 1
lgsm/functions/command_update_linuxgsm.sh

@@ -194,7 +194,7 @@ if [ -n "${functionsdir}" ]; then
 	fi
 fi
 
-fn_print_ok "Updating functions"
+fn_print_ok_nl "Updating functions"
 fn_script_log_pass "Updating functions"
 
 core_exit.sh

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -320,6 +320,11 @@ functionfile="${FUNCNAME[0]}"
 fn_fetch_function
 }
 
+fix_cmw.sh(){
+functionfile="${FUNCNAME[0]}"
+fn_fetch_function
+}
+
 fix_csgo.sh(){
 functionfile="${FUNCNAME[0]}"
 fn_fetch_function

+ 3 - 1
lgsm/functions/fix.sh

@@ -42,6 +42,8 @@ if [ "${commandname}" != "INSTALL" ]&&[ -z "${fixbypass}" ]; then
 		fix_ark.sh
 	elif [ "${shortname}" == "csgo" ]; then
 		fix_csgo.sh
+	elif [ "${shortname}" == "cmw" ]; then
+		fix_cmw.sh
 	elif [ "${shortname}" == "dst" ]; then
 		fix_dst.sh
 	elif [ "${shortname}" == "ges" ]; then
@@ -89,7 +91,7 @@ fi
 
 # Fixes that are run on install only.
 if [ "${commandname}" == "INSTALL" ]; then
-		if [ "${shortname}" == "av" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
+		if [ "${shortname}" == "av" ]||[ "${shortname}" == "cmw" ]||[ "${shortname}" == "kf" ]||[ "${shortname}" == "kf2" ]||[ "${shortname}" == "onset" ]||[ "${shortname}" == "ro" ]||[ "${shortname}" == "ut2k4" ]||[ "${shortname}" == "ut" ]||[ "${shortname}" == "ut3" ]; then
 			echo -e ""
 			echo -e "Applying Post-Install Fixes"
 			echo -e "================================="

+ 33 - 0
lgsm/functions/fix_cmw.sh

@@ -0,0 +1,33 @@
+#!/bin/bash
+# LinuxGSM fix_cmw.sh function
+# Author: Christian Birk
+# Website: https://linuxgsm.com
+# Description: Resolves the issue of the not starting server on linux
+
+fixname="steam_appid.txt"
+
+if [ ! -f "${executabledir}/steam_appid.txt" ]; then
+	fn_fix_msg_start
+	echo 219640 > "${executabledir}/steam_appid.txt"
+	fn_fix_msg_end
+fi
+
+
+if [ ! -f "${executabledir}/lib/steamclient.so" ]; then
+	fixname="steamclient.so"
+	fn_fix_msg_start
+	if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
+		cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so"
+	elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
+		cp "${steamcmddir}/linux32/steamclient.so" "${executabledir}/lib/steamclient.so"
+	fi
+	fn_fix_msg_end
+fi
+
+if [ ! -f "${servercfgfullpath}" ]; then
+	fn_fix_msg_start
+	fixname="copy config"
+	mkdir "${servercfgdir}"
+	cp "${systemdir}/UDKGame/Config/"*.ini "${servercfgdir}"
+	fn_fix_msg_end
+fi

+ 4 - 4
lgsm/functions/fix_hw.sh

@@ -12,9 +12,9 @@ if [ "${shortname}" == "hw" ]; then
 		fixname="steamclient.so x86"
 		fn_fix_msg_start
 		if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
-			cp -v "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
 		elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
-			cp -v "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux32/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86/steamclient.so" >> "${lgsmlog}"
 		else
 			:
 		fi
@@ -24,9 +24,9 @@ if [ "${shortname}" == "hw" ]; then
 		fixname="steamclient.so x86_64"
 		fn_fix_msg_start
 		if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
-			cp -v "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
 		elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
-			cp -v "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
+			cp "${steamcmddir}/linux64/steamclient.so" "${serverfiles}/Hurtworld_Data/Plugins/x86_64/steamclient.so" >> "${lgsmlog}"
 		else
 			:
 		fi

+ 4 - 8
lgsm/functions/fix_steamcmd.sh

@@ -12,11 +12,9 @@ if [ ! -f "${HOME}/.steam/sdk64/steamclient.so" ]; then
 	fn_fix_msg_start
 	mkdir -pv "${HOME}/.steam/sdk64" >> "${lgsmlog}"
 	if [ -f "${HOME}/.steam/steamcmd/linux64/steamclient.so" ]; then
-		cp -v "${HOME}/.steam/steamcmd/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
+		cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
 	elif [ -f "${steamcmddir}/linux64/steamclient.so" ]; then
-		cp -v "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
-	else
-		$?=2
+		cp "${steamcmddir}/linux64/steamclient.so" "${HOME}/.steam/sdk64/steamclient.so" >> "${lgsmlog}"
 	fi
 	fn_fix_msg_end
 fi
@@ -27,11 +25,9 @@ if [ ! -f "${HOME}/.steam/sdk32/steamclient.so" ]; then
 	fn_fix_msg_start
 	mkdir -pv "${HOME}/.steam/sdk32" >> "${lgsmlog}"
 	if [ -f "${HOME}/.steam/steamcmd/linux32/steamclient.so" ]; then
-		cp -v "${HOME}/.steam/steamcmd/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
+		cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
 	elif [ -f "${steamcmddir}/linux32/steamclient.so" ]; then
-		cp -v "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
-	else
-		$?=2
+		cp "${steamcmddir}/linux32/steamclient.so" "${HOME}/.steam/sdk32/steamclient.so" >> "${lgsmlog}"
 	fi
 	fn_fix_msg_end
 fi

+ 20 - 0
lgsm/functions/info_config.sh

@@ -199,6 +199,23 @@ fn_info_config_bf1942(){
 	fi
 }
 
+fn_info_config_chivalry(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		adminpassword="${unavailable}"
+        else
+		servername=$(egrep "^ServerName" "${servercfgfullpath}" | sed 's/^ServerName=//')
+		adminpassword=$(egrep "^AdminPassword" "${servercfgfullpath}" | sed 's/^AdminPassword=//')
+
+		# Not Set
+		servername=${servername:-"NOT SET"}
+		serverpassword=${serverpassword:-"NOT SET"}
+		adminpassword=${adminpassword:-"NOT SET"}
+		port=${port:-"0"}
+	fi
+}
+
 fn_info_config_cod(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
@@ -1455,6 +1472,9 @@ elif [ "${shortname}" == "bt1944" ]; then
 # Battlefield: 1942
 elif [ "${shortname}" == "bf1942" ]; then
 	fn_info_config_bf1942
+# Chivalry: Medieval Warfare
+elif [ "${shortname}" == "cmw" ]; then
+	fn_info_config_chivalry
 # Call of Duty
 elif [ "${shortname}" == "cod" ]||[ "${shortname}" == "coduo" ]; then
 	fn_info_config_cod

+ 14 - 0
lgsm/functions/info_messages.sh

@@ -698,6 +698,18 @@ fn_info_message_coduo(){
 	} | column -s $'\t' -t
 }
 
+fn_info_message_chivalry(){
+	fn_info_message_password_strip
+	echo -e "netstat -atunp | grep UDKGame"
+	echo -e ""
+	{
+		echo -e "${lightblue}DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL${default}"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+		echo -e "> Query\tINBOUND\t${queryport}\tudp"
+		echo -e "> RCON\tINBOUND\t27960\ttcp"
+	} | column -s $'\t' -t
+}
+
 fn_info_message_cod2(){
 	echo -e "netstat -atunp | grep cod2_lnxded"
 	echo -e ""
@@ -1390,6 +1402,8 @@ fn_info_message_select_engine(){
 		fn_info_message_barotrauma
 	elif [ "${shortname}" == "bt1944" ]; then
 		fn_info_message_battalion1944
+	elif [ "${shortname}" == "cmw" ]; then
+		fn_info_message_chivalry
 	elif [ "${shortname}" == "cod" ]; then
 		fn_info_message_cod
 	elif [ "${shortname}" == "coduo" ]; then

+ 2 - 2
lgsm/functions/info_stats.sh

@@ -23,10 +23,10 @@ fi
 if [ ! -f "${datadir}/uuid-${selfname}.txt" ]||[ ! -f "${datadir}/uuid-install.txt" ]; then
 	# download dictionary words
 	if [ ! -f "${datadir}/name-left.csv" ]; then
-		fn_fetch_file_git "lgsm/data" "name-left.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
+		fn_fetch_file_github "lgsm/data" "name-left.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
 	fi
 	if [ ! -f "${datadir}/name-right.csv" ]; then
-		fn_fetch_file_git "lgsm/data" "name-right.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
+		fn_fetch_file_github "lgsm/data" "name-right.csv" "${datadir}" "nochmodx" "norun" "forcedl" "nomd5"
 	fi
 
 	# generate instance uuid

+ 8 - 8
lgsm/functions/query_gamedig.sh

@@ -16,23 +16,23 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
 		# checks if query is working null = pass.
 		gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${ip}\" --query_port \"${queryport}\"|jq")
 		gamedigraw=$(gamedig --type "${querytype}" --host "${ip}" --query_port "${queryport}")
-		querystatus=$(echo -e "${gamedigraw}" | jq '.error|length')
+		querystatus=$(echo "${gamedigraw}" | jq '.error|length')
 
 		if [ "${querystatus}" != "null" ]; then
 			gamedigcmd=$(echo -e "gamedig --type \"${querytype}\" --host \"${ip}\" --port \"${queryport}\"|jq")
 			gamedigraw=$(gamedig --type "${querytype}" --host "${ip}" --port "${queryport}")
-			querystatus=$(echo -e "${gamedigraw}" | jq '.error|length')
+			querystatus=$(echo "${gamedigraw}" | jq '.error|length')
 
 		fi
 
 		# server name.
-		gdname=$(echo -e "${gamedigraw}" | jq -re '.name')
+		gdname=$(echo "${gamedigraw}" | jq -re '.name')
 		if [ "${gdname}" == "null" ]; then
 			unset gdname
 		fi
 
 		# numplayers.
-		gdplayers=$(echo -e "${gamedigraw}" | jq -re '.raw.vanilla.raw.players.online')
+		gdplayers=$(echo "${gamedigraw}" | jq -re '.raw.vanilla.raw.players.online')
 		if [ "${gdplayers}" == "null" ]; then
 			unset gdplayers
 		elif [ "${gdplayers}" == "[]" ]; then
@@ -40,7 +40,7 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
 		fi
 
 		# maxplayers.
-		gdmaxplayers=$(echo -e "${gamedigraw}" | jq -re '.maxplayers')
+		gdmaxplayers=$(echo "${gamedigraw}" | jq -re '.maxplayers')
 		if [ "${gdmaxplayers}" == "null" ]; then
 			unset maxplayers
 		elif [ "${gdmaxplayers}" == "[]" ]; then
@@ -48,19 +48,19 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
 		fi
 
 		# current map.
-		gdmap=$(echo -e "${gamedigraw}" | jq -re '.map')
+		gdmap=$(echo "${gamedigraw}" | jq -re '.map')
 		if [ "${gdmap}" == "null" ]; then
 			unset gdmap
 		fi
 
 		# current gamemode.
-		gdgamemode=$(echo -e "${gamedigraw}" | jq -re '.raw.rules.GameMode_s')
+		gdgamemode=$(echo "${gamedigraw}" | jq -re '.raw.rules.GameMode_s')
 		if [ "${gdgamemode}" == "null" ]; then
 			unset gdgamemode
 		fi
 
 		# numbots.
-		gdbots=$(echo -e "${gamedigraw}" | jq -re '.raw.numbots')
+		gdbots=$(echo "${gamedigraw}" | jq -re '.raw.numbots')
 		if [ "${gdbots}" == "null" ]||[ "${gdbots}" == "0" ]; then
 			unset gdbots
 		fi