Crossfire JXClient, Trunk
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 (final long @NotNull[] 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 33 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 65 of file ExperienceTable.java.

References com.realtime.crossfire.jxclient.stats.ExperienceTable.info, com.realtime.crossfire.jxclient.stats.ExperienceTable.maxLevel, and com.realtime.crossfire.jxclient.stats.ExperienceTable.minLevel.

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

◆ getExperience()

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

◆ 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 118 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 131 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 ( final long @NotNull[]  expTable)

Updates the experience table information.

Parameters
expTablethe new experience table

Definition at line 152 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

◆ maxLevel

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

◆ minLevel

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

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