Olib 0.1.2 → 2.0.0.pre.rc.1
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 +5 -5
- data/Olib.gemspec +1 -1
- data/README.md +0 -0
- data/TODOS.md +0 -0
- data/lib/Olib.rb +6 -79
- data/lib/Olib/actor/actor.rb +0 -0
- data/lib/Olib/area.rb +22 -37
- data/lib/Olib/bounty.rb +8 -10
- data/lib/Olib/character/char.rb +64 -68
- data/lib/Olib/character/disk.rb +31 -9
- data/lib/Olib/character/group.rb +122 -40
- data/lib/Olib/character/inventory.rb +0 -0
- data/lib/Olib/character/mind.rb +0 -0
- data/lib/Olib/character/stance.rb +0 -0
- data/lib/Olib/combat/creature.rb +77 -128
- data/lib/Olib/combat/creatures.rb +52 -36
- data/lib/Olib/core/action.rb +8 -0
- data/lib/Olib/core/container.rb +32 -236
- data/lib/Olib/core/containers.rb +42 -0
- data/lib/Olib/core/errors.rb +69 -71
- data/lib/Olib/core/exist.rb +88 -0
- data/lib/Olib/core/item.rb +43 -598
- data/lib/Olib/core/kinds.rb +6 -0
- data/lib/Olib/core/rummage.rb +42 -0
- data/lib/Olib/core/transaction.rb +53 -0
- data/lib/Olib/core/use.rb +2 -5
- data/lib/Olib/core/utils.rb +25 -123
- data/lib/Olib/core/verbs.rb +304 -0
- data/lib/Olib/dictionary/dictionary.rb +150 -150
- data/lib/Olib/ext/hash.rb +7 -0
- data/lib/Olib/ext/matchdata.rb +14 -0
- data/lib/Olib/ext/string.rb +9 -0
- data/lib/Olib/ext/symbol.rb +13 -0
- data/lib/Olib/go2.rb +48 -112
- data/lib/Olib/loot.rb +44 -0
- data/lib/Olib/npcs/npc.rb +4 -0
- data/lib/Olib/npcs/npcs.rb +45 -0
- data/lib/Olib/objects/box.rb +1 -1
- data/lib/Olib/objects/clothing.rb +1 -1
- data/lib/Olib/objects/herb.rb +1 -1
- data/lib/Olib/objects/jar.rb +0 -0
- data/lib/Olib/objects/jewel.rb +7 -7
- data/lib/Olib/objects/jewelry.rb +1 -1
- data/lib/Olib/objects/scroll.rb +1 -1
- data/lib/Olib/objects/uncommon.rb +1 -1
- data/lib/Olib/objects/wand.rb +1 -1
- data/lib/Olib/pattern_matching/any.rb +11 -0
- data/lib/Olib/pattern_matching/err.rb +4 -0
- data/lib/Olib/pattern_matching/ok.rb +4 -0
- data/lib/Olib/pattern_matching/outcome.rb +35 -0
- data/lib/Olib/pattern_matching/pattern_matching.rb +5 -0
- data/lib/Olib/pattern_matching/result.rb +80 -0
- data/lib/Olib/pattern_matching/rill.rb +43 -0
- data/lib/Olib/pattern_matching/where.rb +4 -0
- data/lib/Olib/shops.rb +147 -155
- data/lib/Olib/supervisor/supervisor.rb +0 -0
- data/lib/Olib/version.rb +1 -1
- data/lib/Olib/xml.rb +43 -0
- metadata +28 -15
- data/lib/Olib/core/extender.rb +0 -29
- data/lib/Olib/interface/queryable.rb +0 -50
- data/lib/Olib/npcs.rb +0 -5
- data/lib/Olib/pattern.rb +0 -34
- data/lib/Olib/storage/app_data.rb +0 -32
- data/lib/Olib/try/try.rb +0 -58
- data/lib/Olib/utils/cli.rb +0 -81
- data/lib/Olib/utils/help_menu.rb +0 -166
- data/lib/Olib/utils/monsterbold.rb +0 -5
- data/lib/Olib/utils/vbulletin.rb +0 -101
@@ -1,168 +1,168 @@
|
|
1
1
|
require "ostruct"
|
2
2
|
|
3
|
-
module Olib
|
4
|
-
class Dictionary < OpenStruct
|
5
|
-
def Dictionary.heirloom
|
6
|
-
re = {}
|
7
|
-
re[:is] = /are the initials ([A-Z]{2})./
|
8
|
-
re[:give] = /Excellent. I'm sure the person who lost this will be quite happy/
|
9
|
-
re
|
10
|
-
end
|
11
3
|
|
12
|
-
|
13
|
-
|
14
|
-
|
4
|
+
class Dictionary < OpenStruct
|
5
|
+
def Dictionary.heirloom
|
6
|
+
re = {}
|
7
|
+
re[:is] = /are the initials ([A-Z]{2})./
|
8
|
+
re[:give] = /Excellent. I'm sure the person who lost this will be quite happy/
|
9
|
+
re
|
10
|
+
end
|
15
11
|
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
def Dictionary.tag
|
13
|
+
/<a exist="(?<id>.*?)" noun="(?<noun>.*?)">(?<name>.*?)<\/a>/
|
14
|
+
end
|
19
15
|
|
20
|
-
|
21
|
-
|
22
|
-
|
16
|
+
def Dictionary.contents
|
17
|
+
/(On|In) the (.*?) you see (?<items>.*)/
|
18
|
+
end
|
23
19
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
re[:no] = /^You can't target/
|
28
|
-
re
|
29
|
-
end
|
30
|
-
def Dictionary.bounty
|
31
|
-
re = {}
|
32
|
-
re[:herb] = /requires (?:a|an|some) ([a-zA-Z '-]+) found (?:in|on|around) ([a-zA-Z '-]+). These samples must be in pristine condition. You have been tasked to retrieve ([0-9]+)/
|
33
|
-
re[:escort] = /Go to the (.*?) and WAIT for (?:him|her|them) to meet you there. You must guarantee (?:his|her|their) safety to ([a-zA-Z '-]+) as soon as/
|
34
|
-
re[:gem] = /has received orders from multiple customers requesting (?:a|an|some) ([a-zA-Z '-]+). You have been tasked to retrieve ([0-9]+)/
|
35
|
-
re[:heirloom] = /You have been tasked to recover ([a-zA-Z '-]+) that an unfortunate citizen lost after being attacked by (a|an|some) ([a-zA-Z '-]+) (in|on|around|near|by) ([a-zA-Z '-]+)./
|
36
|
-
re[:heirloom_found] = /^You have located the heirloom and should bring it back to/
|
37
|
-
re[:turn_in] = /You have succeeded in your task and can return to the Adventurer's Guild to receive your reward/
|
38
|
-
re[:guard_turn_in] = /^You succeeded in your task and should report back to/
|
39
|
-
re[:guard_bounty] = /Go report to ([a-zA-Z ]+) to find out more/
|
40
|
-
re[:cull] = /^You have been tasked to suppress (^((?!bandit).)*$) activity (?:in|on) (?:the )? (.*?)(?: near| between| under|\.) ([a-zA-Z' ]+). You need to kill ([0-9]+)/
|
41
|
-
re[:bandits] = /^You have been tasked to suppress bandit activity (?:in |on )(?:the )(.*?)(?: near| between| under) ([a-zA-Z' ]+). You need to kill ([0-9]+)/
|
42
|
-
re[:dangerous] = /You have been tasked to hunt down and kill a particularly dangerous (.*) that has established a territory (?:in|on) (?:the )?(.*?)(?: near| between| under|\.)/
|
43
|
-
re[:get_skin_bounty] = /The local furrier/
|
44
|
-
re[:get_herb_bounty] = /local herbalist|local healer|local alchemist/
|
45
|
-
re[:get_gem_bounty] = /The local gem dealer, ([a-zA-Z ]+), has an order to fill and wants our help/
|
46
|
-
re[:creature_problem] = /It appears they have a creature problem they\'d like you to solve/
|
47
|
-
re[:rescue] = /A local divinist has had visions of the child fleeing from (?:a|an) (.*) (?:in|on) (?:the )?(.*?)(?: near| between| under|\.)/
|
20
|
+
def Dictionary.ignorable?(line)
|
21
|
+
line =~ /You feel less drained|You feel at full magical power again|\[LNet\]|GSIV|moving stealthily into the room|glides into view|soars out of sight|You notice (.*?) moving stealthily out|[A-Z][a-z]+ says, "|(removes|put) a (.*?) from in (his|her)|just opened (a|an)|just went|You gesture|Your spell is ready|just bit the dust|joins the adventure|just arrived|returns home from a hard day of adventuring|no longer effective|You sense that your attunement|You do not feel drained anymore|You feel the magic of your spell depart/
|
22
|
+
end
|
48
23
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
24
|
+
def Dictionary.targetable
|
25
|
+
re = {}
|
26
|
+
re[:yes] = /^You are now targeting/
|
27
|
+
re[:no] = /^You can't target/
|
28
|
+
re
|
29
|
+
end
|
30
|
+
|
31
|
+
def Dictionary.bounty
|
32
|
+
re = {}
|
33
|
+
re[:herb] = /requires (?:a|an|some) ([a-zA-Z '-]+) found (?:in|on|around) ([a-zA-Z '-]+). These samples must be in pristine condition. You have been tasked to retrieve ([0-9]+)/
|
34
|
+
re[:escort] = /Go to the (.*?) and WAIT for (?:him|her|them) to meet you there. You must guarantee (?:his|her|their) safety to ([a-zA-Z '-]+) as soon as/
|
35
|
+
re[:gem] = /has received orders from multiple customers requesting (?:a|an|some) ([a-zA-Z '-]+). You have been tasked to retrieve ([0-9]+)/
|
36
|
+
re[:heirloom] = /You have been tasked to recover ([a-zA-Z '-]+) that an unfortunate citizen lost after being attacked by (a|an|some) ([a-zA-Z '-]+) (in|on|around|near|by) ([a-zA-Z '-]+)./
|
37
|
+
re[:heirloom_found] = /^You have located the heirloom and should bring it back to/
|
38
|
+
re[:turn_in] = /You have succeeded in your task and can return to the Adventurer's Guild to receive your reward/
|
39
|
+
re[:guard_turn_in] = /^You succeeded in your task and should report back to/
|
40
|
+
re[:guard_bounty] = /Go report to ([a-zA-Z ]+) to find out more/
|
41
|
+
re[:cull] = /^You have been tasked to suppress (^((?!bandit).)*$) activity (?:in|on) (?:the )? (.*?)(?: near| between| under|\.) ([a-zA-Z' ]+). You need to kill ([0-9]+)/
|
42
|
+
re[:bandits] = /^You have been tasked to suppress bandit activity (?:in |on )(?:the )(.*?)(?: near| between| under) ([a-zA-Z' ]+). You need to kill ([0-9]+)/
|
43
|
+
re[:dangerous] = /You have been tasked to hunt down and kill a particularly dangerous (.*) that has established a territory (?:in|on) (?:the )?(.*?)(?: near| between| under|\.)/
|
44
|
+
re[:get_skin_bounty] = /The local furrier/
|
45
|
+
re[:get_herb_bounty] = /local herbalist|local healer|local alchemist/
|
46
|
+
re[:get_gem_bounty] = /The local gem dealer, ([a-zA-Z ]+), has an order to fill and wants our help/
|
47
|
+
re[:creature_problem] = /It appears they have a creature problem they\'d like you to solve/
|
48
|
+
re[:rescue] = /A local divinist has had visions of the child fleeing from (?:a|an) (.*) (?:in|on) (?:the )?(.*?)(?: near| between| under|\.)/
|
49
|
+
|
50
|
+
re[:failed_bounty] = /You have failed in your task/
|
51
|
+
re[:get_bounty] = /You are not currently assigned a task/
|
68
52
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
re[:appraise][:failure] = /As best you can tell, the ([a-zA-Z '-]+) is of average quality/
|
86
|
-
re[:singularize] = Proc.new do |str|
|
87
|
-
str.gsub(/ies$/, 'y').gsub(/zes$/,'z').gsub(/s$/,'').gsub(/large |medium |containing |small |tiny |some /, '').strip
|
88
|
-
end
|
89
|
-
re
|
90
|
-
end
|
53
|
+
end
|
54
|
+
def Dictionary.bandit_traps
|
55
|
+
re = {}
|
56
|
+
re[:net] = /Suddenly, a carefully concealed net springs up from the ground, completely entangling you/
|
57
|
+
re[:jaws] = /large pair of carefully concealed metal jaws slam shut on your/
|
58
|
+
re[:wire] = /stumbled right into a length of nearly invisible razor wire/
|
59
|
+
re[:pouch] = /of air as you realize you've just stepped on a carefully concealed inflated pouch/
|
60
|
+
re[:rope] = /wrapping around your ankle and tossing you up into the air/
|
61
|
+
re[:spikes] = /from under you as you fall into a shallow pit filled with tiny spikes/
|
62
|
+
re[:net] = /completely entangling you/
|
63
|
+
re[:net_end] = /The net entangling you rips and falls apart/
|
64
|
+
re[:hidden] = /You hear a voice shout|leaps|flies from the shadows toward you/
|
65
|
+
re[:fail] = /You spy/
|
66
|
+
re[:statue] = /A faint silvery light flickers from the shadows/
|
67
|
+
re
|
68
|
+
end
|
91
69
|
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
70
|
+
def Dictionary.shop
|
71
|
+
db = {}
|
72
|
+
db[:success] = /^You hand over|You place your/
|
73
|
+
db[:failure] = {}
|
74
|
+
db[:failure][:missing] = /^There is nobody here to buy anything from/
|
75
|
+
db[:failure][:silvers] = /^The merchant frowns and says/
|
76
|
+
db[:failure][:full] = /^There's no more room for anything else/
|
77
|
+
db[:failure][:own] = /^Buy your own merchandise?/
|
78
|
+
db
|
79
|
+
end
|
80
|
+
def Dictionary.gems
|
81
|
+
re = {}
|
82
|
+
# Expressions to match interaction with gems
|
83
|
+
re[:appraise] = {}
|
84
|
+
re[:appraise][:gemshop] = /inspects it carefully before saying, "I'll give you ([0-9]+) for it if you want to sell/
|
85
|
+
re[:appraise][:player] = /You estimate that the ([a-zA-Z '-]+) is of ([a-zA-Z '-]+) quality and worth approximately ([0-9]+) silvers/
|
86
|
+
re[:appraise][:failure] = /As best you can tell, the ([a-zA-Z '-]+) is of average quality/
|
87
|
+
re[:singularize] = Proc.new do |str|
|
88
|
+
str.gsub(/ies$/, 'y').gsub(/zes$/,'z').gsub(/s$/,'').gsub(/large |medium |containing |small |tiny |some /, '').strip
|
89
|
+
end
|
90
|
+
re
|
91
|
+
end
|
92
|
+
|
93
|
+
def Dictionary.get
|
94
|
+
re = {}
|
95
|
+
re[:failure] = {}
|
96
|
+
# Expressions to match `get` verb results
|
97
|
+
re[:failure][:weight] = /You are unable to handle the additional load/
|
98
|
+
re[:failure][:hands_full] = /^You need a free hand to pick that up/
|
99
|
+
re[:failure][:ne] = /^Get what/
|
100
|
+
re[:failure][:buy] = /(is|for|be) (?<cost>[0-9]+) (silvers|coins)/
|
101
|
+
re[:failure][:race] = /be (?<cost>[0-9]+) (silvers|coins) for someone like you/
|
102
|
+
re[:failure][:pshop] = /^Looking closely/
|
103
|
+
re[:success] = /^You carefully|^You unsheathe|^You shield|^You discreetly|^You gather|^You pick up|^You remove|^You rummage|^You draw|^You grab|^You reach|^You already|^You gather/
|
104
|
+
re
|
105
|
+
end
|
106
|
+
|
107
|
+
def Dictionary.put
|
108
|
+
re = {}
|
109
|
+
re[:failure] = {}
|
110
|
+
re[:failure][:full] = /^won't fit in the|is full!|filling it./
|
111
|
+
re[:failure][:ne] = /^I could not find what you were referring to/
|
112
|
+
re[:success] = /^Your bundle|^You attempt to shield|^As you place|^You wipe off the blade|^You discreetly|^You toss|^You carefully|^You give|^You untie your|^You put|^You absent|^You tuck|^You sheathe|^You slip|^You roll up|^You tuck|^You add|^You place/
|
113
|
+
re
|
114
|
+
end
|
105
115
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
re[:success] = /^Your bundle|^You attempt to shield|^As you place|^You wipe off the blade|^You discreetly|^You toss|^You carefully|^You give|^You untie your|^You put|^You absent|^You tuck|^You sheathe|^You slip|^You roll up|^You tuck|^You add|^You place/
|
112
|
-
re
|
113
|
-
end
|
114
|
-
|
115
|
-
def Dictionary.jar(name=nil)
|
116
|
-
if name
|
117
|
-
return name.gsub(/large |medium |containing |small |tiny |some /, '').sub 'rubies', 'ruby'
|
118
|
-
else
|
119
|
-
return false
|
120
|
-
end
|
116
|
+
def Dictionary.jar(name=nil)
|
117
|
+
if name
|
118
|
+
return name.gsub(/large |medium |containing |small |tiny |some /, '').sub 'rubies', 'ruby'
|
119
|
+
else
|
120
|
+
return false
|
121
121
|
end
|
122
|
+
end
|
122
123
|
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
124
|
+
def Dictionary.armors
|
125
|
+
armors = Hash.new
|
126
|
+
armors['robes'] = /cloth armor/i
|
127
|
+
armors['light leather'] = /soft leather armor that covers the torso only./i
|
128
|
+
armors['full leather'] = /soft leather armor that covers the torso and arms./i
|
129
|
+
armors['reinforced leather'] = /soft leather armor that covers the torso, arms, and legs./i
|
130
|
+
armors['double leather'] = /soft leather armor that covers the torso, arms, legs, neck, and head./i
|
131
|
+
armors['leather breastplate'] = /rigid leather armor that covers the torso only./i
|
132
|
+
armors['cuirbouilli leather'] = /rigid leather armor that covers the torso and arms./i
|
133
|
+
armors['studded leather'] = /rigid leather armor that covers the torso, arms, and legs./i
|
134
|
+
armors['brigadine armor'] = /rigid leather armor that covers the torso, arms, legs, neck, and head./i
|
135
|
+
armors['chain mail'] = /chain armor that covers the torso only./i
|
136
|
+
armors['double chain'] = /chain armor that covers the torso and arms./i
|
137
|
+
armors['augmented chain'] = /chain armor that covers the torso, arms, and legs./i
|
138
|
+
armors['chain hauberk'] = /chain armor that covers the torso, arms, legs, neck, and head./i
|
139
|
+
armors['metal breastplate'] = /plate armor that covers the torso only./i
|
140
|
+
armors['augmented plate'] = /plate armor that covers the torso and arms./i
|
141
|
+
armors['half plate'] = /plate armor that covers the torso, arms, and legs./i
|
142
|
+
armors['full plate'] = /plate armor that covers the torso, arms, legs, neck, and head./i
|
143
|
+
armors['DB'] = /miscellaneous armor that protects the wearer in general/
|
144
|
+
armors
|
145
|
+
end
|
145
146
|
|
146
|
-
|
147
|
-
|
148
|
-
|
147
|
+
def Dictionary.size
|
148
|
+
/that it is a (?<size>.*) shield that protects/
|
149
|
+
end
|
149
150
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
151
|
+
def Dictionary.numbers
|
152
|
+
numbers = Hash.new
|
153
|
+
numbers['one'] = 1
|
154
|
+
numbers['two'] = 2
|
155
|
+
numbers['three'] = 3
|
156
|
+
numbers['four'] = 4
|
157
|
+
numbers['five'] = 5
|
158
|
+
numbers
|
159
|
+
end
|
159
160
|
|
160
|
-
|
161
|
-
|
162
|
-
|
161
|
+
def Dictionary.spiked
|
162
|
+
/You also notice that it is spiked./i
|
163
|
+
end
|
163
164
|
|
164
|
-
|
165
|
-
|
166
|
-
end
|
165
|
+
def Dictionary.fusion
|
166
|
+
/(?<orbs>.*?) spherical depressions adorn the (.*?), approximately the size and shape of a small gem/
|
167
167
|
end
|
168
168
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require "ostruct"
|
2
|
+
require "Olib/ext/string"
|
3
|
+
|
4
|
+
class MatchData
|
5
|
+
def to_struct
|
6
|
+
OpenStruct.new to_hash
|
7
|
+
end
|
8
|
+
|
9
|
+
def to_h
|
10
|
+
Hash[self.names.map(&:to_sym).zip(self.captures.map(&:strip).map do |capture|
|
11
|
+
if capture.is_i? then capture.to_i else capture end
|
12
|
+
end)]
|
13
|
+
end
|
14
|
+
end
|
data/lib/Olib/go2.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require "Olib/ext/string"
|
2
|
+
|
1
3
|
class Integer
|
2
4
|
def go2
|
3
5
|
Go2.room self
|
@@ -10,127 +12,61 @@ class String
|
|
10
12
|
end
|
11
13
|
end
|
12
14
|
|
13
|
-
|
15
|
+
class Go2
|
14
16
|
##
|
15
|
-
## @brief
|
17
|
+
## @brief returns the filtered relevant Map db tags
|
16
18
|
##
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
##
|
23
|
-
## @return Array
|
24
|
-
##
|
25
|
-
def Go2.tags
|
26
|
-
Map.tags
|
27
|
-
.select { |tag| !tag.include? "=" }
|
28
|
-
end
|
29
|
-
|
30
|
-
##
|
31
|
-
## dynamically assign all of our Go2#methods
|
32
|
-
##
|
33
|
-
Go2.tags.each { |tag|
|
34
|
-
method = Olib.methodize tag
|
35
|
-
|
36
|
-
Go2.define_singleton_method(method.to_sym) do
|
37
|
-
Go2.room tag
|
38
|
-
end
|
39
|
-
}
|
19
|
+
## @return Array
|
20
|
+
##
|
21
|
+
def Go2.tags
|
22
|
+
Map.tags.select { |tag| !tag.include? "=" }
|
23
|
+
end
|
40
24
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
Go2
|
48
|
-
end
|
25
|
+
##
|
26
|
+
## dynamically assign all of our Go2#methods
|
27
|
+
##
|
28
|
+
Go2.tags.each do |tag|
|
29
|
+
Go2.define_singleton_method(tag.methodize) do Go2.room(tag) end
|
30
|
+
end
|
49
31
|
|
50
|
-
|
51
|
-
|
52
|
-
Char.
|
53
|
-
|
32
|
+
def Go2.room(roomid)
|
33
|
+
unless Room.current.id == roomid || Room.current.tags.include?(roomid)
|
34
|
+
Char.unhide if hidden
|
35
|
+
start_script "go2", [roomid, "_disable_confirm_"]
|
36
|
+
wait_while { running? "go2" };
|
54
37
|
end
|
38
|
+
Go2
|
39
|
+
end
|
55
40
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
unless Inventory.fwi_teleporter
|
63
|
-
echo "Error: Your teleporter could not be found #{Go2.teleporter}"
|
64
|
-
exit
|
65
|
-
end
|
66
|
-
|
67
|
-
last = Room.current.id
|
68
|
-
teleporter = Inventory.fwi_teleporter
|
69
|
-
if teleporter.worn?
|
70
|
-
teleporter.turn
|
71
|
-
else
|
72
|
-
teleporter.take.turn.stash
|
73
|
-
end
|
74
|
-
|
75
|
-
if Room.current.id == last
|
76
|
-
echo "Error: You tried to teleport to FWI in a room that does not allow that"
|
77
|
-
end
|
78
|
-
|
79
|
-
Go2
|
80
|
-
end
|
81
|
-
|
82
|
-
def Go2.rebase
|
83
|
-
@@origin = {}
|
84
|
-
@@origin[:roomid] = Room.current.id
|
85
|
-
@@origin[:hidden] = hiding?
|
86
|
-
@@origin[:location] = Room.current.location
|
87
|
-
Olib.debug "rebasing to #{@@origin}"
|
88
|
-
Go2
|
89
|
-
end
|
41
|
+
def Go2.origin
|
42
|
+
Go2.room @@origin[:roomid]
|
43
|
+
Char.hide if @@origin[:hidden]
|
44
|
+
Go2
|
45
|
+
end
|
90
46
|
|
91
|
-
|
47
|
+
def Go2.rebase
|
48
|
+
@@origin = {}
|
49
|
+
@@origin[:roomid] = Room.current.id
|
50
|
+
@@origin[:hidden] = hiding?
|
51
|
+
@@origin[:location] = Room.current.location
|
52
|
+
Go2
|
53
|
+
end
|
92
54
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
55
|
+
# Thanks Tillmen
|
56
|
+
def Go2.cost(to)
|
57
|
+
cost = 0
|
58
|
+
Map.findpath(Room.current.id, to).each { |id|
|
59
|
+
Room[id].tags.each { |tag|
|
60
|
+
if tag =~ /^silver-cost:#{id-1}:(.*)$/
|
61
|
+
cost_string = $1
|
62
|
+
if cost_string =~ /^[0-9]+$/
|
63
|
+
cost += cost_string.to_i
|
64
|
+
else
|
65
|
+
cost = StringProc.new(cost_string).call.to_i
|
105
66
|
end
|
106
|
-
|
67
|
+
end
|
107
68
|
}
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
# use the teleporter variable to locate your teleporter and teleport
|
112
|
-
# naive of where you are
|
113
|
-
def Go2.fwi_teleport
|
114
|
-
Go2.fwi
|
115
|
-
end
|
116
|
-
|
117
|
-
# TODO
|
118
|
-
# create a dictionary of house lockers and the logic to enter a locker
|
119
|
-
# insure locker is closed before scripting away from it
|
120
|
-
def Go2.locker
|
121
|
-
echo "the go2_locker method currently does not function properly..."
|
122
|
-
self
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
end
|
127
|
-
|
128
|
-
def Olib.Go2
|
129
|
-
Olib::Go2
|
69
|
+
}
|
70
|
+
cost
|
130
71
|
end
|
131
|
-
|
132
|
-
end
|
133
|
-
|
134
|
-
class Go2 < Olib::Go2
|
135
|
-
# expose on the global scope
|
136
72
|
end
|