Class: Lich::Gemstone::Society

Inherits:
Object
  • Object
show all
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.

Class Method Summary collapse

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.

Parameters:

  • target_class (Class)

    the class to define methods on.

  • data (Hash)

    the data containing names to define methods for.



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

.favorString

Deprecated.

Use OrderOfVoln.OrderOfVoln.favor instead.

Retrieves the favor of the Order of Voln. This method is deprecated. Use OrderOfVoln.OrderOfVoln.favor instead.

Returns:

  • (String)

    the favor of the Order of Voln.



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.

Parameters:

  • name (String)

    the name to look up.

  • lookups (Array<Hash>)

    the list of lookups to search through.

Returns:

  • (Hash, nil)

    the found entry or nil if not found.



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

.memberString

Deprecated.

Use membership instead.

Retrieves the current membership status of the society. This method is deprecated. Use membership instead.

Returns:

  • (String)

    the membership status.



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

.membershipString

Retrieves the current membership status of the society.

Returns:

  • (String)

    the membership status.



16
17
18
# File 'documented/gemstone/society.rb', line 16

def self.membership
  Infomon.get("society.status")
end

.rankString

Retrieves the current rank of the society.

Returns:

  • (String)

    the society rank.



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.

Parameters:

  • value (Object)

    the value to resolve.

  • context (Object, nil) (defaults to: nil)

    optional context for the callable.

Returns:

  • (Object)

    the resolved value.



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

.serializeArray<String>

Serializes the current membership and rank of the society into an array.

Returns:

  • (Array<String>)

    an array containing the membership status and rank.



44
45
46
# File 'documented/gemstone/society.rb', line 44

def self.serialize
  [self.membership, self.rank]
end

.statusString

Retrieves the current status of the society.

Returns:

  • (String)

    the society status.



23
24
25
# File 'documented/gemstone/society.rb', line 23

def self.status
  self.membership
end

.stepString

Deprecated.

Use rank instead.

Retrieves the current rank of the society. This method is deprecated. Use rank instead.

Returns:

  • (String)

    the society rank.



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

.taskString

Retrieves the current task assigned to the society.

Returns:

  • (String)

    the society task.



37
38
39
# File 'documented/gemstone/society.rb', line 37

def self.task
  XMLData.society_task
end