Class: Rummage

Inherits:
Object
  • Object
show all
Defined in:
lib/Olib/core/container.rb

Constant Summary collapse

SUCCESS =
/and remove/
FAIL =
/but can't seem|^But your hands are full|^You can only rummage for|^What/
@@message =
OpenStruct.new(
  success: SUCCESS,
  fail: FAIL,
  either: SUCCESS.or(FAIL)
)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(container) ⇒ Rummage


207
208
209
# File 'lib/Olib/core/container.rb', line 207

def initialize(container)
  @container = container
end

Instance Attribute Details

#containerObject

Returns the value of attribute container


205
206
207
# File 'lib/Olib/core/container.rb', line 205

def container
  @container
end

Class Method Details

.messageObject


201
202
203
# File 'lib/Olib/core/container.rb', line 201

def Rummage.message
  @@message
end

Instance Method Details

#holy(tier) ⇒ Object


228
229
230
# File 'lib/Olib/core/container.rb', line 228

def holy(tier)
  perform "holy", tier
end

#ingredient(str) ⇒ Object


224
225
226
# File 'lib/Olib/core/container.rb', line 224

def ingredient(str)
  perform "ingredient", str
end

#perform(mod, query) ⇒ Object


211
212
213
214
# File 'lib/Olib/core/container.rb', line 211

def perform(mod, query)
  res = Olib.do "rummage ##{@container.id} #{mod} #{query}", Rummage.message.either
  [!res.match(FAIL), res]
end

#runestone(rune) ⇒ Object


220
221
222
# File 'lib/Olib/core/container.rb', line 220

def runestone(rune)
  perform "runestone", rune
end

#spell(number) ⇒ Object


216
217
218
# File 'lib/Olib/core/container.rb', line 216

def spell(number)
  perform "spell", number
end