Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::Programmed by Loreadarkshade
- ::------------------------------------------------
- ::DEVELOPER'S NOTES:
- ::
- ::TO IMPLEMENT:
- ::-add pets (follows player?, attacks on turn with player)
- ::-save backups in case of crash, and reload said backups if load corrupt
- ::-implements a check if user has permissions for all files and folders when launching the game for the first time
- ::add pretty UI with bars n such
- ::add random world generation with a world map seed
- ::add dungeon bosses and dungeons
- ::multiplayer mode?
- ::find sound software that can be manipulated using batch
- ::optimize
- ::Add 'L' look feature for items onground or objects, etc
- ::add haggling system to lower shop keepers prices like Moria
- ::KNOWN BUGS:
- ::
- @echo off
- set currentversion=1.8
- title Game v.%currentversion%
- ::This is absolutely necessary for variable inception.
- setlocal enabledelayedexpansion
- call :check_integrity
- ::Loads game config.
- call config.bat
- ::Sets window size based on what is defined "config.bat".
- mode con cols=%window_width% lines=%window_height%
- ::Start title screen music.
- ::start "" "sounds\main_title.mp3"
- :mainmenu
- cls
- color 06
- ::Direct to correct menu depending on whether old saves exist or not.
- dir /b /ad "saves\*" | >nul findstr "^" && (goto saves_exist) || (goto no_saves_exist)
- :saves_exist
- echo __________________________________________________________________________________
- echo [103mGame v.%currentversion%[0m | bin\cmdcolor.exe
- echo __________________________________________________________________________________
- echo.
- echo Use the NUMBER keys to navigate menus.
- echo.
- echo.
- echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
- echo ³ 1) Load Game ³
- echo ³ 2) New Game ³
- echo ³ 3) Exit ³
- echo ³ ³
- echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- call bin\choice.exe /c:123 /N
- if %errorlevel% equ 1 goto loadgame
- if %errorlevel% equ 2 goto newgame
- if %errorlevel% equ 3 exit
- :no_saves_exist
- echo __________________________________________________________________________________
- echo [103mGame v.%currentversion%[0m | bin\cmdcolor.exe
- echo __________________________________________________________________________________
- echo.
- echo Use the NUMBER keys to navigate menus.
- echo.
- echo.
- echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
- echo ³ 1) New Game ³
- echo ³ 2) Exit ³
- echo ³ ³
- echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- echo.
- call bin\choice.exe /c:12 /N
- if %errorlevel% equ 1 goto newgame
- if %errorlevel% equ 2 exit
- :loadgame
- color 06
- cls
- echo Load Game
- echo.
- dir "saves" /b
- echo.
- set player_name=
- set /p player_name=Select Save:
- if not defined player_name goto mainmenu
- if not exist "saves\%player_name%\stats.bat" call :errormessage mainmenu "Save game does not exist."
- call "saves\%player_name%\stats.bat"
- call "saves\%player_name%\inventory\inventory.bat"
- ::Load empty map tiles.
- call bin\maploader.bat
- ::Load static objects only one time.
- call maps\default\static.bat
- ::Sets user's preferred UI color.
- color %usercolor%
- ::Start game.
- goto disp
- :newgame
- color 06
- cls
- set player_name=
- echo ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
- set /p player_name=Name:
- if not defined player_name goto mainmenu
- cls
- set acclongcheck=%player_name:~28,1%
- if defined acclongcheck call :errormessage mainmenu "Name is too long."
- if exist "saves\%player_name%\stats.bat" (
- cls
- color 0c
- echo Name already taken.
- echo.
- pause
- goto mainmenu
- )
- echo Creating character . . .
- ::Create main file that contains stats.
- md "saves\%player_name%"
- (
- echo set player_name=%player_name%
- echo set usercolor=%default_user_color%
- echo set level=1
- echo set Exp=0
- echo set maxExp=100
- echo set hp=100
- echo set maxhp=100
- echo set mana=100
- echo set maxmana=100
- echo set gold=0
- echo set bank=0
- echo set potions=0
- echo set ypos=20
- echo set xpos=30
- )>"saves\%player_name%\stats.bat"
- ::Create inventory file.
- md "saves\%player_name%\inventory"
- (
- echo set inventory_selection=1
- echo set item1=-
- echo set item2=-
- echo set item3=-
- echo set item4=-
- echo set item5=-
- echo set item6=-
- echo set item7=-
- echo set item8=-
- echo set item9=-
- echo set item10=-
- )>"saves\%player_name%\inventory\inventory.bat"
- ::Load new character and start the game.
- call "saves\%player_name%\stats.bat"
- call "saves\%player_name%\inventory\inventory.bat"
- ::Load empty map tiles.
- call bin\maploader.bat
- ::Load static objects only one time.
- call maps\default\static.bat
- ::Sets user's preferred UI color.
- color %usercolor%
- ::Start game.
- goto disp
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\MAIN DISPLAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\MAIN DISPLAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\MAIN DISPLAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\MAIN DISPLAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\MAIN DISPLAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\MAIN DISPLAY\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
- ::Draws entire world map each turn.
- ::This is what the player will look at 99% of the time.
- :disp
- ::Reload anything that isn't static.
- call maps\default\game_objects.bat
- ::Reload any moving objects such as NPCs or MOBS.
- call maps\default\moving_objects.bat
- ::Load character on top of everything else.
- set g%ypos%%xpos%=%char%
- ::Clear screen for fresh map rendering.
- cls
- ::Draw map with its GUI on the right.
- if not "%fully_loaded%" equ "true" call bin\display.bat full_load
- if "%fully_loaded%" equ "true" call bin\display.bat
- echo %line10%
- echo %line11%
- echo %line12%
- echo %line13%
- echo %line14%
- echo %line15%
- echo %line16%
- echo %line17%
- echo %line18%
- echo %line19%
- echo %line20%
- echo %line21%
- echo %line22%
- echo %line23%
- echo %line24%
- echo %line25%
- echo %line26%
- echo %line27%
- echo %line28%
- echo %line29%
- echo %line30%
- call bin\choice.exe /c:8246%interact_key%%options_key%%inventory_key%%heal_key%%map_key%79135 /N
- if %errorlevel% equ 1 goto 8
- if %errorlevel% equ 2 goto 2
- if %errorlevel% equ 3 goto 4
- if %errorlevel% equ 4 goto 6
- if %errorlevel% equ 5 goto action.interact
- if %errorlevel% equ 6 goto options
- if %errorlevel% equ 7 goto inventory
- if %errorlevel% equ 8 goto drinkpotion
- if %errorlevel% equ 9 goto changemap
- if %errorlevel% equ 10 goto 7
- if %errorlevel% equ 11 goto 9
- if %errorlevel% equ 12 goto 1
- if %errorlevel% equ 13 goto 3
- if %errorlevel% equ 14 goto stand_still
- :action.interact
- if "%current_pos%" equ "X" (
- set /a gainexp=%maxExp%/10
- set /a Exp=%Exp%+%gainexp%
- ::Checks for level up.
- call :levelcheck
- goto disp
- )
- if "%current_pos%" equ "B" goto bank
- if "%current_pos%" equ "M" goto market
- if "%current_pos%" equ "*" goto pickup_item
- if "%current_pos%" equ "O" goto wander
- if "%current_pos%" equ "F" goto fishing_spot
- if "%current_pos%" equ "8" goto traveler
- ::Code reaches here if player is in empty tile.
- goto disp
- ::==============================================================
- ::==============================================================
- ::==============================================================
- ::===========================MOVEMENT===========================
- ::==============================================================
- ::==============================================================
- ::==============================================================
- :8
- ::Check for north boundary. If so, cancel move request.
- set /a nexttile_y=%ypos%-1
- if "!g%nexttile_y%%xpos%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a ypos=%ypos%-1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :2
- ::Check for south boundary. If so, cancel move request.
- set /a nexttile_y=%ypos%+1
- if "!g%nexttile_y%%xpos%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a ypos=%ypos%+1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :4
- ::Check for west boundary. If so, cancel move request.
- set /a nexttile_x=%xpos%-1
- if "!g%ypos%%nexttile_x%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a xpos=%xpos%-1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :6
- ::Check for east boundary. If so, cancel move request.
- set /a nexttile_x=%xpos%+1
- if "!g%ypos%%nexttile_x%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a xpos=%xpos%+1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :7
- ::Check for northwest boundary. If so, cancel move request.
- set /a nexttile_y=%ypos%-1
- set /a nexttile_x=%xpos%-1
- if "!g%nexttile_y%%nexttile_x%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a ypos=%ypos%-1
- set /a xpos=%xpos%-1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :9
- ::Check for northwest boundary. If so, cancel move request.
- set /a nexttile_y=%ypos%-1
- set /a nexttile_x=%xpos%+1
- if "!g%nexttile_y%%nexttile_x%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a ypos=%ypos%-1
- set /a xpos=%xpos%+1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :1
- ::Check for northwest boundary. If so, cancel move request.
- set /a nexttile_y=%ypos%+1
- set /a nexttile_x=%xpos%-1
- if "!g%nexttile_y%%nexttile_x%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a ypos=%ypos%+1
- set /a xpos=%xpos%-1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :3
- ::Check for northwest boundary. If so, cancel move request.
- set /a nexttile_y=%ypos%+1
- set /a nexttile_x=%xpos%+1
- if "!g%nexttile_y%%nexttile_x%!" equ "Û" goto disp
- ::Clears old character spot with an empty tile.
- set g%ypos%%xpos%=%backgroundtile%
- ::Move character.
- set /a ypos=%ypos%+1
- set /a xpos=%xpos%+1
- ::Set variable 'current_pos' for future detection of interactable tile.
- set current_pos=!g%ypos%%xpos%!
- goto disp
- :stand_still
- ::Do absolutely nothing.
- goto disp
- ::==============================================================
- :inventory
- ::==============================================================
- ::Load player's inventory.
- call "saves\%player_name%\inventory\inventory.bat"
- :inventory_noload
- set sel%inventory_selection%=*
- ::Display inventory to player.
- cls
- echo Inventory sel: %inventory_selection%
- echo 'Numpad 8,2' to scroll. '%interact_key%' to select. 'D' to drop. 'I' to exit.
- echo.
- echo 1. %sel1%%item1%%sel1%
- echo 2. %sel2%%item2%%sel2%
- echo 3. %sel3%%item3%%sel3%
- echo 4. %sel4%%item4%%sel4%
- echo 5. %sel5%%item5%%sel5%
- echo 6. %sel6%%item6%%sel6%
- echo 7. %sel7%%item7%%sel7%
- echo 8. %sel8%%item8%%sel8%
- echo 9. %sel9%%item9%%sel9%
- echo 10. %sel10%%item10%%sel10%
- echo 11. Not yet added.
- echo 12. Not yet added.
- echo 13. Not yet added.
- echo 14. Not yet added.
- echo 15. Not yet added.
- echo 16. Not yet added.
- echo 17. Not yet added.
- echo 18. Not yet added.
- echo 19. Not yet added.
- echo 20. Not yet added.
- call bin\choice.exe /c:"82%interact_key%di" /n
- if %errorlevel% equ 1 goto inv_up
- if %errorlevel% equ 2 goto inv_down
- if %errorlevel% equ 3 goto inv_select
- if %errorlevel% equ 4 goto drop
- if %errorlevel% equ 5 goto close_inventory
- :close_inventory
- ::Save current marker spot.
- (
- echo set inventory_selection=%inventory_selection%
- echo set item1=%item1%
- echo set item2=%item2%
- echo set item3=%item3%
- echo set item4=%item4%
- echo set item5=%item5%
- echo set item6=%item6%
- echo set item7=%item7%
- echo set item8=%item8%
- echo set item9=%item9%
- echo set item10=%item10%
- )>"saves\%player_name%\inventory\inventory.bat"
- goto disp
- :inv_up
- ::Set in memory last spot, to clear markers later.
- set old_inventory_selection=%inventory_selection%
- ::Check bounds.
- set /a inventory_selection=%inventory_selection%-1
- if "%inventory_selection%" equ "0" set inventory_selection=1
- if "%inventory_selection%" equ "0" goto inventory_noload
- ::Not out of bounds, clear last spot of markers.
- set sel%old_inventory_selection%=
- goto inventory_noload
- :inv_down
- ::Set in memory last spot, to clear markers later.
- set old_inventory_selection=%inventory_selection%
- ::Check bounds.
- set /a inventory_selection=%inventory_selection%+1
- if "%inventory_selection%" equ "11" set inventory_selection=10
- if "%inventory_selection%" equ "11" goto inventory_noload
- ::Not out of bounds, clear last spot of markers.
- set sel%old_inventory_selection%=
- goto inventory_noload
- :inv_select
- if "!item%inventory_selection%!" equ "-" goto inventory_noload
- cls
- echo You have selected: !item%inventory_selection%!
- echo.
- echo Drop? Destroy? Eat? Use? Equip?
- pause
- goto inventory_noload
- :pickup_item
- ::Choose a loot group at random.
- set /a item_group=%random% %%3+1
- if %item_group% equ 1 goto item_group_1
- if %item_group% equ 2 goto item_group_2
- if %item_group% equ 3 goto item_group_3
- :item_group_1
- ::Will produce number between 1-3.
- set /a num=%random% %%3+1
- if %num% equ 1 set item_to_pickup=Iron Ore
- if %num% equ 2 set item_to_pickup=Copper Ore
- if %num% equ 3 set item_to_pickup=Tin Ore
- goto done_item_group
- :item_group_2
- ::Will produce number between 1-3.
- set /a num=%random% %%3+1
- if %num% equ 1 set item_to_pickup=Bass Fish
- if %num% equ 2 set item_to_pickup=Snapper Fish
- if %num% equ 3 set item_to_pickup=Sun Fish
- goto done_item_group
- :item_group_3
- ::Will produce number between 1-3.
- set /a num=%random% %%3+1
- if %num% equ 1 set item_to_pickup=Ruby Gem
- if %num% equ 2 set item_to_pickup=Emerald Gem
- if %num% equ 3 set item_to_pickup=Topaz Gem
- goto done_item_group
- ::Go here when item selection is complete.
- :done_item_group
- ::(BUG PREVENTION) Cancel request if item is not designated.
- if "%item_to_pickup%" equ "" call :errormessage disp "ERROR #213 VARIABLE 'ITEM_TO_PICKUP' NOT DEFINED"
- ::Call inventory file to check which spot is available to fill.
- call "saves\%player_name%\inventory\inventory.bat"
- ::Set counters.
- set inv_check=1
- set inv_counter=1
- :inv_check
- ::Check for full inventory. If 'x' amount of slots are taken, means inventory is full.
- if "%inv_counter%" equ "10" call :ColorText 0c "Inventory is full."
- if "%inv_counter%" equ "10" pause >nul
- if "%inv_counter%" equ "10" goto disp
- ::Each time a loop rolls, add to counter. When loops 'x' times, it means inventory is full.
- if not "!item%inv_check%!" equ "-" set /a inv_counter=%inv_counter%+1
- ::Scan inventory for empty spot.
- if not "!item%inv_check%!" equ "-" set /a inv_check=%inv_check%+1
- if not "!item%inv_check%!" equ "-" goto inv_check
- ::Empty spot found, place item there.
- set item%inv_check%=%item_to_pickup%
- ::Save new item in corresponding slot.
- echo set item=%item_to_pickup% > "saves\%player_name%\inventory\%inv_check%.bat"
- ::Save in inventory registry.
- (
- echo set inventory_selection=%inventory_selection%
- echo set item1=%item1%
- echo set item2=%item2%
- echo set item3=%item3%
- echo set item4=%item4%
- echo set item5=%item5%
- echo set item6=%item6%
- echo set item7=%item7%
- echo set item8=%item8%
- echo set item9=%item9%
- echo set item10=%item10%
- )>"saves\%player_name%\inventory\inventory.bat"
- call :ColorText 0a "Picked up %item_to_pickup%."
- ::Reset item to pickup.
- set item_to_pickup=
- pause >nul
- goto disp
- :drop
- if "!item%inventory_selection%!" equ "-" goto inventory
- cls
- echo Dropping: !item%inventory_selection%!
- echo.
- echo D. Drop
- echo C. Cancel
- call bin\choice.exe /c:dc /N >nul
- if %errorlevel% equ 1 goto proceeddrop
- if %errorlevel% equ 2 goto inventory
- :proceeddrop
- set item%inventory_selection%=-
- ::Save now empty slot.
- (
- echo set item=-
- )>"saves\%player_name%\inventory\%inventory_selection%.bat"
- ::Save in file.
- (
- echo set inventory_selection=%inventory_selection%
- echo set item1=%item1%
- echo set item2=%item2%
- echo set item3=%item3%
- echo set item4=%item4%
- echo set item5=%item5%
- echo set item6=%item6%
- echo set item7=%item7%
- echo set item8=%item8%
- echo set item9=%item9%
- echo set item10=%item10%
- )>"saves\%player_name%\inventory\inventory.bat"
- goto inventory
- ::==============================================================
- :drinkpotion
- ::==============================================================
- ::Check to see if player has enough potions to heal.
- if %potions% equ 0 (
- call :ColorText 0c "You don't have any potions left."
- echo.
- pause >nul
- goto disp
- )
- ::Check to see if player is already at full health.
- if %maxhp% equ %hp% (
- call :ColorText 0c "You are already at full health."
- echo.
- pause >nul
- goto disp
- )
- ::Heal the player
- set gainhealth=%hp%/10
- set /a hp=%hp%+10
- ::Overheal check.
- if %maxhp% lss %hp% (
- set hp=%maxhp%
- )
- ::Reduce potions by 1.
- set /a potions=%potions%-1
- goto disp
- :changemap
- cls
- echo Available maps:
- echo.
- dir maps /b
- echo.
- set input=
- set /p input=Map:
- if not defined input goto disp
- if not exist "maps\%input%\%input%.bat" (
- call :ColorText 0c "Map does not exist."
- echo.
- pause >nul
- goto disp
- )
- set loaded=false
- set map=%input%
- goto disp
- :levelcheck
- ::Checks for level up.
- if %Exp% gtr %maxExp% (
- if %level% lss 50 (
- set /a Exp=%Exp%-%maxExp%
- set /a maxExp=%maxExp%*12/10
- set /a level=%level%+1
- set /a hp=%maxhp%
- set /a maxhp=%maxhp%*11/10
- )
- if %level% geq 50 (
- set /a Exp=%Exp%-%maxExp%
- set /a maxExp=%maxExp%*11/10
- set /a level=%level%+1
- set /a hp=%maxhp%
- set /a maxhp=%maxhp%+167
- )
- if %level% geq 51 (
- set /a Exp=%Exp%-%maxExp%
- set /a maxExp=%maxExp%*11/10
- set /a level=%level%+1
- set /a hp=%maxhp%
- set /a maxhp=%maxhp%+200
- )
- if %level% equ 99 (
- set /a Exp=%Exp%-%maxExp%
- set /a maxExp=100000000
- set /a level=%level%+1
- set /a hp=%maxhp%
- set /a maxhp=%maxhp%+100
- )
- if %level% geq 100 (
- set /a Exp=0
- set /a maxExp=0
- set /a level=100
- set /a hp=%maxhp%
- set /a maxhp=22000
- )
- cls
- color 0a
- echo You have leveled up.
- echo.
- pause
- color %usercolor%
- )
- goto :eof
- :traveler
- cls
- echo Traveler: Greetings, %player_name%.
- echo.
- pause
- goto disp
- :fishing_spot
- call :pickup_item 0 Fish
- goto disp
- :wander
- ::Set values.
- set hplossratio=35
- set /a losehp=%random% %%%hplossratio%
- set /a hp=%hp%-%losehp%
- set /a Expwin=%random% %%25
- set /a potionwin=%random% %%03
- set /a potions=%potions%+%potionwin%
- set /a goldwin=%random% %%25
- set /a gold=%gold%+%goldwin%
- ::Checks if player has died.
- if %hp% lss 1 (
- cls
- color 0c
- echo You have died.
- echo.
- pause
- set hp=5
- set gold=0
- set potions=0
- color %usercolor%
- goto disp
- )
- cls
- echo You successfully killed the monsters.
- echo.
- echo You lost %losehp% Health.
- echo.
- if not %Expwin% equ 0 (
- echo +%Expwin% Exp
- )
- if not %goldwin% equ 0 (
- echo +%goldwin% Gold
- )
- if not %potionwin% equ 0 (
- echo +%potionwin% Potion/s
- )
- echo.
- set /a Exp=%Exp%+%Expwin%
- pause
- ::Checks for level up.
- call :levelcheck
- goto disp
- :bank
- cls
- echo Gold in inventory: $%gold%
- echo Gold in bank: $%bank%
- echo.
- echo 1) Deposit 2) Withdraw
- echo.
- echo %interact_key%) Leave
- echo.
- call bin\choice.exe /c:12%interact_key% /n /m ">"
- if %errorlevel% equ 1 goto deposit
- if %errorlevel% equ 2 goto withdraw
- if %errorlevel% equ 3 goto disp
- :deposit
- cls
- echo Gold in inventory: $%gold%
- echo.
- echo Deposit:
- echo.
- ::Backup gold value in case player doesn't have enough cash.
- set goldbackup=%gold%
- set bankbackup=%bank%
- ::Prompt player.
- set input=
- set /p input="$"
- ::If player enters negative amount, cancel transaction.
- if %input% equ "" goto bank
- if %input% lss 0 goto bank
- set /a gold=%gold%-%input%
- set /a bank=%bank%+%input%
- ::Check if player has that much gold in inventory.
- if %gold% lss 0 (
- call :ColorText 0c "Insufficient funds"
- echo.
- pause
- set gold=%goldbackup%
- set bank=%bankbackup%
- goto bank
- )
- ::Insufficient funds
- if %bank% lss 0 (
- call :ColorText 0c "Insufficient funds"
- echo.
- pause
- set gold=%goldbackup%
- set bank=%bankbackup%
- goto bank
- )
- goto bank
- :withdraw
- cls
- echo Gold in bank: $%bank%
- echo.
- echo Withdraw:
- echo.
- ::Backup gold value in case player doesn't have enough cash.
- set goldbackup=%gold%
- set bankbackup=%bank%
- ::Prompt player.
- set input=
- set /p input="$"
- ::If player enters negative amount, cancel transaction.
- if %input% equ "" goto bank
- if %input% lss 0 goto bank
- set /a gold=%gold%+%input%
- set /a bank=%bank%-%input%
- ::Check if player has that much gold in inventory.
- if %bank% lss 0 (
- call :ColorText 0c "Insufficient funds"
- echo.
- pause
- set gold=%goldbackup%
- set bank=%bankbackup%
- goto bank
- )
- ::Redundancy
- goto bank
- :market
- ::start "" "sounds\fire_loop.wav"
- cls
- echo Welcome to the market.
- echo What would you like to buy?
- echo.
- echo 1) [5 Gold] Potion
- echo 2) [10 Gold] Heal
- echo 3) [250 Gold] 1 Level
- echo.
- echo %interact_key%) Leave
- echo.
- call bin\choice.exe /c:123%interact_key% /n /m ">"
- if %errorlevel% equ 1 goto buypotion
- if %errorlevel% equ 2 goto buyhealth
- if %errorlevel% equ 3 goto buylevel
- if %errorlevel% equ 4 set pos=45
- if %errorlevel% equ 4 goto disp
- :buypotion
- set goldbackup=%gold%
- set /a gold=%gold%-5
- if %gold% lss 0 (
- cls
- color 0c
- echo Not enough gold to do that.
- echo.
- pause
- color %usercolor%
- set gold=%goldbackup%
- goto market
- )
- set /a potions=%potions%+1
- cls
- color 0a
- echo Successfully bought a potion.
- echo.
- pause
- color %usercolor%
- goto market
- :buyhealth
- set goldbackup=%gold%
- set /a gold=%gold%-10
- if %gold% lss 0 (
- cls
- color 0c
- echo Could not process your order, Insufficient funds.
- echo.
- pause
- color %usercolor%
- set gold=%goldbackup%
- goto market
- )
- if %hp% equ %maxhp% (
- call :ColorText 0c "You are already at full health."
- set gold=%goldbackup%
- goto market
- )
- set hp=%maxhp%
- cls
- color 0a
- echo Successfully payed to be healed.
- echo.
- pause
- color %usercolor%
- goto disp
- :buylevel
- set goldbackup=%gold%
- set /a gold=%gold%-250
- if %gold% lss 0 (
- cls
- color 0c
- echo Could not process your order, Insufficient funds.
- echo.
- pause
- color %usercolor%
- set gold=%goldbackup%
- goto market
- )
- set /a level=%level%+1
- cls
- color 0a
- echo Successfully bought a level.
- echo.
- pause
- color %usercolor%
- goto disp
- :givexp
- set /p Expwin=xp
- set /a Exp=%Exp%+%Expwin%
- cls
- echo You gained %Expwin% Exp.
- echo.
- pause
- set hp=%maxhp%
- goto disp
- :options
- cls
- echo Options:
- echo [1] Color
- echo [2] Hotkeys
- echo [3] Save
- echo [4] Exit without saving
- echo [5] Save and exit
- echo.
- echo [O] Back
- call bin\choice.exe /c:12345o /N
- if %errorlevel% equ 1 goto changecolors
- if %errorlevel% equ 2 goto disp
- if %errorlevel% equ 3 goto save
- if %errorlevel% equ 4 goto exitwithoutsaving
- if %errorlevel% equ 5 goto saveandexit
- if %errorlevel% equ 6 goto disp
- :changecolors
- if "%backgroundcolor%" equ "" set backgroundcolor=0
- color %backgroundcolor%f
- cls
- echo Note: Colors are unique to saves.
- echo.
- echo 0 = Black
- echo 1 = Blue
- echo 2 = Green
- echo 3 = Aqua
- echo 4 = Red
- echo 5 = Purple
- echo 6 = Yellow
- echo 7 = White
- echo 8 = Gray
- echo 9 = Light Blue
- echo A = Light Green
- echo B = Light Aqua
- echo C = Light Red
- echo D = Light Purple
- echo E = Light Yellow
- echo F = Bright White
- echo.
- echo Press 'M' to move on.
- echo.
- ver >nul
- call bin\choice.exe /c:0123456789abcdefm /n "Choose background color:"
- if %errorlevel% equ 1 set backgroundcolor=0
- if %errorlevel% equ 2 set backgroundcolor=1
- if %errorlevel% equ 3 set backgroundcolor=2
- if %errorlevel% equ 4 set backgroundcolor=3
- if %errorlevel% equ 5 set backgroundcolor=4
- if %errorlevel% equ 6 set backgroundcolor=5
- if %errorlevel% equ 7 set backgroundcolor=6
- if %errorlevel% equ 8 set backgroundcolor=7
- if %errorlevel% equ 9 set backgroundcolor=8
- if %errorlevel% equ 10 set backgroundcolor=9
- if %errorlevel% equ 11 set backgroundcolor=a
- if %errorlevel% equ 12 set backgroundcolor=b
- if %errorlevel% equ 13 set backgroundcolor=c
- if %errorlevel% equ 14 set backgroundcolor=d
- if %errorlevel% equ 15 set backgroundcolor=e
- if %errorlevel% equ 16 set backgroundcolor=f
- if %errorlevel% equ 17 goto changetxt
- goto changecolors
- :changetxt
- if "%textcolor%" equ "" set textcolor=f
- color %backgroundcolor%%textcolor%
- cls
- echo Note: Colors are unique to saves.
- echo.
- echo 0 = Black
- echo 1 = Blue
- echo 2 = Green
- echo 3 = Aqua
- echo 4 = Red
- echo 5 = Purple
- echo 6 = Yellow
- echo 7 = White
- echo 8 = Gray
- echo 9 = Light Blue
- echo A = Light Green
- echo B = Light Aqua
- echo C = Light Red
- echo D = Light Purple
- echo E = Light Yellow
- echo F = Bright White
- echo.
- echo Press 'M' to move on.
- echo.
- ver >nul
- call bin\choice.exe /c:0123456789abcdefm /n "Choose text color:"
- if %errorlevel% equ 1 set textcolor=0
- if %errorlevel% equ 2 set textcolor=1
- if %errorlevel% equ 3 set textcolor=2
- if %errorlevel% equ 4 set textcolor=3
- if %errorlevel% equ 5 set textcolor=4
- if %errorlevel% equ 6 set textcolor=5
- if %errorlevel% equ 7 set textcolor=6
- if %errorlevel% equ 8 set textcolor=7
- if %errorlevel% equ 9 set textcolor=8
- if %errorlevel% equ 10 set textcolor=9
- if %errorlevel% equ 11 set textcolor=a
- if %errorlevel% equ 12 set textcolor=b
- if %errorlevel% equ 13 set textcolor=c
- if %errorlevel% equ 14 set textcolor=d
- if %errorlevel% equ 15 set textcolor=e
- if %errorlevel% equ 16 set textcolor=f
- if %errorlevel% equ 17 goto save_colors_verification
- goto changetxt
- :save_colors_verification
- cls
- color %backgroundcolor%%textcolor%
- echo Are you sure?
- echo.
- call bin\choice.exe /c:yn /n "Y/N >"
- if %errorlevel% equ 1 goto save_colors
- if %errorlevel% equ 2 goto disp
- :save_colors
- set usercolor=%backgroundcolor%%textcolor%
- goto save
- :hotkeys
- ::UNDER DEVELOPMENT
- ::show all hotkeys here
- goto disp
- :save
- ::Save all data.
- cls
- echo Saving...
- (
- echo set player_name=%player_name%
- echo set usercolor=%usercolor%
- echo set level=%level%
- echo set Exp=%Exp%
- echo set maxExp=%maxExp%
- echo set hp=%hp%
- echo set maxhp=%maxhp%
- echo set mana=%mana%
- echo set maxmana=%maxmana%
- echo set gold=%gold%
- echo set bank=%bank%
- echo set potions=%potions%
- echo set xpos=%xpos%
- echo set ypos=%ypos%
- )>"saves\%player_name%\stats.bat"
- (
- echo set inventory_selection=%inventory_selection%
- echo set item1=%item1%
- echo set item2=%item2%
- echo set item3=%item3%
- echo set item4=%item4%
- echo set item5=%item5%
- echo set item6=%item6%
- echo set item7=%item7%
- echo set item8=%item8%
- echo set item9=%item9%
- echo set item10=%item10%
- )>"saves\%player_name%\inventory\inventory.bat"
- goto disp
- :exitwithoutsaving
- cls
- color 0c
- echo Are you sure you want to quit WITHOUT saving? Y/N
- call bin\choice.exe /c:yn /N
- if %errorlevel% equ 1 exit
- if %errorlevel% equ 2 goto disp
- :saveandexit
- ::Save all data.
- cls
- echo Saving...
- (
- echo set player_name=%player_name%
- echo set usercolor=%usercolor%
- echo set level=%level%
- echo set Exp=%Exp%
- echo set maxExp=%maxExp%
- echo set hp=%hp%
- echo set maxhp=%maxhp%
- echo set mana=%mana%
- echo set maxmana=%maxmana%
- echo set gold=%gold%
- echo set bank=%bank%
- echo set potions=%potions%
- echo set xpos=%xpos%
- echo set ypos=%ypos%
- )>"saves\%player_name%\stats.bat"
- (
- echo set inventory_selection=%inventory_selection%
- echo set item1=%item1%
- echo set item2=%item2%
- echo set item3=%item3%
- echo set item4=%item4%
- echo set item5=%item5%
- echo set item6=%item6%
- echo set item7=%item7%
- echo set item8=%item8%
- echo set item9=%item9%
- echo set item10=%item10%
- )>"saves\%player_name%\inventory\inventory.bat"
- exit
- :check_integrity
- cls
- echo Checking integrity . . .
- ::Display corrupt installation message if some core files are missing.
- set check_status=0
- if exist "bin" set /a check_status=%check_status%+1
- if exist "bin\choice.exe" set /a check_status=%check_status%+1
- if exist "maps" set /a check_status=%check_status%+1
- if exist "npc" set /a check_status=%check_status%+1
- if exist "saves" set /a check_status=%check_status%+1
- if exist "sounds" set /a check_status=%check_status%+1
- if exist "config.bat" set /a check_status=%check_status%+1
- if "%check_status%" equ "7" goto :eof
- cls
- echo Some core files were not detected. Game may not work correctly.
- echo.
- pause
- goto :eof
- :ColorText
- for /F "tokens=1,2 delims=#" %%a in ('"prompt #$H#$E# & echo on & for %%b in (1) do rem"') do set "DEL=%%a"
- <nul set /p ".=%DEL%" > "%~2"
- findstr /v /a:%1 /R "^$" "%~2" nul
- del "%~2" > nul 2>&1
- goto :eof
- :errormessage
- set oldtext=%2
- set text=%oldtext:"=%
- cls
- color %backgroundcolor%c
- echo %text%
- echo.
- pause
- color %backgroundcolor%2
- goto %1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement