Class Integer

  1. lib/nwn/twoda.rb
Parent: Object

Methods

public instance

  1. level_to_xp
  2. xp_to_level

Public instance methods

level_to_xp ()

Returns the amount of experience that this level resolves to. Depends on a set-up TwoDA::Cache, and reads from exptable.

[show source]
    # File lib/nwn/twoda.rb, line 16
16:   def level_to_xp
17:     NWN::TwoDA.get('exptable').by_col("XP", self - 1).to_i
18:   end
xp_to_level ()

Returns the level that this amount experience resolves to. Depends on a set-up TwoDA::Cache, and reads from exptable.

[show source]
    # File lib/nwn/twoda.rb, line 6
 6:   def xp_to_level
 7:     NWN::TwoDA.get('exptable').rows.each {|row|
 8:       level, exp = row.Level.to_i, row.XP.to_i
 9:       return level - 1 if exp > self
10:     }
11:     return nil
12:   end