info_config.sh 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  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 -0)
  22. serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^ *//g' -e '/^--/d' -e 's/Password//g' | tr -d '=\";,:' | xargs -0)
  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 -0)
  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 -0)
  72. serverpassword=$(grep "server_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/server_password//g' | tr -d '=\";,:' | xargs -0)
  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 -0)
  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 -0)
  97. rconpassword=$(grep "rcon.password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/rcon.password//g' | tr -d '=\";,:' | xargs -0)
  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 -0)
  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 -0)
  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 -0)
  128. serverpassword=$(grep "Password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Password" | sed -e '/^#/d' -e 's/Password//g' | tr -d '=\";,:' | xargs -0)
  129. rconpassword=$(grep "RCONPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/RCONPassword//g' | tr -d '=\";,:' | xargs -0)
  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 -0)
  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_quakelive(){
  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 -0)
  150. servername=$(grep "sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname//g' | tr -d '=\";,:' | xargs -0)
  151. serverpassword=$(grep "g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password//g' | tr -d '=\";,:' | xargs -0)
  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. ipconfigcheck=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | xargs -0)
  159. if [ -n "${ipconfigcheck}" ]; then
  160. ip="${ipconfigcheck}"
  161. fi
  162. fi
  163. }
  164. fn_info_config_wolfensteinenemyterritory(){
  165. if [ ! -f "${servercfgfullpath}" ]; then
  166. rconpassword="${unavailable}"
  167. servername="${unavailable}"
  168. serverpassword="${unavailable}"
  169. slots="${zero}"
  170. port="${zero}"
  171. else
  172. port=$(grep "set net_port" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
  173. rconpassword=$(grep "set zmq_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set zmq_rcon_password //g' | tr -d '=\";,:' | sed -e 's/^[ \t]*//g' -e '/^\//d' | xargs -0)
  174. servername=$(grep "set sv_hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set sv_hostname //g' | tr -d '=\";,:' | xargs -0)
  175. serverpassword=$(grep "set g_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set g_password //g' | tr -d '=\";,:' | xargs -0)
  176. slots=$(grep "set sv_maxclients" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
  177. # Not Set
  178. rconpassword=${rconpassword:-"NOT SET"}
  179. servername=${servername:-"NOT SET"}
  180. serverpassword=${serverpassword:-"NOT SET"}
  181. slots=${slots:-"0"}
  182. port=${port:-"27960"}
  183. ipconfigcheck=$(grep "set net_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/set net_ip//g' | tr -d '=\";,:' | xargs -0)
  184. if [ -n "${ipconfigcheck}" ]; then
  185. ip="${ipconfigcheck}"
  186. fi
  187. fi
  188. }
  189. fn_info_config_realvirtuality(){
  190. if [ ! -f "${servercfgfullpath}" ]; then
  191. servername="${unavailable}"
  192. adminpassword="${unavailable}"
  193. serverpassword="${unavailable}"
  194. slots="${zero}"
  195. else
  196. servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/hostname//g' | tr -d '=\";,:' | xargs -0)
  197. adminpassword=$(grep "passwordAdmin" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/passwordAdmin//g' | tr -d '=\";,:' | xargs -0)
  198. serverpassword=$(grep "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/password//g' | tr -d '=\";,:' | xargs -0)
  199. slots=$(grep "maxPlayers" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
  200. # Not Set
  201. servername=${servername:-"NOT SET"}
  202. adminpassword=${adminpassword:-"NOT SET"}
  203. serverpassword=${serverpassword:-"NOT SET"}
  204. slots=${slots:-"0"}
  205. fi
  206. }
  207. fn_info_config_seriousengine35(){
  208. if [ ! -f "${servercfgfullpath}" ]; then
  209. servername="${unavailable}"
  210. rconpassword="${unavailable}"
  211. gamemode="${unavailable}"
  212. slots="${zero}"
  213. port="${zero}"
  214. else
  215. servername=$(grep "prj_strMultiplayerSessionName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/prj_strMultiplayerSessionName//g' | tr -d '=\";,:' | xargs -0)
  216. rconpassword=$(grep "rcts_strAdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/rcts_strAdminPassword//g' | tr -d '=\";,:' | xargs -0)
  217. gamemode=$(grep "gam_idGameMode" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/gam_idGameMode//g' | tr -d '=\";,:' | xargs -0)
  218. slots=$(grep "gam_ctMaxPlayers" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
  219. port=$(grep "prj_uwPort" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
  220. # Not Set
  221. servername=${servername:-"NOT SET"}
  222. rconpassword=${rconpassword:-"NOT SET"}
  223. gamemode=${gamemode:-"NOT SET"}
  224. slots=${slots:-"0"}
  225. port=${port:-"0"}
  226. fi
  227. }
  228. fn_info_config_source(){
  229. if [ ! -f "${servercfgfullpath}" ]; then
  230. servername="${unavailable}"
  231. serverpassword="${unavailable}"
  232. rconpassword="${unavailable}"
  233. else
  234. servername=$(grep "hostname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/hostname//g' | tr -d '=\";,:' | xargs -0)
  235. serverpassword=$(grep "sv_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/sv_password//g' | tr -d '=\";,:' | xargs -0)
  236. rconpassword=$(grep "rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^\//d' -e 's/rcon_password//g' | tr -d '=\";,:' | xargs -0)
  237. # Not Set
  238. servername=${servername:-"NOT SET"}
  239. serverpassword=${serverpassword:-"NOT SET"}
  240. rconpassword=${rconpassword:-"NOT SET"}
  241. fi
  242. }
  243. fn_info_config_starbound(){
  244. if [ ! -f "${servercfgfullpath}" ]; then
  245. servername="${unavailable}"
  246. rconpassword="${unavailable}"
  247. port="21025"
  248. queryport="21025"
  249. rconport="21026"
  250. slots="8"
  251. else
  252. servername=$(grep "serverName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/serverName//g' | tr -d '=\";,:' | xargs -0)
  253. rconpassword=$(grep "rconServerPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e 's/rconServerPassword//g' | tr -d '=\";,:' | xargs -0)
  254. port=$(grep "gameServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  255. queryport=$(grep "queryServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  256. rconport=$(grep "rconServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  257. slots=$(grep "maxPlayers" "${servercfgfullpath}" | tr -cd '[:digit:]')
  258. # Not Set
  259. servername=${servername:-"NOT SET"}
  260. rconpassword=${rconpassword:-"NOT SET"}
  261. port=${port:-"21025"}
  262. queryport=${queryport:-"21025"}
  263. rconport=${rconport:-"21026"}
  264. slots=${slots:-"8"}
  265. fi
  266. }
  267. fn_info_config_teamspeak3(){
  268. if [ ! -f "${servercfgfullpath}" ]; then
  269. dbplugin="${unavailable}"
  270. port="9987"
  271. queryport="10011"
  272. fileport="30033"
  273. else
  274. dbplugin=$(grep "dbplugin=" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/dbplugin=//g' | tr -d '=\";,:' | xargs -0)
  275. port=$(grep "default_voice_port" "${servercfgfullpath}" | tr -cd '[:digit:]')
  276. queryport=$(grep "query_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  277. fileport=$(grep "filetransfer_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  278. # Not Set
  279. port=${port:-"9987"}
  280. queryport=${queryport:-"10011"}
  281. fileport=${fileport:-"30033"}
  282. # check if the ip exists in the config file. Failing this will fall back to the default.
  283. ipconfigcheck=$(grep "voice_ip" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/voice_ip//g' | tr -d '=\";,:' | xargs -0)
  284. if [ -n "${ipconfigcheck}" ]; then
  285. ip="${ipconfigcheck}"
  286. fi
  287. fi
  288. }
  289. fn_info_config_mumble(){
  290. if [ ! -f "${servercfgfullpath}" ]; then
  291. port="64738"
  292. queryport="${port}"
  293. servername="Mumble"
  294. else
  295. port=$(grep "port" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^;/d' -e 's/port//g' | tr -d '=\";,:' | xargs -0)
  296. queryport="${port}"
  297. # Not Set
  298. port=${port:-"64738"}
  299. queryport=${queryport:-"64738"}
  300. servername="Mumble Port ${port}"
  301. # check if the ip exists in the config file. Failing this will fall back to the default.
  302. ipconfigcheck=$(cat "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^;/d' -e 's/voice_ip//g' | tr -d '=\";,:' | xargs -0)
  303. if [ -n "${ipconfigcheck}" ]; then
  304. ip="${ipconfigcheck}"
  305. fi
  306. fi
  307. }
  308. fn_info_config_teeworlds(){
  309. if [ ! -f "${servercfgfullpath}" ]; then
  310. servername="unnamed server"
  311. serverpassword="${unavailable}"
  312. rconpassword="${unavailable}"
  313. port="8303"
  314. slots="12"
  315. else
  316. servername=$(grep "sv_name" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/^sv_name//g' | tr -d '=\";,:' | xargs -0)
  317. serverpassword=$(grep "password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^password" | sed -e '/^#/d' -e 's/^password//g' | tr -d '=\";,:' | xargs -0)
  318. rconpassword=$(grep "sv_rcon_password" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/^sv_rcon_password//g' | tr -d '=\";,:' | xargs -0)
  319. port=$(grep "sv_port" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  320. slots=$(grep "sv_max_clients" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  321. # Not Set
  322. servername=${servername:-"NOT SET"}
  323. serverpassword=${serverpassword:-"NOT SET"}
  324. rconpassword=${rconpassword:-"NOT SET"}
  325. port=${port:-"8303"}
  326. slots=${slots:-"12"}
  327. fi
  328. }
  329. fn_info_config_terraria(){
  330. if [ ! -f "${servercfgfullpath}" ]; then
  331. servername="${unavailable}"
  332. port="${zero}"
  333. gameworld="${unavailable}"
  334. slots="${zero}"
  335. else
  336. servername=$(grep "worldname" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/worldname//g' | tr -d '=\";,:' | xargs -0)
  337. port=$(grep "port" "${servercfgfullpath}" | tr -cd '[:digit:]')
  338. gameworld=$(grep "world=" "${servercfgfullpath}" | grep -v "//" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/world=//g' | tr -d '=\";,:' | xargs -0)
  339. slots=$(grep "maxplayers" "${servercfgfullpath}" | grep -v "//" | tr -cd '[:digit:]')
  340. # Not Set
  341. servername=${servername:-"NOT SET"}
  342. port=${port:-"0"}
  343. gameworld=${gameworld:-"NOT SET"}
  344. slots=${slots:-"0"}
  345. fi
  346. }
  347. fn_info_config_unreal(){
  348. if [ ! -f "${servercfgfullpath}" ]; then
  349. servername="${unavailable}"
  350. serverpassword="${unavailable}"
  351. adminpassword="${unavailable}"
  352. port="${zero}"
  353. gsqueryport="${zero}"
  354. webadminenabled="${unavailable}"
  355. webadminport="${zero}"
  356. webadminuser="${unavailable}"
  357. webadminpass="${unavailable}"
  358. else
  359. servername=$(grep "ServerName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/ServerName//g' | tr -d '=\";,:' | xargs -0)
  360. serverpassword=$(grep "GamePassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/GamePassword//g' | tr -d '=\";,:' | xargs -0)
  361. adminpassword=$(grep "AdminPassword" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | xargs -0)
  362. port=$(grep "Port" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' | grep "^Port" | grep -v "#" | tr -cd '[:digit:]')
  363. gsqueryport=$(grep "OldQueryPortNumber" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  364. webadminenabled=$(grep "bEnabled" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/bEnabled//g' | tr -d '=\";,:' | xargs -0)
  365. webadminport=$(grep "ListenPort" "${servercfgfullpath}" | grep -v "#" | tr -cd '[:digit:]')
  366. if [ "${engine}" == "unreal" ]; then
  367. webadminuser=$(grep "AdminUsername" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminUsername//g' | tr -d '=\";,:' | xargs -0)
  368. webadminpass=$(grep "UTServerAdmin.UTServerAdmin" "${servercfgfullpath}" -A 4 | grep "AdminPassword" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminPassword//g' | tr -d '=\";,:' | xargs -0)
  369. else
  370. webadminuser=$(grep "AdminName" "${servercfgfullpath}" | sed -e 's/^[ \t]*//g' -e '/^#/d' -e 's/AdminName//g' | tr -d '=\";,:' | xargs -0)
  371. webadminpass="${adminpassword}"
  372. fi
  373. # Not Set
  374. servername=${servername:-"NOT SET"}
  375. serverpassword=${serverpassword:-"NOT SET"}
  376. adminpassword=${adminpassword:-"NOT SET"}
  377. port=${port:-"0"}
  378. gsqueryport=${gsqueryport:-"0"}
  379. webadminenabled=${webadminenabled:-"NOT SET"}
  380. webadminport=${webadminport:-"0"}
  381. webadminuser=${webadminuser:-"NOT SET"}
  382. webadminpass=${webadminpass:-"NOT SET"}
  383. fi
  384. }
  385. fn_info_config_sdtd(){
  386. if [ ! -f "${servercfgfullpath}" ]; then
  387. servername="${unavailable}"
  388. serverpassword="${unavailable}"
  389. port="${zero}"
  390. queryport="${zero}"
  391. webadminenabled="${unavailable}"
  392. webadminport="${zero}"
  393. webadminpass="${unavailable}"
  394. telnetenabled="${unavailable}"
  395. telnetport="${zero}"
  396. telnetpass="${unavailable}"
  397. slots="${unavailable}"
  398. gamemode="${unavailable}"
  399. gameworld="${unavailable}"
  400. else
  401. servername=$(grep "ServerName" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  402. serverpassword=$(grep "ServerPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  403. port=$(grep "ServerPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  404. queryport=$((port + 1))
  405. webadminenabled=$(grep "ControlPanelEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  406. webadminport=$(grep "ControlPanelPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  407. webadminpass=$(grep "ControlPanelPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  408. telnetenabled=$(grep "TelnetEnabled" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  409. telnetport=$(grep "TelnetPort" "${servercfgfullpath}" | tr -cd '[:digit:]')
  410. telnetpass=$(grep "TelnetPassword" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  411. slots=$(grep "ServerMaxPlayerCount" "${servercfgfullpath}" | tr -cd '[:digit:]')
  412. gamemode=$(grep "GameMode" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  413. gameworld=$(grep "GameWorld" "${servercfgfullpath}" | sed 's/^.*value="//' | cut -f1 -d"\"")
  414. # Not Set
  415. servername=${servername:-"NOT SET"}
  416. serverpassword=${serverpassword:-"NOT SET"}
  417. port=${port:-"0"}
  418. queryport=${queryport:-"0"}
  419. webadminenabled=${webadminenabled:-"NOT SET"}
  420. webadminport=${webadminport:-"0"}
  421. webadminpass=${webadminpass:-"NOT SET"}
  422. telnetenabled=${telnetenabled:-"NOT SET"}
  423. telnetport=${telnetport:-"0"}
  424. telnetpass=${telnetpass:-"NOT SET"}
  425. slots=${slots:-"NOT SET"}
  426. gamemode=${gamemode:-"NOT SET"}
  427. gameworld=${gameworld:-"NOT SET"}
  428. fi
  429. }
  430. # Just Cause 2
  431. if [ "${engine}" == "avalanche" ]; then
  432. fn_info_config_avalanche
  433. # Battlefield: 1942
  434. elif [ "${gamename}" == "Battlefield: 1942" ]; then
  435. fn_info_config_bf1942
  436. # Dont Starve Together
  437. elif [ "${engine}" == "dontstarve" ]; then
  438. fn_info_config_dontstarve
  439. # Quake Live
  440. elif [ "${gamename}" == "Quake Live" ]; then
  441. fn_info_config_quakelive
  442. # Minecraft
  443. elif [ "${engine}" == "lwjgl2" ]; then
  444. fn_info_config_minecraft
  445. # Project Zomboid
  446. elif [ "${engine}" == "projectzomboid" ]; then
  447. fn_info_config_projectzomboid
  448. # ARMA 3
  449. elif [ "${engine}" == "realvirtuality" ]; then
  450. fn_info_config_realvirtuality
  451. # Serious Sam
  452. elif [ "${engine}" == "seriousengine35" ]; then
  453. fn_info_config_seriousengine35
  454. # Source Engine Games
  455. elif [ "${engine}" == "source" ]||[ "${engine}" == "goldsource" ]; then
  456. fn_info_config_source
  457. # Starbound
  458. elif [ "${engine}" == "starbound" ]; then
  459. fn_info_config_starbound
  460. # TeamSpeak 3
  461. elif [ "${gamename}" == "TeamSpeak 3" ]; then
  462. fn_info_config_teamspeak3
  463. elif [ "${gamename}" == "Mumble" ]; then
  464. fn_info_config_mumble
  465. # Teeworlds
  466. elif [ "${engine}" == "teeworlds" ]; then
  467. fn_info_config_teeworlds
  468. # Terraria
  469. elif [ "${engine}" == "terraria" ]; then
  470. fn_info_config_terraria
  471. # Unreal/Unreal 2 engine
  472. elif [ "${engine}" == "unreal" ]||[ "${engine}" == "unreal2" ]; then
  473. fn_info_config_unreal
  474. # 7 Day To Die (unity3d)
  475. elif [ "${gamename}" == "7 Days To Die" ]; then
  476. fn_info_config_sdtd
  477. elif [ "${gamename}" == "Wolfenstein: Enemy Territory" ]; then
  478. fn_info_config_wolfensteinenemyterritory
  479. fi