@echo off
:: --- Check for Administrator privileges --- USED TO RESTART MEMURAI
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    powershell -Command "Start-Process '%~f0' -Verb RunAs"
    exit /b
)

cls
echo Restarting Memurai service...
net stop Memurai
net start Memurai
echo Starting Topaz Mir 4 Server...

"%~dp0terminal-1.22.10731.0\WindowsTerminal.exe" ^
    new-tab --title "World Server" cmd /k "cd /d \"%~dp0World\" && WorldServer.exe" ^
    ; new-tab --title "Game Server" cmd /k "cd /d \"%~dp0Game\" && GameServer.exe" ^
    ; new-tab --title "Chatting Server" cmd /k "cd /d \"%~dp0Chatting\" && ChattingServer.exe" ^
    ; new-tab --title "Front Server" cmd /k "cd /d \"%~dp0Front\" && FrontServer.exe" ^
    ; new-tab --title "Gateway Server" cmd /k "cd /d \"%~dp0Gateway\" && GatewayServer.exe" ^
	; new-tab --title "Server Manager" cmd /k "cd /d \"%~dp0Admin\Manager\" && \"Mir 4 Server Manager.exe\""

exit