forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathalmanac.lic
68 lines (59 loc) · 1.88 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
60
61
62
63
64
65
66
67
68
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#almanac
=end
custom_require.call(%w[common common-items])
class Almanac
include DRC
include DRCI
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
@almanac = settings.almanac_noun
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 XMLData.room_title.include? 'Carousel Booth'
return if XMLData.room_title.include? 'Family Vault'
return if hidden?
return if checkleft
unless @almanac_skills.empty?
training_skill = @almanac_skills
.select { |skill| DRSkill.getxp(skill) < 18 }
.sort_by { |skill| [DRSkill.getxp(skill), DRSkill.getrank(skill)] }.first
return unless training_skill
end
pause 1 until pause_all
waitrt?
case bput("get my #{@almanac}", 'You get', 'What were', 'You are already', 'You need a free')
when 'What were'
echo('Almanac not found, exiting.')
unpause_all
exit
when 'You need a free'
unless DRCI.in_hands?(@almanac)
unpause_all
return
end
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', 'You hold out')
UserVars.almanac_last_use = Time.now
unpause_all
end
def passive_loop
loop do
use_almanac
pause 20
end
end
end
Almanac.new