 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.stats;
31 import java.util.Collection;
32 import java.util.HashSet;
33 import org.jetbrains.annotations.NotNull;
631 private final int @NotNull []
stats =
new int[268];
678 @SuppressWarnings(
"FieldCanBeLocal")
682 public void start() {
687 public void metaserver() {
692 public void preConnecting(@NotNull
final String serverInfo) {
697 public void connecting(@NotNull
final String serverInfo) {
702 public void connecting(@NotNull
final ClientSocketState clientSocketState, @NotNull
final String param) {
707 public void connected() {
712 public void connectFailed(@NotNull
final String reason) {
743 statsListener.simpleWeaponSpeedChanged(this.simpleWeaponSpeed);
752 statsListener.resetBefore();
754 for (
int statNo = 0; statNo <
stats.length; statNo++) {
762 statsListener.resetAfter();
772 return stats[statNo];
789 public void setStat(
final int statNo,
final int value) {
812 if (
stats[statNo] == value) {
816 stats[statNo] = value;
818 statsListener.statChanged(statNo,
stats[statNo]);
855 if (this.title.equals(
title)) {
861 statsListener.titleChanged(this.title);
870 if (this.godName.equals(
godName)) {
876 statsListener.godNameChanged(this.godName);
886 if (this.range.equals(
range)) {
892 statsListener.rangeChanged(this.range);
907 statsListener.activeSkillChanged(this.activeSkill);
924 if (this.exp ==
exp) {
930 statsListener.experienceChanged(this.exp);
985 if (weaponSpeed < 0.001) {
1139 public void setStatSkill(
final int stat,
final int level,
final long experience) {
1143 System.err.println(
"ignoring skill value for unknown skill "+stat);
1145 sk.
set(level, experience);
1159 System.err.println(
"Warning: unhandled stat "+stat+
" of type "+type);
String range
The current value of the range stat.
long getExperience()
Returns the amount of global experience.
static final int CS_STAT_DEX
The Dexterity Primary stat.
String title
The current value of the title stat.
static final int CS_STAT_POW
The Power Primary stat.
static final int CS_STAT_SPELL_ATTUNE
Attuned spell paths of a spell.
static final int CS_STAT_WEAP_SP
The Weapon Speed stat.
void reportUnhandledStat(final int stat, @NotNull final String type)
Report an unhandled stat value.
static final int CS_STAT_GOLEM_HP
The golem's hitpoints, 0 if no golem.
void reset()
Forgets about all stats.
static final int CS_STAT_RES_BLIND
Resistance to blindness.
void set(final int level, final long experience)
Updates the skill attributes.
void setExperience(final long exp)
Sets the amount of global experience.
static final int CF_NOT_PERFECT
The CS_STAT_CHARACTER_FLAGS bit for a character that needs to drink an improvement potion.
static final int C_STAT_HOSTILE
The "is hostile" indicator.
static final int CF_POISONED
The CS_STAT_CHARACTER_FLAGS bit for a poisoned character.
static final int CS_STAT_APPLIED_CON
The constitution primary stat changes due to gear or skills.
final EventListenerList2< StatsListener > statsListeners
The listeners to inform of stat changes.
final SkillSet skillSet
The SkillSet instance to use.
static final int CS_STAT_OVERLOAD
Indicates how much the character is overloaded: 0=not overloaded, 1=overloaded.
static final int CS_STAT_APPLIED_INT
The integer primary stat changes due to gear or skills.
static final int RESIST_TYPES
The total number of resistances.
static final int CS_STAT_WIS
The Wisdom Primary stat.
void setStatInt2(final int stat, final short param)
Updates a stat value with a two-byte int value.
static final int CS_STAT_TITLE
The Title stat.
static final int CS_STAT_DAM
The Damage stat.
void setStatSkill(final int stat, final int level, final long experience)
Updates a stat value with a skill value.
static final int CS_STAT_SPELL_DENY
Denied spell paths of a spell.
long expNextLevel
The experience needed to reach the next level.
static final int CS_STAT_FOOD
The Food stat.
static final int CS_STAT_APPLIED_STR
The strength primary stat changes due to gear or skills.
static final int CS_STAT_RACE_CHA
The race's maximum charisma primary stat.
static final int CF_DISEASED
The CS_STAT_CHARACTER_FLAGS bit for a character having a disease.
static final int CS_NUM_SKILLS
CS_NUM_SKILLS does not match how many skills there really are - instead, it is used as a range of val...
void setStatInt(final int statNo, final int value)
Sets the given statistic numerical value.
static final int CS_STAT_SKILLINFO
CS_STAT_SKILLINFO is used as the starting index point.
Interface for listeners interested gui state changes.
static final int CF_STEALTHY
The CS_STAT_CHARACTER_FLAGS bit for a character that is stealthy.
static final int CS_STAT_RACE_CON
The race's maximum constitution primary stat.
static final int CS_STAT_BASE_POW
The power primary stat without boosts or depletions.
static final int CS_STAT_RES_MAG
Resistance to magical attacks.
static final int CS_STAT_RACE_WIS
The race's maximum wisdom primary stat.
static final int C_STAT_STEALTHY
The "is stealthy" indicator.
static final int CS_STAT_STR
The Strength Primary stat.
static final int CS_STAT_RES_FIRE
Resistance to fire.
static final int CS_STAT_BASE_INT
The integer primary stat without boosts or depletions.
static final int CS_STAT_RANGE
The Range stat - this is what is currently readied by the player to fire.
static final int CS_STAT_RES_TURN_UNDEAD
Resistance to turn undead.
A list of event listeners.
static final int CS_STAT_RES_DRAIN
Resistance to drain life.
static final int CS_STAT_AC
The Armor Class stat.
Stats(@NotNull final ExperienceTable experienceTable, @NotNull final SkillSet skillSet, @NotNull final GuiStateManager guiStateManager)
Creates a new instance.
static final int C_STAT_CURRENT_SKILL
The name of the current skill.
static final int C_STAT_WIZARD
The "is DM" indicator.
static final int CS_STAT_RESIST_START
Beginning index of the resistances.
static final int C_STAT_STARVING
The "is starving" indicator.
static final int CF_XRAY
The CS_STAT_CHARACTER_FLAGS bit for a character having x-ray vision.
static final int CS_STAT_HP
The Hit Points stat.
static final int C_STAT_BLIND
The "is blind" indicator.
void removeCrossfireStatsListener(@NotNull final StatsListener statsListener)
Removes a StatsListener to be notified about stat changes.
static final int CS_STAT_RES_PARA
Resistance to paralysis.
void setSimpleWeaponSpeed(final boolean simpleWeaponSpeed)
Sets whether the CS_STAT_WEAP_SP value contains the weapon speed directly.
void addCrossfireStatsListener(@NotNull final StatsListener statsListener)
Adds a StatsListener to be notified about stat changes.
double getFloatStat(final int statNo)
Returns the numerical value of the given statistic.
static final int CS_STAT_MAXHP
The Maximum Hit Points stat.
long getExperienceNextLevel()
Returns the experience needed to reach the next level.
static final int CS_STAT_GOD_NAME
The character's god or NO_GOD_NAME if he has none.
static final int CF_PARALYZED
The CS_STAT_CHARACTER_FLAGS bit for a character that is paralyzed.
static final int FLOAT_MULTI
Factor used to convert float to int values.
static final int C_STAT_LOWFOOD
The Low Food indicator.
static final int CS_STAT_RES_COLD
Resistance to cold.
long exp
The total experience.
boolean simpleWeaponSpeed
Whether the CS_STAT_WEAP_SP value contains the weapon speed directly.
String getRange()
Returns the current content of the range stat.
void setActiveSkill(@NotNull final String activeSkill)
Sets the active skill name.
final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.
static final int CS_STAT_APPLIED_CHA
The charisma primary stat changes due to gear or skills.
static final int CS_STAT_EXP64
The Global Experience (64bit encoding) stat.
static final int CS_STAT_ITEM_POWER
The maximum item power the character can handle.
static final int CS_STAT_SP
The Spell Points stat.
static final int CS_STAT_SPELL_REPEL
Repelled spell paths of a spell.
One skill of the character.
static final int CS_STAT_LEVEL
The Global Level stat.
Maintains the current GuiState.
double getWeaponSpeed()
Returns the weapon speed stat.
static final int CS_STAT_RACE_INT
The race's maximum intelligence primary stat.
static final int CS_STAT_RACE_STR
The race's maximum strength primary stat.
static final int CS_STAT_RES_DEATH
Resistance to death.
static final int CS_STAT_RACE_DEX
The race's maximum dexterity primary stat.
static final int CS_STAT_CHA
The Charisma Primary stat.
static final int CS_STAT_RES_DEPLETE
Resistance to depletion.
static final int CS_STAT_RES_ELEC
Resistance to electricity.
void setTitle(@NotNull final String title)
Sets the current Title.
String getActiveSkill()
Returns the active skill name.
static final int C_STAT_EXP_NEXT_LEVEL
The global experience needed to reach next level stat.
static final int CS_STAT_WEIGHT_LIM
The Weight Limit stat.
Skill getSkill(final int id)
Returns the given skill as a Skill object.
final ExperienceTable experienceTable
The ExperienceTable instance to use.
static final int CS_STAT_GOLEM_MAXHP
The golem's maximum hitpoints, 0 if no golem.
static final int CS_STAT_WC
The Weapon Class stat.
static final int CF_WIZARD
The CS_STAT_CHARACTER_FLAGS bit for a character that is a DM.
static final int CS_STAT_RES_PHYS
Resistance to physical attacks.
This is the representation of all the statistics of a player, like its speed or its experience.
static final int CS_STAT_RES_FEAR
Resistance to fear.
static final int C_STAT_CONFUSED
The "is confused" indicator.
static final int CS_STAT_MAXGRACE
The Maximum Grace stat.
static final int C_STAT_DISEASED
The "is diseased" indicator.
static final int CF_CONFUSED
The CS_STAT_CHARACTER_FLAGS bit for a confused character.
final int[] stats
The current stat values.
void setRange(@NotNull final String range)
Sets the current value for the Range - this is basically the currently active skill for the player.
static final int CS_STAT_CON
The Constitution Primary stat.
static final int CS_STAT_BASE_CON
The constitution primary stat without boosts or depletions.
void setStatString(final int stat, @NotNull final String param)
Updates a stat value with a string value.
static final int CS_STAT_APPLIED_DEX
The dexterity primary stat changes due to gear or skills.
static final int CS_STAT_RESIST_END
End index of the resistances.
static final int CS_STAT_BASE_STR
The strength primary stat without boosts or depletions.
static final int C_STAT_PARALYZED
The "is paralyzed" indicator.
static final int CS_STAT_RES_GHOSTHIT
Resistance to ghost hit.
static final String NO_GOD_NAME
The value of CS_STAT_GOD_NAME or godName when the character has no god.
static final int CS_STAT_RES_SLOW
Resistance to slowness.
static final int CS_STAT_INT
The Intelligence Primary stat.
String getTitle()
Returns the current title.
long getExperienceToNextLevel(final int currentLevel, final long currentExp)
Returns the experience needed to reach the next level.
static final int C_STAT_POISONED
The "is poisoned" indicator.
static final int CS_STAT_RES_CONF
Resistance to confusion.
static final int CS_STAT_FLAGS
The various flags used in stats.
final Collection< String > unhandledStats
All unhandled stat values for which an error has been printed.
void calculateExperienceToNextLevel()
Calculates the experience needed to reach the next level.
Stores experience <-> level mappings.
static final int CS_STAT_RES_POISON
Resistance to poison.
static final int CS_STAT_APPLIED_POW
The power primary stat changes due to gear or skills.
void setStatInt4(final int stat, final int param)
Updates a stat value with a four-byte int value.
static final int CS_STAT_RES_HOLYWORD
Resistance to holy word.
static final int CS_STAT_RACE_POW
The race's maximum power primary stat.
String godName
The current value of the god name stat.
static final int CS_STAT_SPEED
The Speed stat.
void setGodName(@NotNull final String godName)
Sets the current god name.
static final int CF_HOSTILE
The CS_STAT_CHARACTER_FLAGS bit for a character that has hostile mode enabled.
Connection progress states of the Crossfire server connection.
static final int CS_STAT_GRACE
The Grace stat.
static final int CS_STAT_MAXSP
The Maximum Spell Points stat.
static final int CS_STAT_APPLIED_WIS
The wisdom primary stat changes due to gear or skills.
static final int CS_STAT_ARMOUR
The Armour stat.
static final int CS_STAT_CHARACTER_FLAGS
Flags the character's current state.
Maintain the set of skills as sent by the server.
int getStat(final int statNo)
Returns the numerical value of the given statistic.
static final int C_STAT_WEIGHT
The character's weight.
static final int CS_STAT_BASE_DEX
The dexterity primary stat without boosts or depletions.
static final int CS_STAT_RES_ACID
Resistance to acid.
Interface for listeners interested in changes of Stats instances.
String activeSkill
The active skill name.
static final int C_STAT_XRAY
The "has xray vision" indicator.
void setStat(final int statNo, final int value)
Sets the given statistic numerical value.
void setStatInt8(final int stat, final long param)
Updates a stat value with an eight-byte int value.
static final int CS_STAT_EXP
The Global Experience (32bit encoding) stat.
static final int CS_STAT_BASE_CHA
The charisma primary stat without boosts or depletions.
static final int CS_STAT_BASE_WIS
The wisdom primary stat without boosts or depletions.
static final int CF_BLIND
The CS_STAT_CHARACTER_FLAGS bit for a lind character.
static final int C_STAT_NOT_PERFECT
The "is not perfect" indicator.