forked from celguar/spp-classics-cmangos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Launcher.bat
3509 lines (3285 loc) · 133 KB
/
Launcher.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
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
@echo off
:beginning
SET NAME=SPP - Classics Collection V2
TITLE %NAME%
set mainfolder=%CD%
set repack_version=2.3.8
set "maps_date=06.06.2021"
set "maps_date2=06/06/2021"
set /a website_version=13
rem disable music for now
IF NOT EXIST "%mainfolder%\music.on" (
IF NOT EXIST "%mainfolder%\music.off" (
echo music > "%mainfolder%\music.on"
)
)
IF NOT EXIST "%mainfolder%\website.on" (
IF NOT EXIST "%mainfolder%\website.off" (
echo music > "%mainfolder%\website.on"
)
)
if not exist "%mainfolder%\Server\Tools\Apache24" goto install_website
if not exist "%mainfolder%\Server\Tools\Notepad" goto install_notepad
if exist "%mainfolder%\Server\Database" goto beginning_part2
cls
echo.
echo Preparing for the first launch...
ping -n 2 127.0.0.1>nul
cd "%mainfolder%\Server"
"%mainfolder%\Server\Tools\7za.exe" e -y -spf Database.7z > nul
REM "%mainfolder%\Server\Tools\7za.exe" e -y -spf Database_Playerbot.7z > nul
cd "%mainfolder%"
goto beginning
:install_website
echo.
echo Extracting Webserver...
echo.
ping -n 3 127.0.0.1>nul
echo Please, wait...
echo.
cd "%mainfolder%\Server\Tools"
"%mainfolder%\Server\Tools\7za.exe" e -y -spf Apache.7z > nul
cd "%mainfolder%"
echo Done!
ping -n 3 127.0.0.1>nul
goto beginning
:update_website
mode con: cols=40 lines=30
cls
more < "%mainfolder%\header_spp.txt"
echo.
echo Website update required!
ping -n 3 127.0.0.1>nul
echo.
echo %current_website_version% ---^> %website_version%
ping -n 3 127.0.0.1>nul
echo.
echo Please wait...
ping -n 3 127.0.0.1>nul
if exist "%mainfolder%\Server\website" rd /s /q "%mainfolder%\Server\website"
cd "%mainfolder%\Server"
mkdir website
"%mainfolder%\Server\Tools\7za.exe" e -y -spf -o"%mainfolder%\Server\website" website.7z > nul
cd "%mainfolder%"
echo.
echo Updating Webserver...
ping -n 3 127.0.0.1>nul
echo.
echo Please, wait...
cd "%mainfolder%\Server\Tools"
"%mainfolder%\Server\Tools\7za.exe" e -y -spf Apache.7z > nul
cd "%mainfolder%"
echo.
echo Done!
ping -n 3 127.0.0.1>nul
>"%mainfolder%\website_version.spp" echo %website_version%
goto beginning
:install_notepad
echo.
echo Extracting Notepad++...
echo.
ping -n 3 127.0.0.1>nul
echo Please, wait...
echo.
cd "%mainfolder%\Server\Tools"
"%mainfolder%\Server\Tools\7za.exe" e -y -spf Notepad.7z > nul
cd "%mainfolder%"
echo Done!
ping -n 3 127.0.0.1>nul
goto beginning
:beginning_part2
if exist "%mainfolder%\music.on" goto new_intro
if exist "%mainfolder%\music.off" goto launcher_intro
:new_intro
mode con: cols=40 lines=30
rem tasklist /FI "IMAGENAME eq cmdmp3win.exe" 2>NUL | find /I /N "cmdmp3win.exe">NUL
rem if "%ERRORLEVEL%"=="0" goto select_expansion
rem cd "%mainfolder%\Server\Tools"
rem start cmdmp3win.exe launcher.mp3
rem Only show intro once
if exist "%mainfolder%\version.spp" goto launcher_intro
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
COLOR 08
echo Press 1 to turn music off
choice /t 1 /c 123456789qm /d q >nul
if %errorlevel% EQU 1 goto skip_music
rem ping -n 1 127.0.0.1>nul
cls
COLOR 0F
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Press 1 to turn music off
choice /t 1 /c 123456789qm /d q >nul
if %errorlevel% EQU 1 goto skip_music
rem ping -n 1 127.0.0.1>nul
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
COLOR 08
echo Press 1 to turn music off
choice /t 1 /c 123456789qm /d q >nul
if %errorlevel% EQU 1 goto skip_music
rem ping -n 1 127.0.0.1>nul
cls
COLOR 0F
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Press 1 to turn music off
choice /t 1 /c 123456789qm /d q >nul
if %errorlevel% EQU 1 goto skip_music
rem ping -n 1 127.0.0.1>nul
rem if NOT %errorlevel% EQU 5 goto new_music
cls
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
COLOR 08
echo Press 1 to turn music off
choice /t 1 /c 123456789qm /d q >nul
if %errorlevel% EQU 1 goto skip_music
rem ping -n 1 127.0.0.1>nul
cls
COLOR 0F
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Press 1 to turn music off
choice /t 1 /c 123456789qm /d q >nul
if %errorlevel% EQU 1 goto skip_music
rem ping -n 1 127.0.0.1>nul
echo.
goto launcher_intro
:skip_music
COLOR 0F
taskkill /f /im cmdmp3win.exe
cls
if exist "%mainfolder%\music.on" del "%mainfolder%\music.on"
cls
echo music > "%mainfolder%\music.off"
goto launcher_intro
:launcher_intro
rem Only show intro once
if exist "%mainfolder%\version.spp" goto select_expansion
COLOR 0F
mode con: cols=40 lines=30
rem echo ############################################################
rem echo # SPP - Classics Collection #
rem echo # https://www.singleplayerproject.com/ #
rem echo ############################################################
rem if exist "%mainfolder%\music.on" start cmdmp3win.exe music/launcher_intro.mp3
cd "%mainfolder%\Server\Tools"
if exist "%mainfolder%\music.on" start cmdmp3win.exe music/launcher_intro.mp3
cls
echo #
echo #
echo #
echo #
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Starting the launcher...
rem echo Get ready...for something nostalgic...
ping -n 3 127.0.0.1>nul
cls
echo ########################################
echo #
echo #
echo #
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Starting the launcher...
ping -n 3 127.0.0.1>nul
cls
echo ########################################
echo # #
echo # #
echo # #
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Starting the launcher...
echo.
echo Get ready...
ping -n 3 127.0.0.1>nul
cls
echo ########################################
echo # #
echo # #
echo ########################################
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Starting the launcher...
echo.
echo Get ready...
echo.
echo for something nostalgic...
ping -n 3 127.0.0.1>nul
cls
echo ########################################
echo # SPP Classics Collection V2 #
echo # https://www.singleplayerproject.com/ #
echo ########################################
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo.
echo Starting the launcher...
echo.
echo Get ready...
echo.
echo for something nostalgic...
ping -n 3 127.0.0.1>nul
cls
echo ########################################
echo # SPP Classics Collection V2 #
echo # https://www.singleplayerproject.com/ #
echo ########################################
echo.
echo CREDITS:
ping -n 3 127.0.0.1>nul
cls
echo ########################################
echo # SPP Classics Collection V2 #
echo # https://www.singleplayerproject.com/ #
echo ########################################
echo.
echo CREDITS:
echo.
echo Teams:
echo ------
echo "MaNGOS" "CMaNGOS"
echo "AzerothCore" "TrinityCore"
echo "WoWruRU Project" "VMaNGOS"
ping -n 3 127.0.0.1>nul
rem goto select_expansion
cls
echo ########################################
echo # SPP Classics Collection V2 #
echo # https://www.singleplayerproject.com/ #
echo ########################################
echo.
echo CREDITS:
echo.
more < "%mainfolder%\credits.txt"
ping -n 7 127.0.0.1>nul
rem if exist "%mainfolder%\music.on" start cmdmp3win.exe music/launcher_intro.mp3
if exist "%mainfolder%\music.on" start cmdmp3win.exe music/launcher_outro.mp3
cd "%mainfolder%"
goto select_expansion
:music_start
mode con: cols=40 lines=30
tasklist /FI "IMAGENAME eq cmdmp3win.exe" 2>NUL | find /I /N "cmdmp3win.exe">NUL
if "%ERRORLEVEL%"=="0" goto select_expansion
cd "%mainfolder%\Server\Tools"
start cmdmp3win.exe launcher.mp3
cls
echo.
echo Starting the launcher...
ping -n 2 127.0.0.1>nul
echo Get ready...
ping -n 3 127.0.0.1>nul
cls
echo.
echo Starting the launcher...
echo Get ready...for something nostalgic...
ping -n 3 127.0.0.1>nul
cls
echo.
echo CREDITS:
echo.
more < "%mainfolder%\credits.txt"
ping -n 9 127.0.0.1>nul
cls
rem echo.
rem echo List of the active Patrons
rem echo --------------------------
rem echo.
rem more < "%mainfolder%\patrons.txt"
rem echo.
rem echo ###################
rem echo # Thank you guys! #
rem echo ###################
rem ping -n 9 127.0.0.1>nul
goto select_expansion
:website_start
tasklist /FI "IMAGENAME eq spp-httpd.exe" 2>NUL | find /I /N "spp-httpd.exe">NUL
if "%ERRORLEVEL%"=="0" goto menu
cd "%mainfolder%\Server\Tools\Apache24"
start "" /min "apache_start.bat"
cd "%mainfolder%"
cls
rem more < "%mainfolder%\header_spp.txt"
rem echo.
rem echo Updating website news!
rem ping -n 1 127.0.0.1>nul
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%login% < "%mainfolder%\sql\%expansion%\website_news.sql"
rem echo.
rem echo Done!
rem ping -n 1 127.0.0.1>nul
cls
goto menu
:music_switch
if exist "%mainfolder%\music.on" goto music_off
if exist "%mainfolder%\music.off" goto music_on
:website_switch
if exist "%mainfolder%\website.on" goto website_off
if exist "%mainfolder%\website.off" goto website_on
:music_off
taskkill /f /im cmdmp3win.exe
cls
del "%mainfolder%\music.on"
echo music > "%mainfolder%\music.off"
goto beginning
:music_on
del "%mainfolder%\music.off"
echo music > "%mainfolder%\music.on"
goto beginning
:website_off
taskkill /f /im spp-httpd.exe
cls
del "%mainfolder%\website.on"
echo music > "%mainfolder%\website.off"
goto beginning
:website_on
del "%mainfolder%\website.off"
echo website > "%mainfolder%\website.on"
tasklist /FI "IMAGENAME eq spp-httpd.exe" 2>NUL | find /I /N "spp-httpd.exe">NUL
if "%ERRORLEVEL%"=="0" goto beginning
REM cd "%mainfolder%\Server\Tools\Apache24"
REM start "" /min "apache_start.bat"
REM cd "%mainfolder%"
goto beginning
:select_expansion
endlocal
mode con: cols=40 lines=30
SET NAME=SPP - Classics Collection V2
TITLE %NAME%
COLOR 0F
set mangos_running=false
tasklist /FI "IMAGENAME eq mangosd.exe" 2>NUL | find /I /N "mangosd.exe">NUL
if "%ERRORLEVEL%"=="0" set mangos_running=true
tasklist /FI "IMAGENAME eq realmd.exe" 2>NUL | find /I /N "realmd.exe">NUL
if "%ERRORLEVEL%"=="0" (if %mangos_running%==false taskkill /f /im realmd.exe)
tasklist /FI "IMAGENAME eq mysqld.exe" 2>NUL | find /I /N "mysqld.exe">NUL
if "%ERRORLEVEL%"=="0" (if %mangos_running%==false "%mainfolder%\Server\Database\bin\mysqladmin.exe" -u root -p123456 --port=3310 shutdown)
tasklist /FI "IMAGENAME eq spp-httpd.exe" 2>NUL | find /I /N "spp-httpd.exe">NUL
if "%ERRORLEVEL%"=="0" (if %mangos_running%==false taskkill /f /im spp-httpd.exe)
rem add message to wait for db shutdown
tasklist /FI "IMAGENAME eq mysqld.exe" 2>NUL | find /I /N "mysqld.exe">NUL
if "%ERRORLEVEL%"=="0" (if %mangos_running%==false (
cls
more < "%mainfolder%\header_spp.txt"
echo.
echo Closing database...
ping -n 3 127.0.0.1>nul
)
)
if exist "%mainfolder%\music.on" set music=ON
if exist "%mainfolder%\music.off" set music=OFF
if exist "%mainfolder%\website.on" set website=ON
if exist "%mainfolder%\website.off" set website=OFF
set module_check_vanilla=Not Installed
set module_check_tbc=Not Installed
set module_check_wotlk=Not Installed
set module_check_cata=Not Installed
set vanilla_beta=
set tbc_beta=
set wotlk_beta=
if exist "%mainfolder%\vanilla_beta.on" set vanilla_beta=- [BETA]
if exist "%mainfolder%\tbc_beta.on" set tbc_beta=- [BETA]
if exist "%mainfolder%\wotlk_beta.on" set wotlk_beta=- [BETA]
if exist "%mainfolder%\Modules\vanilla\dbc" set module_check_vanilla=Installed
if exist "%mainfolder%\Modules\tbc\dbc" set module_check_tbc=Installed
if exist "%mainfolder%\Modules\wotlk\dbc" set module_check_wotlk=Installed
if exist "%mainfolder%\Modules\cata\dbc" set module_check_cata=Installed
set vanilla_running=OFF
set tbc_running=OFF
set wotlk_running=OFF
for /f "tokens=2 delims=," %%I in (
'wmic process where "name='mangosd.exe'" get ExecutablePath^,Handle /format:csv ^| find /i "mangosd.exe"'
) do (
if "%%~I"=="%mainfolder%\Server\Binaries\vanilla\Bin64\mangosd.exe" (
set module_running_vanilla=- [Running]
set vanilla_running=ON
)
if "%%~I"=="%mainfolder%\Server\Binaries\tbc\Bin64\mangosd.exe" (
set module_running_tbc=- [Running]
set tbc_running=ON
)
if "%%~I"=="%mainfolder%\Server\Binaries\wotlk\Bin64\mangosd.exe" (
set module_running_wotlk=- [Running]
set wotlk_running=ON
)
rem if "%%~I"=="%mainfolder%\Server\Binaries\vanilla\Bin64\mangosd.exe" goto setup_vanilla
rem if "%%~I"=="%mainfolder%\Server\Binaries\tbc\Bin64\mangosd.exe" goto setup_tbc
rem if "%%~I"=="%mainfolder%\Server\Binaries\wotlk\Bin64\mangosd.exe" goto setup_wotlk
)
cd "%mainfolder%"
if not exist "%mainfolder%\version.spp" (
echo %repack_version% > "%mainfolder%\version.spp"
rem goto changelog
)
if exist "%mainfolder%\version.spp" (set /p current_version=<"%mainfolder%\version.spp")
if %current_version% LSS %repack_version% (
echo %repack_version% > "%mainfolder%\version.spp"
goto changelog
)
if not exist "%mainfolder%\website_version.spp" goto update_website
set /p current_website_version=<"%mainfolder%\website_version.spp"
set /a "current_website_version=current_website_version"
if %current_website_version% LSS 1 (set /a "current_website_version=1")
if %current_website_version% LSS %website_version% goto update_website
cls
more < "%mainfolder%\header_spp.txt"
echo.
echo Choose expansion:
echo.
echo 1 - World of Warcraft
echo.
echo [%module_check_vanilla%] %module_running_vanilla% %vanilla_beta%
echo.
echo.
echo 2 - The Burning Crusade
echo.
echo [%module_check_tbc%] %module_running_tbc% %tbc_beta%
echo.
echo.
echo 3 - Wrath of the Lich King
echo.
echo [%module_check_wotlk%] %module_running_wotlk% %wotlk_beta%
REM echo 4 - World of Warcraft: Cataclysm [%module_check_cata%]
echo.
echo 9 - Website [%website%]
echo.
echo 0 - Music [%music%]
echo.
echo 5 - Service menu
echo.
echo 6 - Changelog Ver: %repack_version%
echo.
set /P choose_exp=What expansion do you want to play:
if "%choose_exp%"=="1" (if not "%tbc_running%"=="ON" if not "%wotlk_running%"=="ON" goto setup_vanilla)
if "%choose_exp%"=="2" (if not "%vanilla_running%"=="ON" if not "%wotlk_running%"=="ON" goto setup_tbc)
if "%choose_exp%"=="3" (if not "%tbc_running%"=="ON" if not "%vanilla_running%"=="ON" goto setup_wotlk)
REM if "%choose_exp%"=="4" (goto setup_cata)
if "%choose_exp%"=="9" (goto website_switch)
if "%choose_exp%"=="0" (goto music_switch)
if "%choose_exp%"=="5" (goto service_menu)
if "%choose_exp%"=="6" (goto changelog)
if "%choose_exp%"=="" (goto select_expansion)
:setup_vanilla
SET NAME=SPP - Vanilla
TITLE %NAME%
COLOR 0E
set expansion=vanilla
set characters=classiccharacters
set playerbot=classicplayerbots
set world=classicmangos
set login=classicrealmd
set logsdb=classiclogs
set realmserver=realmd.exe
set worldserver=mangosd.exe
set spp_update=vanilla_base
set /a maps_version=2
set /a world_version=21
set /a chars_version=13
set /a realm_version=4
set /a logs_version=1
set /a bots_version=24
set /a website_db_version=4
set /a core_version=38
goto settings
:setup_tbc
SET NAME=SPP - Burning Crusade
TITLE %NAME%
COLOR 0A
set expansion=tbc
set characters=tbccharacters
set playerbot=tbcplayerbots
set world=tbcmangos
set login=tbcrealmd
set logsdb=tbclogs
set realmserver=realmd.exe
set worldserver=mangosd.exe
set spp_update=tbc_base
set /a maps_version=2
set /a world_version=19
set /a chars_version=13
set /a realm_version=4
set /a logs_version=1
set /a bots_version=24
set /a website_db_version=4
set /a core_version=38
goto settings
:setup_wotlk
SET NAME=SPP - WotLK
TITLE %NAME%
COLOR 0B
set expansion=wotlk
set characters=wotlkcharacters
set playerbot=wotlkplayerbots
set world=wotlkmangos
set login=wotlkrealmd
set logsdb=wotlklogs
set realmserver=realmd.exe
set worldserver=mangosd.exe
set spp_update=wotlk_base
set /a maps_version=2
set /a world_version=18
set /a chars_version=6
set /a realm_version=4
set /a logs_version=1
set /a bots_version=17
set /a website_db_version=4
set /a core_version=24
goto settings
cls
REM echo.
REM echo This expansion is not included yet.
REM echo Check back later.
REM more < "%mainfolder%\logo_%expansion%.txt"
REM echo.
REM pause
REM goto select_expansion
goto settings
:setup_cata
SET NAME=Single Player Project - Cataclysm
TITLE %NAME%
COLOR 0C
set expansion=cata
set characters=cata_characters
set playerbot=cata_playerbot
set world=cata_world
set login=cata_auth
set realmserver=authserver.exe
set worldserver=worldserver.exe
set spp_update=cata_base
goto settings
:settings
REM if exist "%mainfolder%\music.on" start cmdmp3win.exe install_vanilla.mp3
REM --- Settings ---
set host=127.0.0.1
set port=3310
set user=root
set pass=123456
REM --- Settings ---
:start_database
if not exist "%mainfolder%\Saves\%expansion%\autosave" mkdir "%mainfolder%\Saves\%expansion%\autosave"
IF NOT EXIST "%mainfolder%\autosave.on" (
IF NOT EXIST "%mainfolder%\autosave.off" (
echo autosave > "%mainfolder%\autosave.on"
)
)
IF NOT EXIST "%mainfolder%\website.on" (
IF NOT EXIST "%mainfolder%\website.off" (
echo website > "%mainfolder%\website.on"
)
)
start "" /min "%mainfolder%\Server\Database\start.bat"
if not exist "%mainfolder%\Modules\%expansion%\dbc" del "%mainfolder%\%expansion%_maps_version.spp"
if not exist "%mainfolder%\Server\Binaries\%expansion%\Bin64\%worldserver%" goto missing_core
if exist "%mainfolder%\%expansion%_beta.on" (
set /a beta_enable=1
set /p beta_version=<"%mainfolder%\%expansion%_beta.on"
)
if not exist "%mainfolder%\%expansion%_beta.on" (set /a beta_enable=0)
set /a "current_world_version=0"
set /a "current_chars_version=0"
set /a "current_bots_version=0"
set /a "current_realm_version=0"
set /a "current_logs_version=0"
set /a "current_maps_version=0"
set /a "current_website_db_version=0"
set /a "current_core_version=0"
if not exist "%mainfolder%\%spp_update%.spp" goto update_install
if not exist "%mainfolder%\%expansion%_maps_version.spp" goto update_maps
if not exist "%mainfolder%\%expansion%_world_version.spp" goto update_world
if not exist "%mainfolder%\%expansion%_chars_version.spp" goto update_chars
if not exist "%mainfolder%\%expansion%_realm_version.spp" goto update_realm
if not exist "%mainfolder%\%expansion%_logs_version.spp" (if not "%logs_version%"=="0" goto update_logs)
if not exist "%mainfolder%\%expansion%_bots_version.spp" goto update_bots
if not exist "%mainfolder%\%expansion%_website_version.spp" goto install_website_db
if not exist "%mainfolder%\%expansion%_core_version.spp" (if not "%core_version%"=="1" goto update_core)
set /p current_maps_version=<"%mainfolder%\%expansion%_maps_version.spp"
set /p current_world_version=<"%mainfolder%\%expansion%_world_version.spp"
set /p current_chars_version=<"%mainfolder%\%expansion%_chars_version.spp"
set /p current_realm_version=<"%mainfolder%\%expansion%_realm_version.spp"
set /p current_logs_version=<"%mainfolder%\%expansion%_logs_version.spp"
set /p current_bots_version=<"%mainfolder%\%expansion%_bots_version.spp"
set /p current_website_db_version=<"%mainfolder%\%expansion%_website_version.spp"
set /p current_core_version=<"%mainfolder%\%expansion%_core_version.spp"
rem convert to int
set /a "current_maps_version=current_maps_version"
set /a "current_world_version=current_world_version"
set /a "current_chars_version=current_chars_version"
set /a "current_realm_version=current_realm_version"
set /a "current_logs_version=current_logs_version"
set /a "current_bots_version=current_bots_version"
set /a "current_website_db_version=current_website_db_version"
set /a "current_core_version=current_core_version"
if %current_maps_version% LSS 1 (set current_maps_version=1)
if %current_world_version% LSS 1 (set current_world_version=1)
if %current_chars_version% LSS 1 (set current_chars_version=1)
if %current_realm_version% LSS 1 (set current_realm_version=1)
if %current_logs_version% LSS 1 (if not "%logs_version%"=="0" set current_logs_version=1)
if %current_bots_version% LSS 1 (set current_bots_version=1)
if %current_website_db_version% LSS 1 (set current_website_db_version=1)
if %current_core_version% LSS 1 (if not "%core_version%"=="1" set current_core_version=1)
rem echo %current_maps_version% - maps
rem echo %current_world_version% - world
rem echo %current_chars_version% - chars
rem echo %current_bots_version% - bots
rem pause
if %current_maps_version% LSS %maps_version% goto update_maps
if %current_world_version% LSS %world_version% goto update_world
if %current_chars_version% LSS %chars_version% goto update_chars
if %current_realm_version% LSS %realm_version% goto update_realm
if %current_logs_version% LSS %logs_version% (if not "%logs_version%"=="0" goto update_logs)
if %current_bots_version% LSS %bots_version% goto update_bots
if %current_website_db_version% LSS %website_db_version% goto update_website_db
if %current_core_version% LSS %core_version% goto update_core
if exist "%mainfolder%\website.on" del "%mainfolder%\Server\website\vanilla.spp"
if exist "%mainfolder%\website.on" del "%mainfolder%\Server\website\tbc.spp"
if exist "%mainfolder%\website.on" del "%mainfolder%\Server\website\wotlk.spp"
if exist "%mainfolder%\website.on" echo %expansion% > "%mainfolder%\Server\website\%expansion%.spp"
if exist "%mainfolder%\website.on" goto website_start
goto menu
:module_not_found
cls
more < "%mainfolder%\header_spp.txt"
echo.
echo The %expansion% module not found
ping -n 2 127.0.0.1>nul
echo Starting download in 10 seconds...
ping -n 10 127.0.0.1>nul
echo.
if "%choose_exp%"=="1" goto install_module_vanilla
if "%choose_exp%"=="2" goto install_module_tbc
if "%choose_exp%"=="3" goto install_module_wotlk
if "%choose_exp%"=="4" goto install_module_vanilla
:install_module_vanilla
mode con: cols=80 lines=30
echo.
echo Downloading Vanilla module...(~750 MB)
echo.
"%mainfolder%\Server\Tools\wget.exe" -c -q --show-progress "https://github.com/celguar/spp-classics-cmangos/releases/download/v2.0/vanilla.7z" -P "%mainfolder%\Modules"
echo.
echo Download complete. Checking file...
ping -n 3 127.0.0.1>nul
goto check_modules
:install_module_tbc
mode con: cols=80 lines=30
echo.
echo Downloading TBC module...(~1000 MB)
echo.
"%mainfolder%\Server\Tools\wget.exe" -c -q --show-progress "https://github.com/celguar/spp-classics-cmangos/releases/download/v2.0/tbc.7z" -P "%mainfolder%\Modules"
echo.
echo Download complete. Checking file...
ping -n 3 127.0.0.1>nul
goto check_modules
:install_module_wotlk
mode con: cols=80 lines=30
echo.
echo Downloading WotLK module...(~1500 MB)
echo.
"%mainfolder%\Server\Tools\wget.exe" -c -q --show-progress "https://github.com/celguar/spp-classics-cmangos/releases/download/v2.0/wotlk.7z" -P "%mainfolder%\Modules"
echo.
echo Download complete. Checking file...
ping -n 3 127.0.0.1>nul
goto check_modules
:check_modules
rem PLAY INTRO PROCESS
if exist "%mainfolder%\music.on" (
cd "%mainfolder%\Server\Tools"
start cmdmp3win.exe music/%expansion%_intro_process.mp3
cd "%mainfolder%"
)
mode con: cols=40 lines=30
if not exist "%mainfolder%\Modules\%expansion%\maps" (
if not exist "%mainfolder%\Modules\%expansion%.7z" goto module_not_found
cd "%mainfolder%\Modules"
mkdir %expansion%
cd %expansion%
cls
more < "%mainfolder%\header_spp.txt"
echo.
echo Extracting %expansion% module...
ping -n 2 127.0.0.1>nul
echo.
echo Please, wait...
"%mainfolder%\Server\Tools\7za.exe" e -y -spf "%mainfolder%\Modules\%expansion%.7z" > nul
echo.
echo Done!
ping -n 3 127.0.0.1>nul
del "%mainfolder%\Modules\%expansion%.7z"
cd "%mainfolder%"
)
if exist "%mainfolder%\Modules\%expansion%\maps" (
cls
more < "%mainfolder%\header_spp.txt"
echo.
echo Existing %expansion% maps found!
ping -n 3 127.0.0.1>nul
echo.
echo Checking version...
ping -n 3 127.0.0.1>nul
echo.
echo Please, wait...
rem check file last modified date
FOR /F "TOKENS=2" %%A IN ('WHERE /T "%mainfolder%\Modules\%expansion%\maps:0002035.map"') do (
if "%%A" GEQ "%maps_date%" (
echo.
echo Existing maps version: OK!
ping -n 3 127.0.0.1>nul
echo.
echo Skipping download...
ping -n 3 127.0.0.1>nul
>"%mainfolder%\%expansion%_maps_version.spp" echo %maps_version%
goto update_install
)
if "%%A" GEQ "%maps_date2%" (
echo.
echo Existing maps version: OK!
ping -n 3 127.0.0.1>nul
echo.
echo Skipping download...
ping -n 3 127.0.0.1>nul
>"%mainfolder%\%expansion%_maps_version.spp" echo %maps_version%
goto update_install
)
if "%%A" LSS "%maps_date%" if "%%A" LSS "%maps_date2%" (
rem echo.
rem echo Existing maps version: FAIL!
rem ping -n 3 127.0.0.1>nul
rem echo.
rem echo NEED: %maps_date% HAVE: %%A
rem ping -n 3 127.0.0.1>nul
rem echo.
rem echo Resuming download...
rem ping -n 3 127.0.0.1>nul
rem goto module_not_found
)
)
)
>"%mainfolder%\%expansion%_maps_version.spp" echo %maps_version%
goto update_install
:extract_worlddb
more < "%mainfolder%\header_spp.txt"
echo.
echo Extracting world db...
ping -n 3 127.0.0.1>nul
cd "%mainfolder%\sql\%expansion%"
"%mainfolder%\Server\Tools\7za.exe" e -y -spf "%mainfolder%\sql\%expansion%\world.7z" > nul
echo.
echo Done!
cd "%mainfolder%"
ping -n 2 127.0.0.1>nul
goto update_install
:update_install
mode con: cols=40 lines=30
cls
if not exist "%mainfolder%\%expansion%_maps_version.spp" goto check_modules
if not exist "%mainfolder%\sql\%expansion%\world.sql" goto extract_worlddb
rem PLAY INTRO SHORT
if exist "%mainfolder%\music.on" (
cd "%mainfolder%\Server\Tools"
start cmdmp3win.exe music/%expansion%_intro_long.mp3
cd "%mainfolder%"
)
more < "%mainfolder%\header_spp.txt"
echo.
echo Installing database, please wait...
ping -n 3 127.0.0.1>nul
echo.
echo Installing world db...
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 < "%mainfolder%\sql\%expansion%\drop_world.sql"
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%world% < "%mainfolder%\sql\%expansion%\world.sql"
rem echo.
echo Installing characters db...
ping -n 3 127.0.0.1>nul
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 < "%mainfolder%\sql\%expansion%\drop_characters.sql"
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%characters% < "%mainfolder%\sql\%expansion%\characters.sql"
rem echo.
echo Installing logs db...
ping -n 3 127.0.0.1>nul
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 < "%mainfolder%\sql\%expansion%\drop_logs.sql"
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%logsdb% < "%mainfolder%\sql\%expansion%\logs.sql"
rem echo.
echo Installing accounts db...
ping -n 3 127.0.0.1>nul
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 < "%mainfolder%\sql\%expansion%\drop_realmd.sql"
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%login% < "%mainfolder%\sql\%expansion%\realmd.sql"
"%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%login% < "%mainfolder%\sql\%expansion%\realmlist.sql"
rem echo.
rem echo Installing playerbot db...
rem ping -n 3 127.0.0.1>nul
rem "%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 < "%mainfolder%\sql\%expansion%\drop_playerbot.sql"
rem for %%i in ("%mainfolder%\sql\%expansion%\playerbot\*sql") do if %%i neq "%mainfolder%\sql\%expansion%\playerbot\*sql" if %%i neq "%mainfolder%\sql\%expansion%\playerbot\*sql" if %%i neq "%mainfolder%\sql\%expansion%\playerbot\*sql" "%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%playerbot% < %%i
rem echo.
rem echo Applying world db updates...
rem ping -n 3 127.0.0.1>nul
rem set /a "next_world_version=current_world_version+1"
rem for /l %%x in (%next_world_version%, 1, %world_version%) do (
rem ping -n 2 127.0.0.1>nul
rem for %%i in ("%mainfolder%\sql\%expansion%\updates\world\%%x\*sql") do if %%i neq "%mainfolder%\sql\%expansion%\updates\world\%%x\*sql" if %%i neq "%mainfolder%\sql\%expansion%\updates\world\%%x\*sql" if %%i neq "%mainfolder%\sql\%expansion%\updates\world\%%x\*sql" "%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%world% < %%i
rem )
echo Applying world db mods...
ping -n 3 127.0.0.1>nul
for %%i in ("%mainfolder%\sql\%expansion%\world\*sql") do if %%i neq "%mainfolder%\sql\%expansion%\world\*sql" if %%i neq "%mainfolder%\sql\%expansion%\world\*sql" if %%i neq "%mainfolder%\sql\%expansion%\world\*sql" "%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%world% < %%i
rem echo.
echo Applying characters db updates...
ping -n 3 127.0.0.1>nul
set /a "next_chars_version=current_chars_version+1"
for /l %%x in (%next_chars_version%, 1, %chars_version%) do (
ping -n 2 127.0.0.1>nul
for %%i in ("%mainfolder%\sql\%expansion%\updates\characters\%%x\*sql") do if %%i neq "%mainfolder%\sql\%expansion%\updates\characters\%%x\*sql" if %%i neq "%mainfolder%\sql\%expansion%\updates\characters\%%x\*sql" if %%i neq "%mainfolder%\sql\%expansion%\updates\characters\%%x\*sql" "%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%characters% < %%i
)
echo Applying characters db mods...
ping -n 3 127.0.0.1>nul
for %%i in ("%mainfolder%\sql\%expansion%\characters\*sql") do if %%i neq "%mainfolder%\sql\%expansion%\characters\*sql" if %%i neq "%mainfolder%\sql\%expansion%\characters\*sql" if %%i neq "%mainfolder%\sql\%expansion%\characters\*sql" "%mainfolder%\Server\Database\bin\mysql.exe" --defaults-extra-file="%mainfolder%\Server\Database\connection.cnf" --default-character-set=utf8 --database=%characters% < %%i
rem echo.
echo Applying accounts db updates...
ping -n 3 127.0.0.1>nul
set /a "next_realm_version=current_realm_version+1"
for /l %%x in (%next_realm_version%, 1, %realm_version%) do (