@echo off
setlocal
cd /d "%~dp0"

set "FLASH=%~dp0flash_player.exe"
if not exist "%FLASH%" (
    echo.
    echo Put Play.bat in your Esgrima 2 folder, next to flash_player.exe.
    echo.
    pause
    exit /b 1
)

echo.
echo 1  Play on the RS server
echo 2  Play on oneshark
echo.
set /p CHOICE=Choose 1 or 2: 

if "%CHOICE%"=="1" goto rs
if "%CHOICE%"=="2" goto oneshark

echo Choose 1 or 2.
pause
exit /b 1

:rs
start "" "%FLASH%" "https://rs0-5.com/Esgrima2/esgrima2-vps.swf?v=%RANDOM%"
exit /b 0

:oneshark
if not exist "%~dp0esgrima2.swf" (
    echo.
    echo esgrima2.swf was not found next to Play.bat.
    echo.
    pause
    exit /b 1
)
set "TRUST=%APPDATA%\Macromedia\Flash Player\#Security\FlashPlayerTrust"
if not exist "%TRUST%" mkdir "%TRUST%"
echo %~dp0> "%TRUST%\esgrima.cfg"
start "" "%FLASH%" "%~dp0esgrima2.swf"
exit /b 0
