Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- setlocal enabledelayedexpansion
- :: Define output file
- set outputFile=race_packets.txt
- :: Clear and initialize output file
- echo Generating Chocobo Racing packets (0x69)... > %outputFile%
- echo. >> %outputFile%
- :: Define packet constants - exactly matching original format
- set "PACKET_ID=69"
- set "TYPE_REGISTER=01"
- set "TYPE_RACE_STATE=02"
- set "TYPE_EXTENDED_STATE=03"
- set "TYPE_RESULT=04"
- set "TYPE_CONFIG=05"
- :: Define weather conditions from Lua - keeping original values
- set "WEATHER_NONE=00"
- set "WEATHER_RAIN=05"
- set "WEATHER_SNOW=61"
- set "WEATHER_FOG=6B"
- set "WEATHER_STORM=75"
- set "WEATHER_GALES=7A"
- set "WEATHER_CONDITIONS=!WEATHER_NONE! !WEATHER_RAIN! !WEATHER_SNOW! !WEATHER_FOG! !WEATHER_STORM! !WEATHER_GALES!"
- :: Define track conditions - keeping original values
- set "TRACK_FAST=01"
- set "TRACK_GOOD=02"
- set "TRACK_MUDDY=03"
- set "TRACK_CONDITIONS=!TRACK_FAST! !TRACK_GOOD! !TRACK_MUDDY!"
- :: Define items - keeping original values
- set "ITEM_SHADOW_APPLE=01"
- set "ITEM_GYSAHL_BOMB=02"
- set "ITEM_FIRE_BISCUIT=03"
- set "ITEM_SPEED_APPLE=04"
- set "ITEM_STAMINA_APPLE=05"
- set "ITEM_FEATHER_MANTLE=06"
- set "ITEM_CHOCOBO_MEDICINE=07"
- set "ITEM_RACING_CHARM=08"
- :: Function to generate random chocobo data
- call :GenerateChocoboData
- :: Function to get random array element
- :GetRandomElement
- set "elements=%~1"
- set /a index=!random! %% %~2
- for %%i in (!elements!) do (
- if !index!==0 (
- set "result=%%i"
- exit /b
- )
- set /a index-=1
- )
- exit /b
- :: Generate Registration Packet (Type 0x01)
- call :GenerateTimestamp
- echo [!timestamp!] >> %outputFile%
- echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
- echo ----------------------------------------------------- ---------------------- >> %outputFile%
- :: Registration data with chocobo parameters - EXACTLY matching original format
- set /a "speed=!random! %% 51 + 50"
- set /a "stamina=!random! %% 51 + 50"
- set /a "jockeySkill=!random! %% 10 + 1"
- echo 0 ^| %PACKET_ID% 00 %TYPE_REGISTER% 00 08 01 !speed! !stamina! !jockeySkill! 00 00 00 00 80 0 ^| i............... >> %outputFile%
- echo 1 ^| !chocobo_color! !chocobo_race! !gender! !racer_race! !saddle_type! 00 00 00 32 32 64 00 1 ^| .........22d... >> %outputFile%
- call :GenerateEmptyLines
- echo. >> %outputFile%
- :: Generate Race State Packet (Type 0x02)
- call :GenerateTimestamp
- echo [!timestamp!] >> %outputFile%
- echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
- echo ----------------------------------------------------- ---------------------- >> %outputFile%
- :: Random weather and track conditions - EXACTLY matching original format
- call :GetRandomElement "%WEATHER_CONDITIONS%" 6
- set "weather=!result!"
- call :GetRandomElement "%TRACK_CONDITIONS%" 3
- set "track=!result!"
- echo 0 ^| %PACKET_ID% 00 %TYPE_RACE_STATE% 00 60 00 !weather! !track! 00 00 00 00 00 00 0 ^| i....`......... >> %outputFile%
- :: Race state with items - EXACTLY matching original format
- set /a "itemIndex=!random! %% 8 + 1"
- echo 1 ^| 00 00 08 15 !itemIndex! 00 00 00 00 00 00 00 00 00 00 00 1 ^| ................ >> %outputFile%
- call :GenerateEmptyLines
- echo. >> %outputFile%
- :: Generate Extended State Packet (Type 0x03)
- call :GenerateTimestamp
- echo [!timestamp!] >> %outputFile%
- echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
- echo ----------------------------------------------------- ---------------------- >> %outputFile%
- :: Extended state with race progress - EXACTLY matching original format
- set /a "progress=!random! %% 100"
- set /a "position=!random! %% 8 + 1"
- echo 0 ^| %PACKET_ID% 00 %TYPE_EXTENDED_STATE% 00 C0 00 !progress! !position! !speed! !stamina! !jockeySkill! 00 00 0 ^| i............... >> %outputFile%
- echo 1 ^| !chocobo_color! !chocobo_race! 20 !weather! !track! 00 00 00 00 00 00 00 00 00 00 00 1 ^| ................ >> %outputFile%
- call :GenerateEmptyLines
- echo. >> %outputFile%
- :: Generate Result Packet (Type 0x04)
- call :GenerateTimestamp
- echo [!timestamp!] >> %outputFile%
- echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
- echo ----------------------------------------------------- ---------------------- >> %outputFile%
- :: Result data with race statistics - EXACTLY matching original format
- set /a "finishTime=!random! %% 600 + 300"
- set /a "placing=!random! %% 8 + 1"
- echo 0 ^| %PACKET_ID% 00 %TYPE_RESULT% 00 04 00 !finishTime! !placing! !position! !progress! 0A 00 00 00 0 ^| i.....4........ >> %outputFile%
- echo 1 ^| 30 EE 00 00 20 !chocobo_color! !chocobo_race! 15 00 00 00 00 00 00 00 00 1 ^| 0... ........... >> %outputFile%
- call :GenerateEmptyLines
- echo. >> %outputFile%
- :: Generate Configuration Packet (Type 0x05)
- call :GenerateTimestamp
- echo [!timestamp!] >> %outputFile%
- echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
- echo ----------------------------------------------------- ---------------------- >> %outputFile%
- echo 0 ^| %PACKET_ID% 00 %TYPE_CONFIG% 00 00 00 27 00 57 !weather! !track! 00 00 00 0 ^| i.....'.W...... >> %outputFile%
- echo 1 ^| !chocobo_color! !chocobo_race! !gender! !racer_race! !saddle_type! 00 00 00 32 32 64 00 1 ^| ............22d. >> %outputFile%
- call :GenerateEmptyLines
- echo Packet generation complete. Check %outputFile%
- goto :eof
- :GenerateChocoboData
- :: Generate random chocobo parameters - Keeping the EXACT field names from original
- set /a "chocobo_color=!random! %% 9"
- set /a "chocobo_race=!random! %% 8"
- set /a "gender=!random! %% 2"
- set /a "racer_race=!random! %% 8"
- set /a "saddle_type=!random! %% 5 + 1"
- goto :eof
- :GenerateEmptyLines
- echo 2 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2 ^| ................ >> %outputFile%
- echo 3 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3 ^| ................ >> %outputFile%
- echo 4 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4 ^| ................ >> %outputFile%
- echo 5 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5 ^| ................ >> %outputFile%
- echo 6 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6 ^| ................ >> %outputFile%
- echo 7 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7 ^| ................ >> %outputFile%
- echo 8 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8 ^| ................ >> %outputFile%
- echo 9 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9 ^| ................ >> %outputFile%
- echo A ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A ^| ................ >> %outputFile%
- echo B ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 B ^| ................ >> %outputFile%
- echo C ^| 00 00 00 00 00 00 00 00 -- -- -- -- -- -- -- -- C ^| ........-------- >> %outputFile%
- goto :eof
- :GenerateTimestamp
- set "timestamp=%yyyy%-%mm%-%dd% %hh%:%nn%:%ss%"
- goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement