Advertisement
brashton

Untitled

Oct 11th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. =begin
  2. This started as crossing-repair, so some parts are vestigial
  3. Documentation: https://elanthipedia.play.net/Lich_script_repository#crossing-repair
  4. =end
  5.  
  6. custom_require.call(%w[drinfomon equipmanager common common-crafting common-money common-items common-travel])
  7.  
  8. class SelfMetalRepair
  9. include DRC
  10. include DRCC
  11. include DRCM
  12. include DRCI
  13. include DRCT
  14.  
  15. def initialize
  16. settings = setup
  17.  
  18. @repair_info.each do |repairer, items|
  19. repair_at(repairer['name'], repairer['id'], items)
  20. end
  21.  
  22. end
  23.  
  24. def repair(repairer, item, repeat = false)
  25. return unless repairer
  26. return unless item
  27.  
  28. # release_invisibility
  29. if repeat
  30. fput('swap') unless right_hand
  31. # command = "give #{repairer}"
  32. else
  33. return unless @equipment_manager.get_item?(item)
  34. # command = "give my #{item.short_name} to #{repairer}"
  35. end
  36.  
  37. case bput("tap my oil","You tap a flask","I could not find what you were referring to.")
  38. when "I could not find what you were referring to."
  39. buy_oil
  40. end
  41.  
  42. case bput("tap my brush","You tap an iron","I could not find what you were referring to.")
  43. when "I could not find what you were referring to."
  44. buy_brush
  45. end
  46.  
  47.  
  48. case bput("appraise my #{item.short_name}","practically in mint condition","in pristine condition", "in good condition", "rather scuffed up", "heavily scratched", "dents and dings")
  49. when "in pristine condition", "practically in mint condition", "in good condition", "rather scuffed up", "heavily scratched", "dents and dings"
  50. bput("get my brush","You get an")
  51. bput("rub #{item.short_name} with brush","you begin rubbing","The #{item.short_name} is not damaged enough to warrant repair.")
  52. when "The #{item.short_name} is not damaged enough to warrant repair."
  53. #no repair needed
  54. waitrt?
  55. pause 2
  56. bput("stow brush","You put your")
  57. bput("get my oil","You get")
  58. bput("pour oil on #{item.short_name}","You pour")
  59. waitrt?
  60. pause 2
  61. bput("stow oil","You put your")
  62. bput("sheath right","You sheath the")
  63. #no repair needed
  64. end
  65. @equipment_manager.empty_hands
  66. end
  67.  
  68.  
  69.  
  70. def repair_at(repairer, target_room, items)
  71. return if items.nil? || items.empty?
  72.  
  73. items.each { |item| repair(repairer, item) }
  74. end
  75.  
  76. def buy_brush()
  77. walk_to('1900')
  78. ensure_copper_on_hand(500, @settings)
  79. @equipment_manager.empty_hands
  80.  
  81. order_item('8776', '10')
  82. bput("stow brush", 'You put')
  83. end
  84.  
  85. def buy_oil()
  86. walk_to('1900')
  87. ensure_copper_on_hand(1000, @settings)
  88. @equipment_manager.empty_hands
  89.  
  90. order_item('8776', '6')
  91. bput("stow oil", 'You put')
  92. end
  93.  
  94. def setup
  95. arg_definitions = [
  96. [
  97. { name: 'town', regex: /Crossing|River.*|Theren.*|Shard|Hib.*|Ratha/i, optional: true, description: 'Town to sell in' }
  98. ]
  99. ]
  100. args = parse_args(arg_definitions)
  101.  
  102. town = args.town.capitalize
  103. if town.start_with?('Hib')
  104. town = 'Hibarnhvidar'
  105. elsif town.start_with?('River')
  106. town = 'Riverhaven'
  107. elsif town.start_with?('Theren')
  108. town = 'Therenborough'
  109. end
  110. settings = get_settings
  111.  
  112. settings['hometown'] = town if town
  113.  
  114. @equipment_manager = EquipmentManager.new
  115. @equipment_manager.wear_equipment_set?('standard')
  116. @equipment_manager.empty_hands
  117.  
  118. @hometown = settings.hometown
  119. # @skip_bank = settings.sell_loot_skip_bank
  120. # amount, denom = settings.sell_loot_money_on_hand.split(' ')
  121. # @keep_copper = convert_to_copper(amount, denom)
  122. # @repair_withdrawal_amount = settings.repair_withdrawal_amount
  123. hometown_data = get_data('town')[settings.hometown]
  124.  
  125. # ensure_copper_on_hand(@repair_withdrawal_amount, settings)
  126.  
  127. # Merge, do not overwrite
  128. # @repair_info = { hometown_data['leather_repair'] => @equipment_manager.items.select(&:leather).reject(&:skip_repair) }
  129. # .merge(hometown_data['metal_repair'] => @equipment_manager.items.reject(&:leather).reject(&:skip_repair)) { |_key, old, new| old + new }
  130. # settings
  131. @repair_info = { hometown_data['metal_repair'] => @equipment_manager.items.reject(&:leather).reject(&:skip_repair) }
  132. settings
  133. end
  134. end
  135.  
  136. SelfMetalRepair.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement