Class: Lich::Gemstone::Society
- Inherits:
-
Object
- Object
- Lich::Gemstone::Society
- Defined in:
- documented/gemstone/society.rb
Overview
Represents a society within the Lich game.
This class provides methods to access society-related information such as membership, status, rank, and tasks.
Direct Known Subclasses
Lich::Gemstone::Societies::CouncilOfLight, Lich::Gemstone::Societies::GuardiansOfSunfist, Lich::Gemstone::Societies::OrderOfVoln
Class Method Summary collapse
-
.define_name_methods(target_class, data) ⇒ void
Defines name methods on the target class based on provided data.
-
.favor ⇒ String
deprecated
Deprecated.
Use OrderOfVoln.OrderOfVoln.favor instead.
-
.lookup(name, lookups) ⇒ Hash?
Looks up a name in the provided list of lookups.
-
.member ⇒ String
deprecated
Deprecated.
Use Society.membership instead.
-
.membership ⇒ String
Retrieves the current membership status of the society.
-
.rank ⇒ String
Retrieves the current rank of the society.
-
.resolve(value, context = nil) ⇒ Object
Resolves a value, calling it if it's a callable object.
-
.serialize ⇒ Array<String>
Serializes the current membership and rank of the society into an array.
-
.status ⇒ String
Retrieves the current status of the society.
-
.step ⇒ String
deprecated
Deprecated.
Use Society.rank instead.
-
.task ⇒ String
Retrieves the current task assigned to the society.
Class Method Details
.define_name_methods(target_class, data) ⇒ void
This method returns an undefined value.
Defines name methods on the target class based on provided data.
115 116 117 118 119 120 121 122 123 |
# File 'documented/gemstone/society.rb', line 115 def self.define_name_methods(target_class, data) data.values.each do |entry| short_method = Lich::Util.normalize_name(entry[:short_name]) long_method = Lich::Util.normalize_name(entry[:long_name]) target_class.define_singleton_method(short_method) { target_class[entry[:short_name]] } target_class.define_singleton_method(long_method) { target_class[entry[:short_name]] } end end |
.favor ⇒ String
Use OrderOfVoln.OrderOfVoln.favor instead.
Retrieves the favor of the Order of Voln. This method is deprecated. Use OrderOfVoln.OrderOfVoln.favor instead.
77 78 79 80 81 |
# File 'documented/gemstone/society.rb', line 77 def self.favor Lich.deprecated("Society.favor", "Society::OrderOfVoln.favor", caller[0], fe_log: false) # Infomon.get('resources.voln_favor') Societies::OrderOfVoln.favor end |
.lookup(name, lookups) ⇒ Hash?
Looks up a name in the provided list of lookups.
88 89 90 91 92 93 94 95 96 97 |
# File 'documented/gemstone/society.rb', line 88 def self.lookup(name, lookups) normalized = Lich::Util.normalize_name(name) lookups.find do |entry| [entry[:short_name], entry[:long_name]] .compact .map { |n| Lich::Util.normalize_name(n) } .include?(normalized) end end |
.member ⇒ String
Use membership instead.
Retrieves the current membership status of the society. This method is deprecated. Use membership instead.
57 58 59 60 |
# File 'documented/gemstone/society.rb', line 57 def self.member Lich.deprecated("Society.member", "Society.membership", caller[0], fe_log: false) self.membership end |
.membership ⇒ String
Retrieves the current membership status of the society.
16 17 18 |
# File 'documented/gemstone/society.rb', line 16 def self.membership Infomon.get("society.status") end |
.rank ⇒ String
Retrieves the current rank of the society.
30 31 32 |
# File 'documented/gemstone/society.rb', line 30 def self.rank Infomon.get("society.rank") end |
.resolve(value, context = nil) ⇒ Object
Resolves a value, calling it if it's a callable object.
104 105 106 107 108 |
# File 'documented/gemstone/society.rb', line 104 def self.resolve(value, context = nil) return value.call if value.respond_to?(:call) && value.arity == 0 return value.call(context) if value.respond_to?(:call) && value.arity == 1 value end |
.serialize ⇒ Array<String>
Serializes the current membership and rank of the society into an array.
44 45 46 |
# File 'documented/gemstone/society.rb', line 44 def self.serialize [self.membership, self.rank] end |
.status ⇒ String
Retrieves the current status of the society.
23 24 25 |
# File 'documented/gemstone/society.rb', line 23 def self.status self.membership end |
.step ⇒ String
67 68 69 70 |
# File 'documented/gemstone/society.rb', line 67 def self.step Lich.deprecated("Society.step", "Society.rank", caller[0], fe_log: false) self.rank end |
.task ⇒ String
Retrieves the current task assigned to the society.
37 38 39 |
# File 'documented/gemstone/society.rb', line 37 def self.task XMLData.society_task end |