Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Documentation: https://elanthipedia.play.net/Lich_script_repository#pick
- =end
- custom_require.call(%w(common common-arcana common-items common-money common-travel drinfomon equipmanager events spellmonitor))
- class LockPicker
- include DRC
- include DRCA
- include DRCI
- include DRCM
- include DRCT
- def initialize
- setup
- boxes = get_boxes(@settings.picking_box_source) if @settings.picking_box_source
- if boxes.nil? || boxes.empty?
- check_pet_boxes(@settings.picking_pet_box_source)
- return
- end
- @equipment_manager = EquipmentManager.new
- @equipment_manager.empty_hands
- removed_items = @equipment_manager.remove_gear_by(&:hinders_lockpicking)
- if left_hand || right_hand
- echo '***ITEMS ARE STILL IN HANDS, EXITING***'
- @equipment_manager.wear_items(removed_items)
- return
- end
- lockpick_buffs = @settings.lockpick_buffs
- do_buffs(lockpick_buffs)
- fput 'sit'
- boxes.each do |box|
- if !attempt_open(box)
- break
- end
- end
- fix_standing
- @equipment_manager.wear_items(removed_items)
- end
- def setup
- arg_definitions = [[]]
- args = parse_args(arg_definitions, true)
- @settings = get_settings(args.flex)
- @lockpick_costs = {
- 'ordinary' => 125,
- 'stout' => 250,
- 'slim' => 500
- }
- @loot_nouns = @settings.lootables
- echo "Loot nouns: #{@loot_nouns}" if UserVars.lockpick_debug
- @trash_nouns = get_data('items').trash_nouns
- echo "Trash nouns: #{@trash_nouns}" if UserVars.lockpick_debug
- messages = get_data('picking').picking
- @pick_careful = messages['pick_careful']
- @pick_quick = messages['pick_quick']
- @pick_blind = messages['pick_blind']
- @pick_retry = messages['pick_retry']
- @disarm_failed = messages['disarm_failed']
- @disarm_retry = messages['disarm_retry']
- @disarm_identify_failed = messages['disarm_identify_failed']
- @disarm_too_hard = messages['disarm_too_hard']
- @disarm_careful = messages['disarm_careful']
- @disarm_quick = messages['disarm_quick']
- @disarm_normal = messages['disarm_normal']
- Flags.add('disarm-more', 'not fully disarmed', 'not yet fully disarmed', 'still has more to torment you with')
- open_container(@settings.picking_box_source)
- open_container(@settings.picking_box_storage)
- open_container(@settings.picking_pet_box_source)
- end
- def open_container(name)
- return unless name
- fput("open my #{name}")
- end
- def do_buffs(buffs)
- if DRRoom.pcs.include?(@settings.lockpick_buff_bot)
- fput("whisper #{@settings.lockpick_buff_bot} buff hol")
- end
- buffs['spells'].each do |spell|
- echo "Buffing: #{spell}" if UserVars.lockpick_debug
- buff(spell, @settings)
- end
- buffs['khri']
- .map { |name| "Khri #{name}" }
- .each { |name| activate_khri?(@settings.kneel_khri, name) }
- end
- def attempt_open(box)
- waitrt?
- echo "attempt_open(#{box})" if UserVars.lockpick_debug
- bput("get my #{box} from my #{@settings.picking_box_source}", 'You get a .* from inside your ')
- unless disarm?(box)
- bput("put my #{box} in my #{@settings.picking_box_storage}", 'You put your .* in your ') if right_hand
- return
- end
- case bput("put my #{box} in my #{@settings.picking_pet_box_source}", /You put/, /room/)
- when /You put/
- return true
- when /room/
- bput("stow #{box}", /You put/)
- return false
- end
- end
- def disarm?(box)
- waitrt?
- check_danger
- echo "disarm?(#{box})" if UserVars.lockpick_debug
- case bput("disarm my #{box} identify", @disarm_identify_failed, @disarm_too_hard, @disarm_careful, @disarm_quick, @disarm_normal, 'Roundtime')
- when 'Roundtime', *@disarm_careful
- disarm_speed?(box, 'careful')
- when *@disarm_quick
- disarm_speed?(box, 'quick')
- when *@disarm_normal
- disarm_speed?(box, 'normal')
- when *@disarm_identify_failed
- disarm?(box)
- when *@disarm_too_hard
- if @settings.lockpick_ignore_difficulty
- disarm_speed?(box, 'careful')
- else
- false
- end
- end
- end
- def check_danger
- pause 0.5 while stunned?
- return unless bleeding? || checkpoison
- snapshot = Room.current.id
- wait_for_script_to_complete('safe-room')
- walk_to(snapshot)
- end
- def disarm_speed?(box, speed)
- waitrt?
- echo "disarm_speed?(#{box}, #{speed})" if UserVars.lockpick_debug
- Flags.reset('disarm-more')
- case bput("disarm my #{box} #{speed}", @disarm_failed, @disarm_retry, 'Roundtime')
- when *@disarm_failed
- beep
- beep
- echo('**SPRUNG TRAP**')
- check_danger
- return false
- when *@disarm_retry
- new_speed = reget(10, 'something to shift') ? 'careful' : speed
- return disarm_speed?(box, new_speed)
- end
- pause 1
- waitrt?
- result = true
- analyze(box) if @settings.harvest_traps
- result = disarm?(box) if Flags['disarm-more']
- result
- end
- def analyze(box)
- waitrt?
- case bput("disarm my #{box} analyze", /You've already analyzed/, /You are unable to determine a proper method/, 'Roundtime')
- when /You are unable to determine a proper method/
- return analyze(box)
- end
- harvest(box)
- end
- def harvest(box)
- waitrt?
- case bput("disarm my #{box} harvest",
- /You fumble around with the trap apparatus/,
- /much for it to be successfully harvested/,
- /completely unsuitable for harvesting/,
- /previous trap have already been completely harvested/,
- 'Roundtime')
- when /You fumble around with the trap apparatus/
- harvest(box)
- when 'Roundtime'
- waitrt?
- dispose_trash(left_hand) # only dispose https://elanthipedia.play.net/Locksmithing_skill#Box_Traps items.
- while left_hand
- end
- end
- end
- end
- LockPicker.new
Advertisement
Add Comment
Please, Sign In to add comment