Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =begin
- Documentation: https://elanthipedia.play.net/Lich_script_repository#sanowret-crystal
- =end
- custom_require.call(%w[common drinfomon])
- class SanowretCrystal
- def initialize
- arg_definitions = [
- [
- { name: 'run', regex: /run/i, description: 'Single run of the script', optional: true }
- ]
- ]
- @invalid_rooms = []
- @worn_crystal = false
- args = parse_args(arg_definitions)
- check_crystal if args.run && !hiding? && !invisible?
- passive unless args.run
- end
- def use_crystal
- return if @invalid_rooms.include?(Room.current.id)
- return if hiding? || invisible?
- if DRSkill.getxp('Arcana') <= 10
- response = DRC.bput('gaze my sanowret crystal', /A soft light blossoms in the very center of the crystal, and begins to fill your mind with the knowledge of .*\./, 'However, nothing much else happens, as you lack the concentration to focus.', 'This is not a good place for that.', 'However, you realize that you\'re already gleaning knowledge from it.', 'That would be difficult to do while you attempt to keep the trail in sight.')
- elsif DRSkill.getxp('Arcana') <= 25
- response = DRC.bput('exhale my sanowret crystal', 'you come away from the experience with a further understanding of Arcana as the scintillating lights fade again.', 'However, nothing much else happens, as you lack the concentration to focus.', 'This is not a good place for that.', 'Doing that would give away your hiding place.', 'That would be difficult to do while you attempt to keep the trail in sight.')
- end
- return if response !~ /This is not a good place for that\./
- return if @invalid_rooms.include?(Room.current.id)
- @invalid_rooms.push(Room.current.id)
- end
- def check_crystal
- return if DRStats.concentration < 100
- return if DRSkill.getxp('Arcana') >= 25
- return if hiding? || invisible?
- if @worn_crystal
- use_crystal
- else
- case DRC.bput('tap my sanowret crystal', /^You tap a .*sanowret crystal inside your .*.$/, /^You tap a .*sanowret crystal.* that you are wearing.$/, /^You tap a .*sanowret crystal that you are holding.$/, 'I could not find what you were referring to.')
- when /You tap a .*sanowret crystal inside your/
- DRC.bput('get my sanowret crystal', 'You get', 'What were you referring to')
- use_crystal
- DRC.bput('stow my sanowret crystal', 'You put', 'Stow what')
- when /^You tap a .*sanowret crystal.* that you are wearing\.$/
- @worn_crystal = true
- use_crystal
- when /^You tap a .*sanowret crystal that you are holding\.$/
- use_crystal
- DRC.bput('stow my sanowret crystal', 'You put', 'Stow what')
- else
- echo 'Sanowret crystal not found.'
- end
- end
- end
- def passive
- loop do
- next if @invalid_rooms.include?(Room.current.id)
- check_crystal
- pause 10
- end
- end
- end
- SanowretCrystal.new
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement