Advertisement
tinyevil

Untitled

Jul 18th, 2019
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. void convert_quests(player) {
  2. local new_quests = {}
  3. local quest_entries = {}
  4. local quest_data = {}
  5.  
  6. for quest, progress in player.quest {
  7. local quest_definition = find_quest_data(quest)
  8. if not quest_definition {
  9. continue;
  10. }
  11. if get_level(player) > quest_definition.level_expire {
  12. continue;
  13. }
  14. local quest_object = {
  15. uuid = generate_uuid(),
  16. id = quest_definition.id
  17. }
  18. local data = {}
  19. quest_data[quest_object.uuid] = data
  20. quest_entries.push_back(quest_object)
  21. if quest_definition.is_accumulate {
  22. data.progress = progress
  23. } else {
  24. data.best = progress
  25. }
  26. if quest_definition.tutorial_marker {
  27. update_tutorial_progress(player, quest_definition.tutorial_marker, progress)
  28. }
  29. if quest_definition.goal <= progress {
  30. complete_quest_and_give_reward(player, quest_object.id)
  31. }
  32. }
  33.  
  34. player.quests = nil
  35. player.quest_entries = quest_entries;
  36. player.quest_data = quest_data;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement