Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.stats.ExperienceTable Class Reference

Stores experience <-> level mappings. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.stats.ExperienceTable:

Public Member Functions

long getExperienceToNextLevel (final int currentLevel, final long currentExp)
 Returns the experience needed to reach the next level. More...
 
int getPercentsToNextLevel (final int currentLevel, final long currentExp)
 Returns the experience fraction of the current level in percents. More...
 
void setExpTable (@NotNull final long[] expTable)
 Updates the experience table information. More...
 

Private Member Functions

void add (final int level, final long exp)
 Adds a new level->experience mapping. More...
 
void clear ()
 Forgets about all level-$> mappings. More...
 
long getExperience (final int level)
 Returns the experience needed for a given level. More...
 

Private Attributes

final Map< Integer, Long > info = new HashMap<>()
 Maps level to experience needed to reach the level. More...
 
int maxLevel
 The maximum level value in info. More...
 
int minLevel
 The minimum level value in info. More...
 

Detailed Description

Stores experience <-> level mappings.

Author
Andreas Kirschbaum

Definition at line 32 of file ExperienceTable.java.

Member Function Documentation

◆ add()

void com.realtime.crossfire.jxclient.stats.ExperienceTable.add ( final int  level,
final long  exp 
)
private

Adds a new level->experience mapping.

Parameters
levelthe level to update
expthe experience needed to reach level
level

Definition at line 64 of file ExperienceTable.java.

Referenced by com.realtime.crossfire.jxclient.stats.ExperienceTable.setExpTable().

+ Here is the caller graph for this function:

◆ clear()

void com.realtime.crossfire.jxclient.stats.ExperienceTable.clear ( )
private

Forgets about all level-$> mappings.

Definition at line 53 of file ExperienceTable.java.

Referenced by com.realtime.crossfire.jxclient.stats.ExperienceTable.setExpTable().

+ Here is the caller graph for this function:

◆ getExperience()

long com.realtime.crossfire.jxclient.stats.ExperienceTable.getExperience ( final int  level)
private

Returns the experience needed for a given level.

Parameters
levelthe level to reach
Returns
the needed experience

Definition at line 83 of file ExperienceTable.java.

References com.realtime.crossfire.jxclient.stats.ExperienceTable.maxLevel.

Referenced by com.realtime.crossfire.jxclient.stats.ExperienceTable.getExperienceToNextLevel(), and com.realtime.crossfire.jxclient.stats.ExperienceTable.getPercentsToNextLevel().

+ Here is the caller graph for this function:

◆ getExperienceToNextLevel()

long com.realtime.crossfire.jxclient.stats.ExperienceTable.getExperienceToNextLevel ( final int  currentLevel,
final long  currentExp 
)

Returns the experience needed to reach the next level.

Parameters
currentLevelthe current level
currentExpthe current experience
Returns
the experience to reach level
currentLevel+1

Definition at line 117 of file ExperienceTable.java.

References com.realtime.crossfire.jxclient.stats.ExperienceTable.getExperience().

Referenced by com.realtime.crossfire.jxclient.stats.Stats.calculateExperienceToNextLevel(), and com.realtime.crossfire.jxclient.gui.gauge.GaugeUpdater.getExperienceToNextLevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPercentsToNextLevel()

int com.realtime.crossfire.jxclient.stats.ExperienceTable.getPercentsToNextLevel ( final int  currentLevel,
final long  currentExp 
)

Returns the experience fraction of the current level in percents.

The value starts at 0% when a new level has been gained; the next level is at 100%.

Parameters
currentLevelthe current level
currentExpthe current experience
Returns
the experience fraction

Definition at line 130 of file ExperienceTable.java.

References com.realtime.crossfire.jxclient.stats.ExperienceTable.getExperience().

Referenced by com.realtime.crossfire.jxclient.gui.gauge.GaugeUpdater.getPercentsToNextLevel().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setExpTable()

void com.realtime.crossfire.jxclient.stats.ExperienceTable.setExpTable ( @NotNull final long []  expTable)

Updates the experience table information.

Parameters
expTablethe new experience table

Definition at line 151 of file ExperienceTable.java.

References com.realtime.crossfire.jxclient.stats.ExperienceTable.add(), and com.realtime.crossfire.jxclient.stats.ExperienceTable.clear().

Referenced by com.realtime.crossfire.jxclient.server.crossfire.DefaultCrossfireServerConnection.processExpTableReplyinfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ info

final Map<Integer, Long> com.realtime.crossfire.jxclient.stats.ExperienceTable.info = new HashMap<>()
private

Maps level to experience needed to reach the level.

Definition at line 38 of file ExperienceTable.java.

◆ maxLevel

int com.realtime.crossfire.jxclient.stats.ExperienceTable.maxLevel
private

The maximum level value in info.

Definition at line 48 of file ExperienceTable.java.

Referenced by com.realtime.crossfire.jxclient.stats.ExperienceTable.getExperience().

◆ minLevel

int com.realtime.crossfire.jxclient.stats.ExperienceTable.minLevel
private

The minimum level value in info.

Definition at line 43 of file ExperienceTable.java.


The documentation for this class was generated from the following file: