forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
first-aid.lic
83 lines (73 loc) · 2.83 KB
/
first-aid.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
78
79
80
81
82
83
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#first-aid
=end
custom_require.call(%w[common common-travel drinfomon equipmanager])
class FirstAid
include DRC
include DRCT
def initialize
@settings = get_settings
@chart_data = get_data('anatomy-charts').first_aid_charts
@performance_pause = @settings.performance_pause
if @settings.bleed_bot
walk_to(@settings.bleed_bot_room)
start_script('tendother', [@settings.bleed_bot])
pause 10
stop_script('tendother')
return
end
if @settings.textbook
@booktype = @settings.textbook_type
textbook_charts
else
@booktype = 'compendium'
compendium_charts
end
end
def compendium_charts
unless @settings.instrument
pause @performance_pause # to give performance time to complete before_dying if stopped from the previous script
start_script('performance', ['noclean']) unless Script.running?('performance')
end
bput('get my compendium', 'You get', 'You are already holding')
bput('look my compendium', '^The compendium lies open to the section on .* physiology')
pause
compendium_charts = reget(40).grep(/^ .+$/).map(&:strip)
charts_to_read = @chart_data.select { |name, _info| compendium_charts.include?(name) }
study_charts(charts_to_read)
end
def textbook_charts
unless @settings.instrument
pause @performance_pause # to give performance time to complete before_dying if stopped from the previous script
start_script('performance', ['noclean']) unless Script.running?('performance')
end
bput("get my #{@booktype}", 'You get', 'You are already holding')
bput("open my #{@booktype}", 'You open your', 'That is already open')
study_charts(@chart_data)
end
def study_charts(charts_to_read)
charts_to_read
.map { |_name, info| info }
.select { |info| info['scholarship'] <= DRSkill.getrank('Scholarship') }
.sort_by { |info| info['scholarship'] }
.reverse
.take(20)
.each do |info|
case bput("turn my #{@booktype} to #{info['index']}", 'You turn', 'That section does not exist', 'Turn what?')
when 'You turn'
case bput("study my #{@booktype}", 'you begin to study', 'you begin studying', 'With a sudden moment of', 'In a sudden moment of clarity', '^Why ', 'you continue to study', 'you attempt', 'you continue studying', 'You need to be holding')
when 'You need to be holding'
bput("get my #{@booktype}", 'You get', 'You are already holding')
end
waitrt?
break if DRSkill.getxp('First Aid') >= 30
end
end
end
end
before_dying do
EquipmentManager.new.empty_hands
stop_script('performance') if Script.running?('performance')
end
# Call this last to avoid the need for forward declarations
FirstAid.new