Advertisement
Guest User

Untitled

a guest
Mar 26th, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. managers.money:_add_to_total(672500)
  2. function SkillTreeManager:unlock(tree, skill_id)
  3. if not self._global.trees[tree].unlocked then
  4. Application:error("Cannot unlock skill", skill_id, "in tree", tree, ". Tree is locked")
  5. return
  6. end
  7. if self._global.skills[skill_id].unlocked >= self._global.skills[skill_id].total then
  8. Application:error("No more steps to unlock in skill", skill_id)
  9. return
  10. end
  11. local talent = tweak_data.skilltree.skills[skill_id]
  12. local prerequisites = talent.prerequisites or {}
  13. for _, prerequisite in ipairs(prerequisites) do
  14. local unlocked = managers.skilltree:skill_step(prerequisite)
  15. if unlocked and unlocked == 0 then
  16. return
  17. end
  18. end
  19. local to_unlock = managers.skilltree:next_skill_step(skill_id)
  20. local skill = talent[to_unlock]
  21. local total_points, points = managers.skilltree:get_skill_points(skill_id, to_unlock)
  22.  
  23. self._global.skills[skill_id].unlocked = to_unlock
  24. local tier
  25. for i, tier_skills in ipairs(tweak_data.skilltree.trees[tree].tiers) do
  26. if table.contains(tier_skills, skill_id) then
  27. tier = i
  28. else
  29. end
  30. end
  31. self:_spend_points(tree, tier, total_points, points)
  32.  
  33. self:_on_skill_unlocked(tree, skill_id)
  34. if SystemInfo:platform() == Idstring("WIN32") then
  35. managers.statistics:publish_skills_to_steam()
  36. end
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement