command_dev_parse_game_details.sh 5.0 KB

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