diff --git a/lgsm/functions/command_details.sh b/lgsm/functions/command_details.sh index 9d9d8fddc..3be04f541 100644 --- a/lgsm/functions/command_details.sh +++ b/lgsm/functions/command_details.sh @@ -168,6 +168,11 @@ fn_details_gameserver(){ echo -e "${blue}dbplugin:\t${default}${dbplugin}" fi + # ASE (Multi Theft Auto) + if [ -n "${ase}" ]; then + echo -e "${blue}ASE:\t${default}${ase}" + fi + # Online status if [ "${status}" == "0" ]; then echo -e "${blue}Status:\t${red}OFFLINE${default}" @@ -310,7 +315,7 @@ fn_details_ports(){ parmslocation="${red}UNKNOWN${default}" # engines that require editing in the config file - local ports_edit_array=( "avalanche" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "projectzomboid" "quake" "refractor" "realvirtuality" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" ) + local ports_edit_array=( "avalanche" "dontstarve" "idtech2" "idtech3" "idtech3_ql" "lwjgl2" "projectzomboid" "quake" "refractor" "realvirtuality" "seriousengine35" "teeworlds" "terraria" "unreal" "unreal2" "unreal3" "TeamSpeak 3" "Mumble" "7 Days To Die" "RenderWare" ) for port_edit in "${ports_edit_array[@]}" do if [ "${engine}" == "${port_edit}" ]||[ "${gamename}" == "${port_edit}" ]; then @@ -701,6 +706,19 @@ fn_details_ark(){ } | column -s $'\t' -t } +fn_details_mta(){ + echo -e "netstat -atunp | grep mta-server64" + echo -e "" + { + echo -e "DESCRIPTION\tDIRECTION\tPORT\tPROTOCOL\tINI VARIABLE" + echo -e "> Game\tOUTBOUND\t${port}\tudp\tPort=${port}" + echo -e "> HTTP Server\tINBOUND\t${httpport}\ttcp" + if [ "${ase}" == "Enabled" ]; then + echo -e "> ASE Game_Monitor\tOUTBOUND\t$((${port} + 123))\tudp" + fi + } | column -s $'\t' -t +} + # Run checks and gathers details to display. fn_display_details() { @@ -716,7 +734,7 @@ fn_display_details() { fn_details_script fn_details_backup # Some game servers do not have parms. - if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]; then + if [ "${gamename}" != "TeamSpeak 3" ]&&[ "${engine}" != "avalanche" ]&&[ "${engine}" != "dontstarve" ]&&[ "${engine}" != "projectzomboid" ]&&[ "${engine}" != "RenderWare" ]; then fn_parms fn_details_commandlineparms fi @@ -783,6 +801,8 @@ fn_display_details() { fn_details_rust elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then fn_details_wolfensteinenemyterritory + elif [ "${gamename}" == "Multi Theft Auto" ]; then + fn_details_mta else fn_print_error_nl "Unable to detect server engine." fi diff --git a/lgsm/functions/info_config.sh b/lgsm/functions/info_config.sh index 829bba841..a5fbf1a40 100644 --- a/lgsm/functions/info_config.sh +++ b/lgsm/functions/info_config.sh @@ -576,6 +576,38 @@ fn_info_config_sdtd(){ fi } +fn_info_config_mta(){ + if [ ! -f "${servercfgfullpath}" ]; then + port="${unavailable}" + httpport="${unavailable}" + ase="${unavailable}" + servername="${unavailable}" + serverpassword="${unavailable}" + maxplayers="${zero}" + else + port=$(grep -m 1 "serverport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]') + httpport=$(grep -m 1 "httpport" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]') + ase=$(grep -m 1 "ase" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]') + servername=$(grep -m 1 "servername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<") + serverpassword=$(grep -m 1 "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<") + maxplayers=$(grep -m 1 "maxplayers" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's///g' | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//' | cut -f1 -d "<" | tr -cd '[:digit:]') + + if [ "${ase}" == "1" ]; then + ase="Enabled" + else + ase="Disabled" + fi + + # Not Set + port=${port:-"NOT SET - Defaults to 22003"} + httpport=${httpport:-"NOT SET - Defaults to 22005"} + ase=${ase:-"NOT SET - Defaults to Disabled"} + servername=${servername:-"NOT SET"} + serverpassword=${serverpassword:-"NOT SET - Defaults to none"} + maxplayers=${maxplayers:-"0"} + fi +} + # Just Cause 2 if [ "${engine}" == "avalanche" ]; then fn_info_config_avalanche @@ -643,4 +675,6 @@ elif [ "${gamename}" == "7 Days To Die" ]; then fn_info_config_sdtd elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then fn_info_config_wolfensteinenemyterritory -fi \ No newline at end of file +elif [ "${gamename}" == "Multi Theft Auto" ]; then + fn_info_config_mta +fi