Advertisement
Tom_Neverwinter

chocobo raising ffxi careplan cleanup

Mar 20th, 2023
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. -- Handle age-up cs's
  2. for _, entry in pairs(ageBoundaries) do
  3. if currentStage == entry[1] and age >= entry[2] then
  4. table.insert(event[2], entry[3])
  5. end
  6. end
  7.  
  8. table.insert(events, event)
  9.  
  10. -- Remove used days from care plan and write back to chocoState + db
  11. for i = 1, #carePlan do
  12. if carePlan[i][2] <= daysElapsed then
  13. daysElapsed = daysElapsed - carePlan[i][2]
  14. table.remove(carePlan, i)
  15. i = i - 1
  16. else
  17. carePlan[i][2] = carePlan[i][2] - daysElapsed
  18. break
  19. end
  20. end
  21.  
  22. chocoState.care_plan = carePlan
  23. -- Write back to db here
  24. This code will remove any completed days from the care plan and update the chocoState accordingly. It assumes that carePlan is a table containing sub-tables of the form {careItem, daysLeft} where careItem is a string describing the care to be given and daysLeft is the number of days remaining for that care item. The updated carePlan table is then written back to both chocoState and the database.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement