Start-Windows.cmd 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. @echo off
  2. :# Open RuneScape Classic: Striving for a replica RSC game and more
  3. :# Variable paths:
  4. SET Portable_Windows="Portable_Windows\"
  5. SET mariadbpath="Portable_Windows\mariadb-10.5.8-winx64\bin\"
  6. :<------------Begin Start------------>
  7. REM Initial menu displayed to the user
  8. :start
  9. cls
  10. echo:
  11. echo What would you like to do?
  12. echo:
  13. echo Choices:
  14. echo %RED%1%NC% - Compile and start the game
  15. echo %RED%2%NC% - Start the game (faster if already compiled)
  16. echo %RED%3%NC% - Change a player's in-game role
  17. echo %RED%4%NC% - Backup database
  18. echo %RED%5%NC% - Restore database
  19. echo %RED%6%NC% - Perform a fresh install
  20. echo %RED%7%NC% - Exit
  21. echo:
  22. SET /P action=Please enter a number choice from above:
  23. echo:
  24. if /i "%action%"=="1" goto compileandrun
  25. if /i "%action%"=="2" goto run
  26. if /i "%action%"=="3" goto role
  27. if /i "%action%"=="4" goto backup
  28. if /i "%action%"=="5" goto import
  29. if /i "%action%"=="6" goto reset
  30. if /i "%action%"=="7" goto exit
  31. echo Error! %action% is not a valid option. Press enter to try again.
  32. echo:
  33. SET /P action=""
  34. goto start
  35. :<------------End Start------------>
  36. :<------------Begin Exit------------>
  37. :exit
  38. REM Shuts down existing processes
  39. taskkill /F /IM Java*
  40. taskkill /F /IM mysqld*
  41. exit
  42. :<------------End Exit------------>
  43. :<------------Begin Compile and Run------------>
  44. :compileandrun
  45. cls
  46. echo:
  47. echo Starting Open RuneScape Classic.
  48. echo:
  49. cd Portable_Windows && call START "" compileandrun.cmd && cd ..
  50. echo:
  51. goto start
  52. :<------------End Compile and Run------------>
  53. :<------------Begin Run------------>
  54. :run
  55. cls
  56. echo:
  57. echo Starting Open RuneScape Classic.
  58. echo:
  59. cd Portable_Windows && call START "" run.cmd && cd ..
  60. echo:
  61. goto start
  62. :<------------End Run------------>
  63. :<------------Begin Role------------>
  64. :role
  65. cls
  66. echo:
  67. echo What would role should the player be set to?
  68. echo:
  69. echo Choices:
  70. echo %RED%1%NC% - Admin
  71. echo %RED%2%NC% - Mod
  72. echo %RED%3%NC% - Regular Player
  73. echo %RED%4%NC% - Return
  74. echo:
  75. SET /P role=Please enter a number choice from above:
  76. echo:
  77. if /i "%role%"=="1" goto admin
  78. if /i "%role%"=="2" goto mod
  79. if /i "%role%"=="3" goto regular
  80. if /i "%role%"=="4" goto start
  81. echo Error! %role% is not a valid option. Press enter to try again.
  82. echo:
  83. SET /P role=""
  84. goto start
  85. :admin
  86. echo:
  87. echo Make sure you are logged out first!
  88. echo Type the username of the player you wish to set as an admin and press enter.
  89. echo:
  90. SET /P username=""
  91. echo:
  92. echo Type the name of the database where the player is saved. (Generally named "preservation", "openrsc", or "cabbage")
  93. echo:
  94. SET /P db=""
  95. call START "" %mariadbpath%mysqld.exe --console
  96. echo Player update will occur in 5 seconds (gives time to start the database server on slow PCs)
  97. PING localhost -n 6 >NUL
  98. call %mariadbpath%mysql.exe -uroot -proot -D %db% -e "USE %db%; UPDATE `players` SET `group_id` = '0' WHERE `players`.`username` = '%username%';"
  99. echo:
  100. echo %username% has been made an admin in database %db%!
  101. echo:
  102. pause
  103. goto start
  104. :mod
  105. echo:
  106. echo Make sure you are logged out first!
  107. echo Type the username of the player you wish to set as a mod and press enter.
  108. echo:
  109. SET /P username=""
  110. echo:
  111. echo Type the name of the database where the player is saved. (Generally named "preservation", "openrsc", or "cabbage")
  112. echo:
  113. SET /P db=""
  114. call START "" %mariadbpath%mysqld.exe --console
  115. echo Player update will occur in 5 seconds (gives time to start the database server on slow PCs)
  116. PING localhost -n 6 >NUL
  117. call %mariadbpath%mysql.exe -uroot -proot -D %db% -e "USE %db%; UPDATE `players` SET `group_id` = '2' WHERE `players`.`username` = '%username%';"
  118. echo:
  119. echo %username% has been made a mod in database %db%!
  120. echo:
  121. pause
  122. goto start
  123. :regular
  124. echo:
  125. echo Make sure you are logged out first!
  126. echo Type the username of the player you wish to set as a regular player and press enter.
  127. echo:
  128. SET /P username=""
  129. echo:
  130. echo Type the name of the database where the player is saved. (Generally named "preservation", "openrsc", or "cabbage")
  131. echo:
  132. SET /P db=""
  133. call START "" %mariadbpath%mysqld.exe --console
  134. echo Player update will occur in 5 seconds (gives time to start the database server on slow PCs)
  135. PING localhost -n 6 >NUL
  136. call %mariadbpath%mysql.exe -uroot -proot -D %db% -e "USE %db%; UPDATE `players` SET `group_id` = '10' WHERE `players`.`username` = '%username%';"
  137. echo:
  138. echo %username% has been made an admin in database %db%!
  139. echo:
  140. pause
  141. goto start
  142. :<------------End Role------------>
  143. :<------------Begin Backup------------>
  144. :backup
  145. REM Shuts down existing processes
  146. taskkill /F /IM Java*
  147. REM Performs a full database export
  148. cls
  149. echo:
  150. echo Type the name of the database you wish to back up. (Generally named "preservation", "openrsc", or "cabbage")
  151. echo:
  152. SET /P db=""
  153. call START "" %mariadbpath%mysqld.exe --console
  154. call START "" %mariadbpath%mysqldump.exe -uroot -proot --database %db% --result-file="Backups/%db%-%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%T%time:~-11,2%-%time:~-8,2%-%time:~-5,2%.sql"
  155. echo:
  156. echo Player database backup complete.
  157. echo:
  158. pause
  159. goto start
  160. :<------------End Backup------------>
  161. :<------------Begin Import------------>
  162. :import
  163. REM Shuts down existing processes
  164. taskkill /F /IM Java*
  165. cls
  166. REM Performs a full database import
  167. echo:
  168. dir /B *.sql
  169. echo:
  170. echo Type the full name of the database listed above that you wish to restore.
  171. echo:
  172. SET /P filename=""
  173. echo:
  174. echo Which database should this be restored to? (Generally named "preservation", "openrsc", or "cabbage")
  175. echo:
  176. SET /P db=""
  177. call START "" %mariadbpath%mysqld.exe --console
  178. call %mariadbpath%mysql.exe -uroot -proot %db% < "Backups/%filename%.sql"
  179. echo:
  180. echo Player database restore complete.
  181. echo:
  182. pause
  183. goto start
  184. :<------------End Import------------>
  185. :<------------Begin Fresh Install------------>
  186. :reset
  187. REM Shuts down existing processes
  188. taskkill /F /IM Java*
  189. REM Verifies the user wishes to clear existing player data
  190. cls
  191. echo:
  192. echo Are you ABSOLUTELY SURE that you want to perform a fresh install and reset any existing game databases?
  193. echo:
  194. echo To confirm the database reset, type yes and press enter.
  195. echo:
  196. SET /P confirmwipe=""
  197. echo:
  198. if /i "%confirmwipe%"=="yes" goto wipe
  199. echo Error! %confirmwipe% is not a valid option.
  200. pause
  201. goto start
  202. :wipe
  203. REM Starts up the database server and imports both server and database files to replace anything previously existing
  204. call START "" %mariadbpath%mysqld.exe --console
  205. cls
  206. call %mariadbpath%mysqlcheck -uroot -proot -o --all-databases
  207. cls
  208. call %mariadbpath%mysql.exe -uroot -proot -e "DROP DATABASE IF EXISTS preservation;"
  209. call %mariadbpath%mysql.exe -uroot -proot -e "DROP DATABASE IF EXISTS openrsc;"
  210. call %mariadbpath%mysql.exe -uroot -proot -e "DROP DATABASE IF EXISTS cabbage;"
  211. call %mariadbpath%mysql.exe -uroot -proot -e "CREATE DATABASE `preservation`;"
  212. call %mariadbpath%mysql.exe -uroot -proot -e "CREATE DATABASE `openrsc`;"
  213. call %mariadbpath%mysql.exe -uroot -proot -e "CREATE DATABASE `cabbage`;"
  214. call %mariadbpath%mysql.exe -uroot -proot preservation < Databases\core.sql
  215. call %mariadbpath%mysql.exe -uroot -proot openrsc < Databases\core.sql
  216. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases\core.sql
  217. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_auctionhouse.sql
  218. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_bank_presets.sql
  219. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_clans.sql
  220. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_custom_items.sql
  221. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_custom_npcs.sql
  222. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_custom_objects.sql
  223. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_equipment_tab.sql
  224. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_harvesting.sql
  225. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_ironman.sql
  226. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_npc_kill_counting.sql
  227. call %mariadbpath%mysql.exe -uroot -proot cabbage < Databases/Addons/add_runecraft.sql
  228. echo:
  229. echo Fresh install complete!
  230. echo:
  231. pause
  232. goto start
  233. :<------------End Fresh Install------------>