Start-Windows.cmd 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. @echo off
  2. :# OpenRSC: Striving for a replica RSC game and more
  3. :# Variable paths:
  4. SET Portable_Windows="Portable_Windows\"
  5. SET sqlitepath="Portable_Windows\"
  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 the server type
  17. echo %RED%4%NC% - Change a player's in-game role
  18. echo %RED%5%NC% - Change a player's name
  19. echo %RED%6%NC% - Backup database
  20. echo %RED%7%NC% - Restore database
  21. echo %RED%8%NC% - Perform a fresh install
  22. echo %RED%9%NC% - Exit
  23. echo:
  24. SET /P action=Please enter a number choice from above:
  25. echo:
  26. if /i "%action%"=="1" goto compileandrun
  27. if /i "%action%"=="2" goto run
  28. if /i "%action%"=="3" goto servertype
  29. if /i "%action%"=="4" goto role
  30. if /i "%action%"=="5" goto name
  31. if /i "%action%"=="6" goto backup
  32. if /i "%action%"=="7" goto import
  33. if /i "%action%"=="8" goto reset
  34. if /i "%action%"=="9" goto exit
  35. echo Error! %action% is not a valid option. Press enter to try again.
  36. echo:
  37. SET /P action=""
  38. goto start
  39. :<------------End Start------------>
  40. :<------------Begin Exit------------>
  41. :exit
  42. REM Shuts down existing java processes
  43. taskkill /F /IM Java*
  44. exit
  45. :<------------End Exit------------>
  46. :<------------Begin Compile and Run------------>
  47. :compileandrun
  48. cls
  49. echo:
  50. echo Starting OpenRSC.
  51. echo:
  52. cd Portable_Windows && call START "" compileandrun.cmd && cd ..
  53. echo:
  54. goto start
  55. :<------------End Compile and Run------------>
  56. :<------------Begin Run------------>
  57. :run
  58. cls
  59. echo:
  60. echo Starting OpenRSC.
  61. echo:
  62. cd Portable_Windows && call START "" run.cmd && cd ..
  63. echo:
  64. goto start
  65. :<------------End Run------------>
  66. :<-------Begin type change--------->
  67. :servertype
  68. cls
  69. echo:
  70. echo This will change your server configuration so you can play other variations of RSC.
  71. echo Please note that any changes you have made to local.conf will be overwritten.
  72. echo:
  73. echo Choices:
  74. echo %RED%1%NC% - Preservation (Play the game as it was at the end of its life)
  75. echo %RED%2%NC% - Cabbage (Modified XP rates, new game modes, and custom content - see wiki for more info)
  76. echo %RED%3%NC% - 2001scape (RSC as it was in the beginning)
  77. echo %RED%4%NC% - OpenPK (Stork PK recreation based on the OpenRSC framework. Currently in alpha)
  78. echo %RED%5%NC% - Return
  79. echo:
  80. SET /P type=Please enter a number choice from above:
  81. echo:
  82. if /i "%type%"=="1" (SET newtype=default
  83. SET newport=43594
  84. )
  85. if /i "%type%"=="2" (SET newtype=rsccabbage
  86. SET newport=43595
  87. )
  88. if /i "%type%"=="3" (SET newtype=2001scape
  89. SET newport=43593
  90. )
  91. if /i "%type%"=="4" (SET newtype=openpk
  92. SET newport=43597
  93. )
  94. if /i "%type%"=="5" goto start
  95. if %type% GTR 0 if %type% LEQ 4 goto changetype
  96. echo Error! %type% is not a valid option. Press enter to try again.
  97. echo:
  98. SET /P type=""
  99. goto start
  100. :changetype
  101. cls
  102. echo:
  103. echo Changing the server configuration to %newtype%.
  104. echo Please make sure you do not have local.conf or port.txt open.
  105. echo:
  106. pause
  107. del "server\local.conf"
  108. echo is_localhost_restricted: false > "server\local.conf"
  109. type "server\%newtype%.conf" >> "server\local.conf"
  110. echo %newport%> "Client_Base\Cache\port.txt"
  111. echo The change is complete; you can now start the game!
  112. echo:
  113. pause
  114. goto start
  115. :<--------End type change---------->
  116. :<------------Begin Role------------>
  117. :role
  118. cls
  119. echo:
  120. echo What would role should the player be set to?
  121. echo:
  122. echo Choices:
  123. echo %RED%1%NC% - Admin
  124. echo %RED%2%NC% - Mod
  125. echo %RED%3%NC% - Regular Player
  126. echo %RED%4%NC% - Return
  127. echo:
  128. SET /P role=Please enter a number choice from above:
  129. echo:
  130. if /i "%role%"=="1" goto admin
  131. if /i "%role%"=="2" goto mod
  132. if /i "%role%"=="3" goto regular
  133. if /i "%role%"=="4" goto start
  134. echo Error! %role% is not a valid option. Press enter to try again.
  135. echo:
  136. SET /P role=""
  137. goto start
  138. :admin
  139. cls
  140. echo:
  141. echo Make sure you are logged out first!
  142. echo Type the username of the player you wish to set and press enter.
  143. echo:
  144. SET /P username=""
  145. cls
  146. echo Type the name of the database where the player is saved.
  147. echo:
  148. echo (preservation, openrsc, cabbage, uranium, coleslaw, 2001scape, or openpk)
  149. echo:
  150. echo The default player database is named preservation.
  151. echo:
  152. echo:
  153. SET /P db=""
  154. cls
  155. echo UPDATE `players` SET `group_id` = '0' WHERE `players`.`username` = '%username%' | %sqlitepath%sqlite3.exe .\server\inc\sqlite\%db%.db
  156. echo:
  157. echo %username% has been made an admin in database %db%!
  158. echo:
  159. pause
  160. goto start
  161. :mod
  162. cls
  163. echo:
  164. echo Make sure you are logged out first!
  165. echo Type the username of the player you wish to set and press enter.
  166. echo:
  167. SET /P username=""
  168. cls
  169. echo Type the name of the database where the player is saved.
  170. echo:
  171. echo (preservation, openrsc, cabbage, uranium, coleslaw, 2001scape, or openpk)
  172. echo:
  173. echo The default player database is named preservation.
  174. echo:
  175. echo:
  176. SET /P db=""
  177. cls
  178. echo UPDATE `players` SET `group_id` = '2' WHERE `players`.`username` = '%username%' | %sqlitepath%sqlite3.exe .\server\inc\sqlite\%db%.db
  179. echo:
  180. echo %username% has been made an mod in database %db%!
  181. echo:
  182. pause
  183. goto start
  184. :regular
  185. cls
  186. echo:
  187. echo Make sure you are logged out first!
  188. echo Type the username of the player you wish to set and press enter.
  189. echo:
  190. SET /P username=""
  191. cls
  192. echo Type the name of the database where the player is saved.
  193. echo:
  194. echo (preservation, openrsc, cabbage, uranium, coleslaw, 2001scape, or openpk)
  195. echo:
  196. echo The default player database is named preservation.
  197. echo:
  198. echo:
  199. SET /P db=""
  200. cls
  201. echo UPDATE `players` SET `group_id` = '10' WHERE `players`.`username` = '%username%' | %sqlitepath%sqlite3.exe .\server\inc\sqlite\%db%.db
  202. echo:
  203. echo %username% has been made a player in database %db%!
  204. echo:
  205. pause
  206. goto start
  207. :<------------End Role------------>
  208. :<------------Begin Name Change------------>
  209. :name
  210. cls
  211. echo Make sure you are logged out first!
  212. echo What existing player should have their name changed?
  213. echo:
  214. SET /P oldname=""
  215. echo:
  216. echo What would you like to change "%oldname%"'s name to?
  217. echo:
  218. SET /P newname=""
  219. cls
  220. echo Type the name of the database where the player is saved.
  221. echo:
  222. echo (preservation, openrsc, cabbage, uranium, coleslaw, 2001scape, or openpk)
  223. echo:
  224. echo The default player database is named preservation.
  225. echo:
  226. echo:
  227. SET /P db=""
  228. cls
  229. echo UPDATE `players` SET `username` = '%newname%' WHERE `players`.`username` = '%oldname%' | %sqlitepath%sqlite3.exe .\server\inc\sqlite\%db%.db
  230. echo:
  231. echo %oldname% has been renamed to %newname%!
  232. echo:
  233. pause
  234. goto start
  235. :<------------End Name Change------------>
  236. :<------------Begin Backup------------>
  237. :backup
  238. REM Shuts down existing processes
  239. taskkill /F /IM Java*
  240. REM Performs a full database export
  241. cls
  242. echo Type the name of the database that you wish to backup.
  243. echo:
  244. echo (preservation, openrsc, cabbage, uranium, coleslaw, 2001scape, or openpk)
  245. echo:
  246. echo The default player database is named preservation.
  247. echo:
  248. SET /P db=""
  249. cls
  250. echo .dump | %sqlitepath%sqlite3.exe .\server\inc\sqlite\%db%.db > "Backups/%db%-%DATE:~-4%-%DATE:~4,2%-%DATE:~7,2%T%time:~-11,2%-%time:~-8,2%-%time:~-5,2%.sql"
  251. echo:
  252. echo Database "%db%" backup complete.
  253. echo:
  254. pause
  255. goto start
  256. :<------------End Backup------------>
  257. :<------------Begin Import------------>
  258. :import
  259. REM Shuts down existing processes
  260. taskkill /F /IM Java*
  261. cls
  262. REM Performs a full database import
  263. echo ===========================================================================
  264. dir Backups
  265. echo ===========================================================================
  266. echo:
  267. echo Type the filename of the backup file listed above that you wish to restore.
  268. echo (Copy and paste it exactly)
  269. echo:
  270. SET /P filename=""
  271. cls
  272. echo Which database should this be restored to? (preservation, openrsc, cabbage, uranium, coleslaw, 2001scape, or openpk)
  273. echo:
  274. SET /P db=""
  275. cls
  276. echo .read Backups/%filename% | %sqlitepath%sqlite3.exe .\server\inc\sqlite\%db%.db
  277. echo:
  278. echo File "%filename%" was restored to database "%db%".
  279. echo:
  280. pause
  281. goto start
  282. :<------------End Import------------>
  283. :<------------Begin Fresh Install------------>
  284. :reset
  285. REM Shuts down existing processes
  286. taskkill /F /IM Java*
  287. REM Verifies the user wishes to clear existing player data
  288. cls
  289. echo:
  290. echo Are you ABSOLUTELY SURE that you want to perform a fresh install and reset any existing game databases?
  291. echo:
  292. echo To confirm the database reset, type yes and press enter.
  293. echo:
  294. SET /P confirmwipe=""
  295. echo:
  296. if /i "%confirmwipe%"=="yes" goto wipe
  297. echo Error! %confirmwipe% is not a valid option.
  298. pause
  299. goto start
  300. :wipe
  301. cls
  302. echo .read ./server/database/sqlite/core.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\preservation.db
  303. echo .read ./server/database/sqlite/core.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openrsc.db
  304. echo .read ./server/database/sqlite/core.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\uranium.db
  305. echo .read ./server/database/sqlite/core.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\cabbage.db
  306. echo .read ./server/database/sqlite/core.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\coleslaw.db
  307. echo .read ./server/database/sqlite/core.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openpk.db
  308. echo .read ./server/database/sqlite/retro.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\2001scape.db
  309. echo .read ./server/database/sqlite/addons/add_auctionhouse.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\cabbage.db
  310. echo .read ./server/database/sqlite/addons/add_bank_presets.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\cabbage.db
  311. echo .read ./server/database/sqlite/addons/add_clans.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\cabbage.db
  312. echo .read ./server/database/sqlite/addons/add_equipment_tab.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\cabbage.db
  313. echo .read ./server/database/sqlite/addons/add_npc_kill_counting.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\cabbage.db
  314. echo .read ./server/database/sqlite/addons/add_auctionhouse.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\coleslaw.db
  315. echo .read ./server/database/sqlite/addons/add_bank_presets.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\coleslaw.db
  316. echo .read ./server/database/sqlite/addons/add_clans.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\coleslaw.db
  317. echo .read ./server/database/sqlite/addons/add_equipment_tab.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\coleslaw.db
  318. echo .read ./server/database/sqlite/addons/add_npc_kill_counting.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\coleslaw.db
  319. echo .read ./server/database/sqlite/addons/add_auctionhouse.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openpk.db
  320. echo .read ./server/database/sqlite/addons/add_bank_presets.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openpk.db
  321. echo .read ./server/database/sqlite/addons/add_clans.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openpk.db
  322. echo .read ./server/database/sqlite/addons/add_equipment_tab.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openpk.db
  323. echo .read ./server/database/sqlite/addons/add_npc_kill_counting.sqlite | %sqlitepath%sqlite3.exe .\server\inc\sqlite\openpk.db
  324. echo:
  325. echo Fresh install complete!
  326. echo:
  327. pause
  328. goto start
  329. :<------------End Fresh Install------------>