-
Notifications
You must be signed in to change notification settings - Fork 3
/
fxegdig.lic
201 lines (179 loc) · 5.77 KB
/
fxegdig.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
=begin
This is an unsupported overhauled fork of Taleph's egdig script. See ;repo info egdig for details.
Set your lootsack (;vars set lootsack=cloak) and buy your own shovels.
Noteworthy changes:
* Redeems seashells rather than bundling or bucketing them
* Pauses itself every ~7.5 minutes rather than every 10 digs (and is resumed by unpausing rather than typing 'yes')
* Uses _drag rather than empty to empty boxes out to save 3 seconds of RT per find.
* Uses typeahead judiciously to save some time per find.
* Spams dig when 1s of RT is remaining to save a little bit of time per find.
author: LostRanger ([email protected])
game: any
tags: utility
required: Lich >= 4.6.0.
version: 3.6.2.4
(derived from Taleph's version 3.6.2)
Changelog:
version 3.6.2.4 (2019-10-16)
* Now works in the digging room where the trash receptacle is a crevice rather than a hole.
version 3.6.2.3 (2019-10-16)
* Possibly Ordim-approved.
version 3.6.2.2 (2019-10-16)
* Now supports SET SORTEDVIEW ON
version 3.6.2.1 (2019-10-16)
* Clear our input buffer before digging so we don't get out of sync
* Use MY SHOVEL instead of just SHOVEL.
version 3.6.2.0 (2019-10-15)
* First release
=end
module XEGDig
def self.find_sacks(base = 'lootsack')
# Adapted from ;loot
sacks = []
ix = nil
while true
var = "#{base}#{ix}"
ix = 1 if ix.nil?
ix += 1
name = Vars[var].strip
return sacks unless name.length > 0
if name =~ /^my\s+(.*)$/i
name = $1
end
pattern = Regexp::escape(name)
sack = nil
[ /\b#{pattern}$/i, /\b#{pattern.sub(' ', '.*')}$/i, /\b#{pattern.sub(' ', '.*')}/i ].each{|pattern|
sack = GameObj.inv.find {|obj| obj.name =~ pattern }
break if sack
}
if sack
sacks << sack
else
echo "warning: failed to find #{var} '#{name}'"
end
end
end
def self.run(script)
@script = script
sacks = self.find_sacks
unless sacks.length > 0
echo "No lootsacks found!"
exit
end
@lootsack = sacks[0]
timeout = Time.now + 450
while self.dig
item_found = GameObj.left_hand
noun = item_found.noun
if noun == "box" or noun == "trunk" or noun == "chest" or noun == "coffer" or noun == "strongbox" or noun == "crate"
self.open_it(item_found)
elsif noun == 'coffin' or noun == 'casket' or noun == 'sarcophagus'
loop { #just making sure the lid comes off
fput "pry ##{item_found}.id"
test = matchtimeout 5, "With the lid loosened, you", "You begin"
waitrt?
words = test.split(' ')
if words[2] == "lid"
break
end
}
echo "ding ding ding ding dingding ding ding ding dingding ding ding ding ding!"
echo "ding ding ding ding dingding ding ding ding dingding ding ding ding ding!"
echo "ding ding ding ding dingding ding ding ding dingding ding ding ding ding!"
echo "likely jackpot...pausing script"
pause_script
else
fput "stow left"
end
if timeout < Time.now
echo "Master, it's been a few minutes...are you still wake? If so, unpause the script"
echo "Master, it's been a few minutes...are you still wake? If so, unpause the script"
echo "Master, it's been a few minutes...are you still wake? If so, unpause the script"
echo "Master, it's been a few minutes...are you still wake? If so, unpause the script"
pause_script
timeout = Time.now + 450
end
end
end
def self.dig
fput "get my shovel"
test = matchwait "You remove", "You already", "Get what", "Hey, that", "You grab", "Slowly, the shovel charm begins to enlarge in your hand"
exit unless test =~ /^You\b|\benlarge\b/
while true
rt = XMLData.roundtime_end.to_f - Time.now.to_f + XMLData.server_time_offset.to_f - 0.5
sleep rt if rt > 0
while true
clear
put "dig"
nil until (line = get) =~ /^You continue|^You hit|^You begin|^\.\.\.wait (\d+) seconds?\./
break unless $1
time_to_wait = $1.to_i
if time_to_wait > 1
sleep time_to_wait - 1
else
sleep 0.2
end
end
if line =~ /\bhit\b/
#
# clear
#
# clear
# waitrt?
# fput "dig"
# test = matchtimeout 11, "You continue", "You hit", "You begin"
# if test =~ /\bhit\b/
waitrt?
fput "stow my shovel" if GameObj.right_hand.noun == "shovel"
return true
end
end
end
def self.open_it(item_found)
item_found = item_found.id
fput "open ##{item_found}"
opened = matchtimeout 5, "locking the hinges", "You open the lid", "You lift the lid", "which begins to glow"
if opened =~ /locking the hinges in place|which begins to glow/
echo "ding ding ding ding ding ding ding!"
echo "ding ding ding ding ding ding ding!"
echo "ding ding ding ding ding ding ding!"
echo "ding ding ding ding ding ding ding!"
echo "a T5 or better! Script is paused. Unpause by typing ;u"
pause_script
end
# put "loot ##{item_found}"
put "look in ##{item_found}"
# In case it didn't clear earlier for whatever reason
fput "stow my shovel" if GameObj.right_hand.noun == "shovel"
put "get seashells from ##{item_found}"
put "redeem seashells"
nil until get =~ /^In the .* you see |^In the .*:|^There is nothing in the/
coins = nil
GameObj.containers[item_found].each do |item|
if item.noun == 'coins'
coins = item.id
elsif item.noun == 'seashells'
# put "get ##{item.id}"
# put "redeem ##{item.id}"
else
put "_drag ##{item.id} ##{@lootsack.id}"
end
end
if coins
fput "get ##{coins}"
end
fput "look in ##{item_found}"
nil until get =~ /^There is nothing in the|^In the (.*) you see /
if $1
echo "something's not coming out. Come look!"
pause_script
end
waitrt?
if GameObj.loot.find{|x| x.noun == 'crevice'}
fput "put ##{item_found} in crevice"
else
fput "put ##{item_found} in hole"
end
end
end
XEGDig.run(script)