forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
almanac.lic
59 lines (50 loc) · 1.55 KB
/
almanac.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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#almanac
=end
custom_require.call(%w[common])
class Almanac
include DRC
def initialize
settings = get_settings
UserVars.almanac_last_use ||= Time.now - 600
@no_use_scripts = settings.almanac_no_use_scripts
@almanac_skills = settings.almanac_skills
passive_loop
end
def use_almanac
return if Time.now - UserVars.almanac_last_use < 600
return if @no_use_scripts.any? { |name| Script.running?(name) }
return if XMLData.room_title.include? 'Carousel Chamber'
return if hidden?
unless @almanac_skills.empty?
training_skill = @almanac_skills
.select { |skill| DRSkill.getxp(skill) < 18 }
.sort_by { |skill| DRSkill.getxp(skill) }.first
return unless training_skill
end
pause 1 until pause_all
waitrt?
bput('stow left', 'Stow what', 'You put') if checkleft
case bput('get my almanac', 'You get', 'What were', 'You are already')
when 'What were'
echo('Almanac not found, exiting.')
unpause_all
exit
end
if training_skill
bput("turn almanac to #{training_skill}", 'You turn', 'You attempt to turn')
end
bput('study my almanac', 'You set about', 'gleaned all the insight you can', 'Study what', 'interrupt your research')
waitrt?
bput('stow my almanac', 'You put', 'Stow what')
UserVars.almanac_last_use = Time.now
unpause_all
end
def passive_loop
loop do
use_almanac
pause 20
end
end
end
Almanac.new