Module: Lich::Gemstone::Experience

Defined in:
documented/gemstone/experience.rb

Overview

Namespace for character experience, field experience, and related bonuses tracked by the game server.

Class Method Summary collapse

Class Method Details

.axpInteger

Returns the character's current ascension experience (AXP).

Returns:

  • (Integer)

    the ascension experience points



42
43
44
# File 'documented/gemstone/experience.rb', line 42

def self.axp
  XMLData.ascension_exp
end

.deaths_stingInteger?

Returns the character's deaths sting value, representing a temporary experience penalty.

Returns:

  • (Integer, nil)

    the deaths sting value, or nil if not yet received from the server



107
108
109
# File 'documented/gemstone/experience.rb', line 107

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

.deedsInteger?

Returns the character's completed deeds value.

Returns:

  • (Integer, nil)

    the deeds count, or nil if not yet received from the server



100
101
102
# File 'documented/gemstone/experience.rb', line 100

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

.expInteger

Returns the character's current total experience (EXP), excluding ascension experience.

Returns:

  • (Integer)

    the total experience points



35
36
37
# File 'documented/gemstone/experience.rb', line 35

def self.exp
  XMLData.exp
end

.fameInteger?

Returns the character's current fame value.

Examples:

Lich::Gemstone::Experience.fame #=> 42

Returns:

  • (Integer, nil)

    the fame value, or nil if not yet received from the server



14
15
16
# File 'documented/gemstone/experience.rb', line 14

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

.fashlonae?Boolean

fashlonae has three states on the mindState bar: absent (no orb redeemed), 1 (redeemed but not active), and 2 (redeemed and active). fashlonae? reports whether the bonus is active; fashlonae_redeemed? reports whether an orb has been redeemed at all.

Returns:

  • (Boolean)


143
144
145
# File 'documented/gemstone/experience.rb', line 143

def self.fashlonae?
  XMLData.fashlonae.eql?(2)
end

.fashlonae_redeemed?Boolean

Returns whether a Fashlonae orb has been redeemed, regardless of whether it is currently active.

Returns:

  • (Boolean)

    true if an orb has been redeemed, false otherwise

See Also:



151
152
153
# File 'documented/gemstone/experience.rb', line 151

def self.fashlonae_redeemed?
  !XMLData.fashlonae.nil?
end

.fxp_currentInteger

Returns the character's current field experience (FXP).

Returns:

  • (Integer)

    the current field experience points



21
22
23
# File 'documented/gemstone/experience.rb', line 21

def self.fxp_current
  XMLData.field_exp
end

.fxp_maxInteger

Returns the character's maximum field experience (FXP) for the current field rank.

Returns:

  • (Integer)

    the maximum field experience points



28
29
30
# File 'documented/gemstone/experience.rb', line 28

def self.fxp_max
  XMLData.max_field_exp
end

.lteInteger?

Returns the character's long-term experience (LTE) bonus value.

Returns:

  • (Integer, nil)

    the long-term experience value, or nil if not yet received from the server



93
94
95
# File 'documented/gemstone/experience.rb', line 93

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

.lumnisInteger?

Returns the character's current Lumnis bonus value.

Returns:

  • (Integer, nil)

    the Lumnis value, or nil if the bonus has not been redeemed



135
136
137
# File 'documented/gemstone/experience.rb', line 135

def self.lumnis
  XMLData.lumnis
end

.lumnis?Boolean

Returns whether the Lumnis bonus is active.

Returns:

  • (Boolean)

    true if Lumnis is active, false otherwise



128
129
130
# File 'documented/gemstone/experience.rb', line 128

def self.lumnis?
  !XMLData.lumnis.nil?
end

.next_atpObject

Ascension experience remaining until the next ascension training point. One ATP is earned per 50,000 ascension experience, so at an exact multiple this reports a full 50,000 interval to the next point.



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

def self.next_atp
  50_000 - (axp % 50_000)
end

.percent_axpFloat

Returns the character's ascension experience as a percentage of total experience.

Returns:

  • (Float)

    the percentage between 0.0 and 100.0



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

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

.percent_expFloat

Returns the character's experience as a percentage of total experience.

Returns:

  • (Float)

    the percentage between 0.0 and 100.0



86
87
88
# File 'documented/gemstone/experience.rb', line 86

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

.percent_fxpFloat

Returns the character's field experience as a percentage of the maximum for the current rank.

Returns:

  • (Float)

    the percentage between 0.0 and 100.0



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

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

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

Returns whether the experience data was updated within the given threshold.

Examples:

Lich::Gemstone::Experience.recently_updated?(threshold: 30.seconds) #=> true

Parameters:

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

    the recency threshold; defaults to 5 minutes

Returns:

  • (Boolean)

    true if data was recently updated, false if data is stale or has never been received



180
181
182
183
# File 'documented/gemstone/experience.rb', line 180

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

.rpaInteger?

Returns the character's current Rank Point Adjustment (RPA) value.

Returns:

  • (Integer, nil)

    the RPA value, or nil if the bonus has not been redeemed



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

def self.rpa
  XMLData.rpa
end

.rpa?Boolean

Returns whether the Rank Point Adjustment (RPA) bonus is active.

Returns:

  • (Boolean)

    true if RPA is active, false otherwise



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

def self.rpa?
  !XMLData.rpa.nil?
end

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

Returns whether the experience data is older than the given threshold.

Examples:

Lich::Gemstone::Experience.stale?(threshold: 1.hour) #=> false

Parameters:

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

    the age threshold; defaults to 24 hours

Returns:

  • (Boolean)

    true if data is stale or has never been received, false otherwise



169
170
171
172
# File 'documented/gemstone/experience.rb', line 169

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

.txpInteger

Returns the sum of the character's total experience and ascension experience.

Returns:

  • (Integer)

    the combined experience points

See Also:



51
52
53
# File 'documented/gemstone/experience.rb', line 51

def self.txp
  XMLData.exp + XMLData.ascension_exp
end

.until_nextInteger

Returns the total experience needed to reach the next experience level.

Returns:

  • (Integer)

    the experience points needed



58
59
60
# File 'documented/gemstone/experience.rb', line 58

def self.until_next
  XMLData.until_next
end

.updated_atTime?

Returns the timestamp when experience data was last updated by the server.

Returns:

  • (Time, nil)

    the last update time, or nil if experience data has not been received



158
159
160
161
# File 'documented/gemstone/experience.rb', line 158

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