Module: Lich::Gemstone::Stats

Defined in:
documented/attributes/stats.rb

Constant Summary collapse

@@stats =
%i(strength constitution dexterity agility discipline aura logic intuition wisdom influence)

Class Method Summary collapse

Class Method Details

.ageInteger

Retrieves the player's age.

Returns:

  • (Integer)

    the player's age



35
36
37
# File 'documented/attributes/stats.rb', line 35

def self.age
  Infomon.get("stat.age")
end

.expInteger

Calculates the experience points needed for the next level.

Returns:

  • (Integer)

    experience points until the next level



89
90
91
92
93
94
95
96
# File 'documented/attributes/stats.rb', line 89

def self.exp
  if XMLData.next_level_text =~ /until next level/
    exp_threshold = [2500, 5000, 10000, 17500, 27500, 40000, 55000, 72500, 92500, 115000, 140000, 167000, 197500, 230000, 265000, 302000, 341000, 382000, 425000, 470000, 517000, 566000, 617000, 670000, 725000, 781500, 839500, 899000, 960000, 1022500, 1086500, 1152000, 1219000, 1287500, 1357500, 1429000, 1502000, 1576500, 1652500, 1730000, 1808500, 1888000, 1968500, 2050000, 2132500, 2216000, 2300500, 2386000, 2472500, 2560000, 2648000, 2736500, 2825500, 2915000, 3005000, 3095500, 3186500, 3278000, 3370000, 3462500, 3555500, 3649000, 3743000, 3837500, 3932500, 4028000, 4124000, 4220500, 4317500, 4415000, 4513000, 4611500, 4710500, 4810000, 4910000, 5010500, 5111500, 5213000, 5315000, 5417500, 5520500, 5624000, 5728000, 5832500, 5937500, 6043000, 6149000, 6255500, 6362500, 6470000, 6578000, 6686500, 6795500, 6905000, 7015000, 7125500, 7236500, 7348000, 7460000, 7572500]
    exp_threshold[XMLData.level] - XMLData.next_level_text.slice(/[0-9]+/).to_i
  else
    XMLData.next_level_text.slice(/[0-9]+/).to_i
  end
end

.genderString

Retrieves the player's gender.

Returns:

  • (String)

    the player's gender



29
30
31
# File 'documented/attributes/stats.rb', line 29

def self.gender
  Infomon.get("stat.gender")
end

.levelInteger

Retrieves the player's level.

Returns:

  • (Integer)

    the player's level



41
42
43
# File 'documented/attributes/stats.rb', line 41

def self.level
  XMLData.level
end

.profString

Retrieves the player's profession (alias for #profession).

Returns:

  • (String)

    the player's profession



23
24
25
# File 'documented/attributes/stats.rb', line 23

def self.prof
  self.profession
end

.professionString

Retrieves the player's profession.

Returns:

  • (String)

    the player's profession



17
18
19
# File 'documented/attributes/stats.rb', line 17

def self.profession
  Infomon.get("stat.profession")
end

.raceString

Retrieves the player's race.

Returns:

  • (String)

    the player's race



11
12
13
# File 'documented/attributes/stats.rb', line 11

def self.race
  Infomon.get("stat.race")
end

.serializeArray<OpenStruct>

Serializes the player's stats into an array.

Returns:

  • (Array<OpenStruct>)

    array of player's stats



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# File 'documented/attributes/stats.rb', line 100

def self.serialize
  [self.race, self.prof, self.gender,
   self.age, self.exp, self.level,
   self.str, self.con, self.dex,
   self.agi, self.dis, self.aur,
   self.log, self.int, self.wis, self.inf,
   self.enhanced_str, self.enhanced_con, self.enhanced_dex,
   self.enhanced_agi, self.enhanced_dis, self.enhanced_aur,
   self.enhanced_log, self.enhanced_int, self.enhanced_wis,
   self.enhanced_inf,
   self.base_str, self.base_con, self.base_dex,
   self.base_agi, self.base_dis, self.base_aur,
   self.base_log, self.base_int, self.base_wis,
   self.base_inf]
end