Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. =begin
  2. Documentation: https://elanthipedia.play.net/Lich_script_repository#sanowret-crystal
  3. =end
  4.  
  5. custom_require.call(%w[common drinfomon])
  6.  
  7. class SanowretCrystal
  8. def initialize
  9. arg_definitions = [
  10. [
  11. { name: 'run', regex: /run/i, description: 'Single run of the script', optional: true }
  12. ]
  13. ]
  14. @invalid_rooms = []
  15. @worn_crystal = false
  16. args = parse_args(arg_definitions)
  17. check_crystal if args.run && !hiding? && !invisible?
  18. passive unless args.run
  19. end
  20.  
  21. def use_crystal
  22. return if @invalid_rooms.include?(Room.current.id)
  23. return if hiding? || invisible?
  24.  
  25. if DRSkill.getxp('Arcana') <= 10
  26. response = DRC.bput('gaze my sanowret crystal', /A soft light blossoms in the very center of the crystal, and begins to fill your mind with the knowledge of .*\./, 'However, nothing much else happens, as you lack the concentration to focus.', 'This is not a good place for that.', 'However, you realize that you\'re already gleaning knowledge from it.', 'That would be difficult to do while you attempt to keep the trail in sight.')
  27. elsif DRSkill.getxp('Arcana') <= 25
  28. response = DRC.bput('exhale my sanowret crystal', 'you come away from the experience with a further understanding of Arcana as the scintillating lights fade again.', 'However, nothing much else happens, as you lack the concentration to focus.', 'This is not a good place for that.', 'Doing that would give away your hiding place.', 'That would be difficult to do while you attempt to keep the trail in sight.')
  29. end
  30.  
  31. return if response !~ /This is not a good place for that\./
  32. return if @invalid_rooms.include?(Room.current.id)
  33. @invalid_rooms.push(Room.current.id)
  34. end
  35.  
  36. def check_crystal
  37. return if DRStats.concentration < 100
  38. return if DRSkill.getxp('Arcana') >= 25
  39. return if hiding? || invisible?
  40.  
  41. if @worn_crystal
  42. use_crystal
  43. else
  44. case DRC.bput('tap my sanowret crystal', /^You tap a .*sanowret crystal inside your .*.$/, /^You tap a .*sanowret crystal.* that you are wearing.$/, /^You tap a .*sanowret crystal that you are holding.$/, 'I could not find what you were referring to.')
  45. when /You tap a .*sanowret crystal inside your/
  46. DRC.bput('get my sanowret crystal', 'You get', 'What were you referring to')
  47. use_crystal
  48. DRC.bput('stow my sanowret crystal', 'You put', 'Stow what')
  49. when /^You tap a .*sanowret crystal.* that you are wearing\.$/
  50. @worn_crystal = true
  51. use_crystal
  52. when /^You tap a .*sanowret crystal that you are holding\.$/
  53. use_crystal
  54. DRC.bput('stow my sanowret crystal', 'You put', 'Stow what')
  55. else
  56. echo 'Sanowret crystal not found.'
  57. end
  58. end
  59. end
  60.  
  61. def passive
  62. loop do
  63. next if @invalid_rooms.include?(Room.current.id)
  64. check_crystal
  65. pause 10
  66. end
  67. end
  68. end
  69.  
  70. SanowretCrystal.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement