forked from ThePansmith/Monifactory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpack-mode-switcher.bat
More file actions
119 lines (101 loc) · 3.32 KB
/
pack-mode-switcher.bat
File metadata and controls
119 lines (101 loc) · 3.32 KB
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
@echo off
setlocal enabledelayedexpansion
set SILENT=false
set RUN_DIR=%~dp0
set MODE=
rem Iterate though all args
:parse_args
if "%~1"=="" goto after_args
if "%~1"=="-s" set SILENT=true& shift & goto parse_args
if "%~1"=="--silent" set SILENT=true& shift & goto parse_args
if "%~1"=="-r" set RUN_DIR=.\& shift & goto parse_args
if "%~1"=="--relative" set RUN_DIR=.\& shift & goto parse_args
if "%~1"=="-h" goto print_help
if "%~1"=="--help" goto print_help
if not defined MODE set MODE=%~1
shift
goto parse_args
:after_args
set normalCfgPath=%RUN_DIR%config-overrides\normal
set hardCfgPath=%RUN_DIR%config-overrides\hardmode
set expertCfgPath=%RUN_DIR%config-overrides\expert
set targetPath=%RUN_DIR%config
set modeFile=%RUN_DIR%.mode
rem Check if config-overrides dirs exist
if not exist "%normalCfgPath%" goto missing_config
if not exist "%hardCfgPath%" goto missing_config
if not exist "%expertCfgPath%" goto missing_config
if not defined MODE (
rem Interactive
color 9
set CURRENT_MODE="normal"
if exist %modeFile% (
set /p CURRENT_MODE=<%modeFile%
)
if "%SILENT%"=="false" (
echo Monifactory ^| Pack Mode Switcher
echo Current Mode: !CURRENT_MODE!
echo.
echo Set Pack Mode:
echo N: Normal (The Default mode^)
echo H: Hard (Adds more lines and progression, removes HNN and Monicoin spending^)
echo E: Expert (A modifier for hard, enables some of the more extreme GTm settings among other things^)
set /p MODE="Selection [Normal / Hard / Expert]: "
) else (
set /p MODE=
)
)
rem case insensitive with /i
for %%A in (n normal) do if /i "!MODE!"=="%%A" goto copyNormal
for %%A in (h hard) do if /i "!MODE!"=="%%A" goto copyHard
for %%A in (e expert) do if /i "!MODE!"=="%%A" goto copyExpert
rem if not matched
echo Error: Invalid input "%MODE%"!
echo Accepted Inputs:
echo - [Normal, normal, N, n]
echo - [Hard, hard, H, h]
echo - [Expert, expert, E, e]
exit /b 1
:copyNormal
robocopy "%normalCfgPath%" "%targetPath%" *.* /e /nfl /ndl >nul
echo normal > %modeFile%
goto success
:copyHard
robocopy "%hardCfgPath%" "%targetPath%" *.* /e /nfl /ndl >nul
echo hard > %modeFile%
goto success
:copyExpert
robocopy "%hardCfgPath%" "%targetPath%" *.* /e /nfl /ndl >nul
robocopy "%expertCfgPath%" "%targetPath%" *.* /e /nfl /ndl >nul
echo expert > %modeFile%
goto success
:success
if "%SILENT%"=="false" (
set /p NEWMODE=<%modeFile%
echo Successfully switched pack mode to !NEWMODE!
)
exit /b 0
:missing_config
echo Could not find `config-overrides` directory!
echo Make sure you are in the `/minecraft` directory of your instance! (The one containing `/config`)
echo Otherwise, if you are in the `/minecraft` directory, please try reinstalling the pack.
exit /b 1
:print_help
echo.
echo Monifactory ^| Pack Mode Switcher Help
echo.
echo Usage: pack-mode-switcher.bat [options] [mode]
echo.
echo Options:
echo -s, --silent Run in silent mode
echo -r, --relative Use relative paths (run from current directory instead of script directory)
echo -h, --help Show this help message and exit
echo.
echo Modes:
echo Normal, normal, N, n Switch to Normal mode (default)
echo Hard, hard, H, h Switch to Hard mode
echo Expert, expert, E, e Switch to Expert mode
echo.
echo Example:
echo pack-mode-switcher.bat -s hard
exit /b 0