Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Documentation: https://elanthipedia.play.net/Lich_script_repository#sigil-buddy
- =end
- custom_require.call(%w[common common-items common-money common-travel drinfomon])
- class SigilBuddy
- include DRC
- include DRCI
- include DRCM
- include DRCT
- def initialize
- setup
- ensure_copper_on_hand(10_000, @settings)
- if @use_packet
- buy_scroll_packet unless exists?('blank scroll')
- buy_scroll_packet unless exists?('second blank scroll')
- first = bput('look first blank scroll', 'You see \d+').scan(/\d+/).first.to_i
- second = bput('look second blank scroll', 'You see \d+').scan(/\d+/).first.to_i
- if second < first
- fput('get my second blank scroll')
- fput('stow my blank scroll')
- end
- end
- wait_for_script_to_complete('buff', ['sigil'])
- @areas.each { |area_name| sigil_rooms(@area_list[area_name]) }
- end
- def buy_scroll_packet
- if @scroll_room && @scroll_number
- order_item(@scroll_room, @scroll_number)
- else
- echo 'Your hometown is missing data for purchasing deeds!'
- exit
- end
- fput('stow my scroll')
- end
- def setup
- @settings = get_settings
- @area_list = get_data('sigil').sigil_buddy_rooms
- @engineering_belt = @settings.engineering_belt
- @outfitting_belt = @settings.outfitting_belt
- @areas = @settings.sigil_to_harvest
- @skip_populated = @settings.sigil_skip_populated
- @sigil_list = @settings.sigil_buddy_list
- @sigil_implement = @settings.sigil_implement
- @use_packet = @settings.sigil_use_packet
- @hometown = @settings.hometown
- scroll_data = get_data('crafting').artificing[@hometown]
- @scroll_room = scroll_data['tool-room']
- @scroll_number = scroll_data['blank-scrolls']
- echo("#{@areas}:#{@sigil_list}") if UserVars.sigil_debug
- end
- def get_sigil_tool
- if @engineering_belt['items'].grep(/#{@sigil_implement}/i).any?
- bput("untie my #{@sigil_implement}", 'You remove', 'You untie')
- elsif @outfitting_belt['items'].grep(/#{@sigil_implement}/i).any?
- bput("untie my #{@sigil_implement}", 'You remove', 'You untie')
- else
- bput("get my #{@sigil_implement}", 'You get', 'You are already')
- end
- end
- def store_sigil_tool
- waitrt?
- if @engineering_belt['items'].grep(/#{@sigil_implement}/i).any?
- fput("tie my #{@sigil_implement} to #{@engineering_belt['name']}")
- elsif @outfitting_belt['items'].grep(/#{@sigil_implement}/i).any?
- fput("tie my #{@sigil_implement} to #{@outfitting_belt['name']}")
- else
- fput("stow my #{@sigil_implement}")
- end
- end
- def check_repair
- get_sigil_tool
- result = bput("anal my #{@sigil_implement}", 'practically in mint', 'pristine condition', 'in good condition', 'crafting tool and it is rather scuffed up', 'Roundtime')
- waitrt?
- store_sigil_tool
- return unless /roundtime/i =~ result
- repair = get_data('crafting')[@hometown]['repair-room']
- walk_to(repair['repair-room'])
- get_sigil_tool
- fput("give #{repair['repair-npc']}")
- fput("give #{repair['repair-npc']}")
- pause 10 until bput('look at my ticket', 'should be ready by now', 'Looking at the') == 'should be ready by now'
- fput("give #{repair['repair-npc']}")
- store_sigil_tool
- end
- def sigil_rooms(rooms)
- rooms.each do |room|
- wait_for_script_to_complete('safe-room') if bleeding?
- check_repair if sigil?(room)
- end
- end
- def sigil?(room)
- waitrt?
- walk_to(room)
- unless DRRoom.pcs.empty?
- return false if @skip_populated
- fput('wave')
- end
- unless @sigil_every_room
- until bput('PERCEIVE SIGIL', '(.*) sigil', 'You recall having', 'Roundtime') == 'details of (a|an) (.*) sigil'
- pause 1
- waitrt?
- end
- results = reget(20, 'sigil')
- echo(results) if UserVars.sigil_debug
- return false if results.nil?
- return false unless results
- .each_with_object([]) { |line, array| array << line.match(/(.*) sigil/i)[1] }
- .reject(&:nil?)
- .map(&:downcase)
- .any? { |sigil| @sigil_list.map(&:downcase).include?(sigil) }
- end
- waitrt?
- wait_for_script_to_complete('sigil')
- true
- end
- end
- SigilBuddy.new
Add Comment
Please, Sign In to add comment