forked from matt-lowe/lich-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshort-haste-message.lic
More file actions
52 lines (42 loc) · 1.17 KB
/
short-haste-message.lic
File metadata and controls
52 lines (42 loc) · 1.17 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
=begin
Simple script to change these game lines:
Roundtime: # sec.
Roundtime changed to # seconds.
into this line:
Roundtime: # sec. (originally # sec.)
author: Tillmen (tillmen@lichproject.org
game: Gemstone
tags: cosmetic
version: 0.1
=end
script.hidden = true
rt_string = nil
orig_rt = nil
hook_proc = proc { |server_string|
if server_string =~ /^Cast Roundtime 3 Seconds\.\r?\n?$|^\[Spell Hindrance|^<a exist="spell" noun="spell">Your spell is ready\.<\/a>/
nil
elsif rt_string.nil?
if (server_string =~ /^(?:<.+>)?Roundtime\: ([0-9]+) sec\./) and (XMLData.active_spells['Haste'] or XMLData.active_spells['506'])
orig_rt = $1
rt_string = server_string
nil
else
server_string
end
else
if server_string =~ /^Roundtime changed to ([0-9]+) seconds?\./
new_rt = $1
new_server_string = rt_string.sub("Roundtime: #{orig_rt} sec.", "Roundtime: #{new_rt} sec. (originally #{orig_rt} sec.)")
else
new_server_string = rt_string.concat(server_string)
end
rt_string = nil
new_server_string
end
}
begin
DownstreamHook.add('short_haste_message', hook_proc)
loop { sleep 1 }
ensure
DownstreamHook.remove('short_haste_message')
end