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