Class: Dictionary

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/Olib/dictionary/dictionary.rb

Class Method Summary collapse

Class Method Details

.armorsObject



124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/Olib/dictionary/dictionary.rb', line 124

def Dictionary.armors
  armors                           = Hash.new
  armors['robes']                  = /cloth armor/i
  armors['light leather']          = /soft leather armor that covers the torso only./i
  armors['full leather']           = /soft leather armor that covers the torso and arms./i 
  armors['reinforced leather']     = /soft leather armor that covers the torso, arms, and legs./i 
  armors['double leather']         = /soft leather armor that covers the torso, arms, legs, neck, and head./i
  armors['leather breastplate']    = /rigid leather armor that covers the torso only./i
  armors['cuirbouilli leather']    = /rigid leather armor that covers the torso and arms./i
  armors['studded leather']        = /rigid leather armor that covers the torso, arms, and legs./i
  armors['brigadine armor']        = /rigid leather armor that covers the torso, arms, legs, neck, and head./i
  armors['chain mail']             = /chain armor that covers the torso only./i
  armors['double chain']           = /chain armor that covers the torso and arms./i
  armors['augmented chain']        = /chain armor that covers the torso, arms, and legs./i
  armors['chain hauberk']          = /chain armor that covers the torso, arms, legs, neck, and head./i
  armors['metal breastplate']      = /plate armor that covers the torso only./i
  armors['augmented plate']        = /plate armor that covers the torso and arms./i
  armors['half plate']             = /plate armor that covers the torso, arms, and legs./i
  armors['full plate']             = /plate armor that covers the torso, arms, legs, neck, and head./i
  armors['DB']                     = /miscellaneous armor that protects the wearer in general/
  armors
end

.bandit_trapsObject



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/Olib/dictionary/dictionary.rb', line 54

def Dictionary.bandit_traps
  re = {}
  re[:net]     = /Suddenly, a carefully concealed net springs up from the ground, completely entangling you/
  re[:jaws]    = /large pair of carefully concealed metal jaws slam shut on your/
  re[:wire]    = /stumbled right into a length of nearly invisible razor wire/
  re[:pouch]   = /of air as you realize you've just stepped on a carefully concealed inflated pouch/
  re[:rope]    = /wrapping around your ankle and tossing you up into the air/
  re[:spikes]  = /from under you as you fall into a shallow pit filled with tiny spikes/
  re[:net]     = /completely entangling you/
  re[:net_end] = /The net entangling you rips and falls apart/
  re[:hidden]  = /You hear a voice shout|leaps|flies from the shadows toward you/
  re[:fail]    = /You spy/
  re[:statue]  = /A faint silvery light flickers from the shadows/
  re
end

.bountyObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/Olib/dictionary/dictionary.rb', line 31

def Dictionary.bounty
  re = {}
  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]+)/
  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/
  re[:gem]              = /has received orders from multiple customers requesting (?:a|an|some) ([a-zA-Z '-]+).  You have been tasked to retrieve ([0-9]+)/
  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 '-]+)./
  re[:heirloom_found]   = /^You have located the heirloom and should bring it back to/
  re[:turn_in]          = /You have succeeded in your task and can return to the Adventurer's Guild to receive your reward/
  re[:guard_turn_in]    = /^You succeeded in your task and should report back to/
  re[:guard_bounty]     = /Go report to ([a-zA-Z ]+) to find out more/
  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]+)/
  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]+)/
  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|\.)/
  re[:get_skin_bounty]  = /The local furrier/
  re[:get_herb_bounty]  = /local herbalist|local healer|local alchemist/
  re[:get_gem_bounty]   = /The local gem dealer, ([a-zA-Z ]+), has an order to fill and wants our help/
  re[:creature_problem] = /It appears they have a creature problem they\'d like you to solve/
  re[:rescue]           = /A local divinist has had visions of the child fleeing from (?:a|an) (.*) (?:in|on) (?:the )?(.*?)(?: near| between| under|\.)/

  re[:failed_bounty]    = /You have failed in your task/
  re[:get_bounty]       = /You are not currently assigned a task/
  
end

.contentsObject



16
17
18
# File 'lib/Olib/dictionary/dictionary.rb', line 16

def Dictionary.contents
  /(On|In) the (.*?) you see (?<items>.*)/
end

.fusionObject



165
166
167
# File 'lib/Olib/dictionary/dictionary.rb', line 165

def Dictionary.fusion
  /(?<orbs>.*?) spherical depressions adorn the (.*?), approximately the size and shape of a small gem/
