java.lang.Object com.realtime.crossfire.jxclient.stats.ExperienceTable
public class ExperienceTable
Stores experience <-> level mappings.
Field Summary | |
---|---|
private CrossfireExpTableListener |
crossfireExpTableListener
The CrossfireExpTableListener to receive updated experience
tables. |
private java.util.Map<java.lang.Integer,java.lang.Long> |
info
Maps level to experience needed to reach the level. |
private int |
maxLevel
The maximum level value in info . |
private int |
minLevel
The minimum level value in info . |
Constructor Summary | |
---|---|
ExperienceTable(CrossfireServerConnection crossfireServerConnection)
Creates a new instance. |
Method Summary | |
---|---|
private void |
add(int level,
long exp)
Add a new level->experience mapping. |
private void |
clear()
Forget about all level-$> mappings. |
private long |
getExperience(int level)
Return the experience needed for a given level. |
long |
getExperienceToNextLevel(int currentLevel,
long currentExp)
Return the experience needed to reach the next level. |
int |
getPercentsToNextLevel(int currentLevel,
long currentExp)
Return the experience fraction of the current level in percents. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
@NotNull private final CrossfireExpTableListener crossfireExpTableListener
CrossfireExpTableListener
to receive updated experience
tables.
@NotNull private final java.util.Map<java.lang.Integer,java.lang.Long> info
private int maxLevel
info
.
private int minLevel
info
.
Constructor Detail |
---|
public ExperienceTable(@NotNull CrossfireServerConnection crossfireServerConnection)
crossfireServerConnection
- the connection to monitorMethod Detail |
---|
private void add(int level, long exp)
level
- The level to update.exp
- The experience needed to reach level level
.private void clear()
private long getExperience(int level)
level
- The level to reach.
public long getExperienceToNextLevel(int currentLevel, long currentExp)
currentLevel
- The current level.currentExp
- The current experience.
currentLevel+1
.public int getPercentsToNextLevel(int currentLevel, long currentExp)
currentLevel
- The current level.currentExp
- The current experience.