forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheal-remedy.lic
More file actions
122 lines (111 loc) · 3.47 KB
/
heal-remedy.lic
File metadata and controls
122 lines (111 loc) · 3.47 KB
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
# 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 }
]
]
args = parse_args(arg_definitions)
$debug_mode_hr = args.debug
$remedies = get_data('remedies')
def wounds
wounds = DRCH.check_health['wounds']
pause 1
echo wounds if $debug_mode_hr
hurt = wounds.select { |level, _| level >= 4 }.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
apply_wounds(key)
end
pause 180 # 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
apply_scars(key)
end
end
def 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 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}! ***")
DRC.bput('Trying general scar remedies.')
apply_general_scar('general')
end
end
end
def 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.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 loop_debug
echo('In apply loop') if $debug_mode_hr
end
wounds