/
sanowret-crystal.lic
77 lines (68 loc) · 3.26 KB
/
sanowret-crystal.lic
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
=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)
@no_use_scripts = get_settings.sanowret_no_use_scripts
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 && @worn_crystal
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?
return if @no_use_scripts.any? { |name| Script.running?(name) }
return if @invalid_rooms.include?(Room.current.id)
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.', 'Not here, ', 'a wave of Corruption magic')
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')
when /Not here, /, /a wave of Corruption magic/
echo "Pausing #{Script.current.name} script until you move"
non_sano_room_id = Room.current.id
pause 1 until Room.current.id != non_sano_room_id
else
echo 'Sanowret crystal not found, exiting'
exit
end
end
end
def passive
loop do
check_crystal
pause 10
end
end
end
SanowretCrystal.new