Olib 0.0.1 → 0.0.2
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.rb +9 -0
- data/lib/Olib/container.rb +1 -1
- data/lib/Olib/creature.rb +10 -1
- data/lib/Olib/dictionary.rb +1 -8
- data/lib/Olib/item.rb +4 -15
- data/lib/Olib/transport.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: 7c811e8b8cce0165c3641d1205e17d0dc98078c3
|
4
|
+
data.tar.gz: e250c1e84cda3bb4b4b165ac9370472b128a7cf5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90b35f58139d7ff5e5e1cbffaa75fa6985038a3276b7bbc82d6f359146b3e1bcd3396e4a06db9d5c5f887821e92180b2810c65b941f2fdf982fc1f835fffc81d
|
7
|
+
data.tar.gz: 6721db13df3f4b1a1c52ea338b9eaf2cbd23437a0d90649dc88075ec5bb92dccf33e17d20246d169dc7f8a368b5bce3bef3eb107c199205381d1634c9bba853c
|
data/lib/Olib.rb
CHANGED
@@ -2,6 +2,15 @@ module Olib
|
|
2
2
|
def Olib.do(action, re)
|
3
3
|
dothistimeout action, 5, re
|
4
4
|
end
|
5
|
+
|
6
|
+
def Olib.common_lines
|
7
|
+
|
8
|
+
/You feel less drained|You feel at full magical power again|You gesture|Your spell is ready|
|
9
|
+
just bit the dust|joins the adventure|just arrived|returns home from a hard day of adventuring|
|
10
|
+
no longer effective|You sense that your attunement|You do not feel drained anymore|You feel the magic of your spell depart|(*.?) just arrived|just climbed up/
|
11
|
+
|
12
|
+
end
|
13
|
+
|
5
14
|
require 'Olib/group'
|
6
15
|
require 'Olib/creature'
|
7
16
|
require 'Olib/creatures'
|
data/lib/Olib/container.rb
CHANGED
@@ -66,7 +66,7 @@ module Olib
|
|
66
66
|
end
|
67
67
|
|
68
68
|
def __verbs__
|
69
|
-
@verbs = 'open close analyze inspect
|
69
|
+
@verbs = 'open close analyze inspect weigh'.split(' ').map(&:to_sym)
|
70
70
|
singleton = (class << self; self end)
|
71
71
|
@verbs.each do |verb|
|
72
72
|
singleton.send :define_method, verb do
|
data/lib/Olib/creature.rb
CHANGED
@@ -38,10 +38,19 @@ module Olib
|
|
38
38
|
type == t
|
39
39
|
end
|
40
40
|
|
41
|
+
def bandit?
|
42
|
+
type == 'bandit'
|
43
|
+
end
|
44
|
+
|
45
|
+
def grimswarm?
|
46
|
+
type == "grimswarm"
|
47
|
+
end
|
48
|
+
|
41
49
|
def heal
|
42
50
|
[:right_leg, :left_leg, :right_arm, :left_arm, :head, :left_eye, :right_eye].each do |location| @wounds[location] = 0 end
|
43
51
|
@wounds
|
44
52
|
end
|
53
|
+
|
45
54
|
def injuries
|
46
55
|
fput "look ##{@id}"
|
47
56
|
woundinfo = matchtimeout(2, /(he|she|it) (?:has|appears) .*/i)
|
@@ -102,7 +111,7 @@ module Olib
|
|
102
111
|
end
|
103
112
|
|
104
113
|
def kill_shot
|
105
|
-
wounds
|
114
|
+
wounds = injuries
|
106
115
|
location = "left eye"
|
107
116
|
location = "right eye" if @wounds[:left_eye] == 3
|
108
117
|
location = "head" if @wounds[:right_eye] == 3
|
data/lib/Olib/dictionary.rb
CHANGED
@@ -34,14 +34,7 @@ module Olib
|
|
34
34
|
|
35
35
|
re[:failed_bounty] = /You have failed in your task/
|
36
36
|
re[:get_bounty] = /You are not currently assigned a task/
|
37
|
-
|
38
|
-
if checkbounty =~ exp
|
39
|
-
bounty = {}
|
40
|
-
bounty[:type] = type
|
41
|
-
bounty[:args] = checkbounty.scan(exp).flatten
|
42
|
-
return bounty
|
43
|
-
end
|
44
|
-
end
|
37
|
+
|
45
38
|
end
|
46
39
|
def Gemstone_Regex.bandit_traps
|
47
40
|
re = {}
|
data/lib/Olib/item.rb
CHANGED
@@ -1,20 +1,9 @@
|
|
1
|
+
require 'Olib/extender'
|
2
|
+
require 'Olib/dictionary'
|
3
|
+
|
1
4
|
module Olib
|
2
5
|
# special item wrapper class to wrap item types with custom, common interactions becoming syntactic sugar
|
3
|
-
|
4
|
-
attr_accessor :type, :buyable, :cost
|
5
|
-
def initialize(item)
|
6
|
-
@type = item.type
|
7
|
-
self._extend(item)
|
8
|
-
end
|
9
|
-
|
10
|
-
# This copies GameObj data to attributes so we can employ it for scripting
|
11
|
-
def _extend(item)
|
12
|
-
item.instance_variables.each do |var|
|
13
|
-
s = var.to_s.sub('@', '')
|
14
|
-
(class << self; self end).class_eval do; attr_accessor "#{s}"; end
|
15
|
-
instance_variable_set "#{var}", item.send(s)
|
16
|
-
end
|
17
|
-
end
|
6
|
+
class Item < Gameobj_Extender
|
18
7
|
|
19
8
|
def take
|
20
9
|
result = Olib.do "get ##{@id}", /#{[Olib::Gemstone_Regex.get[:success], Olib::Gemstone_Regex.get[:failure].values].flatten.join('|')}/
|
data/lib/Olib/transport.rb
CHANGED
@@ -147,7 +147,7 @@ module Olib
|
|
147
147
|
].each do |target|
|
148
148
|
singleton.send :define_method, "go2_#{target}".to_sym do
|
149
149
|
|
150
|
-
unhide if hidden
|
150
|
+
unhide if hidden?
|
151
151
|
unless Room.current.tags.include?(target)
|
152
152
|
start_script 'go2', [target, '_disable_confirm_']
|
153
153
|
wait_while { running? "go2" };
|