info_config.sh 20 KB

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