Dartellum

Sigil-buddy

Sep 26th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. =begin
  2. Documentation: https://elanthipedia.play.net/Lich_script_repository#sigil-buddy
  3. =end
  4.  
  5. custom_require.call(%w[common common-items common-money common-travel drinfomon])
  6.  
  7. class SigilBuddy
  8. include DRC
  9. include DRCI
  10. include DRCM
  11. include DRCT
  12.  
  13. def initialize
  14. setup
  15.  
  16. ensure_copper_on_hand(10_000, @settings)
  17.  
  18. if @use_packet
  19. buy_scroll_packet unless exists?('blank scroll')
  20. buy_scroll_packet unless exists?('second blank scroll')
  21.  
  22. first = bput('look first blank scroll', 'You see \d+').scan(/\d+/).first.to_i
  23. second = bput('look second blank scroll', 'You see \d+').scan(/\d+/).first.to_i
  24.  
  25. if second < first
  26. fput('get my second blank scroll')
  27. fput('stow my blank scroll')
  28. end
  29. end
  30. wait_for_script_to_complete('buff', ['sigil'])
  31. @areas.each { |area_name| sigil_rooms(@area_list[area_name]) }
  32. end
  33.  
  34. def buy_scroll_packet
  35. if @scroll_room && @scroll_number
  36. order_item(@scroll_room, @scroll_number)
  37. else
  38. echo 'Your hometown is missing data for purchasing deeds!'
  39. exit
  40. end
  41. fput('stow my scroll')
  42. end
  43.  
  44. def setup
  45. @settings = get_settings
  46. @area_list = get_data('sigil').sigil_buddy_rooms
  47. @engineering_belt = @settings.engineering_belt
  48. @outfitting_belt = @settings.outfitting_belt
  49. @areas = @settings.sigil_to_harvest
  50. @skip_populated = @settings.sigil_skip_populated
  51. @sigil_list = @settings.sigil_buddy_list
  52. @sigil_implement = @settings.sigil_implement
  53. @use_packet = @settings.sigil_use_packet
  54. @hometown = @settings.hometown
  55. scroll_data = get_data('crafting').artificing[@hometown]
  56. @scroll_room = scroll_data['tool-room']
  57. @scroll_number = scroll_data['blank-scrolls']
  58. echo("#{@areas}:#{@sigil_list}") if UserVars.sigil_debug
  59. end
  60.  
  61. def get_sigil_tool
  62. if @engineering_belt['items'].grep(/#{@sigil_implement}/i).any?
  63. bput("untie my #{@sigil_implement}", 'You remove', 'You untie')
  64. elsif @outfitting_belt['items'].grep(/#{@sigil_implement}/i).any?
  65. bput("untie my #{@sigil_implement}", 'You remove', 'You untie')
  66. else
  67. bput("get my #{@sigil_implement}", 'You get', 'You are already')
  68. end
  69. end
  70.  
  71. def store_sigil_tool
  72. waitrt?
  73. if @engineering_belt['items'].grep(/#{@sigil_implement}/i).any?
  74. fput("tie my #{@sigil_implement} to #{@engineering_belt['name']}")
  75. elsif @outfitting_belt['items'].grep(/#{@sigil_implement}/i).any?
  76. fput("tie my #{@sigil_implement} to #{@outfitting_belt['name']}")
  77. else
  78. fput("stow my #{@sigil_implement}")
  79. end
  80. end
  81.  
  82. def check_repair
  83. get_sigil_tool
  84. result = bput("anal my #{@sigil_implement}", 'practically in mint', 'pristine condition', 'in good condition', 'crafting tool and it is rather scuffed up', 'Roundtime')
  85. waitrt?
  86.  
  87. store_sigil_tool
  88. return unless /roundtime/i =~ result
  89. repair = get_data('crafting')[@hometown]['repair-room']
  90. walk_to(repair['repair-room'])
  91. get_sigil_tool
  92. fput("give #{repair['repair-npc']}")
  93. fput("give #{repair['repair-npc']}")
  94. pause 10 until bput('look at my ticket', 'should be ready by now', 'Looking at the') == 'should be ready by now'
  95. fput("give #{repair['repair-npc']}")
  96. store_sigil_tool
  97. end
  98.  
  99. def sigil_rooms(rooms)
  100. rooms.each do |room|
  101. wait_for_script_to_complete('safe-room') if bleeding?
  102. check_repair if sigil?(room)
  103. end
  104. end
  105.  
  106. def sigil?(room)
  107. waitrt?
  108. walk_to(room)
  109. unless DRRoom.pcs.empty?
  110. return false if @skip_populated
  111.  
  112. fput('wave')
  113. end
  114.  
  115. unless @sigil_every_room
  116. until bput('PERCEIVE SIGIL', '(.*) sigil', 'You recall having', 'Roundtime') == 'details of (a|an) (.*) sigil'
  117. pause 1
  118. waitrt?
  119. end
  120. results = reget(20, 'sigil')
  121.  
  122. echo(results) if UserVars.sigil_debug
  123.  
  124. return false if results.nil?
  125. return false unless results
  126. .each_with_object([]) { |line, array| array << line.match(/(.*) sigil/i)[1] }
  127. .reject(&:nil?)
  128. .map(&:downcase)
  129. .any? { |sigil| @sigil_list.map(&:downcase).include?(sigil) }
  130. end
  131.  
  132. waitrt?
  133.  
  134. wait_for_script_to_complete('sigil')
  135. true
  136. end
  137. end
  138.  
  139. SigilBuddy.new
  140.  
Add Comment
Please, Sign In to add comment