info_config.sh 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. #!/bin/bash
  2. # LGSM info_config.sh function
  3. # Author: Daniel Gibbs
  4. # Contributor: UltimateByte
  5. # Website: https://gameservermanagers.com
  6. # Description: Gets specific details from config files.
  7. function_selfname="$(basename $(readlink -f "${BASH_SOURCE[0]}"))"
  8. ## Examples of filtering to get info from config files
  9. # sed 's/foo//g' - remove foo
  10. # tr -cd '[:digit:]' leave only digits
  11. # tr -d '=\"; ' remove selected characters =\";
  12. # grep -v "foo" filter out lines that contain foo
  13. # cut -f1 -d "/" remove everything after /
  14. gamename=$1
  15. engine=$2
  16. servercfgfullpath=$3
  17. echo "Game Name: ${gamename}"
  18. echo "Engine: ${engine}"
  19. echo "servercfgfullpath: ${servercfgfullpath}"
  20. echo "#####################"
  21. unavailable="${red}UNAVAILABLE${default}"
  22. zero="${red}0${default}"
  23. fn_info_config_avalanche(){
  24. if [ ! -f "${servercfgfullpath}" ]; then
  25. servername="${unavailable}"
  26. serverpassword="${unavailable}"
  27. slots="${zero}"
  28. port="${zero}"
  29. else
  30. servername=$(grep "Name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/Name//g' | tr -d '=\";,:' | xargs)
  31. serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/Password//g' | tr -d '=\";,:' | xargs)
  32. slots=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]')
  33. port=$(grep "BindPort" "${servercfgfullpath}" | grep -v "\--" | tr -cd '[:digit:]')
  34. # Not Set
  35. servername=${servername:-"NOT SET"}
  36. serverpassword=${serverpassword:-"NOT SET"}
  37. slots=${slots:-"0"}
  38. port=${port:-"0"}
  39. # check if the ip exists in the config file. Failing this will fall back to the default.
  40. ipconfigcheck=$(grep "BindIP" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/BindIP//g' | tr -d '=\";,:' | xargs)
  41. if [ -n "${ipconfigcheck}" ]; then
  42. ip="${ipconfigcheck}"
  43. fi
  44. fi
  45. }
  46. fn_info_config_dontstarve(){
  47. if [ ! -f "${servercfgfullpath}" ]; then
  48. servername="${unavailable}"
  49. serverpassword="${unavailable}"
  50. slots="${zero}"
  51. gamemode="${unavailable}"
  52. tickrate="${zero}"
  53. port="${zero}"
  54. else
  55. servername=$(grep "default_server_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/default_server_name//g' | tr -d '=\";,:' | xargs)
  56. serverpassword=$(grep "server_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_password//g' | tr -d '=\";,:' | xargs)
  57. slots=$(grep "max_players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  58. gamemode=$(grep "game_mode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/game_mode//g' | tr -d '=\";,:' | xargs)
  59. tickrate=$(grep "tick_rate" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  60. port=$(grep "server_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  61. # Not Set
  62. servername=${servername:-"NOT SET"}
  63. serverpassword=${serverpassword:-"NOT SET"}
  64. slots=${slots:-"0"}
  65. gamemode=${gamemode:-"NOT SET"}
  66. tickrate=${tickrate:-"0"}
  67. port=${port:-"0"}
  68. fi
  69. }
  70. fn_info_config_minecraft(){
  71. if [ ! -f "${servercfgfullpath}" ]; then
  72. servername="${unavailable}"
  73. rconpassword="${unavailable}"
  74. rconport="${zero}"
  75. slots="${zero}"
  76. port="${zero}"
  77. gamemode="${unavailable}"
  78. gameworld="${unavailable}"
  79. else
  80. servername=$(grep "motd" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/motd//g' | tr -d '=\";,:' | xargs)
  81. rconpassword=$(grep "rcon.password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/rcon.password//g' | tr -d '=\";,:' | xargs)
  82. rconport=$(grep "rcon.port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  83. slots=$(grep "max-players" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  84. port=$(grep "server-port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  85. gamemode=$(grep "gamemode" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  86. gameworld=$(grep "level-name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/level-name//g' | tr -d '=\";,:' | xargs)
  87. # Not Set
  88. servername=${servername:-"NOT SET"}
  89. rconpassword=${rconpassword:-"NOT SET"}
  90. rconport=${rconport:-"NOT SET"}
  91. slots=${slots:-"NOT SET"}
  92. port=${port:-"NOT SET"}
  93. gamemode=${gamemode:-"NOT SET"}
  94. gameworld=${gameworld:-"NOT SET"}
  95. # check if the ip exists in the config file. Failing this will fall back to the default.
  96. ipconfigcheck=$(grep "server-ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^--/d' -e 's/server-ip//g' | tr -d '=\";,:' | xargs)
  97. if [ -n "${ipconfigcheck}" ]; then
  98. ip="${ipconfigcheck}"
  99. fi
  100. fi
  101. }
  102. fn_info_config_projectzomboid(){
  103. if [ ! -f "${servercfgfullpath}" ]; then
  104. servername="${unavailable}"
  105. serverpassword="${unavailable}"
  106. rconpassword="${unavailable}"
  107. slots="${zero}"
  108. port="${zero}"
  109. gameworld="${unavailable}"
  110. else
  111. servername=$(grep "PublicName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/PublicName//g' | tr -d '=\";,:' | xargs)
  112. serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Password" | sed -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | xargs)
  113. rconpassword=$(grep "RCONPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/RCONPassword//g' | tr -d '=\";,:' | xargs)
  114. slots=$(grep "MaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  115. port=$(grep "DefaultPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  116. gameworld=$(grep "Map" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Map" | sed -e '/^#/d' -e 's/Map//g' | tr -d '=\";' | xargs)
  117. # Not Set
  118. servername=${servername:-"NOT SET"}
  119. serverpassword=${serverpassword:-"NOT SET"}
  120. rconpassword=${rconpassword:-"NOT SET"}
  121. slots=${slots:-"NOT SET"}
  122. port=${port:-"NOT SET"}
  123. gameworld=${gameworld:-"NOT SET"}
  124. fi
  125. }
  126. fn_info_config_idtech3(){
  127. if [ ! -f "${servercfgfullpath}" ]; then
  128. rconpassword="${unavailable}"
  129. servername="${unavailable}"
  130. serverpassword="${unavailable}"
  131. slots="${zero}"
  132. else
  133. rconpassword=$(grep "zmq_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set zmq_rcon_password//g' | tr -d '=\";,:' | xargs)
  134. servername=$(grep "sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname//g' | tr -d '=\";,:' | xargs)
  135. serverpassword=$(grep "g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password//g' | tr -d '=\";,:' | xargs)
  136. slots=$(grep "sv_maxClients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  137. # Not Set
  138. rconpassword=${rconpassword:-"NOT SET"}
  139. servername=${servername:-"NOT SET"}
  140. serverpassword=${serverpassword:-"NOT SET"}
  141. slots=${slots:-"0"}
  142. fi
  143. }
  144. fn_info_config_realvirtuality(){
  145. if [ ! -f "${servercfgfullpath}" ]; then
  146. servername="${unavailable}"
  147. adminpassword="${unavailable}"
  148. serverpassword="${unavailable}"
  149. slots="${zero}"
  150. else
  151. servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/hostname//g' | tr -d '=\";,:' | xargs)
  152. adminpassword=$(grep "passwordAdmin" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/passwordAdmin//g' | tr -d '=\";,:' | xargs)
  153. serverpassword=$(grep "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/password//g' | tr -d '=\";,:' | xargs)
  154. slots=$(grep "maxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  155. # Not Set
  156. servername=${servername:-"NOT SET"}
  157. adminpassword=${adminpassword:-"NOT SET"}
  158. serverpassword=${serverpassword:-"NOT SET"}
  159. slots=${slots:-"0"}
  160. fi
  161. }
  162. fn_info_config_seriousengine35(){
  163. if [ ! -f "${servercfgfullpath}" ]; then
  164. servername="${unavailable}"
  165. rconpassword="${unavailable}"
  166. gamemode="${unavailable}"
  167. slots="${zero}"
  168. port="${zero}"
  169. else
  170. servername=$(grep "prj_strMultiplayerSessionName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/prj_strMultiplayerSessionName//g' | tr -d '=\";,:' | xargs)
  171. rconpassword=$(grep "rcts_strAdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/rcts_strAdminPassword//g' | tr -d '=\";,:' | xargs)
  172. gamemode=$(grep "gam_idGameMode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/gam_idGameMode//g' | tr -d '=\";,:' | xargs)
  173. slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  174. port=$(grep "prj_uwPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  175. # Not Set
  176. servername=${servername:-"NOT SET"}
  177. rconpassword=${rconpassword:-"NOT SET"}
  178. gamemode=${gamemode:-"NOT SET"}
  179. slots=${slots:-"0"}
  180. port=${port:-"0"}
  181. fi
  182. }
  183. fn_info_config_source(){
  184. if [ ! -f "${servercfgfullpath}" ]; then
  185. servername="${unavailable}"
  186. serverpassword="${unavailable}"
  187. rconpassword="${unavailable}"
  188. else
  189. servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/hostname//g' | tr -d '=\";,:' | xargs)
  190. serverpassword=$(grep "sv_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/sv_password//g' | tr -d '=\";,:' | xargs)
  191. rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/rcon_password//g' | tr -d '=\";,:' | xargs)
  192. # Not Set
  193. servername=${servername:-"NOT SET"}
  194. serverpassword=${serverpassword:-"NOT SET"}
  195. rconpassword=${rconpassword:-"NOT SET"}
  196. fi
  197. }
  198. fn_info_config_starbound(){
  199. if [ ! -f "${servercfgfullpath}" ]; then
  200. servername="${unavailable}"
  201. rconpassword="${unavailable}"
  202. port="21025"
  203. queryport="21025"
  204. rconport="21026"
  205. slots="8"
  206. else
  207. servername=$(grep "serverName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/serverName//g' | tr -d '=\";,:' | xargs)
  208. rconpassword=$(grep "rconServerPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/rconServerPassword//g' | tr -d '=\";,:' | xargs)
  209. port=$(grep "gameServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  210. queryport=$(grep "queryServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  211. rconport=$(grep "rconServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  212. slots=$(grep "maxPlayers" "${servercfgfullpath}" | tr -cd '[:digit:]')
  213. # Not Set
  214. servername=${servername:-"NOT SET"}
  215. rconpassword=${rconpassword:-"NOT SET"}
  216. port=${port:-"21025"}
  217. queryport=${queryport:-"21025"}
  218. rconport=${rconport:-"21026"}
  219. slots=${slots:-"8"}
  220. fi
  221. }
  222. fn_info_config_teamspeak3(){
  223. if [ ! -f "${servercfgfullpath}" ]; then
  224. dbplugin="${unavailable}"
  225. port="9987"
  226. queryport="10011"
  227. fileport="30033"
  228. else
  229. dbplugin=$(grep "dbplugin=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/dbplugin=//g' | tr -d '=\";,:' | xargs)
  230. port=$(grep "default_voice_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
  231. queryport=$(grep "query_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  232. fileport=$(grep "filetransfer_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  233. # Not Set
  234. port=${port:-"9987"}
  235. queryport=${queryport:-"10011"}
  236. fileport=${fileport:-"30033"}
  237. # check if the ip exists in the config file. Failing this will fall back to the default.
  238. ipconfigcheck=$(grep "voice_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/voice_ip//g' | tr -d '=\";,:' | xargs)
  239. if [ -n "${ipconfigcheck}" ]; then
  240. ip="${ipconfigcheck}"
  241. fi
  242. fi
  243. }
  244. fn_info_config_mumble(){
  245. if [ ! -f "${servercfgfullpath}" ]; then
  246. port="64738"
  247. queryport="${port}"
  248. servername="Mumble"
  249. else
  250. port=$(grep "port" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^;/d' -e 's/port//g' | tr -d '=\";,:' | xargs)
  251. queryport="${port}"
  252. # Not Set
  253. port=${port:-"64738"}
  254. queryport=${queryport:-"64738"}
  255. servername="Mumble Port ${port}"
  256. # check if the ip exists in the config file. Failing this will fall back to the default.
  257. ipconfigcheck=$(cat "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^;/d' -e 's/voice_ip//g' | tr -d '=\";,:' | xargs)
  258. if [ -n "${ipconfigcheck}" ]; then
  259. ip="${ipconfigcheck}"
  260. fi
  261. fi
  262. }
  263. fn_info_config_teeworlds(){
  264. if [ ! -f "${servercfgfullpath}" ]; then
  265. servername="unnamed server"
  266. serverpassword="${unavailable}"
  267. rconpassword="${unavailable}"
  268. port="8303"
  269. slots="12"
  270. else
  271. servername=$(grep "sv_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/^sv_name//g' | tr -d '=\";,:' | xargs)
  272. serverpassword=$(grep "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^password" | sed -e '/^#/d' -e 's/^password//g' | tr -d '=\";,:' | xargs)
  273. rconpassword=$(grep "sv_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/^sv_rcon_password//g' | tr -d '=\";,:' | xargs)
  274. port=$(grep "sv_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  275. slots=$(grep "sv_max_clients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  276. # Not Set
  277. servername=${servername:-"NOT SET"}
  278. serverpassword=${serverpassword:-"NOT SET"}
  279. rconpassword=${rconpassword:-"NOT SET"}
  280. port=${port:-"8303"}
  281. slots=${slots:-"12"}
  282. fi
  283. }
  284. fn_info_config_terraria(){
  285. if [ ! -f "${servercfgfullpath}" ]; then
  286. servername="${unavailable}"
  287. port="${zero}"
  288. gameworld="${unavailable}"
  289. slots="${zero}"
  290. else
  291. servername=$(grep "worldname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/worldname//g' | tr -d '=\";,:' | xargs)
  292. port=$(grep "port" "${servercfgfullpath}" | tr -cd '[:digit:]')
  293. gameworld=$(grep "world=" "${servercfgfullpath}" | grep -v "#" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/world=//g' | tr -d '=\";,:' | xargs)
  294. slots=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  295. # Not Set
  296. servername=${servername:-"NOT SET"}
  297. port=${port:-"0"}
  298. gameworld=${gameworld:-"NOT SET"}
  299. slots=${slots:-"0"}
  300. fi
  301. }
  302. fn_info_config_unreal(){
  303. if [ ! -f "${servercfgfullpath}" ]; then
  304. servername="${unavailable}"
  305. serverpassword="${unavailable}"
  306. adminpassword="${unavailable}"
  307. port="${zero}"
  308. gsqueryport="${zero}"
  309. webadminenabled="${unavailable}"
  310. webadminport="${zero}"
  311. webadminuser="${unavailable}"
  312. webadminpass="${unavailable}"
  313. else
  314. servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | xargs)
  315. serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | xargs)
  316. adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | xargs)
  317. port=$(grep "Port" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Port" | grep -v "#" | tr -cd '[:digit:]')
  318. gsqueryport=$(grep "OldQueryPortNumber" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  319. webadminenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | xargs)
  320. webadminport=$(grep "ListenPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  321. if [ "${engine}" == "unreal" ]; then
  322. webadminuser=$(grep "AdminUsername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminUsername//g' | tr -d '=\";,:' | xargs)
  323. webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 4 | grep "AdminPassword" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | xargs)
  324. else
  325. webadminuser=$(grep "AdminName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminName//g' | tr -d '=\";,:' | xargs)
  326. webadminpass="${adminpassword}"
  327. fi
  328. # Not Set
  329. servername=${servername:-"NOT SET"}
  330. serverpassword=${serverpassword:-"NOT SET"}
  331. adminpassword=${adminpassword:-"NOT SET"}
  332. port=${port:-"0"}
  333. gsqueryport=${gsqueryport:-"0"}
  334. webadminenabled=${webadminenabled:-"NOT SET"}
  335. webadminport=${webadminport:-"0"}
  336. webadminuser=${webadminuser:-"NOT SET"}
  337. webadminpass=${webadminpass:-"NOT SET"}
  338. fi
  339. }
  340. fn_info_config_sdtd(){
  341. if [ ! -f "${servercfgfullpath}" ]; then
  342. servername="${unavailable}"
  343. serverpassword="${unavailable}"
  344. port="${zero}"
  345. queryport="${zero}"
  346. webadminenabled="${unavailable}"
  347. webadminport="${zero}"
  348. webadminpass="${unavailable}"
  349. telnetenabled="${unavailable}"
  350. telnetport="${zero}"
  351. telnetpass="${unavailable}"
  352. slots="${unavailable}"
  353. gamemode="${unavailable}"
  354. gameworld="${unavailable}"
  355. else
  356. servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  357. serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  358. port=$(grep "ServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  359. queryport=$((port + 1))
  360. webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  361. webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  362. webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  363. telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  364. telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  365. telnetpass=$(grep "TelnetPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  366. slots=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd '[:digit:]')
  367. gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  368. gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  369. # Not Set
  370. servername=${servername:-"NOT SET"}
  371. serverpassword=${serverpassword:-"NOT SET"}
  372. port=${port:-"0"}
  373. queryport=${queryport:-"0"}
  374. webadminenabled=${webadminenabled:-"NOT SET"}
  375. webadminport=${webadminport:-"0"}
  376. webadminpass=${webadminpass:-"NOT SET"}
  377. telnetenabled=${telnetenabled:-"NOT SET"}
  378. telnetport=${telnetport:-"0"}
  379. telnetpass=${telnetpass:-"NOT SET"}
  380. slots=${slots:-"NOT SET"}
  381. gamemode=${gamemode:-"NOT SET"}
  382. gameworld=${gameworld:-"NOT SET"}
  383. fi
  384. }
  385. # Just Cause 2
  386. if [ "${engine}" == "avalanche" ]; then
  387. fn_info_config_avalanche
  388. # Dont Starve Together
  389. elif [ "${engine}" == "dontstarve" ]; then
  390. fn_info_config_dontstarve
  391. # Quake Live
  392. elif [ "${engine}" == "idtech3" ]; then
  393. fn_info_config_idtech3
  394. # Minecraft
  395. elif [ "${engine}" == "lwjgl2" ]; then
  396. fn_info_config_minecraft
  397. # Project Zomboid
  398. elif [ "${engine}" == "projectzomboid" ]; then
  399. fn_info_config_projectzomboid
  400. # ARMA 3
  401. elif [ "${engine}" == "realvirtuality" ]; then
  402. fn_info_config_realvirtuality
  403. # Serious Sam
  404. elif [ "${engine}" == "seriousengine35" ]; then
  405. fn_info_config_seriousengine35
  406. # Source Engine Games
  407. elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
  408. fn_info_config_source
  409. # Starbound
  410. elif [ "${engine}" == "starbound" ]; then
  411. fn_info_config_starbound
  412. # TeamSpeak 3
  413. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  414. fn_info_config_teamspeak3
  415. elif [ "${gamename}" == "Mumble" ]; then
  416. fn_info_config_mumble
  417. # Teeworlds
  418. elif [ "${engine}" == "teeworlds" ]; then
  419. fn_info_config_teeworlds
  420. # Terraria
  421. elif [ "${engine}" == "terraria" ]; then
  422. fn_info_config_terraria
  423. # Unreal/Unreal 2 engine
  424. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  425. fn_info_config_unreal
  426. # 7 Day To Die (unity3d)
  427. elif [ "${gamename}" == "7 Days To Die" ]; then
  428. fn_info_config_sdtd
  429. fi