diff --git a/lgsm/modules/command_dev_details.sh b/lgsm/modules/command_dev_details.sh index 41e165253..2525be7f7 100644 --- a/lgsm/modules/command_dev_details.sh +++ b/lgsm/modules/command_dev_details.sh @@ -17,16 +17,23 @@ echo -e "" echo -e "Game: ${gamename}" echo -e "Config type: ${configtype}" echo -e "Config file: ${servercfgfullpath}" +if [ -f "${clustercfgfullpath}" ]; then + echo -e "Cluster config file: ${clustercfgfullpath}" +fi echo -e "Carriage Return: ${carriagereturn}" # Create an associative array of the server details. declare -A server_details=( ['Admin Password']="${adminpassword}" + ['Cave']="${cave}" + ['Cluster']="${cluster}" ['Config IP']="${configip}" ['Default Map']="${defaultmap}" ['Game Mode']="${gamemode}" ['Game Type']="${gametype}" ['ip']="${ip}" + ['Master Port']="${masterport}" + ['Master']="${master}" ['Maxplayers']="${maxplayers}" ['Port']="${port}" ['Query Port']="${queryport}" @@ -36,12 +43,17 @@ declare -A server_details=( ['Reserved Slots']="${reservedslots}" ['Server Password']="${serverpassword}" ['Servername']="${servername}" + ['Shard']="${shard}" + ['Sharding']="${sharding}" + ['Steam Auth Port']="${steamauthport}" + ['Steam Master Port']="${steammasterport}" ['Tickrate']="${tickrate}" ['Web Admin Enabled']="${webadminenabled}" ['Web Admin Password']="${webadminpassword}" ['Web Admin User']="${webadminuser}" ['World Name']="${worldname}" ['World Type']="${worldtype}" + ) # Initialize a variable to keep track of missing server details. diff --git a/lgsm/modules/info_game.sh b/lgsm/modules/info_game.sh index 3538cacbf..02727d1e4 100644 --- a/lgsm/modules/info_game.sh +++ b/lgsm/modules/info_game.sh @@ -28,10 +28,7 @@ fn_info_game_ini() { # q at the end of the s command tells sed to quit after the first match. # tr -d '\r' removes CRLF carriage returns from the end of the line. - if [ -n "${3}" ]; then - servercfgfullpath="${3}" - fi - eval "${1}=\"$(sed -n '/^[[:space:]]*\<'"${2}"'\>/ { s/.*= *"\?\([^"]*\)"\?/\1/p;q }' "${servercfgfullpath}" | tr -d '\r')\"" + eval "${1}=\"$(sed -n '/^[[:space:]]*\<'"${2}"'\>/ { s/.*= *"\?\([^"]*\)"\?/\1/p;q }' "${3}" | tr -d '\r')\"" configtype="ini" } @@ -50,38 +47,25 @@ fn_info_game_quakec() { # p at the end of the s command tells sed to print the resulting line if there was a match. # q at the end of the s command tells sed to quit after the first match. - if [ -n "${3}" ]; then - servercfgfullpath="${3}" - fi - eval "${1}"="$(sed -n "s/^.*${2}\s\+\"\(.*\)\"/\1/p;q" "${servercfgfullpath}")" - + eval "${1}"="$(sed -n "s/^.*${2}\s\+\"\(.*\)\"/\1/p;q" "${3}")" } # Config Type: json # Comment: // or /* */ fn_info_game_json() { - if [ -n "${3}" ]; then - servercfgfullpath="${3}" - fi - eval "${1}"="$(jq -r '${2}' "${servercfgfullpath}")" + eval "${1}"="$(jq -r '${2}' "${3}")" } # Config Type: SQF # Comment: // or /* */ fn_info_game_sqf() { - if [ -n "${3}" ]; then - servercfgfullpath="${3}" - fi - eval "${1}"="$(sed -n "/^[^/]*${2} = \"\(.*\)\";/{s//\1/;p;q;}" "${servercfgfullpath}")" + eval "${1}"="$(sed -n "/^[^/]*${2} = \"\(.*\)\";/{s//\1/;p;q;}" "${3}")" } # Config Type: XML # Comment: fn_info_game_xml() { - if [ -n "${3}" ]; then - servercfgfullpath="${3}" - fi - eval "${1}"="$(xmllint --xpath "string(${2})" "${servercfgfullpath}")" + eval "${1}"="$(xmllint --xpath "string(${2})" "${3}")" } # Config Type: ini @@ -216,6 +200,11 @@ fn_info_game_dodr() { # Example: cluster_name = SERVERNAME # Filetype: ini fn_info_game_dst() { + if [ -f "${servercfgfullpath}" ]; then + fn_info_game_ini "port" "server_port" "${servercfgfullpath}" + fn_info_game_ini "steamauthport" "authentication_port" "${servercfgfullpath}" + fn_info_game_ini "steammasterport" "master_server_port" "${servercfgfullpath}" + fi if [ -f "${clustercfgfullpath}" ]; then fn_info_game_ini "maxplayers" "max_players" "${clustercfgfullpath}" fn_info_game_ini "servername" "cluster_name" "${clustercfgfullpath}" @@ -225,11 +214,6 @@ fn_info_game_dst() { fn_info_game_ini "gamemode" "game_mode" "${clustercfgfullpath}" fn_info_game_ini "configip" "bind_ip" "${clustercfgfullpath}" fi - if [ -f "${servercfgfullpath}" ]; then - fn_info_game_ini "port" "server_port" "${servercfgfullpath}" - fn_info_game_ini "steamauthport" "authentication_port" "${servercfgfullpath}" - fn_info_game_ini "steammasterport" "master_server_port" "${servercfgfullpath}" - fi cave="${cave:-"NOT SET"}" cluster="${cluster:-"NOT SET"}" configip="${configip:-"0.0.0.0"}"