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

Feature/inssserver 2004 (#2079)

* Added insurgency: Sandstorm
* gamedig will now attempt to use --port if --query_port fails
* Stopped gamedig from querying twice
* Added Default Scenario
* Added Current Scenario
* added current gamemode
* Updated servername for parms
* if serverpassword NOT SET unset var for display on Command-line Parameters
Daniel Gibbs 7 лет назад
Родитель
Сommit
b03069d234

+ 1 - 1
lgsm/config-default/config-lgsm/hwserver/_default.cfg

@@ -9,7 +9,7 @@
 #### Server Settings ####
 
 ## Server Start Settings | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
-servername="Hurtworld LinuxGSM Server"
+servername="LinuxGSM Server"
 ip="0.0.0.0"
 port="12871"
 queryport="12881"

+ 134 - 0
lgsm/config-default/config-lgsm/inssserver/_default.cfg

@@ -0,0 +1,134 @@
+##################################
+######## 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://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters
+
+ip="0.0.0.0"
+port="27102"
+queryport="27131"
+servername="LinuxGSM Server"
+serverpassword=""
+defaultmap="Oilfield"
+defaultscenario="Scenario_Oilfield_Push_Security"
+maxplayers="28"
+
+## Server Start Command | https://github.com/GameServerManagers/LinuxGSM/wiki/Start-Parameters#additional-parameters
+fn_parms(){
+parms="${defaultmap}?Scenario=${defaultscenario}?MaxPlayers=${maxplayers} -password=${serverpassword} -Port=${port} -QueryPort=${queryport} -hostname='${servername}' -log"
+}
+
+#### LinuxGSM Settings ####
+
+## Notification Alerts
+# (on|off)
+
+# More info | https://github.com/GameServerManagers/LinuxGSM/wiki/Alerts#more-info
+postalert="off"
+postdays="7"
+posttarget="https://hastebin.com"
+
+# Discord Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Discord
+discordalert="off"
+discordwebhook="webhook"
+
+# Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Email
+emailalert="off"
+email="email@example.com"
+emailfrom=""
+
+# IFTTT Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/IFTTT
+iftttalert="off"
+ifttttoken="accesstoken"
+iftttevent="linuxgsm_alert"
+
+# Mailgun Email Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/mailgun
+mailgunalert="off"
+mailguntoken="accesstoken"
+mailgundomain="example.com"
+mailgunemailfrom="alert@example.com"
+mailgunemail="email@myemail.com"
+
+# Pushbullet Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushbullet
+pushbulletalert="off"
+pushbullettoken="accesstoken"
+channeltag=""
+
+# Pushover Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/Pushover
+pushoveralert="off"
+pushovertoken="accesstoken"
+
+# Telegram Alerts | https://github.com/GameServerManagers/LinuxGSM/wiki/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://github.com/GameServerManagers/LinuxGSM/wiki/Update
+updateonstart="off"
+
+## Backup | https://github.com/GameServerManagers/LinuxGSM/wiki/Backup
+maxbackups="4"
+maxbackupdays="30"
+stoponbackup="on"
+
+## Logging | https://github.com/GameServerManagers/LinuxGSM/wiki/Logging
+consolelogging="on"
+logdays="7"
+
+#### LinuxGSM Advanced Settings ####
+
+# ANSI Colors
+ansi="on"
+
+## SteamCMD Settings
+# Server appid
+appid="581330"
+# Steam App Branch Select
+# Allows to opt into the various Steam app branches. Default branch is "".
+# Example: "-beta latest_experimental"
+branch=""
+
+## LinuxGSM Server Details
+# Do not edit
+gamename="Insurgency: Sandstorm"
+engine="unreal4"
+
+#### Directories ####
+# Edit with care
+
+## Server Specific Directories
+systemdir="${serverfiles}/Insurgency"
+executabledir="${systemdir}/Binaries/Linux"
+executable="./InsurgencyServer-Linux-Shipping"
+servercfg="Game.ini"
+servercfgdefault="Game.ini"
+servercfgdir="${systemdir}/Saved/Config/LinuxServer"
+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}/${servicename}-game.log"
+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 - 1
lgsm/config-default/config-lgsm/ns2cserver/_default.cfg

@@ -13,7 +13,7 @@ ip="0.0.0.0"
 port="27015"
 defaultmap="co_core"
 maxplayers="24"
-servername="NS2C Server"
+servername="LinuxGSM Server"
 webadminuser="admin"
 webadminpass="admin"
 webadminport="8080"

+ 1 - 1
lgsm/config-default/config-lgsm/ns2server/_default.cfg

@@ -17,7 +17,7 @@ ip="0.0.0.0"
 port="27015"
 defaultmap="ns2_summit"
 maxplayers="24"
-servername="NS2 Server"
+servername="LinuxGSM Server"
 webadminuser="admin"
 webadminpass="admin"
 webadminport="8080"

+ 1 - 1
lgsm/config-default/config-lgsm/pstbsserver/_default.cfg

