4
0

command_dev_parse_game_details.sh 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. #!/bin/bash
  2. # LinuxGSM command_dev_parse_game_details.sh module
  3. # Author: Daniel Gibbs
  4. # Contributors: https://linuxgsm.com/contrib
  5. # Website: https://linuxgsm.com
  6. # Description: Display parsed gameserver details.
  7. if [ -f "config" ]; then
  8. servercfgfullpath="config"
  9. fi
  10. if [ -f "clusterconfig" ]; then
  11. clustercfgfullpath="clusterconfig"
  12. fi
  13. info_game.sh
  14. carriagereturn=$(file -b "${servercfgfullpath}" | grep -q CRLF && echo "${red}CRLF${default}" || echo "${lightgreen}LF${default}")
  15. echo -e ""
  16. echo -e "${bold}${lightgreen}Server Details${default}"
  17. fn_messages_separator
  18. echo -e ""
  19. echo -e "${lightblue}Game: ${default}${gamename}"
  20. echo -e "${lightblue}Config type: ${default}${configtype}"
  21. echo -e "${lightblue}Config file: ${default}${servercfgfullpath}"
  22. if [ -f "${clustercfgfullpath}" ]; then
  23. echo -e "${lightblue}Cluster config file: ${default}${clustercfgfullpath}"
  24. fi
  25. echo -e "${lightblue}Carriage Return: ${default}${carriagereturn}"
  26. # Create an associative array of the server details.
  27. declare -A server_details=(
  28. ['Admin Password']="${adminpassword}"
  29. ['Alert IP']="${alertip}"
  30. ['API Port']="${apiport}"
  31. ['App Port']="${appport}"
  32. ['ASE']="${ase}"
  33. ['Auth Token']="${authtoken}"
  34. ['BattleEye Port']="${battleeyeport}"
  35. ['Beacon Port']="${beaconport}"
  36. ['Cave']="${cave}"
  37. ['Client Port']="${clientport}"
  38. ['Cluster']="${cluster}"
  39. ['Config IP']="${configip}"
  40. ['Creative Mode']="${creativemode}"
  41. ['Custom Level URL']="${customlevelurl}"
  42. ['DB Plugin']="${dbplugin}"
  43. ['Default Map']="${defaultmap}"
  44. ['Default Scenario']="${defaultscenario}"
  45. ['Display Master Server']="${displaymasterserver}"
  46. ['Epic Settings']="${epicsettings}"
  47. ['File Port']="${fileport}"
  48. ['Files Port']="${filesport}"
  49. ['Game Mode']="${gamemode}"
  50. ['Game Type']="${gametype}"
  51. ['Home Kingdom']="${homekingdom}"
  52. ['Home Server']="${homeserver}"
  53. ['HTTP Enabled']="${httpenabled}"
  54. ['HTTP IP']="${httpip}"
  55. ['HTTP Password']="${httppassword}"
  56. ['HTTP Port']="${httpport}"
  57. ['HTTP User']="${httpuser}"
  58. ['Internet IP']="${publicip}"
  59. ['LAN Port']="${lanport}"
  60. ['Login Server']="${loginserver}"
  61. ['Master Port']="${masterport}"
  62. ['Master Server']="${masterserver}"
  63. ['Master']="${master}"
  64. ['Max Players']="${maxplayers}"
  65. ['Mod Server Port']="${modserverport}"
  66. ['OldQueryPortNumber']="${oldqueryportnumber}"
  67. ['Port 401']="${port401}"
  68. ['Port IPv6']="${portipv6}"
  69. ['Port']="${port}"
  70. ['Query Enabled']="${queryenabled}"
  71. ['Query HTTP Port']="${httpqueryport}"
  72. ['Query HTTPS Port']="${httpsqueryport}"
  73. ['Query Mode']="${querymode}"
  74. ['Query Port GS']="${gamespyqueryport}"
  75. ['Query Port']="${queryport}"
  76. ['Query SSH Port']="${sshqueryport}"
  77. ['Queue Enabled']="${queueenabled}"
  78. ['Queue Port']="${queueport}"
  79. ['Random Map']="${randommap}"
  80. ['Raw Port']="${rawport}"
  81. ['RCON Enabled']="${rconenabled}"
  82. ['RCON Password']="${rconpassword}"
  83. ['RCON Port']="${rconport}"
  84. ['RCON Web']="${rconweb}"
  85. ['Reserved Slots']="${reservedslots}"
  86. ['RMI Port']="${rmiport}"
  87. ['RMI Reg Port']="${rmiregport}"
  88. ['Salt']="${salt}"
  89. ['Save Game Interval']="${savegameinterval}"
  90. ['Save Interval']="${saveinterval}"
  91. ['Secondary Port']="${port3}"
  92. ['Seed']="${seed}"
  93. ['Server Description']="${serverdescription}"
  94. ['Server IP']="${ip}"
  95. ['Server Level']="${serverlevel}"
  96. ['Server Name']="${servername}"
  97. ['Server Password Enabled']="${serverpasswordenabled}"
  98. ['Server Password']="${serverpassword}"
  99. ['Server Version']="${serverversion}"
  100. ['Shard']="${shard}"
  101. ['Sharding']="${sharding}"
  102. ['Shutdown Port']="${shutdownport}"
  103. ['Stats Port']="${statsport}"
  104. ['Steam Auth Port']="${steamauthport}"
  105. ['Steam Port']="${steamport}"
  106. ['Steamworks Port']="${steamworksport}"
  107. ['Telnet Enabled']="${telnetenabled}"
  108. ['Telnet IP']="${telnetip}"
  109. ['Telnet Password']="${telnetpassword}"
  110. ['Telnet Port']="${telnetport}"
  111. ['Tickrate']="${tickrate}"
  112. ['Unknown Port']="${unknownport}"
  113. ['Version Count']="${versioncount}"
  114. ['Voice Port']="${voiceport}"
  115. ['Voice Unused Port']="${voiceunusedport}"
  116. ['World Name']="${worldname}"
  117. ['World Size']="${worldsize}"
  118. ['World Type']="${worldtype}"
  119. )
  120. # Initialize variables to keep track of available and missing server details.
  121. available_details=""
  122. missing_details=""
  123. # Loop through the server details and store them.
  124. for key in "${!server_details[@]}"; do
  125. value=${server_details[$key]}
  126. if [ -n "$value" ]; then
  127. available_details+="${lightblue}${key}: ${default}${value}\n"
  128. else
  129. missing_details+="${key}\n"
  130. fi
  131. done
  132. # Sort and output the available distro details.
  133. if [ -n "$available_details" ]; then
  134. echo -e ""
  135. echo -e "${bold}${lightgreen}Available Gameserver Details${default}"
  136. fn_messages_separator
  137. echo -e "${available_details}" | sort
  138. fi
  139. # Output the missing server details if there are any.
  140. if [ -n "$missing_details" ]; then
  141. echo -e ""
  142. echo -e "${lightgreen}Missing or unsupported Gameserver Details${default}"
  143. fn_messages_separator
  144. echo -e "${missing_details}" | sort
  145. fi
  146. core_exit.sh