Browse Source

refactor: remove unnecessary code duplication in info_game.sh

The commit removes duplicated code for retrieving server information from the game configuration file. Specifically, it removes redundant lines related to rconpassword, rconport, and serverpassword. This improves code readability and maintainability.
pull/4356/head
Daniel Gibbs 2 years ago
parent
commit
03d44e510d
No known key found for this signature in database GPG Key ID: 2076B128385E8C55
  1. 7
      lgsm/modules/info_game.sh

7
lgsm/modules/info_game.sh

@ -1138,25 +1138,18 @@ fn_info_game_col() {
# Filetype: cfg # Filetype: cfg
fn_info_game_cs2() { fn_info_game_cs2() {
if [ -f "${servercfgfullpath}" ]; then if [ -f "${servercfgfullpath}" ]; then
fn_info_game_valve_keyvalues "rconpassword" "rcon_password"
fn_info_game_valve_keyvalues "servername" "hostname" fn_info_game_valve_keyvalues "servername" "hostname"
fn_info_game_valve_keyvalues "serverpassword" "sv_password"
fi fi
# Steamport can be between 26901-26910 and is normally automatically set. # Steamport can be between 26901-26910 and is normally automatically set.
# Some servers might support -steamport parameter to set # Some servers might support -steamport parameter to set
if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then if [ "${steamport}" == "0" ] || [ -v "${steamport}" ]; then
steamport="$(echo "${ssinfo}" | grep "${srcdslinuxpid}" | awk '{print $5}' | grep ":269" | cut -d ":" -f2)" steamport="$(echo "${ssinfo}" | grep "${srcdslinuxpid}" | awk '{print $5}' | grep ":269" | cut -d ":" -f2)"
fi fi
clientport="${clientport:-"0"}"
defaultmap="${defaultmap:-"NOT SET"}" defaultmap="${defaultmap:-"NOT SET"}"
maxplayers="${maxplayers:-"0"}" maxplayers="${maxplayers:-"0"}"
port="${port:-"0"}" port="${port:-"0"}"
queryport="${port:-"0"}" queryport="${port:-"0"}"
rconpassword="${rconpassword:-"NOT SET"}"
rconport="${port:-"0"}"
servername="${servername:-"NOT SET"}" servername="${servername:-"NOT SET"}"
serverpassword="${serverpassword:-"NOT SET"}"
# steamport="${steamport:-"0"}" Steamport is optional so we dont want it to show as not set.
} }
# Config Type: ini # Config Type: ini

Loading…
Cancel
Save