Module: Lich::Gemstone::Experience

Defined in:
documented/gemstone/experience.rb

Overview

Provides methods to access experience-related data

Examples:

Accessing experience data

Lich::Gemstone::Experience.fame

Class Method Summary collapse

Class Method Details

.axpInteger

Retrieves the current ascension experience

Examples:

Lich::Gemstone::Experience.axp

Returns:

  • (Integer)

    The current ascension experience



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:

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 number of deeds

Examples:

Lich::Gemstone::Experience.deeds

Returns:

  • (Integer)

    The number of deeds



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

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

.expInteger

Retrieves the current experience

Examples:

Lich::Gemstone::Experience.exp

Returns:

  • (Integer)

    The current experience



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

def self.exp
  Stats.exp
end

.fameInteger

Retrieves the current fame value

Examples:

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

Examples:

Lich::Gemstone::Experience.fxp_current

Returns:

  • (Integer)

    The current field experience



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

Examples:

Lich::Gemstone::Experience.fxp_max

Returns:

  • (Integer)

    The maximum field experience



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

Examples:

Lich::Gemstone::Experience.lte

Returns:

  • (Integer)

    The long-term experience



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 to total experience

Examples:

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 to total experience

Examples:

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 to maximum field experience

Examples:

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 recently updated based on a given threshold

Examples:

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

Parameters:

  • threshold (ActiveSupport::Duration) (defaults to: 5.minutes)

    The duration threshold to check against

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 a given threshold

Examples:

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

Parameters:

  • threshold (ActiveSupport::Duration) (defaults to: 24.hours)

    The duration threshold to check against

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

Examples:

Lich::Gemstone::Experience.txp

Returns:

  • (Integer)

    The total experience



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

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

.updated_atTime?

Retrieves the last updated timestamp for total experience

Examples:

Lich::Gemstone::Experience.updated_at

Returns:

  • (Time, nil)

    The last updated time 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