4
0

command_dev_parse_game_details.sh 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. ['Port 401']="${port401}"
  73. ['Port IPv6']="${portipv6}"
  74. ['Port']="${port}"
  75. ['Query Enabled']="${queryenabled}"
  76. ['Query HTTP Port']="${httpqueryport}"
  77. ['Query HTTPS Port']="${httpsqueryport}"
  78. ['Query Mode']="${querymode}"
  79. ['Query Port GS']="${gamespyqueryport}"
  80. ['Query Port']="${queryport}"
  81. ['Query SSH Port']="${sshqueryport}"
  82. ['Queue Enabled']="${queueenabled}"
  83. ['Queue Port']="${queueport}"
  84. ['Random Map']="${randommap}"
  85. ['Raw Port']="${rawport}"
  86. ['RCON Enabled']="${rconenabled}"
  87. ['RCON Password']="${rconpassword}"
  88. ['RCON Port']="${rconport}"
  89. ['RCON Web']="${rconweb}"
  90. ['Reserved Slots']="${reservedslots}"
  91. ['Reliable Messaging']="${reliableport}"
  92. ['RMI Port']="${rmiport}"
  93. ['RMI Reg Port']="${rmiregport}"
  94. ['Salt']="${salt}"
  95. ['Save Game Interval']="${savegameinterval}"
  96. ['Save Interval']="${saveinterval}"
  97. ['Secondary Port']="${port3}"
  98. ['Seed']="${seed}"
  99. ['Server Description']="${serverdescription}"
  100. ['Server IP']="${ip}"
  101. ['Server Level']="${serverlevel}"
  102. ['Server Name']="${servername}"
  103. ['Server Password Enabled']="${serverpasswordenabled}"
  104. ['Server Password']="${serverpassword}"
  105. ['Server Version']="${serverversion}"
  106. ['Shard']="${shard}"
  107. ['Sharding']="${sharding}"
  108. ['Shutdown Port']="${shutdownport}"
  109. ['Stats Port']="${statsport}"
  110. ['Steam Auth Port']="${steamauthport}"
  111. ['Steam Port']="${steamport}"
  112. ['Steamworks Port']="${steamworksport}"
  113. ['Telnet Enabled']="${telnetenabled}"
  114. ['Telnet IP']="${telnetip}"
  115. ['Telnet Password']="${telnetpassword}"
  116. ['Telnet Port']="${telnetport}"
  117. ['Tickrate']="${tickrate}"
  118. ['Unknown Port']="${unknownport}"
  119. ['Version Count']="${versioncount}"
  120. ['Voice Port']="${voiceport}"
  121. ['Voice Unused Port']="${voiceunusedport}"
  122. ['World Name']="${worldname}"
  123. ['World Size']="${worldsize}"
  124. ['World Type']="${worldtype}"
  125. )
  126. # Initialize variables to keep track of available and missing server details.
  127. available_details=""
  128. missing_details=""
  129. # Loop through the server details and store them.
  130. for key in "${!server_details[@]}"; do
  131. value=${server_details[$key]}
  132. if [ -n "$value" ]; then
  133. available_details+="${lightblue}${key}: ${default}${value}\n"
  134. else
  135. missing_details+="${key}\n"
  136. fi
  137. done
  138. # Sort and output the available distro details.
  139. if [ -n "$available_details" ]; then
  140. echo -e ""
  141. echo -e "${bold}${lightgreen}Available Gameserver Details${default}"
  142. fn_messages_separator
  143. echo -e "${available_details}" | sort
  144. fi
  145. # Output the missing server details if there are any.
  146. if [ -n "$missing_details" ]; then
  147. echo -e ""
  148. echo -e "${lightgreen}Missing or unsupported Gameserver Details${default}"
  149. fn_messages_separator
  150. echo -e "${missing_details}" | sort
  151. fi
  152. core_exit.sh