Advertisement
Dartellum

make-lockpicks.lic

May 16th, 2020
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. =begin
  2. make-lockpicks.lic
  3. Refills worn lockpick ring
  4. =end
  5.  
  6. custom_require.call(%w[common common-crafting common-items])
  7.  
  8. class MakeLockpicks
  9. include DRC
  10. include DRCC
  11. include DRCI
  12.  
  13. def initialize
  14. @settings = get_settings
  15. @lockpick_ring = @settings.lockpick_ring || 'lockpick ring'
  16. @picks_to_keep = @settings.lockpicks_to_keep || [ 'grandmaster\'s', 'master\'s' ]
  17.  
  18. stow_hands
  19. @keyblanks_on_hand = count_keyblanks
  20. @lockpicks_needed = count_lockpicks
  21. if @lockpicks_needed == 0
  22. echo "*** Your lockpick ring is already full ***"
  23. exit
  24. elsif @keyblanks_on_hand == 0
  25. echo "*** You do not have any keyblanks ***"
  26. exit
  27. elsif @keyblanks_on_hand < @lockpicks_needed
  28. echo "*** You do not have enough keyblanks to make #{@lockpicks_needed} lockpicks. Reducing to #{@keyblanks_on_hand}."
  29. @lockpicks_needed = @keyblanks_on_hand
  30. end
  31.  
  32. make_lockpicks
  33. end
  34.  
  35. def make_lockpicks
  36. get_crafting_item('carving knife', @settings.crafting_container, @settings.crafting_items_in_container, @settings.engineering_belt)
  37.  
  38. @lockpicks_needed.times do
  39. wait_for_script_to_complete('buff', ['make-lockpicks'])
  40. carve_keyblank
  41. finish_lockpick
  42. case bput("put my lockpick on my #{@lockpick_ring}", 'You put', 'already has', 'You don\'t think you should put different kinds of lockpicks')
  43. when 'already has'
  44. break
  45. when 'You don\'t think you should put different kinds of lockpicks'
  46. echo "*** #{left_hand} is of a different quality than your lockpick ring, stowing it"
  47. stow_hand('left')
  48. redo
  49. end
  50. end
  51.  
  52. stow_crafting_item('carving knife', @settings.crafting_container, @settings.engineering_belt)
  53. end
  54.  
  55. def carve_keyblank
  56. case bput('get keyblank from my keyblank pocket', 'You get', 'What were you referring')
  57. when 'What were you referring'
  58. unless count_keyblanks > 0
  59. echo '*** You\'ve run out of key blanks ***'
  60. stow_crafting_item('carving knife', @settings.crafting_container, @settings.engineering_belt)
  61. exit
  62. end
  63. carve_keyblank
  64. end
  65.  
  66. case bput('carve my keyblank with my carving knife', 'Starting with a simple slab of material', 'keyblank snaps like a twig', 'You are too injured to do any', 'proudly glance down at a')
  67. when 'keyblank snaps like a twig'
  68. carve_keyblank
  69. when 'You are too injured to do any'
  70. stow_crafting_item('carving knife', @settings.crafting_container, @settings.engineering_belt)
  71. bput('put my keyblank in my keyblank pocket', 'You put')
  72. echo '*** Go get healed ***'
  73. exit
  74. when 'proudly glance down at a'
  75. return
  76. end
  77.  
  78. loop do
  79. case bput('carve my lockpick with my carving knife', 'Working with extreme caution', 'proudly glance down at a', 'lockpick snaps like a twig', 'It would be better to find')
  80. when 'lockpick snaps like a twig'
  81. carve_keyblank
  82. when 'It would be better to find', 'proudly glance down at a'
  83. return
  84. end
  85. end
  86.  
  87. end
  88.  
  89. def finish_lockpick
  90. case bput('glance', 'You glance down to see .*')
  91. when /and a ([a-z\']+) \w+ lockpick in your left hand/
  92. if Regexp.last_match(1) == 'grandmaster\'s'
  93. bput('carve my lockpick with my carving knife', 'With the precision and skill shown only by true masters')
  94. end
  95. return if @picks_to_keep.include? Regexp.last_match(1)
  96. dispose_trash('lockpick')
  97. carve_keyblank
  98. end
  99. end
  100.  
  101. def count_keyblanks
  102. keyblanks = 0
  103. $ORDINALS.each do |ordinal|
  104. bput("open my #{ordinal} keyblank pocket", 'You open', 'That is already', 'What were you')
  105. case bput("count my #{ordinal} keyblank pocket", /It looks like there are .* keyblanks/, 'I could not find', 'There\'s nothing inside')
  106. when /It looks like there are (\d+) \w+ keyblanks/
  107. keyblanks += Regexp.last_match(1).to_i
  108. when 'There\'s nothing inside'
  109. dispose("#{ordinal} keyblank pocket")
  110. redo
  111. when 'I could not find'
  112. break
  113. end
  114. end
  115. return keyblanks
  116. end
  117.  
  118. def count_lockpicks
  119. case bput("glance my #{@lockpick_ring}", /and it might hold an additional (\d+)/, 'and it appears to be full', 'I could not find what you', /but you think (\d+) lockpicks would probably fit/)
  120. when /and it might hold an additional (\d+)/, /but you think (\d+) lockpicks would probably fit/
  121. return Regexp.last_match(1).to_i
  122. when 'and it appears to be full'
  123. return 0
  124. when 'I could not find what you'
  125. echo '*** Unable to find your lockpick ring ***'
  126. exit
  127. end
  128. end
  129.  
  130. end
  131.  
  132. MakeLockpicks.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement