forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathheal-remedy.lic
190 lines (176 loc) · 6.24 KB
/
heal-remedy.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# quiet
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#heal-remedy
=end
custom_require.call(%w[common common-healing common-items])
arg_definitions = [
[
{ name: 'debug', regex: /debug/i, optional: true },
{ name: 'nohands', regex: /nohands/i, optional: true, description: 'Skip herbs which must be held to use' },
{ name: 'noscars', regex: /noscars/i, optional: true, description: 'Skip scar healing herbs' },
{ name: 'quick', regex: /quick/i, optional: true, description: 'Skip delay between wound and scar herbs' },
{ name: 'level', regex: /\d+/i, optional: true, description: 'Healing level desired.' }
]
]
args = parse_args(arg_definitions)
$debug_mode_hr = args.debug
$nohands_mode = args.nohands
$noscars_mode = args.noscars
$quick_mode = args.quick
$heal_level = if args.level
args.level.to_i
else
0
end
@settings = get_settings
$remedies = get_data('remedies') unless @settings.herbs
$remedies = get_data('herbs') if @settings.herbs
@wounds_applied = FALSE
def wounds
wounds = DRCH.check_health['wounds']
pause 1
echo wounds if $debug_mode_hr
hurt = wounds.select { |level, _| level >= $heal_level }.values.flatten
wound_grouping = { 'right arm' => 'limbs', 'left arm' => 'limbs', 'left leg' => 'limbs', 'right leg' => 'limbs', 'right hand' => 'limbs', 'left hand' => 'limbs', 'right eye' => 'eyes', 'left eye' => 'eyes' }
scar_grouping = { 'right arm' => 'limbs', 'left arm' => 'limbs', 'left leg' => 'limbs', 'right leg' => 'limbs', 'right hand' => 'limbs', 'left hand' => 'limbs', 'head' => 'face', 'neck' => 'face', 'eyes' => 'face', 'chest' => 'body', 'abdomen' => 'body', 'back' => 'body' }
hurt = hurt.map { |raw| wound_grouping[raw] || raw }.uniq
scar = hurt.map { |raw| scar_grouping[raw] || raw }.uniq
if $debug_mode_hr
echo 'Wounds: '
hurt.each do |key|
echo key
end
echo
echo 'Scars: '
scar.each do |key|
echo key
end
end
hurt.each do |key|
echo key if $debug_mode_hr
echo('In hurt loop') if $debug_mode_hr
remedy_apply_wounds(key) unless @settings.herbs
herb_apply_wounds(key) if @settings.herbs
end
return unless @wounds_applied
pause 180 unless $quick_mode # pause 3 minutes before using scar remedies
scar.each do |key|
echo key if $debug_mode_hr
echo('In scar loop') if $debug_mode_hr
remedy_apply_scars(key) unless @settings.herbs
herb_apply_scars(key) if @settings.herbs
end
end
def remedy_apply_wounds(key)
echo("In apply_wounds function and key is #{key}") if $debug_mode_hr
rem_wounds = $remedies['remedies']['external'][key]
echo(rem_wounds) if $debug_mode_hr
rem_wounds.each do |key|
loop_debug
if DRCI.exists?(key)
DRC.bput("get #{key}", 'You get')
case key
when /salve/, /ungent/, /poultices/, /ointment/
DRC.bput("rub #{key}", 'You')
when /potion/, /tonic/, /elixir/, /draught/
DRC.bput("drink #{key}", 'You')
end
DRC.bput("stow #{key}", 'You')
else
echo("*** No more #{key}! ***")
end
end
end
def remedy_apply_scars(key)
echo("In apply_scar function and key is #{key}") if $debug_mode_hr
rem_scars = $remedies['remedies']['scars'][key]
echo(rem_scars) if $debug_mode_hr
rem_scars.each do |key|
loop_debug
if DRCI.exists?(key)
DRC.bput("get #{key}", 'You get')
case key
when /salve/, /ungent/, /poultices/, /ointment/
DRC.bput("rub #{key}", 'You')
when /potion/, /tonic/, /elixir/, /draught/
DRC.bput("drink #{key}", 'You')
end
DRC.bput("stow #{key}", 'You')
else
echo("*** No more #{key}! ***")
echo('Trying general scar remedies.')
apply_general_scar('general')
end
end
end
def remedy_apply_general_scar(key)
echo("In apply_gerneral_scar function and key is #{key}") if $debug_mode_hr
rem_scars_general = $remedies['remedies']['scars'][key]
echo(rem_scars_general) if $debug_mode_hr
rem_scars_general.each do |key|
loop_debug
if DRCI.exists?(key)
DRC.bput("get #{key}", 'You get')
case key
when /salve/, /ungent/, /poultices/, /ointment/
DRC.bput("rub #{key}", 'You')
when /potion/, /tonic/, /elixir/, /draught/
DRC.bput("drink #{key}", 'You')
end
DRC.bput("stow #{key}", 'You')
@wounds_applied = TRUE
else
echo("*** No more #{key}! ***")
end
end
end
def herb_apply_wounds(key)
echo("In apply_wounds function and key is #{key}") if $debug_mode_hr
rem_wounds = $remedies['remedies']['external'][key]
echo(rem_wounds) if $debug_mode_hr
rem_wounds.each do |key|
loop_debug
case key
when /salve/, /sap/
DRC.bput("get #{key}", 'You get', 'referring to?') unless $nohands_mode
DRC.bput("rub my #{key}", 'You', 'Rub what?') unless $nohands_mode
DRC.bput("stow #{key}", 'You', 'Stow what?') unless $nohands_mode
@wounds_applied = TRUE
when /ungent/, /poultices/, /ointment/
DRC.bput("rub my #{key}", 'You', 'Rub what?')
@wounds_applied = TRUE
when /potion/, /tonic/, /elixir/, /draught/
DRC.bput("drink my #{key}", 'You', 'Drink what?')
@wounds_applied = TRUE
when /flower/, /root/, /leaf/, /grass/
DRC.bput("eat my #{key}", 'You', 'you referring to?')
@wounds_applied = TRUE
end
end
end
def herb_apply_scars(key)
echo("In apply_scar function and key is #{key}") if $debug_mode_hr
rem_scars = $remedies['remedies']['scars'][key]
echo(rem_scars) if $debug_mode_hr
rem_scars.each do |key|
loop_debug
case key
when /genich/
DRC.bput("get #{key}", 'You get', 'referring to?') unless $nohands_mode
DRC.bput("inhale my #{key}", 'You') unless $nohands_mode
DRC.bput("stow #{key}", 'You', 'Stow what?') unless $nohands_mode
when /salve/, /ungent/, /poultices/, /ointment/, /sap/
DRC.bput("rub my #{key}", 'You', 'Rub what?')
when /tonic/, /draught/, /qun/
DRC.bput("drink my #{key}", 'You', 'Drink what?')
when /potion/
DRC.bput("eat my #{key}", 'You', 'you referring to?')
when /flower/, /root/, /leaf/, /grass/, /potion/, /nuloe/, /elixir/, /jadice/
DRC.bput("eat my #{key}", 'You', 'you referring to?')
end
end
end
def loop_debug
echo('In apply loop') if $debug_mode_hr
end
wounds