فهرست منبع

feat(newserver): Soldier of Fortune 2: Gold Edition (#2359)

Co-authored-by: tkrn <tkrn@users.noreply.github.com>
tkrn 7 سال پیش
والد
کامیت
e2ca77de3b

+ 119 - 0
lgsm/config-default/config-lgsm/sof2server/_default.cfg

@@ -0,0 +1,119 @@
+##################################
+######## Default Settings ########
+##################################
+# DO NOT EDIT 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
+
+#### Server Settings ####
+
+## Server Start Settings | https://docs.linuxgsm.com/configuration/start-parameters
+ip="0.0.0.0"
+port="20100"
+defaultmap="mp_shop"
+
+## Server Start Command | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
+fn_parms(){
+parms="+set sv_punkbuster 0 +set dedicated 2 +set net_ip ${ip} +set net_port ${port} +exec ${servercfg} +map ${defaultmap}"
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://docs.linuxgsm.com/alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.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"
+
+# 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=""
+
+## Backup | https://docs.linuxgsm.com/commands/backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://docs.linuxgsm.com/features/logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+# ANSI Colors
+ansi="on"
+
+# Message Display Time
+sleeptime="0.5"
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="Soldier Of Fortune 2: Gold Edition"
+engine="idtech3"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}/main"
+executabledir="${serverfiles}"
+executable="./sof2ded"
+servercfg="${servicename}.cfg"
+servercfgdefault="server.cfg"
+servercfgdir="${systemdir}"
+servercfgfullpath="${servercfgdir}/${servercfg}"
+
+## Backup Directory
+backupdir="${rootdir}/backups"
+
+## Logging Directories
+logdir="${rootdir}/log"
+gamelogdir="${serverfiles}/Logs"
+lgsmlogdir="${logdir}/script"
+consolelogdir="${logdir}/console"
+lgsmlog="${lgsmlogdir}/${servicename}-script.log"
+consolelog="${consolelogdir}/${servicename}-console.log"
+alertlog="${lgsmlogdir}/${servicename}-alert.log"
+postdetailslog="${lgsmlogdir}/${servicename}-postdetails.log"
+
+## Logs Naming
+lgsmlogdate="${lgsmlogdir}/${servicename}-script-$(date '+%Y-%m-%d-%H:%M:%S').log"
+consolelogdate="${consolelogdir}/${servicename}-console-$(date '+%Y-%m-%d-%H:%M:%S').log"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -70,6 +70,7 @@ rust,rustserver,Rust
 rw,rwserver, Rising World
 samp,sampserver,San Andreas Multiplayer
 sbots,sbotsserver, StickyBots
+sof2,sof2server,Soldier Of Fortune 2: Gold Edition
 ss3,ss3server,Serious Sam 3: BFE
 sb,sbserver,Starbound
 st,stserver,Stationeers

+ 5 - 0
lgsm/functions/core_functions.sh

@@ -382,6 +382,11 @@ functionfile="${FUNCNAME}"
 fn_fetch_function
 }
 