@@ -14,7 +14,7 @@ ip="0.0.0.0"
 randommap="ALWAYS"
 port="10027"
 queryport="10037"
-#servername="LinuxGSM server"
+#servername="LinuxGSM Server"
 # If your server is not meeting the minimal server requirement, do not host the server for 80 players, decrease that number.
 maxplayers="40"
 numreservedslots="2"

+ 1 - 0
lgsm/data/serverlist.csv

@@ -36,6 +36,7 @@ hldms,hldmsserver,Half-Life Deathmatch: Source
 hldm,hldmserver,Half-Life: Deathmatch
 hw,hwserver,Hurtworld
 ins,insserver,Insurgency
+inss,inssserver,Insurgency: Sandstorm
 jc2,jc2server,Just Cause 2
 jc3,jc3server,Just Cause 3
 kf,kfserver,Killing Floor

+ 3 - 3
lgsm/functions/check_ip.sh

@@ -21,7 +21,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 	# IP is not set to specific IP
 	if [ "${ip}" == "0.0.0.0" ]||[ "${ip}" == "" ]; then
 		fn_print_dots "Check IP"
-		sleep 0.5
+		sleep 0.2
 		# Multiple interfaces
 		if [ "${getipwc}" -ge "2" ]; then
 			if [ "${function_selfname}" == "command_details.sh" ]; then
@@ -29,7 +29,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 			else
 			    fn_print_fail "Check IP: Multiple IP addresses found."
 			fi
-			sleep 0.5
+			sleep 0.2
 			echo -en "\n"
 			# IP is set within game config
 			if [ "${ipsetinconfig}" == "1" ]; then
@@ -85,7 +85,7 @@ if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${gamename}" != "Mumble" ]&&[ "${travi
 		else
 			fn_print_info_nl "Check IP: ${getip}"
 			fn_script_log_info "IP automatically set as: ${getip}"
-			sleep 0.5
+			sleep 0.2
 			ip="${getip}"
 		fi
 	fi

+ 1 - 1
lgsm/functions/command_dev_query_raw.sh

@@ -29,7 +29,7 @@ elif [ "${gamename}" == "Killing Floor 2" ]; then
 fi
 
 query_gamedig.sh
-echo "gamedig --type \"${gamedigengine}\" --host \"${ip}\" --query_port \"${queryport}\"|jq"
+echo "${gamedigcmd}"
 echo""
 echo "${gamedigraw}" | jq
 echo""

+ 27 - 1
lgsm/functions/info_config.sh

@@ -297,6 +297,29 @@ fn_info_config_factorio(){
 	fi
 }
 
+fn_info_config_inss(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		rconenabled="${unavailable}"
+		rconpassword="${unavailable}"
+		rconport="${zero}"
+		maxplayers="${zero}"
+		port="${zero}"
+		queryport="${zero}"
+		queryenabled="${unavailable}"
+		rconport="${zero}"
+		gamemode="${unavailable}"
+		gameworld="${unavailable}"
+	else
+		rconenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		rconpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		rconport=$(grep "ListenPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
+
+		# Not Set
+		rconenabled=${rconenabled:-"NOT SET"}
+		rconpassword=${rconpassword:-"NOT SET"}
+		rconport=${rconport:-"0"}
+	fi	
+}
 fn_info_config_minecraft(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		servername="${unavailable}"
@@ -364,7 +387,7 @@ fn_info_config_pstbs(){
 	servername=${servername:-"NOT SET"}
 	serverpassword=${serverpassword:-"NOT SET"}
 	maxplayers=${maxplayers:-"0"}
-	numreservedslots=${maxplayers:-"0"}
+	numreservedslots=${numreservedslots:-"0"}
 }
 
 fn_info_config_projectcars(){
@@ -1121,6 +1144,9 @@ elif [ "${shortname}" == "eco" ]; then
 # Factorio
 elif [ "${gamename}" == "Factorio" ]; then
 	fn_info_config_factorio
+# Insurgency: Sandstorm
+elif [ "${shortname}" == "inss" ]; then
+	fn_info_config_inss
 # Just Cause 2
 elif [ "${gamename}" == "Just Cause 2" ]; then
 	fn_info_config_justcause2

+ 31 - 0
lgsm/functions/info_messages.sh

@@ -225,11 +225,25 @@ fn_info_message_gameserver(){
 			echo -e "${blue}Current Map:\t${default}${gdmap}"
 		fi
 
+		if [ -n "${defaultscenario}" ]; then
+			# Current Scenario
+			if [ -n "${gdgamemode}" ]; then
+				echo -e "${blue}Current Scenario:\t${default}${gdgamemode}"
+			fi
+		else
+			echo -e "${blue}Current Game Mode:\t${default}${gdgamemode}"
+		fi
+
 		# Default Map
 		if [ -n "${defaultmap}" ]; then
 			echo -e "${blue}Default Map:\t${default}${defaultmap}"
 		fi
 
+		# Default Scenario
+		if [ -n "${defaultscenario}" ]; then
+			echo -e "${blue}Default Scenario:\t${default}${defaultscenario}"
+		fi
+
 		# Game type
 		if [ -n "${gametype}" ]; then
 			echo -e "${blue}Game type:\t${default}${gametype}"
@@ -444,6 +458,10 @@ fn_info_message_commandlineparms(){
 	echo -e "${lightgreen}Command-line Parameters${default}"
 	fn_info_message_password_strip
 	fn_messages_separator
+	if [ "${serverpassword}" == "NOT SET" ]; then
+		unset serverpassword
+	fi
+	fn_parms
 	echo -e "${executable} ${parms}"
 }
 
@@ -677,6 +695,17 @@ fn_info_message_hurtworld(){
 	} | column -s $'\t' -t
 }
 
+fn_info_message_inss(){
+	echo -e "netstat -atunp | grep Insurgency"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+		echo -e "> Query\tINBOUND\t${queryport}\tudp"
+		echo -e "> RCON\tINBOUND\t${rconport}\ttcp"
+	} | column -s $'\t' -t
+}
+
 fn_info_message_justcause2(){
 	echo -e "netstat -atunp | grep Jcmp-Server"
 	echo -e ""
@@ -1144,6 +1173,8 @@ fn_info_message_select_engine(){
 		fn_info_message_factorio
 	elif [ "${gamename}" == "Hurtworld" ]; then
 		fn_info_message_hurtworld
+	elif [ "${shortname}" == "inss" ]; then
+		fn_info_message_inss
 	elif [ "${gamename}" == "Just Cause 2" ]; then
 		fn_info_message_justcause2
 	elif [ "${gamename}" == "Just Cause 3" ]; then

+ 12 - 1
lgsm/functions/info_parms.sh

@@ -45,13 +45,22 @@ fn_info_parms_eco(){
 	queryport=${webadminport}
 }
 
-
 fn_info_parms_factorio(){
 	port=${port:-"0"}
 	rconport=${rconport:-"0"}
 	rconpassword=${rconpassword:-"NOT SET"}
 }
 
+fn_info_parms_inss(){
+	port=${port:-"0"}
+	queryport=${queryport:-"0"}
+	servername=${servername:-"NOT SET"}
+	serverpassword=${serverpassword:-"NOT SET"}
+	defaultmap=${defaultmap:-"NOT SET"}
+	defaultscenario=${defaultscenario:-"NOT SET"}
+	maxplayers=${maxplayers:-"0"}
+}
+
 fn_info_parms_hurtworld(){
 	servername=${servername:-"NOT SET"}
 	port=${port:-"0"}
@@ -158,6 +167,8 @@ elif [ "${gamename}" == "Eco" ]; then
 # Factorio
 elif [ "${gamename}" == "Factorio" ]; then
 	fn_info_parms_factorio
+elif [ "${shortname}" == "inss" ]; then
+	fn_info_parms_inss
 elif [ "${shortname}" == "kf2" ]; then
 	fn_info_parms_kf2
 # Project Zomboid

+ 17 - 3
lgsm/functions/query_gamedig.sh

@@ -73,10 +73,18 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
 	# will bypass query if server offline
 	check_status.sh
 	if [ "${status}" != "0" ]; then
-		# checks if query is working 0 = pass
-		querystatus=$(gamedig --type "${gamedigengine}" --host "${ip}" --query_port "${queryport}" | jq '.error|length')
-		# raw output
+		# checks if query is working null = pass
+		gamedigcmd=$(echo "gamedig --type \"${gamedigengine}\" --host \"${ip}\" --query_port \"${queryport}\"|jq")
 		gamedigraw=$(gamedig --type "${gamedigengine}" --host "${ip}" --query_port "${queryport}")
+		querystatus=$(echo "${gamedigraw}" | jq '.error|length')
+		
+		if [ "${querystatus}" != "null" ]; then
+			gamedigcmd=$(echo "gamedig --type \"${gamedigengine}\" --host \"${ip}\" --port \"${queryport}\"|jq")
+			gamedigraw=$(gamedig --type "${gamedigengine}" --host "${ip}" --port "${queryport}")
+			querystatus=$(echo "${gamedigraw}" | jq '.error|length')
+			
+		fi	
+		
 
 		# server name
 		gdname=$(echo "${gamedigraw}" | jq -re '.name')
@@ -102,6 +110,12 @@ if [ "$(command -v gamedig 2>/dev/null)" ]&&[ "$(command -v jq 2>/dev/null)" ];
 			gdmap=
 		fi
 
+		# current gamemode
+		gdgamemode=$(echo "${gamedigraw}" | jq -re '.raw.rules.GameMode_s')
+		if [ "${gdgamemode}" == "null" ]; then
+			gdgamemode=
+		fi
+
 		# numbots
 		gdbots=$(echo "${gamedigraw}" | jq -re '.raw.numbots')
 		if [ "${gdbots}" == "null" ]; then