Module: Lich::Gemstone::Stats
- Defined in:
- lib/attributes/stats.rb
Constant Summary collapse
- @@stats =
%i(strength constitution dexterity agility discipline aura logic intuition wisdom influence)
Class Method Summary collapse
-
.age ⇒ Integer
Retrieves the age of the character.
-
.exp ⇒ Integer
Calculates the experience points needed to reach the next level.
-
.gender ⇒ String
Retrieves the gender of the character.
-
.level ⇒ Integer
Retrieves the level of the character.
-
.prof ⇒ String
Retrieves the profession of the character (alias for profession).
-
.profession ⇒ String
Retrieves the profession of the character.
-
.race ⇒ String
Retrieves the race of the character.
-
.serialize ⇒ Array
Serializes the character’s stats into an array.
Class Method Details
.age ⇒ Integer
Retrieves the age of the character.
52 53 54 |
# File 'lib/attributes/stats.rb', line 52 def self.age Infomon.get("stat.age") end |
.exp ⇒ Integer
Calculates the experience points needed to reach the next level.
120 121 122 123 124 125 126 127 |
# File 'lib/attributes/stats.rb', line 120 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 |
.gender ⇒ String
Retrieves the gender of the character.
42 43 44 |
# File 'lib/attributes/stats.rb', line 42 def self.gender Infomon.get("stat.gender") end |
.level ⇒ Integer
Retrieves the level of the character.
62 63 64 |
# File 'lib/attributes/stats.rb', line 62 def self.level XMLData.level end |
.prof ⇒ String
Retrieves the profession of the character (alias for profession).
32 33 34 |
# File 'lib/attributes/stats.rb', line 32 def self.prof self.profession end |
.profession ⇒ String
Retrieves the profession of the character.
22 23 24 |
# File 'lib/attributes/stats.rb', line 22 def self.profession Infomon.get("stat.profession") end |
.race ⇒ String
Retrieves the race of the character.
12 13 14 |
# File 'lib/attributes/stats.rb', line 12 def self.race Infomon.get("stat.race") end |
.serialize ⇒ Array
Serializes the character’s stats into an array.
135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/attributes/stats.rb', line 135 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] end |