Przeglądaj źródła

Added quake 2 details

Daniel Gibbs 9 lat temu
rodzic
commit
f172233995
2 zmienionych plików z 29 dodań i 0 usunięć
  1. 11 0
      lgsm/functions/command_details.sh
  2. 18 0
      lgsm/functions/info_config.sh

+ 11 - 0
lgsm/functions/command_details.sh

@@ -386,6 +386,15 @@ fn_details_refractor(){
 	} | column -s $'\t' -t
 }
 
+fn_details_quake2(){
+	echo -e "netstat -atunp | grep quake2"
+	echo -e ""
+	{
+		echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL"
+		echo -e "> Game\tINBOUND\t${port}\tudp"
+	} | column -s $'\t' -t
+}
+
 fn_details_quake3(){
 	echo -e "netstat -atunp | grep q3ded"
 	echo -e ""
@@ -674,6 +683,8 @@ fn_display_details() {
 		fn_details_ark
 	elif [ "${gamename}" == "Hurtworld" ]; then
 		fn_details_hurtworld
+	elif [ "${gamename}" == "Quake 2" ]; then
+		fn_details_quake2
 	elif [ "${gamename}" == "Quake 3: Arena" ]; then
 		fn_details_quake3
 	elif [ "${gamename}" == "Quake Live" ]; then

+ 18 - 0
lgsm/functions/info_config.sh

@@ -154,6 +154,24 @@ fn_info_config_projectzomboid(){
 	fi
 }
 
+fn_info_config_quake2(){
+	if [ ! -f "${servercfgfullpath}" ]; then
+		rconpassword="${unavailable}"
+		servername="${unavailable}"
+		serverpassword="${unavailable}"
+		slots="${zero}"
+	else
+		rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set rcon_password//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set hostname//g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
+		slots=$(grep "maxclients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
+
+		# Not Set
+		rconpassword=${rconpassword:-"NOT SET"}
+		servername=${servername:-"NOT SET"}
+		slots=${slots:-"0"}
+	fi
+}
+
 fn_info_config_quake3(){
 	if [ ! -f "${servercfgfullpath}" ]; then
 		rconpassword="${unavailable}"