Tom_Neverwinter

chatgpt interesting chocobo circuit data 6/1/2024

Jun 1st, 2024
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.10 KB | None | 0 0
  1. -----------------------------------
  2. -- Chocobo Racing
  3. -- https://www.bg-wiki.com/ffxi/Category:Chocobo_Racing
  4. -- https://ffxiclopedia.fandom.com/wiki/Chocobo_Racing_Guide
  5. -----------------------------------
  6. require('scripts/globals/utils')
  7. -----------------------------------
  8. xi = xi or {}
  9. xi.chocoboRacing = xi.chocoboRacing or {}
  10.  
  11. -- FOR HEAVILY-IN-DEVELOPMENT TESTING, you can force these settings:
  12. -- TODO: When ready for release, publish these to main settings files.
  13. xi.settings.main.ENABLE_CHOCOBO_RACING = true
  14. xi.settings.main.DEBUG_CHOCOBO_RACING = true
  15.  
  16. -- To Run:
  17. -- !exec xi.chocoboRacing.startRace()
  18.  
  19. local debug = function(player, ...)
  20. if xi.settings.main.DEBUG_CHOCOBO_RACING then
  21. local t = { ... }
  22. print(unpack(t))
  23. player:printToPlayer(table.concat(t, ' '), xi.msg.channel.SYSTEM_3, '')
  24. end
  25. end
  26.  
  27. local startRaceImpl = function(player)
  28. debug(player, 'Starting race')
  29. player:startEvent(210, 3885177, 3885177, -132554, -14500, 1344, -1, 610862737, 1)
  30. end
  31.  
  32. xi.chocoboRacing.startRace = function()
  33. local players = GetZone(xi.zone.CHOCOBO_CIRCUIT):getPlayers()
  34. for _, player in ipairs(players) do
  35. startRaceImpl(player)
  36. end
  37. end
  38.  
  39. -- 0x05C
  40. xi.chocoboRacing.onEventUpdate = function(player, csid, option, npc)
  41. debug(player, 'update', csid, option, npc)
  42.  
  43. local chocobos =
  44. {
  45. 'Friend',
  46. 'Neddy',
  47. 'Beau',
  48. 'Grand',
  49. 'Reppu',
  50. 'Ace',
  51. 'Winning',
  52. 'Northern',
  53. }
  54.  
  55. local winningsPerQuill = 1076
  56.  
  57. if csid == 210 then
  58. if option == 5 then
  59. debug(player, 'Intro banner')
  60. player:updateEvent(1, 0, 0xFFFDFA36, 0xFFFFC75C, 0x17345260, 0xFFFFFFFF, 0x24690691, 0xFFFFFFFB)
  61. elseif option == 274 then
  62. debug(player, 'Names 1-4')
  63. player:updateEventString(chocobos[1], chocobos[2], chocobos[3], chocobos[4],
  64. 0x000060B9, 0x000000B9)
  65. player:updateEvent(70, 0, 7, 4, 0x17345260, 0xFFFFFFFF, 0x24690691, 0xFFFFFFFB)
  66. elseif option == 510 or option == 530 then
  67. debug(player, 'Names 5-8 and Start')
  68. player:updateEventString(chocobos[5], chocobos[6], chocobos[7], chocobos[8],
  69. 0x00002928, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00085735)
  70. player:updateEvent(70, 0, 7, 4, 0x17345260, 0xFFFFFFFF, 0x24690691, 0xFFFFFFFB)
  71. elseif option == 17 then
  72. debug(player, 'End and announce winnings')
  73. player:updateEvent(70, 0, winningsPerQuill, 1, 0, 3, 3, 0xFFFFFFFB)
  74. end
  75. elseif csid == 319 then
  76. if option == 1 then
  77. debug(player, 'CS Event 319: Gate interaction with Gate: Chocobo Circuit')
  78. -- Handle gate interaction for event 319
  79. end
  80. elseif csid == 374 then
  81. if option == 1 then
  82. debug(player, 'CS Event 374: Initial interaction')
  83. -- Handle initial interaction for event 374
  84. elseif option == 2 then
  85. debug(player, 'CS Event 374: Second interaction')
  86. -- Handle second interaction for event 374
  87. elseif option == 100 then
  88. debug(player, 'CS Event 374: Option 100 selected')
  89. -- Handle option 100 for event 374
  90. elseif option == 4 then
  91. debug(player, 'CS Event 374: Option 4 selected')
  92. -- Handle option 4 for event 374
  93. end
  94. end
  95. end
  96.  
  97. xi.chocoboRacing.onEventFinish = function(player, csid, option, npc)
  98. debug(player, 'finish', csid, option, npc)
  99. if csid == 210 and option == 17 then
  100. debug(player, 'Hand out winnings')
  101. elseif csid == 319 and option == 1 then
  102. debug(player, 'Finish handling for event 319')
  103. -- Handle finish interaction for event 319
  104. elseif csid == 374 and option == 0 then
  105. debug(player, 'Finish handling for event 374')
  106. -- Handle finish interaction for event 374
  107. end
  108. end
  109.  
  110. xi.chocoboRacing.onNPCChat = function(player, npc, message)
  111. debug(player, 'NPC chat', npc, message)
  112. if npc == 17064036 then
  113. if message == 9307 then
  114. debug(player, 'Handling NPC chat message 9307')
  115. -- Handle chat message 9307 from NPC 17064036
  116. elseif message == 9308 then
  117. debug(player, 'Handling NPC chat message 9308')
  118. -- Handle chat message 9308 from NPC 17064036
  119. end
  120. end
  121. end
  122.  
  123. -- Additional Chocobo Racing Data and Simulation Functions
  124.  
  125. local chocobo_race = {
  126. {
  127. name = "Speedy",
  128. speed = 10,
  129. endurance = 8,
  130. agility = 9,
  131. color = "red",
  132. },
  133. {
  134. name = "Blaze",
  135. speed = 9,
  136. endurance = 10,
  137. agility = 8,
  138. color = "orange",
  139. },
  140. {
  141. name = "Storm",
  142. speed = 8,
  143. endurance = 9,
  144. agility = 10,
  145. color = "blue",
  146. },
  147. {
  148. name = "Shadow",
  149. speed = 7,
  150. endurance = 10,
  151. agility = 9,
  152. color = "black",
  153. },
  154. {
  155. name = "Spark",
  156. speed = 9,
  157. endurance = 8,
  158. agility = 10,
  159. color = "yellow",
  160. }
  161. }
  162.  
  163. local function getWeather()
  164. -- Example dynamic weather conditions based on the LandSandBoat server data
  165. -- This function should interface with the server to get current weather conditions
  166. -- Placeholder for actual weather data retrieval logic
  167. local weather_conditions = {
  168. "sunny",
  169. "rainy",
  170. "windy",
  171. "snowy",
  172. "stormy"
  173. }
  174. -- Simulate getting a random weather condition
  175. local weather = weather_conditions[math.random(#weather_conditions)]
  176. return weather
  177. end
  178.  
  179. local function adjustStatsForWeather(chocobo, weather)
  180. -- Adjust chocobo stats based on weather conditions
  181. if weather == "rainy" then
  182. chocobo.speed = chocobo.speed - 1
  183. chocobo.agility = chocobo.agility - 1
  184. elseif weather == "windy" then
  185. chocobo.endurance = chocobo.endurance - 1
  186. elseif weather == "snowy" then
  187. chocobo.speed = chocobo.speed - 2
  188. elseif weather == "stormy" then
  189. chocobo.endurance = chocobo.endurance - 2
  190. end
  191. end
  192.  
  193. local function simulateRace()
  194. local weather = getWeather()
  195. print("Current weather condition: " .. weather)
  196. for _, chocobo in ipairs(chocobo_race) do
  197. adjustStatsForWeather(chocobo, weather)
  198. chocobo.performance = chocobo.speed + chocobo.endurance + chocobo.agility + math.random(-5, 5)
  199. end
  200. table.sort(chocobo_race, function(a, b) return a.performance > b.performance end)
  201. end
  202.  
  203. local function printRaceResults()
  204. print("Chocobo Race Results:")
  205. for i, chocobo in ipairs(chocobo_race) do
  206. print(i .. ". " .. chocobo.name .. " (" .. chocobo.color .. ") - Performance: " .. chocobo.performance)
  207. end
  208. end
  209.  
  210. local function automateRaces(interval)
  211. while true do
  212. simulateRace()
  213. printRaceResults()
  214. os.execute("sleep " .. interval)
  215. end
  216. end
  217.  
  218. -- Run the automated races every 15 minutes (900 seconds)
  219. automateRaces(900)
  220.  
Advertisement
Add Comment
Please, Sign In to add comment