-
Notifications
You must be signed in to change notification settings - Fork 3
/
fixit.lic
128 lines (107 loc) · 3.8 KB
/
fixit.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
=begin
Attempts to automatically fix common Lich issues. Currently performed steps (in order) are:
- Restarting Infomon
- Doing ;magic reset, SPELL ACTIVE, SKILL FULL, and INFO
- Loading and possibly downloading the map database if it is not already downloaded
If this actually downloads the map database, it will be set to auto-update as well.
- Restarting Uberbar, Uberbounty and invdb (and their variants) if they are running.
author: LostRanger ([email protected])
game: any
tags: utility
required: Lich >= 4.6.0.
version: 0.2 (2019-11-19)
changelog:
version 0.2 (2019-11-19)
Wait for Infomon to no longer be running before we attempt to restart it in order to reduce the likelihood of
Schroedinger's Infomon (both alive and dead)
version 0.1 (2019-11-08)
Initial release.
=end
script.want_downstream = false
script.want_downstream_xml = true
clear
def quiet_command(command, start_pattern, end_pattern = /<prompt/, include_end = true, timeout=5)
result = []
name = 'fixit_reduces_screen_scroll'
filter = false
begin
Timeout::timeout(timeout, Interrupt) {
DownstreamHook.add(name, proc {|xml|
if filter
if xml =~ end_pattern
DownstreamHook.remove(name)
filter = false
# result << xml.rstrip if include_end
# thread.raise(Interrupt)
# next(include_end ? nil : xml)
else
# result << xml.rstrip
next(nil)
end
elsif xml =~ start_pattern
filter = true
# result << xml.rstrip
next(nil)
else
xml
end
})
fput command
until (xml = get) =~ start_pattern; end
result << xml.rstrip
until (xml = get) =~ end_pattern
result << xml.rstrip
end
if include_end
result << xml.rstrip
end
}
rescue Interrupt
nil
end
return result
end
unless Script.running?("infomon")
echo "Infomon was not running, which was probably your issue. Starting it."
else
echo "Restarting Infomon..."
Script.kill("infomon")
wait_while{Script.running?("infomon")}
end
Script.start("infomon")
wait_until{Script.running?("infomon")}
while spell = Spell.active.last
spell.putdown
end
Spell.active.clear
echo "Making sure Infomon's information is up to date."
['spell active', 'skill full', 'info'].each do |cmd|
quiet_command(cmd, /<output class="mono"|your current skill bonuses and ranks \(including all modifiers\) are:/)
end
unless Map.class_variable_get(:@@loaded)
echo "Your map database does not appear to be loaded. Attempting to load it."
unless Map.load
echo "Failed to load the map database. Attempting to download it."
Script.run("repository", "download-mapdb")
Script.run("repository", "set-mapdb-updatable")
end
end
# Restart some other scripts
scripts_to_restart = []
Script.list.each do |scr|
n = scr.name
if n =~ /^uberbar|^uberbounty|^invdb$/i
scripts_to_restart << n
end
end
if scripts_to_restart.length > 0
# Uberspells creates scroll when it restarts, which we don't like.
echo "Restarting script(s): #{scripts_to_restart.join(', ')}"
scripts_to_restart.each{|n| Script.kill(n) }
scripts_to_restart.each{|n| wait_while{Script.running?(n)}}
scripts_to_restart.each{|n| Script.start(n)}
end
sleep 1.0
echo "I tried a few things! Hopefully that fixes whatever your problem was."
echo "If it did not, you may find ;version helpful when reporting your issue."
exit