Browse Source

feat(ets2): add game info

pull/4104/head
Marcin Jakubowski 3 years ago
parent
commit
ce829fa8e7
  1. 26
      lgsm/functions/info_game.sh
  2. 15
      lgsm/functions/info_messages.sh

26
lgsm/functions/info_game.sh

@ -1242,6 +1242,30 @@ fn_info_game_pvr() {
queryport=${port:-"0"}
}
fn_info_game_prism3d() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
maxplayers="${unavailable}"
port="${zero}"
queryport="${zero}"
servername="${unavailable}"
serverpassword="${unavailable}"
else
maxplayers=$(sed -nr 's/^\s*max_players\s*:\s*([0-9]+)/\1/p' "${servercfgfullpath}")
port=$(sed -nr 's/^\s*connection_dedicated_port\s*:\s*([0-9]+)/\1/p' "${servercfgfullpath}")
queryport=$(sed -nr 's/^\s*query_dedicated_port\s*:\s*([0-9]+)/\1/p' "${servercfgfullpath}")
servername=$(sed -nr 's/^\s*lobby_name\s*:\s*"(.*)"/\1/p' "${servercfgfullpath}")
serverpassword=$(sed -nr 's/^\s*password\s*:\s*"(.*)"/\1/p' "${servercfgfullpath}")
# Not set
maxplayers=${maxplayers:-"0"}
port=${port:-"27015"}
queryport=${queryport:-"27016"}
servername=${servername:-"NOT SET"}
serverpassword=${serverpassword:-"NOT SET"}
fi
}
fn_info_game_pz() {
# Config
if [ ! -f "${servercfgfullpath}" ]; then
@ -2515,6 +2539,8 @@ elif [ "${shortname}" == "wmc" ]; then
fn_info_game_wmc
elif [ "${shortname}" == "wurm" ]; then
fn_info_game_wurm
elif [ "${engine}" == "prism3d" ]; then
fn_info_game_prism3d
elif [ "${engine}" == "source" ] || [ "${engine}" == "goldsrc" ]; then
fn_info_game_source
elif [ "${engine}" == "unreal2" ]; then

15
lgsm/functions/info_messages.sh

@ -658,7 +658,7 @@ fn_info_message_ports_edit() {
startparameterslocation="${red}UNKNOWN${default}"
# engines/games that require editing in the config file.
local ports_edit_array=("ac" "arma3" "armar" "bo" "bt" "cd" "dst" "eco" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "mumble" "nec" "pc" "pc2" "pz" "qw" "refractor" "renderware" "rw" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "wurm")
local ports_edit_array=("ac" "arma3" "armar" "bo" "bt" "cd" "dst" "eco" "idtech2" "idtech3" "idtech3_ql" "jc2" "jc3" "lwjgl2" "mcb" "mumble" "nec" "pc" "pc2" "prism3d" "pz" "qw" "refractor" "renderware" "rw" "sb" "sdtd" "st" "stn" "ts3" "tw" "terraria" "unreal" "unreal2" "unreal3" "vints" "wurm")
for port_edit in "${ports_edit_array[@]}"; do
if [ "${shortname}" == "ut3" ]; then
startparameterslocation="${servercfgdir}/UTWeb.ini"
@ -689,6 +689,8 @@ fn_info_message_ports() {
echo -e "ss -tuplwn | grep bf1942_lnxded"
elif [ "${shortname}" == "mc" ] || [ "${shortname}" == "nec" ] || [ "${shortname}" == "pmc" ] || [ "${shortname}" == "rw" ] || [ "${shortname}" == "vpmc" ] || [ "${shortname}" == "wmc" ]; then
echo -e "ss -tuplwn | grep java"
elif [ "${shortname}" == "ets2" ]; then
echo -e "ss -tuplwn | grep eurotrucks2_ser"
elif [ "${shortname}" == "terraria" ]; then
echo -e "ss -tuplwn | grep Main"
elif [ "${engine}" == "source" ]; then
@ -1403,6 +1405,15 @@ fn_info_message_sol() {
fn_port "Files" filesport tcp
} | column -s $'\t' -t
}
fn_info_message_prism3d() {
{
fn_port "header"
fn_port "Game" port udp
fn_port "Query" queryport udp
} | column -s $'\t' -t
}
fn_info_message_source() {
{
fn_port "header"
@ -1824,6 +1835,8 @@ fn_info_message_select_engine() {
fn_info_message_wurm
elif [ "${engine}" == "goldsrc" ]; then
fn_info_message_goldsrc
elif [ "${engine}" == "prism3d" ]; then
fn_info_message_prism3d
elif [ "${engine}" == "source" ]; then
fn_info_message_source
elif [ "${engine}" == "spark" ]; then

Loading…
Cancel
Save