forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
first-aid.lic
119 lines (108 loc) · 3.95 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#first-aid
Advanced Options: https://github.com/rpherbig/dr-scripts/wiki/First-Aid-Strategy
=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
@num_charts = @settings.number_of_firstaid_charts
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 = @settings.compendium_type
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 #{@booktype}", 'You get', 'You are already holding')
bput("look my #{@booktype}", "^The #{@booktype} 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'] <= effective_scholarship }
.sort_by { |info| info['scholarship'] }
.reverse
.take(@num_charts)
.each do |info|
case bput("turn my #{@booktype} to #{info['index']}", 'You turn', 'That section does not exist', 'Turn what?','almost impossible to do')
when 'You turn'
case bput("study my #{@booktype}", 'You attempt to study', 'find it almost impossible to do', 'gradually absorbing', 'difficult time comprehending the advanced text', 'suddenly makes sense to you', '^Why ', 'You need to be holding', 'discerned all you can')
when 'gradually absorbing'
3.times{ message = bput("study my #{@booktype}", /Roundtime/, /makes sense/, /discerned all you can/ ); break if message == 'makes sense' || 'discerned all you can'}
when 'You need to be holding'
bput("get my #{@booktype}", 'You get', 'You are already holding')
end
waitrt?
break if DRSkill.getxp('First Aid') >= 32
end
end
end
def effective_scholarship
if @settings.firstaid_scholarship_modifier
skill = DRSkill.getrank('Scholarship') - @settings.firstaid_scholarship_modifier
else
skill = DRSkill.getrank('Scholarship')
case
when skill <= 100
skill
when skill <= 150
skill - 30
when skill <= 200
skill - 50
when skill <= 400
skill - 100
when skill <= 600
skill - 150
when skill <= 800
skill - 230
when skill <= 1000
skill - 350
when skill <= 1100
skill - 400
when skill <= 1200
skill - 450
when skill <= 1300
skill - 500
when skill > 1301
skill - 650
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