batchGame/batchGame/cmd/map.bat
2023-09-05 21:35:59 +02:00

233 lines
7.1 KiB
Batchfile
Executable File

@echo off
color 74
if not "%1"=="" (set "player=%1") else (set /p player=enter player: )
if not "%2"=="" (set "world=%2") else (set /p world=enter world: )
if not "%3"=="" (set "mainFlag=1")
if "%3"=="3" (set "mainFlag=3")
if not exist "%world%\*" (
echo.ERROR: Needed Files Not Found
pause>nul
exit
) else (
cd %world%
)
if "%mainFlag%"=="3" goto new
::CHANGE RESOLUTION HERE!!!
::MODE CON COLS=50 LINES=22
MODE CON COLS=42 LINES=18
:new
if exist "%player%\curMap.txt" (set /p map=<"%player%\curMap.txt") else (set map=map1.txt & echo.map1.txt>%player%\curMap.txt)
:getPosition
set count=1
set "lineId="
set "lineL="
set "lineT="
set "lineR="
set "lineB="
set "lineItem="
set "getPositionFlag=0"
setlocal enabledelayedexpansion
if not "%mainFlag%"=="3" (
echo.loading...
)
for /f "tokens=1,2 delims=." %%a in ("%map:~3,250%") do (set "Level=%%a")
if not "%mainFlag%"=="3" (
title level: %Level%
)
for /f "skip=1" %%a in (%map%) do (set "getPositionLine=%%a" & call :getPositionFl1)
goto getPositionFlEnd
:getPositionFl1
for /f "tokens=1,2,3,4,5,6 delims=;" %%a in ("%getPositionLine%") do (
set "lineId=%%a"
set "lineL=%%b"
set "lineT=%%c"
set "lineR=%%d"
set "lineB=%%e"
set "lineItem=%%f"
)
set "lineId!count!=%lineId%"
set "lineL!count!=%lineL%"
set "lineT!count!=%lineT%"
set "lineR!count!=%lineR%"
set "lineB!count!=%lineB%"
set "lineItem!count!=%lineItem%"
set /a count=%count%+1
goto :eof
:getPositionFlEnd
set count=0
::BUILD FIELD AND DISPLAY
:buildRoom
set /a count=%count%+1
set /a nextCount=%count%+1
set /a nextCount4=%count%+4
set fieldId=%count%
if "!lineL%count%!"=="w" set "bl!count!=^|" & set "bl!count!b=^"
if "!lineL%count%!"=="d" set "bl!count!=+" & set "bl!count!b=^"
if "!lineL%count%!"=="p" set "bl!count!= " & set "bl!count!b= "
if "!lineT%count%!"=="w" set "bt!count!=_" & set "bt!count!b=__"
if "!lineT%count%!"=="d" set "bt!count!=+" & set "bt!count!b=__"
if "!lineT%count%!"=="p" set "bt!count!= " & set "bt!count!b= "
if "!lineT%count%!"=="w" if "!lineB%nextCount4%!"=="w" set "bt!count!= " & set "bt!count!b= "
if "!lineT%count%!"=="d" if "!lineB%nextCount4%!"=="d" set "bt!count!= " & set "bt!count!b= "
if "!lineR%count%!"=="w" set "br!count!=^|" & set "br!count!b=^"
if "!lineR%count%!"=="d" set "br!count!=+" & set "br!count!b=^"
if "!lineR%count%!"=="p" set "br!count!= " & set "br!count!b= "
if "!lineR%count%!"=="w" if "!lineL%nextCount%!"=="w" set "br!count!= " & set "br!count!b= "
if "!lineR%count%!"=="d" if "!lineL%nextCount%!"=="d" set "br!count!= " & set "br!count!b= "
if %count%==4 if not "!lineR%count%!"=="d" set "br!count!=^|" & set "br!count!b=║"
if %count%==8 if not "!lineR%count%!"=="d" set "br!count!=^|" & set "br!count!b=║"
if %count%==12 if not "!lineR%count%!"=="d" set "br!count!=^|" & set "br!count!b=║"
if "!lineB%count%!"=="w" set "bb!count!=_" & set "bb!count!b=__"
if "!lineB%count%!"=="d" set "bb!count!=+" & set "bb!count!b=__"
if "!lineB%count%!"=="p" set "bb!count!= " & set "bb!count!b= "
if "!lineItem%count%!"=="0" set "bm!count!= "
if "!lineItem%count%!"=="c" set "bm!count!=^!"
if "!lineItem%count%!"=="e" set "bm!count!=^!"
if "!lineItem%count%!"=="p" set "bm!count!=P"
if "!lineItem%count%!"=="s" set "bm!count!=S"
if "!lineItem%count%!"=="f" set "bm!count!=S"
if not exist "%player%\log%Level%.txt" goto endLogChk
find "!fieldId!;!lineItem%count%!" "%player%\log%Level%.txt">nul
if "!errorlevel!"=="0" if "!lineItem%count%!"=="c" (set "bm!count!= ")
find "!fieldId!;!lineItem%count%!" "%player%\log%Level%.txt">nul
if "!errorlevel!"=="0" if "!lineItem%count%!"=="e" (set "bm!count!= ")
:endLogChk
if not exist "!player!\pp.txt" goto endPosChk
set /p y=<"!player!\pp.txt">nul
if "!y!"=="!fieldId!" (
set "bm!count!=@"
del /Q "!player!\pp.txt"
)
:endPosChk
if %count% lss 17 goto buildroom
if not "%mainFlag%"=="3" cls
echo. !bt13b! !bt13! !bt13b! !bt14b! !bt14! !bt14b! !bt15b! !bt15! !bt15b! !bt16b! !bt16! !bt16b!
echo. !bl13b! !br13b!!bl14b! !br14b!!bl15b! !br15b!!bl16b! !br16b!
echo. !bl13! !bm13! !br13!!bl14! !bm14! !br14!!bl15! !bm15! !br15!!bl16! !bm16! !br16!
echo. !bl13b!!bb13b! !bb13! !bb13b!!br13b!!bl14b!!bb14b! !bb14! !bb14b!!br14b!!bl15b!!bb15b! !bb15! !bb15b!!br15b!!bl16b!!bb16b! !bb16! !bb16b!!br16b!
echo. !bt9b! !bt9! !bt9b! !bt10b! !bt10! !bt10b! !bt11b! !bt11! !bt11b! !bt12b! !bt12! !bt12b!
echo. !bl9b! !br9b!!bl10b! !br10b!!bl11b! !br11b!!bl12b! !br12b!
echo. !bl9! !bm9! !br9!!bl10! !bm10! !br10!!bl11! !bm11! !br11!!bl12! !bm12! !br12!
echo. !bl9b!!bb9b! !bb9! !bb9b!!br9b!!bl10b!!bb10b! !bb10! !bb10b!!br10b!!bl11b!!bb11b! !bb11! !bb11b!!br11b!!bl12b!!bb12b! !bb12! !bb12b!!br12b!
echo. !bt5b! !bt5! !bt5b! !bt6b! !bt6! !bt6b! !bt7b! !bt7! !bt7b! !bt8b! !bt8! !bt8b!
echo. !bl5b! !br5b!!bl6b! !br6b!!bl7b! !br7b!!bl8b! !br8b!
echo. !bl5! !bm5! !br5!!bl6! !bm6! !br6!!bl7! !bm7! !br7!!bl8! !bm8! !br8!
echo. !bl5b!!bb5b! !bb5! !bb5b!!br5b!!bl6b!!bb6b! !bb6! !bb6b!!br6b!!bl7b!!bb7b! !bb7! !bb7b!!br7b!!bl8b!!bb8b! !bb8! !bb8b!!br8b!
echo. !bt1b! !bt1! !bt1b! !bt2b! !bt2! !bt2b! !bt3b! !bt3! !bt3b! !bt4b! !bt4! !bt4b!
echo. !bl1b! !br1b!!bl2b! !br2b!!bl3b! !br3b!!bl4b! !br4b!
echo. !bl1! !bm1! !br1!!bl2! !bm2! !br2!!bl3! !bm3! !br3!!bl4! !bm4! !br4!
echo. !bl1b!!bb1b! !bb1! !bb1b!!br1b!!bl2b!!bb2b! !bb2! !bb2b!!br2b!!bl3b!!bb3b! !bb3! !bb3b!!br3b!!bl4b!!bb4b! !bb4! !bb4b!!br4b!
:loop
if "%mainFlag%"=="3" goto end
if exist "%player%\curMap.txt" (
ping -n 2 localhost >nul
set /p x=<"%player%\curMap.txt"
)
if exist "%player%\pp.txt" (
ping -n 1 localhost >nul
goto new
)
if "%x%"=="done" call :endScreen
if not "%map%"=="%x%" goto new
if exist "%player%\mapRefresh" if not "%mainFlag%"=="1" (
ping -n 1 localhost >nul
del /Q "%player%\mapRefresh"
goto new
)
if "%mainFlag%"=="1" goto end
goto loop
:endScreen
echo.#############################################
echo.# #
echo.# #
echo.# #
echo.# #
echo.# #
echo.# Congratulations #
echo.# You made it through all Levels #
echo.# and you saved the beautiful #
echo.# Princess #
echo.# #
echo.# #
echo.# #
echo.# #
echo.# by karim #
echo.# #
echo.#############################################
ping -n 10 localhost >nul
goto :eof
:end
echo.
if not "%mainFlag%"=="3" choice /C:"b" /N "b: go back ->"