Olib 0.0.6 → 0.0.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/Olib.gemspec +1 -1
- data/lib/Olib/bounty.rb +1 -1
- data/lib/Olib/character/inventory.rb +3 -0
- data/lib/Olib/core/container.rb +41 -3
- data/lib/Olib/core/item.rb +19 -0
- data/lib/Olib/dictionary/dictionary.rb +2 -1
- data/lib/Olib/objects/scroll.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eaaaac56f4caad79d1b256ca6778187530d17a2
|
4
|
+
data.tar.gz: a508a86335a27ff329439568e437cda5346bae7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffbe252d534f357d9778e99547a414b8b15ff5c8b8c44d2f3df8ed3cc63d5438b802ded884f278b196b3fef37107f59270dd1fdd83e486c196de963b6c8002d0
|
7
|
+
data.tar.gz: d41029048d3c53d321c0a4dede7e5689550990ce677554df8a04043ab84aed797acffd3067e51d2c46b2e517a046dafb4345a6189697cd3fd454322cf4d20f5b
|
data/Olib.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'Olib'
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.7'
|
7
7
|
s.date = '2014-09-12'
|
8
8
|
s.summary = "Useful Lich extensions for Gemstone IV"
|
9
9
|
s.description = "Useful Lich extensions for Gemstone IV including hostile creature management, group management, syntactically pleasing movement, locker management, etc"
|
data/lib/Olib/bounty.rb
CHANGED
@@ -122,7 +122,7 @@ module Olib
|
|
122
122
|
end
|
123
123
|
|
124
124
|
def Bounty.npc
|
125
|
-
GameObj.npcs.select { |npc| npc.name =~ /guard|taskmaster|gemcutter|jeweler|healer/i }.first
|
125
|
+
GameObj.npcs.select { |npc| npc.name =~ /guard|taskmaster|gemcutter|jeweler|akrash|healer/i }.first
|
126
126
|
end
|
127
127
|
|
128
128
|
end
|
data/lib/Olib/core/container.rb
CHANGED
@@ -24,7 +24,7 @@ module Olib
|
|
24
24
|
# extract the class name to attempt to lookup the item by your settings
|
25
25
|
# ex: class Lootsack
|
26
26
|
# ex: class Gemsack
|
27
|
-
name = self.class.name.downcase.split('::').last.strip
|
27
|
+
name = if self.class.name.include?("::") then self.class.name.downcase.split('::').last.strip else self.class.name.downcase end
|
28
28
|
candidates = Olib.Inventory[Vars[name]]
|
29
29
|
raise Olib::Errors::DoesntExist.new("#{name} could not be initialized are you sure you:\n ;var set #{name}=<something>") if candidates.empty? && id.nil?
|
30
30
|
|
@@ -86,6 +86,30 @@ module Olib
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
def gems
|
90
|
+
find_by_tags('gem')
|
91
|
+
end
|
92
|
+
|
93
|
+
def magic_items
|
94
|
+
find_by_tags('magic')
|
95
|
+
end
|
96
|
+
|
97
|
+
def jewelry
|
98
|
+
find_by_tags('jewelry')
|
99
|
+
end
|
100
|
+
|
101
|
+
def skins
|
102
|
+
find_by_tags('skin')
|
103
|
+
end
|
104
|
+
|
105
|
+
def boxes
|
106
|
+
find_by_tags('boxes')
|
107
|
+
end
|
108
|
+
|
109
|
+
def scrolls
|
110
|
+
find_by_tags('scroll')
|
111
|
+
end
|
112
|
+
|
89
113
|
def full?
|
90
114
|
is? 'full'
|
91
115
|
end
|
@@ -100,12 +124,26 @@ module Olib
|
|
100
124
|
class Lootsack < Container
|
101
125
|
|
102
126
|
end
|
103
|
-
|
104
|
-
@@lootsack = nil
|
105
127
|
|
106
128
|
def Olib.Lootsack
|
107
129
|
return @@lootsack if @@lootsack
|
108
130
|
@@lootsack = Lootsack.new
|
109
131
|
@@lootsack
|
110
132
|
end
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
module Containers
|
137
|
+
@@containers = {}
|
138
|
+
|
139
|
+
def Containers.define(name)
|
140
|
+
@@containers[name] = Object.const_set(name.capitalize, Class.new(Olib::Container)).new
|
141
|
+
@@containers[name]
|
142
|
+
end
|
143
|
+
|
144
|
+
def Containers.method_missing(name)
|
145
|
+
return @@containers[name] if @@containers[name]
|
146
|
+
return Containers.define(name)
|
147
|
+
end
|
148
|
+
|
111
149
|
end
|
data/lib/Olib/core/item.rb
CHANGED
@@ -192,6 +192,17 @@ module Olib
|
|
192
192
|
|
193
193
|
end
|
194
194
|
|
195
|
+
def sell
|
196
|
+
price = 0
|
197
|
+
Olib.wrap( action "sell" ){ |line|
|
198
|
+
raise Olib::Errors::Fatal.new "#{to_s} is not sellable here" if GameObj.right_hand.id == @id
|
199
|
+
|
200
|
+
if line =~ /([\d]+) silver/
|
201
|
+
price = $1.to_i
|
202
|
+
raise Olib::Errors::Mundane
|
203
|
+
end
|
204
|
+
}
|
205
|
+
end
|
195
206
|
|
196
207
|
def turn
|
197
208
|
fput action 'turn'
|
@@ -325,6 +336,14 @@ module Olib
|
|
325
336
|
define 'cost', line.match(Olib::Dictionary.get[:failure][:buy])[:cost].to_i
|
326
337
|
end
|
327
338
|
|
339
|
+
if line =~ Olib::Dictionary.get[:failure][:race]
|
340
|
+
define 'cost', line.match(Olib::Dictionary.get[:failure][:race])[:cost].to_i
|
341
|
+
end
|
342
|
+
|
343
|
+
if line =~ /let me help you with that/
|
344
|
+
raise Olib::Errors::Mundane
|
345
|
+
end
|
346
|
+
|
328
347
|
if line=~ /You'll have to buy it if you want it/
|
329
348
|
tag 'buyable'
|
330
349
|
raise Olib::Errors::Mundane
|
@@ -85,7 +85,8 @@ module Olib
|
|
85
85
|
re[:failure][:weight] = /You are unable to handle the additional load/
|
86
86
|
re[:failure][:hands_full] = /^You need a free hand to pick that up/
|
87
87
|
re[:failure][:ne] = /^Get what/
|
88
|
-
re[:failure][:buy] = /(?<cost>[0-9]+) (silvers|coins)/
|
88
|
+
re[:failure][:buy] = /is (?<cost>[0-9]+) (silvers|coins)/
|
89
|
+
re[:failure][:race] = /be (?<cost>[0-9]+) (silvers|coins) for someone like you/
|
89
90
|
re[:failure][:pshop] = /^Looking closely/
|
90
91
|
re[:success] = /^You pick up|^You remove|^You rummage|^You draw|^You grab|^You reach|^You already/
|
91
92
|
re
|
data/lib/Olib/objects/scroll.rb
CHANGED