forked from mangosone/database
-
Notifications
You must be signed in to change notification settings - Fork 0
/
InstallDatabases.bat
399 lines (331 loc) · 10.1 KB
/
InstallDatabases.bat
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
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
@ECHO OFF
set createcharDB=YES
set createworldDB=YES
set createrealmDB=YES
set loadcharDB=YES
set loadworldDB=YES
set loadrealmDB=YES
set DBType=POPULATED
set activity=N
set locFR=NO
set locES=NO
set locDE=NO
rem -- Change the values below to match your server --
set mysql=Tools\
set svr=localhost
set user=mangos
set pass=
set port=3306
set wdb=mangos1
set wdborig=mangos1
set cdb=character1
set cdborig=character1
set rdb=realmd
set rdborig=realmd
rem -- Don't change past this point --
:main
color 0e
CLS
echo.
echo __ __ _ _ ___ ___ ___
echo ^| \/ ^|__ _^| \^| ^|/ __^|/ _ \/ __^| Database Setup and
echo ^| ^|\/^| / _` ^| .` ^| (_ ^| (_) \__ \
echo ^|_^| ^|_\__,_^|_^|\_^|\___^|\___/^|___/ World Loader v0.04
echo.
echo _____________________________________________________________
echo.
echo Website / Forum / Wiki: https://getmangos.eu
echo _____________________________________________________________
echo.
ECHO.
echo Character Database : V - Toggle Create DB (%createcharDB%)
echo C - Toggle Create Structure (%loadcharDB%)
echo.
echo World Database : E - Toggle Create DB (%createworldDB%)
echo W - Toggle Create Structure (%loadworldDB%)
if %loadworldDB% == YES echo D - Toggle World Type (%DBType%)
echo.
echo Realm Database : T - Toggle Create DB (%createrealmDB%)
echo R - Toggle Create Structure (%loadrealmDB%)
echo.
set LOCList=NO
if %locFR% == YES set LOCList=YES
if %locDE% == YES set LOCList=YES
if %locES% == YES set LOCList=YES
REM echo A - Add Localised Content (%LOCList%)
echo N - Next Step
echo X - Exit
echo.
set /p activity=. Please select an activity ? :
if %activity% == V goto ToggleCharDB:
if %activity% == v goto ToggleCharDB:
if %activity% == E goto ToggleWorldDB:
if %activity% == e goto ToggleWorldDB:
if %activity% == D goto ToggleWorldDBType:
if %activity% == d goto ToggleWorldDBType:
if %activity% == T goto ToggleRealmDB:
if %activity% == t goto ToggleRealmDB:
if %activity% == C goto LoadCharDB:
if %activity% == c goto LoadCharDB:
if %activity% == W goto LoadWorldDB:
if %activity% == w goto LoadWorldDB:
if %activity% == R goto LoadRealmDB:
if %activity% == r goto LoadRealmDB:
if %activity% == N goto Step1:
if %activity% == n goto Step1:
REM if %activity% == A goto StepLoc1:
REM if %activity% == a goto StepLoc1:
if %activity% == X goto done:
if %activity% == x goto done:
if %activity%. == . goto main:
goto main
:ToggleWorldDBType
if %DBType% == EMPTY goto ToggleWorldDBTypePopulated:
if %DBType% == POPULATED goto ToggleWorldDBTypeEmpty:
goto main:
:ToggleWorldDBTypePopulated
set DBType=POPULATED
goto main:
:ToggleWorldDBTypeEmpty
set DBType=EMPTY
goto main:
:ToggleCharDB
if %createcharDB% == NO goto ToggleCharDBNo:
if %createcharDB% == YES goto ToggleCharDBYes:
goto main:
:ToggleCharDBNo
set createcharDB=YES
goto main:
:ToggleCharDBYes
set createcharDB=NO
goto main:
:ToggleWorldDB
if %createworldDB% == NO goto ToggleWorldDBNo:
if %createworldDB% == YES goto ToggleWorldDBYes:
goto main:
:ToggleWorldDBNo
set createworldDB=YES
goto main:
:ToggleWorldDBYes
set createworldDB=NO
goto main:
:ToggleRealmDB
if %createrealmDB% == NO goto ToggleRealmDBNo:
if %createrealmDB% == YES goto ToggleRealmDBYes:
goto main:
:ToggleRealmDBNo
set createrealmDB=YES
goto main:
:ToggleRealmDBYes
set createrealmDB=NO
goto main:
:LoadCharDB
if %loadcharDB% == NO goto LoadCharDBNo:
if %loadcharDB% == YES goto LoadCharDBYes:
goto main:
:LoadCharDBNo
set loadcharDB=YES
goto main:
:LoadCharDBYes
set loadcharDB=NO
goto main:
:LoadWorldDB
if %loadworldDB% == NO goto LoadWorldDBNo:
if %loadworldDB% == YES goto LoadWorldDBYes:
goto main:
:LoadWorldDBNo
set loadworldDB=YES
goto main:
:LoadWorldDBYes
set loadworldDB=NO
goto main:
:LoadRealmDB
if %loadrealmDB% == NO goto LoadRealmDBNo:
if %loadrealmDB% == YES goto LoadRealmDBYes:
goto main:
:LoadRealmDBNo
set loadrealmDB=YES
goto main:
:LoadRealmDBYes
set loadrealmDB=NO
goto main:
:Step1
if not exist %mysql%\mysql.exe then goto patherror
color 08
CLS
echo.
echo __ __ _ _ ___ ___ ___
echo ^| \/ ^|__ _^| \^| ^|/ __^|/ _ \/ __^| Database Setup and
echo ^| ^|\/^| / _` ^| .` ^| (_ ^| (_) \__ \
echo ^|_^| ^|_\__,_^|_^|\_^|\___^|\___/^|___/ World Loader v0.03
echo.
echo _____________________________________________________________
echo.
echo.
set /p svr=What is your MySQL host name? [%svr%] :
if %svr%. == . set svr=localhost
set /p user=What is your MySQL user name? [%user%] :
if %user%. == . set user=mangos
set /p pass=What is your MySQL password? [ ] :
if %pass%. == . set pass=
set /p port=What is your MySQL port? [%port%] :
if %port%. == . set port=3306
set showChar=0
if %createcharDB% == YES set showChar=1
if %loadcharDB% == YES set showChar=1
if %showChar% == 1 set /p cdb=What is your Character database name? [%cdb%] :
if %cdb%. == . set cdb=%cdborig%
set showWorld=0
if %createworldDB% == YES set showWorld=1
if %loadworldDB% == YES set showWorld=1
if %showWorld% == 1 set /p wdb=What is your World database name? [%wdb%] :
if %wdb%. == . set wdb=%wdborig%
set showRealm=0
if %createrealmDB% == YES set showRealm=1
if %loadrealmDB% == YES set showRealm=1
if %showRealm% == 1 set /p rdb=What is your Realm database name? [%rdb%] :
if %rdb%. == . set rdb=%rdborig%
color 02
:WorldDB
REM ##### IF createworlddb = YES then create the DB
if %createworldDB% == YES goto WorldDB1:
:WorldDB2
REM ##### IF loadworlddb = YES then load the DB
if %loadworldDB% == YES goto WorldDB3:
:CharDB
REM ##### IF createchardb = YES then create the DB
if %createcharDB% == YES goto CharDB1:
:CharDB2
REM ##### IF loadchardb = YES then load the DB
if %loadcharDB% == YES goto CharDB3:
:RealmDB
REM ##### IF createrealmdb = YES then create the DB
if %createrealmDB% == YES goto RealmDB1:
:RealmDB2
REM ##### IF loadrealmdb = YES then load the DB
if %loadrealmDB% == YES goto RealmDB3:
goto done:
:WorldDB1
echo Creating World Database %wdb%
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% -e "create database %wdb%";
goto WorldDB2:
:WorldDB3
if %DBType% == POPULATED goto WorldDB4:
echo Loading world Database %wdb%
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < World\Setup\mangosdLoadDB.sql
goto CharDB:
:WorldDB4
echo Importing World database %wdb%
for %%i in (World\Setup\FullDB\*.sql) do echo %%i & %mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %wdb% < %%i
goto CharDB:
:CharDB1
echo Creating Character Database %cdb%
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% -e "create database %cdb%";
goto CharDB2:
:CharDB3
echo Loading Character Database %cdb%
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %cdb% < Character\Setup\characterLoadDB.sql
goto RealmDB:
:RealmDB1
echo Creating Realm Database %rdb%
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% -e "create database %rdb%";
goto RealmDB2:
:RealmDB3
echo Loading Realm Database %rdb%
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %rdb% < Realm\Setup\realmdLoadDB.sql
%mysql%mysql -q -s -h %svr% --user=%user% --password=%pass% --port=%port% %rdb% < Tools\updateRealm.sql
goto done:
:patherror
echo Cannot find required files.
pause
goto :error
:StepLoc1
color 0e
cls
echo.
echo __ __ _ _ ___ ___ ___
echo ^| \/ ^|__ _^| \^| ^|/ __^|/ _ \/ __^| Database Setup and
echo ^| ^|\/^| / _` ^| .` ^| (_ ^| (_) \__ \
echo ^|_^| ^|_\__,_^|_^|\_^|\___^|\___/^|___/ World Loader v0.03
echo.
echo _____________________________________________________________
echo.
echo Database Localisation Support
echo _____________________________________________________________
echo.
echo French (Francaís) : F - Toggle Loading Localisations (%locFR%)
echo.
echo German (Deusch) : G/D - Toggle Loading Localisations (%locDE%)
echo.
echo Spanish (Espána) : S/E - Toggle Loading Localisations (%locES%)
echo.
echo N - Next Step
echo.
set /p activity=. Please select an activity ? :
if %activity% == F goto ToggleLocFR:
if %activity% == f goto TogglelocFR:
if %activity% == G goto TogglelocDE:
if %activity% == g goto TogglelocDE:
if %activity% == D goto TogglelocDE:
if %activity% == d goto TogglelocDE:
if %activity% == S goto TogglelocES:
if %activity% == s goto TogglelocES:
if %activity% == E goto TogglelocES:
if %activity% == e goto TogglelocES:
if %activity% == N goto main:
if %activity% == n goto main:
goto StepLoc1
:ToggleLocFR
if %locFR% == NO goto ToggleLocFRNo:
if %locFR% == YES goto ToggleLocFRYes:
goto StepLoc1:
:ToggleLocFRNo
set locFR=YES
goto StepLoc1:
:ToggleLocFRYes
set locFR=NO
goto StepLoc1:
:ToggleLocDE
if %locDE% == NO goto ToggleLocDENo:
if %locDE% == YES goto ToggleLocDEYes:
goto StepLoc1:
:ToggleLocDENo
set locDE=YES
goto StepLoc1:
:ToggleLocDEYes
set locDE=NO
goto StepLoc1:
:ToggleLocES
if %locES% == NO goto ToggleLocESNo:
if %locES% == YES goto ToggleLocESYes:
goto StepLoc1:
:ToggleLocESNo
set locES=YES
goto StepLoc1:
:ToggleLocESYes
set locES=NO
goto StepLoc1:
:error
echo _____________________________________________________________
echo.
echo Install Database Process Failed
echo _____________________________________________________________
echo.
goto finish:
:done
color 08
echo.
echo __ __ _ _ ___ ___ ___
echo ^| \/ ^|__ _^| \^| ^|/ __^|/ _ \/ __^| Database Setup and
echo ^| ^|\/^| / _` ^| .` ^| (_ ^| (_) \__ \
echo ^|_^| ^|_\__,_^|_^|\_^|\___^|\___/^|___/ World Loader v0.03
echo.
echo _____________________________________________________________
echo.
echo Database Creation and Load complete
echo _____________________________________________________________
echo.
echo Done :)
echo.
:finish
pause