Olib 2.0.0.pre.rc.6 → 2.0.0.pre.rc.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/Olib/bounty.rb +5 -46
- data/lib/Olib/combat/metadata.rb +4 -0
- data/lib/Olib/core/transaction.rb +10 -6
- data/lib/Olib/ext/matchdata.rb +1 -1
- data/lib/Olib/ext/string.rb +1 -1
- data/lib/Olib/go2.rb +14 -5
- data/lib/Olib/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b6389e96091c8dc8e79ea4bb25b9c30805c91d47f09addab1a1e2075976a9dc
|
4
|
+
data.tar.gz: 6008e2a6431503d0c72b17c7ec5e27a940ae7a2a4d4af807f6c11670f346794f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b19fd1ecffec4ddd4a0e8a587b8db4ccb9089c28ffc1d74c4bab90626a2e43e52efcdec7c2abbb8ae943331d7b5c3deac78e1a2674cfdd47dd6f6410294a0fdf
|
7
|
+
data.tar.gz: bf7d1ddb8a5d621f5a9c98656127a051c93842942c0079d061d415fbefd937450e57866ece27d978652af98881ba620b599575b65735aab76f5daf732d0a0b00
|
data/lib/Olib/bounty.rb
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
require "ostruct"
|
2
2
|
|
3
3
|
class Bounty
|
4
|
-
NPCS = /guard|sergeant|Felinium|clerk|purser|taskmaster|gemcutter|jeweler|akrash|kris|Ghaerdish|Furryback|healer|dealer|Ragnoz|Maraene|Kelph|Areacne|Jhiseth|Gaedrein/i
|
4
|
+
NPCS = /guard|sergeant|Luthrek|Felinium|clerk|purser|taskmaster|gemcutter|jeweler|akrash|kris|Ghaerdish|Furryback|healer|dealer|Ragnoz|Maraene|Kelph|Areacne|Jhiseth|Gaedrein/i
|
5
5
|
HERBALIST_AREAS = /illistim|vaalor|legendary rest|solhaven/i
|
6
|
-
|
6
|
+
|
7
7
|
# this should be refactored to use CONST
|
8
8
|
REGEX = OpenStruct.new(
|
9
9
|
creature_problem: /"Hmm, I've got a task here from (?<town>.*?)\. It appears they have a creature problem they\'d like you to solve/,
|
10
10
|
report_to_guard: /^You succeeded in your task and should report back to/,
|
11
11
|
get_skin_bounty: /The local furrier/,
|
12
|
-
heirloom_found: /^You have located
|
12
|
+
heirloom_found: /^You have located (?:a|an|some) (?<heirloom>.*?) and should bring it back to one of the (?<town>.*?) gate guards\./,
|
13
13
|
cooldown: /^You are not currently assigned a task. You will be eligible for new task assignment in about (?<minutes>.*?) minute(s)./,
|
14
14
|
|
15
15
|
dangerous: /You have been tasked to hunt down and kill a particularly dangerous (?<creature>.*) that has established a territory (?:in|on) (?:the )?(?<area>.*?)(?: near| between| under|\.)/,
|
@@ -27,14 +27,14 @@ class Bounty
|
|
27
27
|
escort: /Go to the (.*?) and WAIT for (?:him|her|them) to meet you there. You must guarantee (?:his|her|their) safety to (?<destination>.*?) as soon as/,
|
28
28
|
gem: /The gem dealer in (?<town>.*?), (?<npc>.*?), has received orders from multiple customers requesting (?:a|an|some) (?<gem>[a-zA-Z '-]+). You have been tasked to retrieve (?<number>[0-9]+)/,
|
29
29
|
cull: /^You have been tasked to suppress (?<creature>(?!bandit).*) activity (?:in|on|around) (?<area>.*?)(| (near|between) (?<realm>.*?)). You need to kill (?<number>[0-9]+)/,
|
30
|
-
bandits: /^You have been tasked to suppress bandit activity (?:in|on|around) (?<area>.*?) (?:near|between|under) (?<realm>.*?). You need to kill (?<number>[0-9]+)/,
|
30
|
+
bandits: /^You have been tasked to suppress bandit activity (?:in|on|around|near) (?<area>.*?) (?:near|between|under) (?<realm>.*?). You need to kill (?<number>[0-9]+)/,
|
31
31
|
|
32
32
|
rescue: /A local divinist has had visions of the child fleeing from (?:a|an) (?<creature>.*) (?:in|on) (?:the )?(?<area>.*?)(?: near| between| under|\.)/,
|
33
33
|
failed: /You have failed in your task/,
|
34
34
|
none: /You are not currently assigned a task/,
|
35
35
|
skin: /^You have been tasked to retrieve (?<number>\d+) (?<skin>.*?) of at least (?<quality>.*?) quality for (?<buyer>.*?) in (?<realm>.*?)\.\s+You can SKIN them off the corpse of (a|an|some) (?<creature>.*?) or/,
|
36
36
|
|
37
|
-
help_bandits: /You have been tasked to help (?<partner>.*?) suppress bandit activity (?:in|on|around) (?<area>.*?) (?:near|between|under) (?<realm>.*?). You need to kill (?<number>[0-9]+)/,
|
37
|
+
help_bandits: /You have been tasked to help (?<partner>.*?) suppress bandit activity (?:in|on|around|near) (?<area>.*?) (?:near|between|under) (?<realm>.*?). You need to kill (?<number>[0-9]+)/,
|
38
38
|
help_creatures: /You have been tasked to help (?<partner>.*?) kill a dangerous creature by suppressing (?<creature>.*) activity (?:in|on|around|near) (?<area>.*?) (?:near|between|under) (?<realm>.*?) during the hunt. You need to kill (?<number>[0-9]+)/,
|
39
39
|
help_cull: /You have been tasked to help (?<partner>.*?) suppress (?<creature>.*) activity (?:in|on|around|near) (?<area>.*?) (?:near|between|under) (?<realm>.*?). You need to kill (?<number>[0-9]+)/,
|
40
40
|
)
|
@@ -142,15 +142,6 @@ class Bounty
|
|
142
142
|
Bounty
|
143
143
|
end
|
144
144
|
|
145
|
-
def Bounty.on(namespace, &block)
|
146
|
-
@@listeners[namespace] = block
|
147
|
-
Bounty
|
148
|
-
end
|
149
|
-
|
150
|
-
def Bounty.listeners
|
151
|
-
@@listeners
|
152
|
-
end
|
153
|
-
|
154
145
|
def Bounty.cooldown?
|
155
146
|
not XMLData.active_spells["Next Bounty"].nil?
|
156
147
|
end
|
@@ -163,38 +154,6 @@ class Bounty
|
|
163
154
|
Bounty
|
164
155
|
end
|
165
156
|
|
166
|
-
def Bounty.throw_missing_listener
|
167
|
-
msg = "\n"
|
168
|
-
msg.concat "\nBounty.dispatch called for `:#{Bounty.type}` without a defined listener\n\n"
|
169
|
-
msg.concat "define a listener with:\n"
|
170
|
-
msg.concat " \n"
|
171
|
-
msg.concat " Bounty.on(:#{Bounty.type}) {\n"
|
172
|
-
msg.concat " # do something\n"
|
173
|
-
msg.concat " }\n"
|
174
|
-
msg.concat " \n"
|
175
|
-
msg.concat "or rescue this error (Errors::Fatal) gracefully\n"
|
176
|
-
msg.concat " \n"
|
177
|
-
raise Errors::Fatal.new msg
|
178
|
-
end
|
179
|
-
|
180
|
-
def Bounty.dispatch(listener=nil)
|
181
|
-
if listener
|
182
|
-
if @@listeners[listener]
|
183
|
-
@@listeners[listener].call
|
184
|
-
return Bounty
|
185
|
-
else
|
186
|
-
Bounty.throw_missing_listener
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
if @@listeners[Bounty.type]
|
191
|
-
@@listeners[Bounty.type].call
|
192
|
-
return Bounty
|
193
|
-
else
|
194
|
-
Bounty.throw_missing_listener
|
195
|
-
end
|
196
|
-
end
|
197
|
-
|
198
157
|
def Bounty.find_guard
|
199
158
|
Go2.advguard
|
200
159
|
if Bounty.npc.nil? then Go2.advguard2 end
|
data/lib/Olib/combat/metadata.rb
CHANGED
@@ -6,14 +6,14 @@ class Transaction < Exist
|
|
6
6
|
close: Regexp.union(
|
7
7
|
%r[I already appraised that],
|
8
8
|
%r[Sorry, #{Char.name}, I'm not buying anything this valuable today\.],
|
9
|
-
%r[(I'll give you|How's|I'll offer you|worth at least) (?<value
|
10
|
-
%r[(?<value
|
9
|
+
%r[(I'll give you|How's|I'll offer you|worth at least) (?<value>[,\d]+)],
|
10
|
+
%r[(?<value>[,\d]+) silvers])
|
11
11
|
)
|
12
12
|
|
13
13
|
Sell = Rill.new(
|
14
14
|
start: %[You offer|You ask (?<merchant>.*?) if (he|she) would like to buy (?:a |an |)<a exist="{{id}}"],
|
15
15
|
close: Regexp.union(
|
16
|
-
%r[(hands you|for) (?<value
|
16
|
+
%r[(hands you|for) (?<value>[,\d]+)],
|
17
17
|
%r[No #{Char.name}, I won't buy that],
|
18
18
|
%r[I'm sorry, #{Char.name}, but I have no use for that\.],
|
19
19
|
%r[He hands it back to you],
|
@@ -39,10 +39,11 @@ class Transaction < Exist
|
|
39
39
|
take
|
40
40
|
(_, match, lines) = Appraise.capture(self.to_h,
|
41
41
|
"appraise \#{{id}}")
|
42
|
-
if lines.any? {|line| line.include?(%[Sorry,
|
42
|
+
if lines.any? {|line| line.include?(%[Sorry, #{Char.name}, I'm not buying anything this valuable today.])}
|
43
43
|
@value = Float::INFINITY
|
44
44
|
else
|
45
|
-
|
45
|
+
Log.out(match[:value])
|
46
|
+
@value = match[:value].delete(",").to_i
|
46
47
|
end
|
47
48
|
self
|
48
49
|
end
|
@@ -58,7 +59,10 @@ class Transaction < Exist
|
|
58
59
|
(_, match, _lines) = Sell.capture(self.to_h,
|
59
60
|
"sell \#{{id}}")
|
60
61
|
|
61
|
-
|
62
|
+
if match[:value].is_a?(String) && match[:value] =~ /[\d,]+/
|
63
|
+
match[:value] = match[:value].delete(",").to_i
|
64
|
+
end
|
65
|
+
|
62
66
|
match[:value] = 0 unless match[:value].is_a?(Integer)
|
63
67
|
Ok[**match]
|
64
68
|
end
|
data/lib/Olib/ext/matchdata.rb
CHANGED
data/lib/Olib/ext/string.rb
CHANGED
data/lib/Olib/go2.rb
CHANGED
@@ -29,23 +29,32 @@ class Go2
|
|
29
29
|
Go2.define_singleton_method(tag.methodize) do Go2.room(tag) end
|
30
30
|
end
|
31
31
|
|
32
|
-
def Go2.
|
33
|
-
|
32
|
+
def Go2.run(target)
|
33
|
+
Script.run "go2", ("%s _disable_confirm_" % target)
|
34
|
+
end
|
35
|
+
|
36
|
+
def Go2.room(target)
|
37
|
+
starting_room = Room.current.id
|
38
|
+
unless Room.current.id == target || Room.current.tags.include?(target)
|
34
39
|
Char.unhide if hidden
|
35
|
-
|
40
|
+
Go2.run(target)
|
41
|
+
if block_given?
|
42
|
+
yield
|
43
|
+
starting_room
|
44
|
+
end
|
36
45
|
end
|
37
46
|
Go2
|
38
47
|
end
|
39
48
|
|
40
49
|
def Go2.origin
|
41
|
-
Go2.room @@origin[:
|
50
|
+
Go2.room @@origin[:target]
|
42
51
|
Char.hide if @@origin[:hidden]
|
43
52
|
Go2
|
44
53
|
end
|
45
54
|
|
46
55
|
def Go2.rebase
|
47
56
|
@@origin = {}
|
48
|
-
@@origin[:
|
57
|
+
@@origin[:target] = Room.current.id
|
49
58
|
@@origin[:hidden] = hiding?
|
50
59
|
@@origin[:location] = Room.current.location
|
51
60
|
Go2
|
data/lib/Olib/version.rb
CHANGED