info_config.sh 22 KB

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