Module: Lich::Gemstone::Experience

Defined in:
documented/gemstone/experience.rb

Overview

The Experience module provides methods to access and calculate experience-related data.

See Also:

Class Method Summary collapse

Class Method Details

.axpInteger

Retrieves the current ascension experience value.

Examples:

Get current ascension experience

Lich::Gemstone::Experience.axp

Returns:

  • (Integer)

    the current ascension experience value.



48
49
50
# File 'documented/gemstone/experience.rb', line 48

def self.axp
  Infomon.get("experience.ascension_experience")
end

.deaths_stingInteger

Retrieves the deaths sting value.

Examples:

Get deaths sting

Lich::Gemstone::Experience.deaths_sting

Returns:

  • (Integer)

    the deaths sting value.



104
105
106
# File 'documented/gemstone/experience.rb', line 104

def self.deaths_sting
  Infomon.get("experience.deaths_sting")
end

.deedsInteger

Retrieves the deeds value.

Examples:

Get deeds

Lich::Gemstone::Experience.deeds

Returns:

  • (Integer)

    the deeds value.



96
97
98
# File 'documented/gemstone/experience.rb', line 96

def self.deeds
  Infomon.get("experience.deeds")
end

.expInteger

Retrieves the current experience value.

Examples:

Get current experience

Lich::Gemstone::Experience.exp

Returns:

  • (Integer)

    the current experience value.



40
41
42
# File 'documented/gemstone/experience.rb', line 40

def self.exp
  Stats.exp
end

.fameInteger

Retrieves the current fame value.

Examples:

Get current fame

Lich::Gemstone::Experience.fame

Returns:

  • (Integer)

    the current fame value.



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

def self.fame
  Infomon.get("experience.fame")
end

.fxp_currentInteger

Retrieves the current field experience value.

Examples:

Get current field experience

Lich::Gemstone::Experience.fxp_current

Returns:

  • (Integer)

    the current field experience value.



24
25
26
# File 'documented/gemstone/experience.rb', line 24

def self.fxp_current
  Infomon.get("experience.field_experience_current")
end

.fxp_maxInteger

Retrieves the maximum field experience value.

Examples:

Get maximum field experience

Lich::Gemstone::Experience.fxp_max

Returns:

  • (Integer)

    the maximum field experience value.



32
33
34
# File 'documented/gemstone/experience.rb', line 32

def self.fxp_max
  Infomon.get("experience.field_experience_max")
end

.lteInteger

Retrieves the long-term experience value.

Examples:

Get long-term experience

Lich::Gemstone::Experience.lte

Returns:

  • (Integer)

    the long-term experience value.



88
89
90
# File 'documented/gemstone/experience.rb', line 88

def self.lte
  Infomon.get("experience.long_term_experience")
end

.percent_axpFloat

Calculates the percentage of ascension experience relative to total experience.

Examples:

Get percentage of ascension experience

Lich::Gemstone::Experience.percent_axp

Returns:

  • (Float)

    the percentage of ascension experience.



72
73
74
# File 'documented/gemstone/experience.rb', line 72

def self.percent_axp
  (axp.to_f / txp.to_f) * 100
end

.percent_expFloat

Calculates the percentage of current experience relative to total experience.

Examples:

Get percentage of current experience

Lich::Gemstone::Experience.percent_exp

Returns:

  • (Float)

    the percentage of current experience.



80
81
82
# File 'documented/gemstone/experience.rb', line 80

def self.percent_exp
  (exp.to_f / txp.to_f) * 100
end

.percent_fxpFloat

Calculates the percentage of current field experience relative to maximum field experience.

Examples:

Get percentage of current field experience

Lich::Gemstone::Experience.percent_fxp

Returns:

  • (Float)

    the percentage of current field experience.



64
65
66
# File 'documented/gemstone/experience.rb', line 64

def self.percent_fxp
  (fxp_current.to_f / fxp_max.to_f) * 100
end

.recently_updated?(threshold: 5.minutes) ⇒ Boolean

Checks if the experience data was updated recently based on the given threshold.

Examples:

Check if experience data was recently updated

Lich::Gemstone::Experience.recently_updated?(5)

Parameters:

  • threshold (Integer) (defaults to: 5.minutes)

    the time threshold to check against in minutes.

Returns:

  • (Boolean)

    true if recently updated, false otherwise.



132
133
134
135
# File 'documented/gemstone/experience.rb', line 132

def self.recently_updated?(threshold: 5.minutes)
  return false unless updated_at
  updated_at >= threshold.ago
end

.stale?(threshold: 24.hours) ⇒ Boolean

Checks if the experience data is stale based on the given threshold.

Examples:

Check if experience data is stale

Lich::Gemstone::Experience.stale?(24)

Parameters:

  • threshold (Integer) (defaults to: 24.hours)

    the time threshold to check against in hours.

Returns:

  • (Boolean)

    true if stale, false otherwise.



122
123
124
125
# File 'documented/gemstone/experience.rb', line 122

def self.stale?(threshold: 24.hours)
  return true unless updated_at
  updated_at < threshold.ago
end

.txpInteger

Retrieves the total experience value.

Examples:

Get total experience

Lich::Gemstone::Experience.txp

Returns:

  • (Integer)

    the total experience value.



56
57
58
# File 'documented/gemstone/experience.rb', line 56

def self.txp
  Infomon.get("experience.total_experience")
end

.updated_atTime?

Retrieves the timestamp of the last update for total experience.

Examples:

Get last updated timestamp

Lich::Gemstone::Experience.updated_at

Returns:

  • (Time, nil)

    the last updated timestamp or nil if not available.



112
113
114
115
# File 'documented/gemstone/experience.rb', line 112

def self.updated_at
  timestamp = Infomon.get_updated_at("experience.total_experience")
  timestamp ? Time.at(timestamp) : nil
end