Class: Jewel
Overview
Class to interact with gems overwriting Gem is a bad idea
Constant Summary
Constants inherited from Exist
Instance Attribute Summary collapse
-
#quality ⇒ Object
Returns the value of attribute quality.
-
#value ⇒ Object
Returns the value of attribute value.
Attributes inherited from Item
Attributes inherited from Exist
Instance Method Summary collapse
Methods inherited from Item
fetch, #held?, #initialize, of, #stash, #take, #to_json, #transaction, #use, #worn?
Methods inherited from Exist
#==, #deconstruct_keys, #effects, #exists?, #fetch, fetch, #gone?, #initialize, #method_missing, normalize_type_data, #respond_to_missing?, scan, #tags, #to_h, #to_s
Constructor Details
This class inherits a constructor from Item
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Exist
Instance Attribute Details
#quality ⇒ Object
Returns the value of attribute quality.
4 5 6 |
# File 'lib/Olib/objects/jewel.rb', line 4 def quality @quality end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/Olib/objects/jewel.rb', line 4 def value @value end |
Instance Method Details
#appraise ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/Olib/objects/jewel.rb', line 6 def appraise result = dothistimeout "appraise ##{@id}", 3, /#{Dictionary.gems[:appraise].values.join('|')}/ case result when Dictionary.gems[:appraise][:gemshop] # handle gemshop appraisal @value = $1.to_i when Dictionary.gems[:appraise][:player] @value = $3.to_i @quality = $2 when Dictionary.gems[:appraise][:failure] waitrt? self.appraise else respond result Client.notify "Error during gem appraisal" end end |
#normalized_name ⇒ Object
24 25 26 |
# File 'lib/Olib/objects/jewel.rb', line 24 def normalized_name Dictionary.gems[:singularize].call(@name) end |
#sell ⇒ Object
28 29 30 31 |
# File 'lib/Olib/objects/jewel.rb', line 28 def sell result = take fput "sell ##{@id}" if result =~ Dictionary.get[:success] end |