-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdoctorwho.lic
53 lines (42 loc) · 1.4 KB
/
doctorwho.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
=begin
Highlights (in monsterbold, for now) when you receive healing from a player, so you can see Who your Doctor was.
author: LostRanger ([email protected])
game: Gemstone
tags: utility
required: Lich >= 4.6.0.
version: 0.2 (2019-09-17)
changelog:
version 0.2 (2019-09-17)
* No longer detects changes to HP, since that was causing too many false positives. Need to fix this later.
Only healed injuries will be highlighted.
version 0.1 (2019-09-15)
* Initial release
=end
script.want_downstream = false
script.want_downstream_xml = false
script.want_upstream = false
# In case someone forces two copies of the script, make the hook names unique.
hook = "DoctorWho::#{Time.now.to_f}"
# Need to track current HP, so we can see if it's going up or down
hp = XMLData.health
before_dying do
DownstreamHook.remove(hook)
end
active = false
DownstreamHook.add(hook, proc{|xml|
if active
if xml.include?("<prompt")
active = false
elsif xml.include?('<a exist="-')
xml = "<pushBold />#{xml}<popBold />"
end
elsif xml =~ /^<dialogData id="injuries"><image id="(\w+)" name="\1" height="0" width="0"\/>/
active = true
elsif xml =~ /<progressBar id='health' value='-?\d+' text='.*?(-?\d+)\//
new_hp = $1.to_i
# active = true if new_hp > hp
hp = new_hp
end
next xml
})
sleep