Advertisement
Tom_Neverwinter

packet generator v3 2/24/2025

Feb 24th, 2025 (edited)
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.98 KB | None | 0 0
  1. @echo off
  2. setlocal enabledelayedexpansion
  3.  
  4. :: Define output file
  5. set outputFile=race_packets.txt
  6.  
  7. :: Clear and initialize output file
  8. echo Generating Chocobo Racing packets (0x69)... > %outputFile%
  9. echo. >> %outputFile%
  10.  
  11. :: Define packet constants - exactly matching original format
  12. set "PACKET_ID=69"
  13. set "TYPE_REGISTER=01"
  14. set "TYPE_RACE_STATE=02"
  15. set "TYPE_EXTENDED_STATE=03"
  16. set "TYPE_RESULT=04"
  17. set "TYPE_CONFIG=05"
  18.  
  19. :: Define weather conditions from Lua - keeping original values
  20. set "WEATHER_NONE=00"
  21. set "WEATHER_RAIN=05"
  22. set "WEATHER_SNOW=61"
  23. set "WEATHER_FOG=6B"
  24. set "WEATHER_STORM=75"
  25. set "WEATHER_GALES=7A"
  26. set "WEATHER_CONDITIONS=!WEATHER_NONE! !WEATHER_RAIN! !WEATHER_SNOW! !WEATHER_FOG! !WEATHER_STORM! !WEATHER_GALES!"
  27.  
  28. :: Define track conditions - keeping original values
  29. set "TRACK_FAST=01"
  30. set "TRACK_GOOD=02"
  31. set "TRACK_MUDDY=03"
  32. set "TRACK_CONDITIONS=!TRACK_FAST! !TRACK_GOOD! !TRACK_MUDDY!"
  33.  
  34. :: Define items - keeping original values
  35. set "ITEM_SHADOW_APPLE=01"
  36. set "ITEM_GYSAHL_BOMB=02"
  37. set "ITEM_FIRE_BISCUIT=03"
  38. set "ITEM_SPEED_APPLE=04"
  39. set "ITEM_STAMINA_APPLE=05"
  40. set "ITEM_FEATHER_MANTLE=06"
  41. set "ITEM_CHOCOBO_MEDICINE=07"
  42. set "ITEM_RACING_CHARM=08"
  43.  
  44. :: Function to generate random chocobo data
  45. call :GenerateChocoboData
  46.  
  47. :: Function to get random array element
  48. :GetRandomElement
  49. set "elements=%~1"
  50. set /a index=!random! %% %~2
  51. for %%i in (!elements!) do (
  52. if !index!==0 (
  53. set "result=%%i"
  54. exit /b
  55. )
  56. set /a index-=1
  57. )
  58. exit /b
  59.  
  60. :: Generate Registration Packet (Type 0x01)
  61. call :GenerateTimestamp
  62. echo [!timestamp!] >> %outputFile%
  63. echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
  64. echo ----------------------------------------------------- ---------------------- >> %outputFile%
  65. :: Registration data with chocobo parameters - EXACTLY matching original format
  66. set /a "speed=!random! %% 51 + 50"
  67. set /a "stamina=!random! %% 51 + 50"
  68. set /a "jockeySkill=!random! %% 10 + 1"
  69. echo 0 ^| %PACKET_ID% 00 %TYPE_REGISTER% 00 08 01 !speed! !stamina! !jockeySkill! 00 00 00 00 80 0 ^| i............... >> %outputFile%
  70. echo 1 ^| !chocobo_color! !chocobo_race! !gender! !racer_race! !saddle_type! 00 00 00 32 32 64 00 1 ^| .........22d... >> %outputFile%
  71. call :GenerateEmptyLines
  72. echo. >> %outputFile%
  73.  
  74. :: Generate Race State Packet (Type 0x02)
  75. call :GenerateTimestamp
  76. echo [!timestamp!] >> %outputFile%
  77. echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
  78. echo ----------------------------------------------------- ---------------------- >> %outputFile%
  79. :: Random weather and track conditions - EXACTLY matching original format
  80. call :GetRandomElement "%WEATHER_CONDITIONS%" 6
  81. set "weather=!result!"
  82. call :GetRandomElement "%TRACK_CONDITIONS%" 3
  83. set "track=!result!"
  84. echo 0 ^| %PACKET_ID% 00 %TYPE_RACE_STATE% 00 60 00 !weather! !track! 00 00 00 00 00 00 0 ^| i....`......... >> %outputFile%
  85. :: Race state with items - EXACTLY matching original format
  86. set /a "itemIndex=!random! %% 8 + 1"
  87. echo 1 ^| 00 00 08 15 !itemIndex! 00 00 00 00 00 00 00 00 00 00 00 1 ^| ................ >> %outputFile%
  88. call :GenerateEmptyLines
  89. echo. >> %outputFile%
  90.  
  91. :: Generate Extended State Packet (Type 0x03)
  92. call :GenerateTimestamp
  93. echo [!timestamp!] >> %outputFile%
  94. echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
  95. echo ----------------------------------------------------- ---------------------- >> %outputFile%
  96. :: Extended state with race progress - EXACTLY matching original format
  97. set /a "progress=!random! %% 100"
  98. set /a "position=!random! %% 8 + 1"
  99. echo 0 ^| %PACKET_ID% 00 %TYPE_EXTENDED_STATE% 00 C0 00 !progress! !position! !speed! !stamina! !jockeySkill! 00 00 0 ^| i............... >> %outputFile%
  100. echo 1 ^| !chocobo_color! !chocobo_race! 20 !weather! !track! 00 00 00 00 00 00 00 00 00 00 00 1 ^| ................ >> %outputFile%
  101. call :GenerateEmptyLines
  102. echo. >> %outputFile%
  103.  
  104. :: Generate Result Packet (Type 0x04)
  105. call :GenerateTimestamp
  106. echo [!timestamp!] >> %outputFile%
  107. echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
  108. echo ----------------------------------------------------- ---------------------- >> %outputFile%
  109. :: Result data with race statistics - EXACTLY matching original format
  110. set /a "finishTime=!random! %% 600 + 300"
  111. set /a "placing=!random! %% 8 + 1"
  112. echo 0 ^| %PACKET_ID% 00 %TYPE_RESULT% 00 04 00 !finishTime! !placing! !position! !progress! 0A 00 00 00 0 ^| i.....4........ >> %outputFile%
  113. echo 1 ^| 30 EE 00 00 20 !chocobo_color! !chocobo_race! 15 00 00 00 00 00 00 00 00 1 ^| 0... ........... >> %outputFile%
  114. call :GenerateEmptyLines
  115. echo. >> %outputFile%
  116.  
  117. :: Generate Configuration Packet (Type 0x05)
  118. call :GenerateTimestamp
  119. echo [!timestamp!] >> %outputFile%
  120. echo ^| 0 1 2 3 4 5 6 7 8 9 A B C D E F ^| 0123456789ABCDEF >> %outputFile%
  121. echo ----------------------------------------------------- ---------------------- >> %outputFile%
  122. echo 0 ^| %PACKET_ID% 00 %TYPE_CONFIG% 00 00 00 27 00 57 !weather! !track! 00 00 00 0 ^| i.....'.W...... >> %outputFile%
  123. echo 1 ^| !chocobo_color! !chocobo_race! !gender! !racer_race! !saddle_type! 00 00 00 32 32 64 00 1 ^| ............22d. >> %outputFile%
  124. call :GenerateEmptyLines
  125.  
  126. echo Packet generation complete. Check %outputFile%
  127. goto :eof
  128.  
  129. :GenerateChocoboData
  130. :: Generate random chocobo parameters - Keeping the EXACT field names from original
  131. set /a "chocobo_color=!random! %% 9"
  132. set /a "chocobo_race=!random! %% 8"
  133. set /a "gender=!random! %% 2"
  134. set /a "racer_race=!random! %% 8"
  135. set /a "saddle_type=!random! %% 5 + 1"
  136. goto :eof
  137.  
  138. :GenerateEmptyLines
  139. echo 2 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2 ^| ................ >> %outputFile%
  140. echo 3 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 3 ^| ................ >> %outputFile%
  141. echo 4 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 4 ^| ................ >> %outputFile%
  142. echo 5 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5 ^| ................ >> %outputFile%
  143. echo 6 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 6 ^| ................ >> %outputFile%
  144. echo 7 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 7 ^| ................ >> %outputFile%
  145. echo 8 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8 ^| ................ >> %outputFile%
  146. echo 9 ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9 ^| ................ >> %outputFile%
  147. echo A ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 A ^| ................ >> %outputFile%
  148. echo B ^| 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 B ^| ................ >> %outputFile%
  149. echo C ^| 00 00 00 00 00 00 00 00 -- -- -- -- -- -- -- -- C ^| ........-------- >> %outputFile%
  150. goto :eof
  151.  
  152. :GenerateTimestamp
  153. set "timestamp=%yyyy%-%mm%-%dd% %hh%:%nn%:%ss%"
  154. goto :eof
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement