forked from rpherbig/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
empathylink.lic
131 lines (122 loc) · 4.4 KB
/
empathylink.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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#empathylink
=end
custom_require.call(%w[common equipmanager])
class Empathylink
def initialize
if UserVars.empathylink.nil?
UserVars.empathylink = Hash.new
end
settings = get_settings
@buddies = settings.hunting_buddies
@use_hodierna = settings.has_hodierna
noheal = settings.noheal_empathylink
populate_noheal_list(noheal)
in_room = DRRoom.pcs
while true
in_room.each do |target|
if should_heal?(target)
touch(target)
end
end
pause 0.5
in_room = DRRoom.pcs
end
end
def populate_noheal_list(noheal)
### This setting is to never heal the people listed here even if on
### hunting_buddies list.
noheal.each do |no_heal|
UserVars.empathylink[no_heal] = 2496928411
end
end
def should_heal?(target)
now = Time.now.to_i
heal_time = UserVars.empathylink[target]
if heal_time.nil? or now > heal_time and Script.running?('combat-trainer')
pause 5
if DRRoom.pcs.include?(target) and @buddies.include?(target)
# echo "Should heal #{target}"
return true
end
end
# echo "Shouldn't heal #{target}"
return false
end
def touch(target)
p_script
waitrt?
case DRC.bput("touch #{target}",
"You touch",
"You lay your hand on",
"Touch what",
"I could not find",
"You rest your hand on")
when 'You touch', 'You lay your hand on', 'You rest your hand on'
if @use_hodierna == true
hodierna_heal_patient(target)
else
heal_patient(target)
end
when 'Touch what', 'I could not find'
DRC.message("Failed to establish link with #{target}")
UserVars.empathylink[target] = Time.now.to_i + 1800 # Put them on hold for 30m
end
u_script
end
def hodierna_heal_patient(target)
DRC.message("In hodierna healing patient")
case DRC.bput("link #{target} persistent",
'gradually strengthening the fragile diagnostic link',
'I could not find',
'You have not established an empathic link',
'You already have a persistent empathic link')
when 'gradually strengthening the fragile diagnostic link', 'You already have a persistent empathic link'
DRC.message("Empathically linked to #{target}.")
case DRC.bput("link #{target} hodierna",
'begins to seep through the connection',
'I could not find',
'You have not established an empathic link',
'the diagnostic link is too fragile')
when 'begins to seep through the connection'
DRC.message("Established link of Hodierna with #{target}")
UserVars.empathylink[target] = Time.now.to_i + 1800 # Put them on hold for 30m
else
DRC.message("Failed to establish link Hodierna with #{target}")
UserVars.empathylink[target] = Time.now.to_i + 300 # Put them on hold for 5m
end
else
DRC.message("Failing to establish Link Persistent with #{target}")
UserVars.empathylink[target] = Time.now.to_i + 300 # Put them on hold for 5m
end
# u_script
end
def heal_patient(target)
DRC.message("In healing patient")
case DRC.bput("transfer #{target} all",
'You feel the transfer beginning',
'What do you want to get',
'You have not established an empathic link',
'You already have',
'You sense that you already have such a connection',
'is not wounded in that location')
when 'You feel the transfer beginning'
DRC.message("Established healing with #{target}")
UserVars.empathylink[target] = Time.now.to_i + 300 # Put them on hold for 5m
when 'is not wounded in that location'
DRC.message("No wounds on #{target}")
UserVars.empathylink[target] = Time.now.to_i + 300 # Put them on hold for 5m
else
DRC.message("Failed to establish healing with #{target}")
UserVars.empathylink[target] = Time.now.to_i + 1800 # Put them on hold for 30m
end
# u_script
end
def p_script
pause_script('combat-trainer') if Script.running?('combat-trainer')
end
def u_script
unpause_script('combat-trainer') if Script.running?('combat-trainer')
end
end
Empathylink.new