jbrocky

Untitled

Mar 10th, 2018
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. =begin
  2. Documentation: https://elanthipedia.play.net/sell-pouches
  3. =end
  4.  
  5. custom_require.call(%w(common common-items))
  6.  
  7. class SellPouches
  8. include DRC
  9. include DRCI
  10.  
  11. def initialize
  12. arg_definitions = [
  13. [
  14. { name: 'trader', regex: /\d+/, variable: true, description: 'Container the pouches to be sold are located.' },
  15. { name: 'container', regex: /\d+/, variable: true, description: 'Name of the Trader doing the selling.' },
  16. { name: 'dispose', regex: /\d+/, variable: true, optional: true, description: 'Place to put the pouches when returned. (Can be your own container).' }
  17. ]
  18. ]
  19.  
  20. args = parse_args(arg_definitions)
  21.  
  22. EquipmentManager.new.empty_hands
  23.  
  24. @trader = args.trader
  25. @container = args.container
  26. @dispose = args.dispose || 'bucket'
  27.  
  28. @pouches = rummage('C pouch', @container)
  29.  
  30. sell
  31. end
  32.  
  33. def sell
  34. @pouches.each do |pouch|
  35. case DRC.bput("get suede pouch in my #{@container}", 'You get', 'What were')
  36. when 'You get'
  37. result = bput("give my suede pouch to #{@trader}", 'You offer', 'What is it')
  38. if result =~ /What is it/i
  39. echo "Exiting, Trader is invalid."
  40. exit
  41. end
  42. waitfor ('offers you')
  43. pause 1.5
  44. bput('accept tip', 'You accept', 'But you have no tip')
  45. case DRC.bput("accept", 'You accept', 'You have no offers')
  46. when "You accept"
  47. result = bput("put my pouch in #{@dispose}", 'You put', 'I could not')
  48. bput('drop my pouch', 'You drop') if result =~ /I could not/i
  49. end
  50. when 'What were'
  51. bput('accept tip', 'You accept', 'But you have no tip')
  52. return
  53. end
  54. end
  55. bput('accept tip', 'You accept', 'But you have no tip')
  56. end
  57. end
Advertisement
Add Comment
Please, Sign In to add comment