java.lang.Objectcom.realtime.crossfire.jxclient.stats.Stats
public class Stats
This is the representation of all the statistics of a player, like its speed or its experience.
Constants named C_STAT_xxx are client-sided; constants named
 CS_STAT_xxx are stats as sent by the server.
| Field Summary | |
|---|---|
private  java.lang.String | 
activeSkill
The active skill name.  | 
private  CrossfireStatsListener | 
crossfireStatsListener
The CrossfireStatsListener attached to the server connection for
 detecting stat changes. | 
private  long | 
exp
The total experience.  | 
private  ExperienceTable | 
experienceTable
The ExperienceTable instance to use. | 
private  long | 
expNextLevel
The experience needed to reach the next level.  | 
private  GuiStateListener | 
guiStateListener
The GuiStateListener for detecting established or dropped
 connections. | 
private  java.lang.String | 
range
The current value of the range stat.  | 
private  boolean | 
simpleWeaponSpeed
Whether the CrossfireStatsListener.CS_STAT_WEAP_SP value contains
 the weapon speed directly. | 
private  SkillSet | 
skillSet
The SkillSet instance to use. | 
private  int[] | 
stats
The current stat values.  | 
private  java.util.Collection<StatsListener> | 
statsListeners
The listeners to inform of stat changes.  | 
private  java.lang.String | 
title
The current value of the title stat.  | 
| Constructor Summary | |
|---|---|
Stats(CrossfireServerConnection crossfireServerConnection,
      ExperienceTable experienceTable,
      SkillSet skillSet,
      GuiStateManager guiStateManager)
Creates a new instance.  | 
|
| Method Summary | |
|---|---|
 void | 
addCrossfireStatsListener(StatsListener statsListener)
Adds a StatsListener to be notified about stat changes. | 
private  void | 
calculateExperienceToNextLevel()
Calculates experience needed to reach the next level.  | 
 java.lang.String | 
getActiveSkill()
Returns the active skill name.  | 
 long | 
getExperience()
Returns the amount of global experience.  | 
 long | 
getExperienceNextLevel()
Returns the experience needed to reach the next level.  | 
 double | 
getFloatStat(int statNo)
Returns the numerical value of the given statistic.  | 
 java.lang.String | 
getRange()
Returns the current content of the range stat.  | 
 int | 
getStat(int statNo)
Returns the numerical value of the given statistic.  | 
 java.lang.String | 
getTitle()
Returns the current title.  | 
 double | 
getWeaponSpeed()
Returns the weapon speed stat.  | 
 void | 
removeCrossfireStatsListener(StatsListener statsListener)
Removes a StatsListener to be notified about stat changes. | 
private  void | 
reset()
Forgets about all stats.  | 
 void | 
setActiveSkill(java.lang.String activeSkill)
Sets the active skill name.  | 
private  void | 
setExperience(long exp)
Sets the amount of global experience.  | 
private  void | 
setRange(java.lang.String range)
Sets the current value for the Range - this is basically the currently active skill for the player.  | 
private  void | 
setSimpleWeaponSpeed(boolean simpleWeaponSpeed)
Sets whether the CrossfireStatsListener.CS_STAT_WEAP_SP value
 contains the weapon speed directly. | 
 void | 
setStat(int statNo,
        int value)
Sets the given statistic numerical value.  | 
private  void | 
setTitle(java.lang.String title)
Sets the current Title.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Field Detail | 
|---|
@NotNull private java.lang.String activeSkill
@NotNull private final CrossfireStatsListener crossfireStatsListener
CrossfireStatsListener attached to the server connection for
 detecting stat changes.
private long exp
@NotNull private final ExperienceTable experienceTable
ExperienceTable instance to use.
private long expNextLevel
@NotNull private final GuiStateListener guiStateListener
GuiStateListener for detecting established or dropped
 connections.
@NotNull private java.lang.String range
private boolean simpleWeaponSpeed
CrossfireStatsListener.CS_STAT_WEAP_SP value contains
 the weapon speed directly.
@NotNull private final SkillSet skillSet
SkillSet instance to use.
@NotNull private final int[] stats
@NotNull private final java.util.Collection<StatsListener> statsListeners
@NotNull private java.lang.String title
| Constructor Detail | 
|---|
public Stats(@NotNull
             CrossfireServerConnection crossfireServerConnection,
             @NotNull
             ExperienceTable experienceTable,
             @NotNull
             SkillSet skillSet,
             @NotNull
             GuiStateManager guiStateManager)
crossfireServerConnection - the connection to monitorexperienceTable - the experience table instance to useskillSet - the skill set instance to useguiStateManager - the gui state manager to watch| Method Detail | 
|---|
public void addCrossfireStatsListener(@NotNull
                                      StatsListener statsListener)
StatsListener to be notified about stat changes.
statsListener - the listener to addprivate void calculateExperienceToNextLevel()
@NotNull public java.lang.String getActiveSkill()
public long getExperience()
public long getExperienceNextLevel()
public double getFloatStat(int statNo)
statNo - the stat identifier. See the CS_STAT constants
@NotNull public java.lang.String getRange()
public int getStat(int statNo)
statNo - the stat identifier. See the CS_STAT constants
@NotNull public java.lang.String getTitle()
public double getWeaponSpeed()
public void removeCrossfireStatsListener(@NotNull
                                         StatsListener statsListener)
StatsListener to be notified about stat changes.
statsListener - the listener to removeprivate void reset()
public void setActiveSkill(@NotNull
                           java.lang.String activeSkill)
activeSkill - the active skill nameprivate void setExperience(long exp)
exp - The new amount of global experience.
private void setRange(@NotNull
                      java.lang.String range)
range - the new content of rangeprivate void setSimpleWeaponSpeed(boolean simpleWeaponSpeed)
CrossfireStatsListener.CS_STAT_WEAP_SP value
 contains the weapon speed directly.
simpleWeaponSpeed - whether CS_STAT_WEAP_SP is the
 weapon speed value
public void setStat(int statNo,
                    int value)
statNo - the stat identifier. See the CS_STAT constantsvalue - the value to assign to the chosen statistic
private void setTitle(@NotNull
                      java.lang.String title)
title - the new Title content