mirror of
https://gitlab.com/2009scape/singleplayer/windows.git
synced 2026-08-01 14:39:18 -06:00
133 lines
No EOL
3.6 KiB
Batchfile
133 lines
No EOL
3.6 KiB
Batchfile
@echo off
|
|
:# Thanks to the OpenRSC team who I adapted this script from, much love <3
|
|
SET mariadbpath="%~dp0\database\bin\"
|
|
SET data="%~dp0\data\"
|
|
SET database="%~dp0\database\"
|
|
SET home=%~dp0
|
|
:<------------Begin Start------------>
|
|
REM Initial menu displayed to the user
|
|
:start
|
|
cls
|
|
echo:
|
|
echo What would you like to do?
|
|
echo:
|
|
echo Choices:
|
|
echo 1. Run the game
|
|
echo 2. Initialize the database. (Only needs to be run once!)
|
|
echo 3. Reset the database.
|
|
echo 4. Grant a player admin rights.
|
|
echo 5. Exit.
|
|
SET /P action=Please enter a number choice from above:
|
|
echo:
|
|
if /i "%action%"=="1" goto run
|
|
if /i "%action%"=="2" goto initDB
|
|
if /i "%action%"=="3" goto reset
|
|
if /i "%action%"=="4" goto role
|
|
if /i "%action%"=="5" goto exit
|
|
echo Error! %action% is not a valid option. Press enter to try again.
|
|
echo:
|
|
SET /P action=""
|
|
goto start
|
|
:<------------End Start------------>
|
|
|
|
:<------------Begin Role----------->
|
|
:role
|
|
taskkill /F /IM mysqld*
|
|
taskkill /F /IM java*
|
|
cls
|
|
cd %database%
|
|
call START "" %mariadbpath%mysqld.exe --console --skip-grant-tables --lc-messages-dir="%CD%\share\english" --datadir="%CD%\data"
|
|
sleep 3
|
|
cls
|
|
SET /p username=Please enter the user to make an admin:
|
|
call %mariadbpath%mysql.exe -uroot -e "USE global; UPDATE `members` SET `rights` = '2' WHERE `members`.`username` = '%username%';"
|
|
sleep 2
|
|
echo:
|
|
echo %username% is now an Administrator!
|
|
call %mariadbpath%mysqladmin.exe -uroot shutdown
|
|
echo:
|
|
pause
|
|
goto start
|
|
:<------------End Role------------->
|
|
|
|
:<------------Begin Exit------------>
|
|
:exit
|
|
REM Shuts down existing processes
|
|
taskkill /F /IM Java*
|
|
taskkill /F /IM mysqld*
|
|
exit
|
|
:<------------End Exit------------>
|
|
|
|
:<------------Begin Run------------>
|
|
:run
|
|
cls
|
|
cd %database%
|
|
start /b "" %mariadbpath%mysqld.exe --console --skip-grant-tables --lc-messages-dir="%CD%\share\english" --datadir="%CD%\data"
|
|
sleep 5
|
|
cls
|
|
echo:
|
|
echo Starting 2009scape.
|
|
echo:
|
|
cd %home%
|
|
start /b "" java -jar ms.jar
|
|
sleep 1
|
|
echo "Starting server-------------------------"
|
|
start /b "" java -cp server.jar core.Server %home%default.xml
|
|
sleep 10
|
|
echo "Starting client-------------------------"
|
|
start "" java -jar client.jar
|
|
echo:
|
|
goto start
|
|
:<------------End Run------------>
|
|
|
|
:<------------Begin initDB------------>
|
|
:initDB
|
|
REM Shuts down existing processes
|
|
taskkill /F /IM Java*
|
|
taskkill /F /IM mysqld*
|
|
cd %home%
|
|
mkdir %home%..\.runite_rs\runescape
|
|
robocopy data\cache\ ..\.runite_rs\runescape /MIR
|
|
cd %database%
|
|
mkdir data
|
|
call START "" %mariadbpath%mysqld.exe --console --skip-grant-tables --lc-messages-dir="%CD%\share\english" --datadir="%CD%\data"
|
|
sleep 3
|
|
call %mariadbpath%mysql.exe -uroot -e "CREATE DATABASE global;
|
|
call %mariadbpath%mysql.exe -uroot -e "CREATE DATABASE server;
|
|
call %mariadbpath%mysql.exe -uroot server < "%data%\server.sql"
|
|
call %mariadbpath%mysql.exe -uroot global < "%data%\global.sql"
|
|
echo:
|
|
echo Databases initialized!
|
|
taskkill /F /IM mysqld*
|
|
echo:
|
|
pause
|
|
goto start
|
|
:<------------End initDB------------>
|
|
|
|
:<------------Begin Reset------------>
|
|
:reset
|
|
REM Shuts down existing processes
|
|
taskkill /F /IM Java*
|
|
taskkill /F /IM mysqld*
|
|
REM Verifies the user wishes to clear existing player data
|
|
cls
|
|
echo:
|
|
echo Are you ABSOLUTELY SURE that you want to reset all game databases?
|
|
echo:
|
|
echo To confirm the database reset, type yes and press enter.
|
|
echo:
|
|
SET /P confirmwipe=""
|
|
echo:
|
|
if /i "%confirmwipe%"=="yes" goto wipe
|
|
if /i "%confirmwipe%"=="no" goto start
|
|
echo Error! %confirmwipe% is not a valid option.
|
|
pause
|
|
goto start
|
|
REM Starts up the database server and imports both server and player database files to replace anything previously existing
|
|
:wipe
|
|
cls
|
|
cd %database%
|
|
rm -fr data
|
|
mkdir data
|
|
goto initDB
|
|
:<------------End Reset------------> |