+fix_sof2.sh(){
+functionfile="${FUNCNAME}"
+fn_fetch_function
+}
+
 fix_ss3.sh(){
 functionfile="${FUNCNAME}"
 fn_fetch_function

+ 2 - 0
lgsm/functions/fix.sh

@@ -55,6 +55,8 @@ if [ "${function_selfname}" != "command_install.sh" ]&&[ -z "${fixbypass}" ]; th
 		fix_rw.sh
 	elif [ "${shortname}" == "sdtd" ]; then
 		fix_sdtd.sh
+	elif [ "${shortname}" == "sof2" ]; then
+		fix_sof2.sh
 	elif [ "${shortname}" == "ss3" ]; then
 		fix_ss3.sh
 	elif [ "${shortname}" == "tf2" ]; then

+ 11 - 0
lgsm/functions/fix_sof2.sh

@@ -0,0 +1,11 @@
+#!/bin/bash
+# LinuxGSM fix_rust.sh function
+# Author: Daniel Gibbs
+# Website: https://linuxgsm.com
+# Description: Resolves startup issue with Soldier of Fortune 2
+
+local commandname="FIX"
+local commandaction="Fix"
+
+# Fixes: error while loading shared libraries: libcxa.so.1
+export LD_LIBRARY_PATH=":$LD_LIBRARY_PATH"

+ 23 - 0
lgsm/functions/info_config.sh

@@ -650,6 +650,26 @@ fn_info_config_sbots(){
 	maxplayers=${maxplayers:-"0"}
 }
 
+fn_info_config_sof2(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		rconpassword="${unavailable}"
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		maxplayers="${zero}"
+	else
+		rconpassword=$(grep "rconpassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rconpassword//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		servername=$(grep "sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		serverpassword=$(grep "g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		maxplayers=$(grep "sv_maxclients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+		# Not Set
+		rconpassword=${rconpassword:-"NOT SET"}
+		servername=${servername:-"NOT SET"}
+		serverpassword=${serverpassword:-"NOT SET"}
+		maxplayers=${maxplayers:-"0"}
+	fi
+}
+
 fn_info_config_source(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
@@ -1250,6 +1270,9 @@ elif [ "${shortname}" == "rw" ]; then
 # Serious Sam
 elif [ "${shortname}" == "ss3" ]; then
 	fn_info_config_seriousengine35
+# Soldier Of Fortune 2: Gold Edition
+elif [ "${shortname}" == "sof2" ]; then
+  fn_info_config_sof2
 # Source Engine Games
 elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
 	fn_info_config_source

+ 3 - 0
lgsm/functions/info_glibc.sh

@@ -111,6 +111,9 @@ elif [ "${gamename}" == "Return to Castle Wolfenstein" ]; then
 elif [ "${shortname}" == "rw" ]; then
 	glibcrequired="2.14"
 	glibcfix="no"
+elif [ "${gamename}" == "Soldier Of Fortune 2: Gold Edition" ]; then
+  glibcrequired="2.1"
+  glibcfix="no"
 elif [ "${gamename}" == "San Andreas Multiplayer" ]; then
 	glibcrequired="2.3"
 	glibcfix="no"

+ 11 - 0
lgsm/functions/info_messages.sh

@@ -942,6 +942,15 @@ fn_info_message_sdtd(){
 	} | column -s $'\t' -t
 }
 
+fn_info_message_sof2(){
+	echo -e "netstat -atunp | grep sof2ded"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game/Query\tINBOUND\t${port}\tudp"
+	} | column -s $'\t' -t
+}
+
 fn_info_message_source(){
 	echo -e "netstat -atunp | grep srcds_linux"
 	echo -e ""
@@ -1284,6 +1293,8 @@ fn_info_message_select_engine(){
 		fn_info_message_seriousengine35
 	elif [ "${engine}" == "source" ]; then
 		fn_info_message_source
+	elif [ "${gamename}" == "Soldier Of Fortune 2: Gold Edition" ]; then
+	  fn_info_message_sof2
 	elif [ "${engine}" == "spark" ]; then
 		fn_info_message_spark
 	elif [ "${engine}" == "starbound" ]; then

+ 14 - 0
lgsm/functions/info_parms.sh

@@ -111,6 +111,11 @@ fn_info_parms_rust(){
 	tickrate=${tickrate:-"0"}
 }
 
+fn_info_parms_sof2(){
+	port=${port:-"0"}
+	defaultmap=${defaultmap:-"NOT SET"}
+}
+
 fn_info_parms_source(){
 	defaultmap=${defaultmap:-"NOT SET"}
 	maxplayers=${maxplayers:-"0"}
@@ -141,6 +146,12 @@ fn_info_parms_stickybots(){
 	maxplayers=${maxplayers:-"0"}
 }
 
+fn_info_parms_sof2(){
+	port=${port:-"0"}
+	queryport=${port}
+	defaultmap=${defaultmap:-"NOT SET"}
+}
+
 fn_info_parms_towerunite(){
 	port=${port:-"0"}
 	queryport=${queryport:-"0"}
@@ -214,6 +225,9 @@ elif [ "${shortname}" == "rust" ]; then
 # Rising World
 elif [ "${shortname}" == "rw" ]; then
 	fn_info_parms_risingworld
+# Soldier Of Fortune 2: Gold Edition
+elif [ "${shortname}" == "sof2" ]; then
+	fn_info_parms_sof2
 # Sticky Bots
 elif [ "${shortname}" == "sbots" ]; then
 	fn_info_parms_stickybots

+ 6 - 0
lgsm/functions/install_config.sh

@@ -530,6 +530,12 @@ elif [ "${gamename}" == "Serious Sam 3: BFE" ]; then
 	fn_fetch_default_config
 	fn_default_config_remote
 	fn_set_config_vars
+elif [ "${gamename}" == "Soldier Of Fortune 2: Gold Edition" ]; then
+	gamedirname="SoldierOfFortune2Gold"
+	array_configs+=( server.cfg mapcycle.txt)
+	fn_fetch_default_config
+	fn_default_config_remote
+	fn_set_config_vars
 elif [ "${gamename}" == "Squad" ]; then
 	gamedirname="Squad"
 	array_configs+=( Admins.cfg Bans.cfg License.cfg Server.cfg Rcon.cfg )

+ 2 - 0
lgsm/functions/install_server_files.sh

@@ -37,6 +37,8 @@ fn_install_server_files(){
 		remote_fileurl="https://files.linuxgsm.com/QuakeWorld/nquake.server.linux.190506.full.tar.bz2"; local_filedir="${tmpdir}"; local_filename="nquake.server.linux.190506.full.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="74405ec030463c5e1175e776ab572d32"
 	elif [ "${shortname}" == "rtcw" ]; then
 		remote_fileurl="https://files.linuxgsm.com/ReturnToCastleWolfenstein/iortcw-1.51c-x86_64-server-linux-20190507.tar.bz2"; local_filedir="${tmpdir}"; local_filename="iortcw-1.51c-x86_64-server-linux-20190507.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="6a3be9700372b228d1187422464e4212"
+	elif [ "${shortname}" == "sof2" ]; then
+			remote_fileurl="https://files.linuxgsm.com/SoldierOfFortune2/sof2gold-1.03.tar.bz2"; local_filedir="${tmpdir}"; local_filename="sof2gold-1.03.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="871b1dc0dafeeace65b198119e8fa200"
 	elif [ "${shortname}" == "ut2k4" ]; then
 		remote_fileurl="https://files.linuxgsm.com/UnrealTournament2004/ut2004-server-3369-2-ultimate-linux.tar.bz2"; local_filedir="${tmpdir}"; local_filename="ut2004-server-3369-2-ultimate-linux.tar.bz2"; chmodx="nochmodx" run="norun"; force="noforce"; md5="67c5e2cd9c2a4b04f163962ee41eff54"
 	elif [ "${shortname}" == "ut99" ]; then