Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- This started as crossing-repair, so some parts are vestigial
- Documentation: https://elanthipedia.play.net/Lich_script_repository#crossing-repair
- =end
- custom_require.call(%w[drinfomon equipmanager common common-crafting common-money common-items common-travel])
- class SelfMetalRepair
- include DRC
- include DRCC
- include DRCM
- include DRCI
- include DRCT
- def initialize
- settings = setup
- @repair_info.each do |repairer, items|
- repair_at(repairer['name'], repairer['id'], items)
- end
- end
- def repair(repairer, item, repeat = false)
- return unless repairer
- return unless item
- # release_invisibility
- if repeat
- fput('swap') unless right_hand
- # command = "give #{repairer}"
- else
- return unless @equipment_manager.get_item?(item)
- # command = "give my #{item.short_name} to #{repairer}"
- end
- case bput("tap my oil","You tap a flask","I could not find what you were referring to.")
- when "I could not find what you were referring to."
- buy_oil
- end
- case bput("tap my brush","You tap an iron","I could not find what you were referring to.")
- when "I could not find what you were referring to."
- buy_brush
- end
- 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")
- when "in pristine condition", "practically in mint condition", "in good condition", "rather scuffed up", "heavily scratched", "dents and dings"
- bput("get my brush","You get an")
- bput("rub #{item.short_name} with brush","you begin rubbing","The #{item.short_name} is not damaged enough to warrant repair.")
- when "The #{item.short_name} is not damaged enough to warrant repair."
- #no repair needed
- waitrt?
- pause 2
- bput("stow brush","You put your")
- bput("get my oil","You get")
- bput("pour oil on #{item.short_name}","You pour")
- waitrt?
- pause 2
- bput("stow oil","You put your")
- bput("sheath right","You sheath the")
- #no repair needed
- end
- @equipment_manager.empty_hands
- end
- def repair_at(repairer, target_room, items)
- return if items.nil? || items.empty?
- items.each { |item| repair(repairer, item) }
- end
- def buy_brush()
- walk_to('1900')
- ensure_copper_on_hand(500, @settings)
- @equipment_manager.empty_hands
- order_item('8776', '10')
- bput("stow brush", 'You put')
- end
- def buy_oil()
- walk_to('1900')
- ensure_copper_on_hand(1000, @settings)
- @equipment_manager.empty_hands
- order_item('8776', '6')
- bput("stow oil", 'You put')
- end
- def setup
- arg_definitions = [
- [
- { name: 'town', regex: /Crossing|River.*|Theren.*|Shard|Hib.*|Ratha/i, optional: true, description: 'Town to sell in' }
- ]
- ]
- args = parse_args(arg_definitions)
- town = args.town.capitalize
- if town.start_with?('Hib')
- town = 'Hibarnhvidar'
- elsif town.start_with?('River')
- town = 'Riverhaven'
- elsif town.start_with?('Theren')
- town = 'Therenborough'
- end
- settings = get_settings
- settings['hometown'] = town if town
- @equipment_manager = EquipmentManager.new
- @equipment_manager.wear_equipment_set?('standard')
- @equipment_manager.empty_hands
- @hometown = settings.hometown
- # @skip_bank = settings.sell_loot_skip_bank
- # amount, denom = settings.sell_loot_money_on_hand.split(' ')
- # @keep_copper = convert_to_copper(amount, denom)
- # @repair_withdrawal_amount = settings.repair_withdrawal_amount
- hometown_data = get_data('town')[settings.hometown]
- # ensure_copper_on_hand(@repair_withdrawal_amount, settings)
- # Merge, do not overwrite
- # @repair_info = { hometown_data['leather_repair'] => @equipment_manager.items.select(&:leather).reject(&:skip_repair) }
- # .merge(hometown_data['metal_repair'] => @equipment_manager.items.reject(&:leather).reject(&:skip_repair)) { |_key, old, new| old + new }
- # settings
- @repair_info = { hometown_data['metal_repair'] => @equipment_manager.items.reject(&:leather).reject(&:skip_repair) }
- settings
- end
- end
- SelfMetalRepair.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement