Browse Source

Working on info_parms

pull/1477/head
Daniel Gibbs 8 years ago
parent
commit
2717fedd2d
  1. 176
      lgsm/functions/info_parms.sh

176
lgsm/functions/info_parms.sh

@ -2,7 +2,7 @@
# LinuxGSM info_parms.sh function
# Author: Daniel Gibbs
# Website: https://gameservermanagers.com
# Description: Gets specific details from server parameters.
# Description: If specific parms are not set then this will be displayed in details.
local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
@ -15,139 +15,95 @@ local function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
unavailable="${red}UNAVAILABLE${default}"
zero="${red}0${default}"
fn_info_config_quakelive(){
# Not Set
port=${port:-"NOT SET"}
fn_info_parms_ark(){
port=${port:-"0"}
queryport=${queryport:-"0"}
rconport=${rconport:-"0"}
rconpassword=${rconpassword:-"NOT SET"}
statsport=${statsport:-"0"}
statspassword=${statspassword:-"NOT SET"}
mappool=${mappool:-"NOT SET"}
rconpassword=${rconpassword:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
}
fn_info_config_source(){
fn_info_parms_realvirtuality(){
port=${port:-"0"}
}
fn_info_parms_cod(){
defaultmap=${defaultmap:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"0"}
clientport=${clientport:-"0"}
}
fn_info_config_spark(){
# Not Set
fn_info_parms_dst(){
sharding=${sharding:-"NOT SET"}
master=${master:-"NOT SET"}
shard=${shard:-"NOT SET"}
cluster=${cluster:-"NOT SET"}
cave=${cave:-"NOT SET"}
fn_info_parms_factorio(){
port=${port:-"0"}
queryport=$((port + 1))
maxplayers=${maxplayers:-"0"}
webadminuser=${webadminuser:-"NOT SET"}
webadminpass=${webadminpass:-"NOT SET"}
webadminport=${webadminport:-"0"}
rconport=${rconport:-"0"}
rconpassword=${rconpassword:-"NOT SET"}
}
fn_info_config_teeworlds(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="unnamed server"
serverpassword="${unavailable}"
rconpassword="${unavailable}"
port="8303"
maxplayers="12"
else
servername=$(grep "sv_name" "${servercfgfullpath}" | sed 's/sv_name //g' | sed 's/"//g')
serverpassword=$(grep "password " "${servercfgfullpath}" | awk '!/sv_rcon_password/'| sed 's/password //g' | tr -d '=\"; ')
rconpassword=$(grep "sv_rcon_password" "${servercfgfullpath}" | sed 's/sv_rcon_password //g' | tr -d '=\"; ')
port=$(grep "sv_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
maxplayers=$(grep "sv_max_clients" "${servercfgfullpath}" | tr -cd '[:digit:]')
fn_info_parms_hurtworld(){
servername=${defaultmap:-"NOT SET"}
port=${port:-"0"}
queryport=${queryport:-"0"}
maxplayers=${maxplayers:-"0"}
defaultmap=${defaultmap:-"NOT SET"}
creativemode=${creativemode:-"NOT SET"}
x64mode=${creativemode:-"NOT SET"}
admins=""
# Not Set
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
rconpassword=${rconpassword:-"NOT SET"}
port=${port:-"8303"}
maxplayers=${maxplayers:-"12"}
fi
## Advanced Server Start Settings
# Rollback server state (remove after start command)
loadsave=""
# Use unstable 64 bit server executable (O/1)
x64mode="0"
}
fn_info_config_terraria(){
if [ ! -f "${servercfgfullpath}" ]; then
port="0"
else
port=$(grep "port=" "${servercfgfullpath}" | tr -cd '[:digit:]')
# Not Set
port=${port:-"0"}
fi
fn_info_parms_source(){
defaultmap=${defaultmap:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"0"}
clientport=${clientport:-"0"}
}
fn_info_config_unreal(){
if [ ! -f "${servercfgfullpath}" ]; then
servername="${unavailable}"
serverpassword="${unavailable}"
adminpassword="${unavailable}"
port="${zero}"
gsqueryport="${zero}"
webadminenabled="${unavailable}"
webadminport="${zero}"
webadminuser="${unavailable}"
webadminpass="${unavailable}"
else
servername=$(grep "ServerName=" "${servercfgfullpath}" | sed 's/ServerName=//g')
serverpassword=$(grep "GamePassword=" "${servercfgfullpath}" | sed 's/GamePassword=//g')
adminpassword=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/AdminPassword=//g')
port=$(grep "Port=" "${servercfgfullpath}" | grep -v "Master" | grep -v "LAN" | grep -v "Proxy" | grep -v "Listen" | tr -d '\r' | tr -cd '[:digit:]')
gsqueryport=$(grep "OldQueryPortNumber=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
webadminenabled=$(grep "bEnabled=" "${servercfgfullpath}" | sed 's/bEnabled=//g' | tr -d '\r')
webadminport=$(grep "ListenPort=" "${servercfgfullpath}" | tr -d '\r' | tr -cd '[:digit:]')
if [ "${engine}" == "unreal" ]; then
webadminuser=$(grep "AdminUsername=" "${servercfgfullpath}" | sed 's/\AdminUsername=//g')
webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 2 | grep "AdminPassword=" | sed 's/\AdminPassword=//g')
else
webadminuser=$(grep "AdminName=" "${servercfgfullpath}" | sed 's/\AdminName=//g')
webadminpass=$(grep "AdminPassword=" "${servercfgfullpath}" | sed 's/\AdminPassword=//g')
fi
fn_info_parms_spark(){
defaultmap=${defaultmap:-"NOT SET"}
maxplayers=${maxplayers:-"0"}
port=${port:-"0"}
queryport=$((port + 1))
servername=${servername:-"NOT SET"}
webadminuser=${webadminuser:-"NOT SET"}
webadminpass=${webadminpass:-"NOT SET"}
webadminport=${webadminport:-"0"}
mods=${mods:-"NOT SET"}
password=${password:-"NOT SET"}
}
# Not Set
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
adminpassword=${adminpassword:-"NOT SET"}
port=${port:-"0"}
gsqueryport=${gsqueryport:-"NOT SET"}
webadminenabled=${webadminenabled:-"NOT SET"}
webadminport=${webadminport:-"NOT SET"}
webadminuser=${webadminuser:-"NOT SET"}
webadminpass=${webadminpass:-"NOT SET"}
fi
fn_info_parms_unreal(){
:
}
## Just Cause 2
if [ "${engine}" == "avalanche" ]; then
fn_info_config_avalanche
## Dont Starve Together
elif [ "${engine}" == "dontstarve" ]; then
fn_info_config_dontstarve
## Project Zomboid
elif [ "${engine}" == "projectzomboid" ]; then
fn_info_config_projectzomboid
# Quake Live
elif [ "${gamename}" == "Quake Live" ]; then
fn_info_config_quakelive
# ARK: Survival Evolved
if [ "${gamename}" == "ARK: Survival Evolved" ]; then
fn_info_parms_ark
# ARMA 3
elif [ "${engine}" == "realvirtuality" ]; then
fn_info_config_realvirtuality
# Serious Sam
elif [ "${engine}" == "seriousengine35" ]; then
fn_info_config_seriousengine35
# Source Engine Games
fn_info_parms_realvirtuality
# Call of Duty
elif [ "${gamename}" == "Call of Duty" ]||[ "${gamename}" == "Call of Duty: United Offensive" ]||[ "${engine}" == "iw2.0" ]||[ "${engine}" == "iw3.0" ]; then
fn_info_parms_cod
# Factorio
elif [ "${gamename}" == "Factorio" ]; then
fn_info_parms_factorio
elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
fn_info_config_source
fn_info_parms_source
# Spark
elif [ "${engine}" == "spark" ]; then
fn_info_config_spark
# Teeworlds
elif [ "${engine}" == "teeworlds" ]; then
fn_info_config_teeworlds
# Terraria
elif [ "${engine}" == "terraria" ]; then
fn_info_config_terraria
fn_info_parms_spark
# Unreal/Unreal 2 engine
elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
fn_info_config_unreal
fn_info_parms_unreal
fi

Loading…
Cancel
Save