end

.gemsObject



80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/Olib/dictionary/dictionary.rb', line 80

def Dictionary.gems
  re                         = {}
  # Expressions to match interaction with gems
  re[:appraise]              = {}
  re[:appraise][:gemshop]    = /inspects it carefully before saying, "I'll give you ([0-9]+) for it if you want to sell/
  re[:appraise][:player]     = /You estimate that the ([a-zA-Z '-]+) is of ([a-zA-Z '-]+) quality and worth approximately ([0-9]+) silvers/
  re[:appraise][:failure]    = /As best you can tell, the ([a-zA-Z '-]+) is of average quality/
  re[:singularize]           = Proc.new do |str| 
    str.gsub(/ies$/, 'y').gsub(/zes$/,'z').gsub(/s$/,'').gsub(/large |medium |containing |small |tiny |some /, '').strip 
  end
  re
end

.getObject



93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/Olib/dictionary/dictionary.rb', line 93

def Dictionary.get
  re = {}
  re[:failure] = {}
  # Expressions to match `get` verb results
  re[:failure][:weight]       = /You are unable to handle the additional load/
  re[:failure][:hands_full]   = /^You need a free hand to pick that up/
  re[:failure][:ne]           = /^Get what/
  re[:failure][:buy]          = /(is|for|be) (?<cost>[0-9]+) (silvers|coins)/
  re[:failure][:race]         = /be (?<cost>[0-9]+) (silvers|coins) for someone like you/
  re[:failure][:pshop]        = /^Looking closely/
  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/
  re
end

.heirloomObject



5
6
7
8
9
10
# File 'lib/Olib/dictionary/dictionary.rb', line 5

def Dictionary.heirloom
  re = {}
  re[:is]   = /are the initials ([A-Z]{2})./
  re[:give] = /Excellent.  I'm sure the person who lost this will be quite happy/
  re
end

.ignorable?(line) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/Olib/dictionary/dictionary.rb', line 20

def Dictionary.ignorable?(line)
  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/
end

.jar(name = nil) ⇒ Object



116
117
118
119
120
121
122
# File 'lib/Olib/dictionary/dictionary.rb', line 116

def Dictionary.jar(name=nil)
  if name
    return name.gsub(/large |medium |containing |small |tiny |some /, '').sub 'rubies', 'ruby'
  else
    return false
  end
end

.numbersObject



151
152
153
154
155
156
157
158
159
# File 'lib/Olib/dictionary/dictionary.rb', line 151

def Dictionary.numbers
  numbers                          = Hash.new
  numbers['one']                   = 1
  numbers['two']                   = 2
  numbers['three']                 = 3
  numbers['four']                  = 4
  numbers['five']                  = 5
  numbers
end

.putObject



107
108
109
110
111
112
113
114
# File 'lib/Olib/dictionary/dictionary.rb', line 107

def Dictionary.put
  re = {}
  re[:failure]        = {}    
  re[:failure][:full] = /^won't fit in the|is full!|filling it./
  re[:failure][:ne]   = /^I could not find what you were referring to/
  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/
  re
end

.shopObject



70
71
72
73
74
75
76
77
78
79
# File 'lib/Olib/dictionary/dictionary.rb', line 70

def Dictionary.shop
  db = {}
  db[:success]            = /^You hand over|You place your/
  db[:failure]            = {}
  db[:failure][:missing]  = /^There is nobody here to buy anything from/
  db[:failure][:silvers]  = /^The merchant frowns and says/
  db[:failure][:full]     = /^There's no more room for anything else/
  db[:failure][:own]      = /^Buy your own merchandise?/
  db
end

.sizeObject



147
148
149
# File 'lib/Olib/dictionary/dictionary.rb', line 147

def Dictionary.size
  /that it is a (?<size>.*) shield that protects/
end

.spikedObject



161
162
163
# File 'lib/Olib/dictionary/dictionary.rb', line 161

def Dictionary.spiked
  /You also notice that it is spiked./i
end

.tagObject



12
13
14
# File 'lib/Olib/dictionary/dictionary.rb', line 12

def Dictionary.tag
  /<a exist="(?<id>.*?)" noun="(?<noun>.*?)">(?<name>.*?)<\/a>/
end

.targetableObject



24
25
26
27
28
29
# File 'lib/Olib/dictionary/dictionary.rb', line 24

def Dictionary.targetable
  re = {}
  re[:yes] = /^You are now targeting/
  re[:no]  = /^You can't target/
  re
end