Class: Integer
- Inherits:
-
Object
- Object
- Integer
- Defined in:
- lib/nwn/twoda.rb
Instance Method Summary collapse
-
#level_to_xp ⇒ Object
Returns the amount of experience that this level resolves to.
-
#xp_to_level ⇒ Object
Returns the level that this amount experience resolves to.
Instance Method Details
#level_to_xp ⇒ Object
Returns the amount of experience that this level resolves to. Depends on a set-up TwoDA::Cache, and reads from exptable
.
16 17 18 |
# File 'lib/nwn/twoda.rb', line 16 def level_to_xp NWN::TwoDA.get('exptable').by_col("XP", self - 1).to_i end |
#xp_to_level ⇒ Object
Returns the level that this amount experience resolves to. Depends on a set-up TwoDA::Cache, and reads from exptable
.
6 7 8 9 10 11 12 |
# File 'lib/nwn/twoda.rb', line 6 def xp_to_level NWN::TwoDA.get('exptable').rows.each {|row| level, exp = row.Level.to_i, row.XP.to_i return level - 1 if exp > self } return nil end |