Crossfire JXClient, Trunk  R20561
Stats.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.stats;
23 
30 import java.util.Collection;
31 import java.util.HashSet;
32 import org.jetbrains.annotations.NotNull;
33 
43 public class Stats {
44 
48  public static final int CS_STAT_HP = 1;
49 
53  public static final int CS_STAT_MAXHP = 2;
54 
58  public static final int CS_STAT_SP = 3;
59 
63  public static final int CS_STAT_MAXSP = 4;
64 
68  public static final int CS_STAT_STR = 5;
69 
73  public static final int CS_STAT_INT = 6;
74 
78  public static final int CS_STAT_WIS = 7;
79 
83  public static final int CS_STAT_DEX = 8;
84 
88  public static final int CS_STAT_CON = 9;
89 
93  public static final int CS_STAT_CHA = 10;
94 
98  public static final int CS_STAT_EXP = 11;
99 
103  public static final int C_STAT_EXP_NEXT_LEVEL = 0x10000;
104 
108  public static final int CS_STAT_LEVEL = 12;
109 
113  public static final int CS_STAT_WC = 13;
114 
118  public static final int CS_STAT_AC = 14;
119 
123  public static final int CS_STAT_DAM = 15;
124 
128  public static final int CS_STAT_ARMOUR = 16;
129 
133  public static final int CS_STAT_SPEED = 17;
134 
138  public static final int CS_STAT_FOOD = 18;
139 
143  public static final int C_STAT_LOWFOOD = 0x10003;
144 
148  public static final int CS_STAT_WEAP_SP = 19;
149 
154  public static final int CS_STAT_RANGE = 20;
155 
159  public static final int CS_STAT_TITLE = 21;
160 
164  public static final int CS_STAT_POW = 22;
165 
169  public static final int CS_STAT_GRACE = 23;
170 
174  public static final int CS_STAT_MAXGRACE = 24;
175 
179  public static final int CS_STAT_FLAGS = 25;
180 
184  public static final int CS_STAT_WEIGHT_LIM = 26;
185 
189  public static final int C_STAT_WEIGHT = 257;
190 
194  public static final int CS_STAT_EXP64 = 28;
195 
199  public static final int CS_STAT_SPELL_ATTUNE = 29;
200 
204  public static final int CS_STAT_SPELL_REPEL = 30;
205 
209  public static final int CS_STAT_SPELL_DENY = 31;
210 
214  public static final int CS_STAT_RACE_STR = 32;
215 
219  public static final int CS_STAT_RACE_INT = 33;
220 
224  public static final int CS_STAT_RACE_WIS = 34;
225 
229  public static final int CS_STAT_RACE_DEX = 35;
230 
234  public static final int CS_STAT_RACE_CON = 36;
235 
239  public static final int CS_STAT_RACE_CHA = 37;
240 
244  public static final int CS_STAT_RACE_POW = 38;
245 
249  public static final int CS_STAT_BASE_STR = 39;
250 
254  public static final int CS_STAT_BASE_INT = 40;
255 
259  public static final int CS_STAT_BASE_WIS = 41;
260 
264  public static final int CS_STAT_BASE_DEX = 42;
265 
269  public static final int CS_STAT_BASE_CON = 43;
270 
274  public static final int CS_STAT_BASE_CHA = 44;
275 
279  public static final int CS_STAT_BASE_POW = 45;
280 
284  public static final int CS_STAT_APPLIED_STR = 46;
285 
289  public static final int CS_STAT_APPLIED_INT = 47;
290 
294  public static final int CS_STAT_APPLIED_WIS = 48;
295 
299  public static final int CS_STAT_APPLIED_DEX = 49;
300 
304  public static final int CS_STAT_APPLIED_CON = 50;
305 
309  public static final int CS_STAT_APPLIED_CHA = 51;
310 
314  public static final int CS_STAT_APPLIED_POW = 52;
315 
319  public static final int CS_STAT_GOLEM_HP = 53;
320 
324  public static final int CS_STAT_GOLEM_MAXHP = 54;
325 
329  public static final int CS_STAT_RESIST_START = 100;
330 
334  public static final int CS_STAT_RESIST_END = 117;
335 
339  public static final int CS_STAT_RES_PHYS = 100;
340 
344  public static final int CS_STAT_RES_MAG = 101;
345 
349  public static final int CS_STAT_RES_FIRE = 102;
350 
354  public static final int CS_STAT_RES_ELEC = 103;
355 
359  public static final int CS_STAT_RES_COLD = 104;
360 
364  public static final int CS_STAT_RES_CONF = 105;
365 
369  public static final int CS_STAT_RES_ACID = 106;
370 
374  public static final int CS_STAT_RES_DRAIN = 107;
375 
379  public static final int CS_STAT_RES_GHOSTHIT = 108;
380 
384  public static final int CS_STAT_RES_POISON = 109;
385 
389  public static final int CS_STAT_RES_SLOW = 110;
390 
394  public static final int CS_STAT_RES_PARA = 111;
395 
399  public static final int CS_STAT_RES_TURN_UNDEAD = 112;
400 
404  public static final int CS_STAT_RES_FEAR = 113;
405 
409  public static final int CS_STAT_RES_DEPLETE = 114;
410 
414  public static final int CS_STAT_RES_DEATH = 115;
415 
419  public static final int CS_STAT_RES_HOLYWORD = 116;
420 
424  public static final int CS_STAT_RES_BLIND = 117;
425 
429  public static final int FLOAT_MULTI = 100000;
430 
434  public static final int RESIST_TYPES = 18;
435 
440  public static final int C_STAT_POISONED = 256;
441 
447  public static final int CS_NUM_SKILLS = 50;
448 
454  public static final int CS_STAT_SKILLINFO = 140;
455 
460  private boolean simpleWeaponSpeed;
461 
465  @NotNull
467 
471  @NotNull
473 
477  @NotNull
478  private final SkillSet skillSet;
479 
483  @NotNull
484  private final int[] stats = new int[258];
485 
489  private long exp;
490 
494  private long expNextLevel;
495 
499  @NotNull
500  private String range = "";
501 
505  @NotNull
506  private String title = "";
507 
511  @NotNull
512  private String activeSkill = "";
513 
517  @NotNull
518  private final Collection<String> unhandledStats = new HashSet<>(0);
519 
524  @NotNull
525  @SuppressWarnings("FieldCanBeLocal")
527 
528  @Override
529  public void start() {
530  // ignore
531  }
532 
533  @Override
534  public void metaserver() {
535  // ignore
536  }
537 
538  @Override
539  public void preConnecting(@NotNull final String serverInfo) {
540  // ignore
541  }
542 
543  @Override
544  public void connecting(@NotNull final String serverInfo) {
545  reset();
546  }
547 
548  @Override
549  public void connecting(@NotNull final ClientSocketState clientSocketState) {
550  // ignore
551  }
552 
553  @Override
554  public void connected() {
555  // ignore
556  }
557 
558  @Override
559  public void connectFailed(@NotNull final String reason) {
560  // ignore
561  }
562 
563  };
564 
571  public Stats(@NotNull final ExperienceTable experienceTable, @NotNull final SkillSet skillSet, @NotNull final GuiStateManager guiStateManager) {
572  this.experienceTable = experienceTable; // XXX: should detect changed information
573  this.skillSet = skillSet;
574  guiStateManager.addGuiStateListener(guiStateListener);
575  }
576 
583  public void setSimpleWeaponSpeed(final boolean simpleWeaponSpeed) {
584  if (this.simpleWeaponSpeed == simpleWeaponSpeed) {
585  return;
586  }
587 
588  this.simpleWeaponSpeed = simpleWeaponSpeed;
589  for (final StatsListener statsListener : statsListeners) {
590  statsListener.simpleWeaponSpeedChanged(this.simpleWeaponSpeed);
591  }
592  }
593 
597  private void reset() {
598  for (final StatsListener statsListener : statsListeners) {
599  statsListener.reset();
600  }
601  for (int statNo = 0; statNo < stats.length; statNo++) {
602  setStat(statNo, 0);
603  }
604  setExperience(0);
605  setRange("");
606  setTitle("");
607  setActiveSkill("");
608  }
609 
615  public int getStat(final int statNo) {
616  return stats[statNo];
617  }
618 
624  public double getFloatStat(final int statNo) {
625  return (double)stats[statNo]/FLOAT_MULTI;
626  }
627 
633  public void setStat(final int statNo, final int value) {
634  if (stats[statNo] == value) {
635  return;
636  }
637 
638  stats[statNo] = value;
639  for (final StatsListener statsListener : statsListeners) {
640  statsListener.statChanged(statNo, stats[statNo]);
641  }
642  }
643 
648  @NotNull
649  public String getTitle() {
650  return title;
651  }
652 
658  @NotNull
659  public String getRange() {
660  return range;
661  }
662 
667  @NotNull
668  public String getActiveSkill() {
669  return activeSkill;
670  }
671 
676  private void setTitle(@NotNull final String title) {
677  if (this.title.equals(title)) {
678  return;
679  }
680 
681  this.title = title;
682  for (final StatsListener statsListener : statsListeners) {
683  statsListener.titleChanged(this.title);
684  }
685  }
686 
692  private void setRange(@NotNull final String range) {
693  if (this.range.equals(range)) {
694  return;
695  }
696 
697  this.range = range;
698  for (final StatsListener statsListener : statsListeners) {
699  statsListener.rangeChanged(this.range);
700  }
701  }
702 
707  public void setActiveSkill(@NotNull final String activeSkill) {
708  if (this.activeSkill.equals(activeSkill)) {
709  return;
710  }
711 
712  this.activeSkill = activeSkill;
713  for (final StatsListener statsListener : statsListeners) {
714  statsListener.activeSkillChanged(this.activeSkill);
715  }
716  }
717 
722  public long getExperience() {
723  return exp;
724  }
725 
730  private void setExperience(final long exp) {
731  if (this.exp == exp) {
732  return;
733  }
734 
735  this.exp = exp;
736  for (final StatsListener statsListener : statsListeners) {
737  statsListener.experienceChanged(this.exp);
738  }
739 
741  }
742 
747  public long getExperienceNextLevel() {
748  return expNextLevel;
749  }
750 
755  final long newExpNextLevel = experienceTable.getExperienceToNextLevel(stats[CS_STAT_LEVEL], exp);
756  if (expNextLevel == newExpNextLevel) {
757  return;
758  }
759 
760  expNextLevel = newExpNextLevel;
761  for (final StatsListener statsListener : statsListeners) {
762  statsListener.experienceNextLevelChanged(expNextLevel);
763  }
764  }
765 
770  public void addCrossfireStatsListener(@NotNull final StatsListener statsListener) {
771  statsListeners.add(statsListener);
772  }
773 
778  public void removeCrossfireStatsListener(@NotNull final StatsListener statsListener) {
779  statsListeners.remove(statsListener);
780  }
781 
786  public double getWeaponSpeed() {
787  final double weaponSpeed = getFloatStat(CS_STAT_WEAP_SP);
788  if (simpleWeaponSpeed) {
789  return weaponSpeed;
790  }
791 
792  if (weaponSpeed < 0.001) {
793  return 0;
794  }
795 
796  return getFloatStat(CS_STAT_SPEED)/weaponSpeed;
797  }
798 
804  public void setStatInt2(final int stat, final short param) {
805  switch (stat) {
806  case CS_STAT_HP:
807  case CS_STAT_MAXHP:
808  case CS_STAT_SP:
809  case CS_STAT_MAXSP:
810  case CS_STAT_STR:
811  case CS_STAT_INT:
812  case CS_STAT_WIS:
813  case CS_STAT_DEX:
814  case CS_STAT_CON:
815  case CS_STAT_CHA:
816  case CS_STAT_LEVEL:
817  case CS_STAT_WC:
818  case CS_STAT_AC:
819  case CS_STAT_DAM:
820  case CS_STAT_ARMOUR:
821  case CS_STAT_FOOD:
822  case CS_STAT_POW:
823  case CS_STAT_GRACE:
824  case CS_STAT_MAXGRACE:
825  case CS_STAT_RACE_STR:
826  case CS_STAT_RACE_INT:
827  case CS_STAT_RACE_WIS:
828  case CS_STAT_RACE_DEX:
829  case CS_STAT_RACE_CON:
830  case CS_STAT_RACE_CHA:
831  case CS_STAT_RACE_POW:
832  case CS_STAT_BASE_STR:
833  case CS_STAT_BASE_INT:
834  case CS_STAT_BASE_WIS:
835  case CS_STAT_BASE_DEX:
836  case CS_STAT_BASE_CON:
837  case CS_STAT_BASE_CHA:
838  case CS_STAT_BASE_POW:
839  case CS_STAT_APPLIED_STR:
840  case CS_STAT_APPLIED_INT:
841  case CS_STAT_APPLIED_WIS:
842  case CS_STAT_APPLIED_DEX:
843  case CS_STAT_APPLIED_CON:
844  case CS_STAT_APPLIED_CHA:
845  case CS_STAT_APPLIED_POW:
846  case CS_STAT_GOLEM_HP:
847  case CS_STAT_GOLEM_MAXHP:
848  setStat(stat, param);
849  if (stat == CS_STAT_LEVEL) {
851  }
852  break;
853 
854  case CS_STAT_FLAGS:
855  setStat(stat, param&0xFFFF);
856  break;
857 
858  default:
859  if (CS_STAT_RESIST_START <= stat && stat < CS_STAT_RESIST_START+RESIST_TYPES) {
860  setStat(stat, param);
861  } else {
862  reportUnhandledStat(stat, "int2");
863  }
864  break;
865  }
866  }
867 
873  public void setStatInt4(final int stat, final int param) {
874  switch (stat) {
875  case CS_STAT_EXP:
876  setExperience(param&0xFFFFFFFFL);
877  break;
878 
879  case CS_STAT_SPEED:
880  case CS_STAT_WEAP_SP:
881  case CS_STAT_WEIGHT_LIM:
883  case CS_STAT_SPELL_REPEL:
884  case CS_STAT_SPELL_DENY:
885  setStat(stat, param);
886  break;
887 
888  default:
889  reportUnhandledStat(stat, "int4");
890  break;
891  }
892  }
893 
899  public void setStatInt8(final int stat, final long param) {
900  switch (stat) {
901  case CS_STAT_EXP64:
902  setExperience(param);
903  break;
904 
905  default:
906  reportUnhandledStat(stat, "int8");
907  break;
908  }
909  }
910 
916  public void setStatString(final int stat, @NotNull final String param) {
917  switch (stat) {
918  case CS_STAT_RANGE:
919  setRange(param);
920  break;
921 
922  case CS_STAT_TITLE:
923  setTitle(param);
924  break;
925 
926  default:
927  reportUnhandledStat(stat, "string");
928  break;
929  }
930  }
931 
938  public void setStatSkill(final int stat, final int level, final long experience) {
939  if (CS_STAT_SKILLINFO <= stat && stat < CS_STAT_SKILLINFO+CS_NUM_SKILLS) {
940  final Skill sk = skillSet.getSkill(stat);
941  if (sk == null) {
942  System.err.println("ignoring skill value for unknown skill "+stat);
943  } else {
944  sk.set(level, experience);
945  }
946  } else {
947  reportUnhandledStat(stat, "skill");
948  }
949  }
950 
956  private void reportUnhandledStat(final int stat, @NotNull final String type) {
957  if (unhandledStats.add(type+"-"+stat)) {
958  System.err.println("Warning: unhandled stat "+stat+" of type "+type);
959  }
960  }
961 
962 }
static final int CS_STAT_GOLEM_HP
The golem&#39;s hitpoints, 0 if no golem.
Definition: Stats.java:319
static final int CS_STAT_RES_BLIND
Resistance to blindness.
Definition: Stats.java:424
static final int CS_STAT_RACE_CHA
The race&#39;s maximum charisma primary stat.
Definition: Stats.java:239
Interface for listeners interested gui state changes.
static final int CS_STAT_DEX
The Dexterity Primary stat.
Definition: Stats.java:83
static final int CS_STAT_SPELL_ATTUNE
Attuned spell paths of a spell.
Definition: Stats.java:199
static final int RESIST_TYPES
The total number of resistances.
Definition: Stats.java:434
static final int CS_STAT_TITLE
The Title stat.
Definition: Stats.java:159
static final int CS_STAT_SPELL_DENY
Denied spell paths of a spell.
Definition: Stats.java:209
static final int CS_STAT_RANGE
The Range stat - this is what is currently readied by the player to fire.
Definition: Stats.java:154
String range
The current value of the range stat.
Definition: Stats.java:500
String activeSkill
The active skill name.
Definition: Stats.java:512
static final int CS_STAT_APPLIED_CON
The constitution primary stat changes due to gear or skills.
Definition: Stats.java:304
static final int CS_STAT_RESIST_START
Beginning index of the resistances.
Definition: Stats.java:329
long getExperienceToNextLevel(final int currentLevel, final long currentExp)
Returns the experience needed to reach the next level.
void removeCrossfireStatsListener(@NotNull final StatsListener statsListener)
Removes a StatsListener to be notified about stat changes.
Definition: Stats.java:778
final EventListenerList2< StatsListener > statsListeners
The listeners to inform of stat changes.
Definition: Stats.java:466
static final int CS_STAT_BASE_POW
The power primary stat without boosts or depletions.
Definition: Stats.java:279
void setStatInt2(final int stat, final short param)
Updates a stat value with a two-byte int value.
Definition: Stats.java:804
static final int CS_STAT_POW
The Power Primary stat.
Definition: Stats.java:164
void reportUnhandledStat(final int stat, @NotNull final String type)
Report an unhandled stat value.
Definition: Stats.java:956
static final int CS_STAT_APPLIED_INT
The integer primary stat changes due to gear or skills.
Definition: Stats.java:289
static final int C_STAT_LOWFOOD
The Low Food indicator.
Definition: Stats.java:143
void setActiveSkill(@NotNull final String activeSkill)
Sets the active skill name.
Definition: Stats.java:707
static final int CS_STAT_RES_TURN_UNDEAD
Resistance to turn undead.
Definition: Stats.java:399
long getExperience()
Returns the amount of global experience.
Definition: Stats.java:722
void reset()
Forgets about all stats.
Definition: Stats.java:597
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...
Definition: Stats.java:447
long expNextLevel
The experience needed to reach the next level.
Definition: Stats.java:494
Stats(@NotNull final ExperienceTable experienceTable, @NotNull final SkillSet skillSet, @NotNull final GuiStateManager guiStateManager)
Creates a new instance.
Definition: Stats.java:571
static final int CS_STAT_HP
The Hit Points stat.
Definition: Stats.java:48
static final int CS_STAT_LEVEL
The Global Level stat.
Definition: Stats.java:108
void setSimpleWeaponSpeed(final boolean simpleWeaponSpeed)
Sets whether the CS_STAT_WEAP_SP value contains the weapon speed directly.
Definition: Stats.java:583
static final int CS_STAT_MAXHP
The Maximum Hit Points stat.
Definition: Stats.java:53
static final int CS_STAT_RACE_WIS
The race&#39;s maximum wisdom primary stat.
Definition: Stats.java:224
final SkillSet skillSet
The SkillSet instance to use.
Definition: Stats.java:478
long getExperienceNextLevel()
Returns the experience needed to reach the next level.
Definition: Stats.java:747
static final int CS_STAT_DAM
The Damage stat.
Definition: Stats.java:123
static final int CS_STAT_STR
The Strength Primary stat.
Definition: Stats.java:68
void setExperience(final long exp)
Sets the amount of global experience.
Definition: Stats.java:730
static final int CS_STAT_AC
The Armor Class stat.
Definition: Stats.java:118
static final int CS_STAT_RES_FIRE
Resistance to fire.
Definition: Stats.java:349
static final int CS_STAT_FOOD
The Food stat.
Definition: Stats.java:138
static final int CS_STAT_WIS
The Wisdom Primary stat.
Definition: Stats.java:78
void setStatSkill(final int stat, final int level, final long experience)
Updates a stat value with a skill value.
Definition: Stats.java:938
static final int CS_STAT_BASE_INT
The integer primary stat without boosts or depletions.
Definition: Stats.java:254
void set(final int level, final long experience)
Updates the skill attributes.
Definition: Skill.java:74
static final int CS_STAT_SP
The Spell Points stat.
Definition: Stats.java:58
void addCrossfireStatsListener(@NotNull final StatsListener statsListener)
Adds a StatsListener to be notified about stat changes.
Definition: Stats.java:770
One skill of the character.
Definition: Skill.java:32
static final int CS_STAT_RACE_CON
The race&#39;s maximum constitution primary stat.
Definition: Stats.java:234
void setStatString(final int stat, @NotNull final String param)
Updates a stat value with a string value.
Definition: Stats.java:916
static final int CS_STAT_WEIGHT_LIM
The Weight Limit stat.
Definition: Stats.java:184
boolean simpleWeaponSpeed
Whether the CS_STAT_WEAP_SP value contains the weapon speed directly.
Definition: Stats.java:460
static final int CS_STAT_APPLIED_STR
The strength primary stat changes due to gear or skills.
Definition: Stats.java:284
static final int CS_STAT_BASE_STR
The strength primary stat without boosts or depletions.
Definition: Stats.java:249
static final int CS_STAT_GOLEM_MAXHP
The golem&#39;s maximum hitpoints, 0 if no golem.
Definition: Stats.java:324
static final int FLOAT_MULTI
Factor used to convert float to int values.
Definition: Stats.java:429
static final int CS_STAT_RES_DRAIN
Resistance to drain life.
Definition: Stats.java:374
long exp
The total experience.
Definition: Stats.java:489
double getWeaponSpeed()
Returns the weapon speed stat.
Definition: Stats.java:786
static final int CS_STAT_RES_PHYS
Resistance to physical attacks.
Definition: Stats.java:339
static final int CS_STAT_SKILLINFO
CS_STAT_SKILLINFO is used as the starting index point.
Definition: Stats.java:454
void setRange(@NotNull final String range)
Sets the current value for the Range - this is basically the currently active skill for the player...
Definition: Stats.java:692
static final int CS_STAT_CON
The Constitution Primary stat.
Definition: Stats.java:88
static final int CS_STAT_RACE_STR
The race&#39;s maximum strength primary stat.
Definition: Stats.java:214
static final int CS_STAT_RES_PARA
Resistance to paralysis.
Definition: Stats.java:394
static final int CS_STAT_RES_DEPLETE
Resistance to depletion.
Definition: Stats.java:409
static final int CS_STAT_RES_ELEC
Resistance to electricity.
Definition: Stats.java:354
static final int CS_STAT_RES_MAG
Resistance to magical attacks.
Definition: Stats.java:344
static final int CS_STAT_APPLIED_DEX
The dexterity primary stat changes due to gear or skills.
Definition: Stats.java:299
String getActiveSkill()
Returns the active skill name.
Definition: Stats.java:668
static final int CS_STAT_RES_COLD
Resistance to cold.
Definition: Stats.java:359
static final int CS_STAT_RES_GHOSTHIT
Resistance to ghost hit.
Definition: Stats.java:379
static final int C_STAT_EXP_NEXT_LEVEL
The global experience needed to reach next level stat.
Definition: Stats.java:103
String getRange()
Returns the current content of the range stat.
Definition: Stats.java:659
static final int CS_STAT_RES_FEAR
Resistance to fear.
Definition: Stats.java:404
void add(@NotNull final T listener)
Adds a listener.
static final int CS_STAT_RACE_INT
The race&#39;s maximum intelligence primary stat.
Definition: Stats.java:219
static final int CS_STAT_MAXGRACE
The Maximum Grace stat.
Definition: Stats.java:174
static final int CS_STAT_RES_CONF
Resistance to confusion.
Definition: Stats.java:364
static final int CS_STAT_RES_DEATH
Resistance to death.
Definition: Stats.java:414
Skill getSkill(final int id)
Returns the given skill as a Skill object.
Definition: SkillSet.java:172
Interface for listeners interested in changes of Stats instances.
double getFloatStat(final int statNo)
Returns the numerical value of the given statistic.
Definition: Stats.java:624
static final int CS_STAT_RACE_DEX
The race&#39;s maximum dexterity primary stat.
Definition: Stats.java:229
static final int CS_STAT_BASE_CON
The constitution primary stat without boosts or depletions.
Definition: Stats.java:269
static final int CS_STAT_CHA
The Charisma Primary stat.
Definition: Stats.java:93
final GuiStateListener guiStateListener
The GuiStateListener for detecting established or dropped connections.
Definition: Stats.java:526
void setTitle(@NotNull final String title)
Sets the current Title.
Definition: Stats.java:676
void calculateExperienceToNextLevel()
Calculates the experience needed to reach the next level.
Definition: Stats.java:754
static final int CS_STAT_EXP64
The Global Experience (64bit encoding) stat.
Definition: Stats.java:194
static final int CS_STAT_APPLIED_CHA
The charisma primary stat changes due to gear or skills.
Definition: Stats.java:309
static final int CS_STAT_SPELL_REPEL
Repelled spell paths of a spell.
Definition: Stats.java:204
static final int CS_STAT_WC
The Weapon Class stat.
Definition: Stats.java:113
static final int C_STAT_POISONED
The "is poisoned" indicator.
Definition: Stats.java:440
static final int CS_STAT_EXP
The Global Experience (32bit encoding) stat.
Definition: Stats.java:98
static final int CS_STAT_BASE_WIS
The wisdom primary stat without boosts or depletions.
Definition: Stats.java:259
static final int C_STAT_WEIGHT
The character&#39;s weight.
Definition: Stats.java:189
final Collection< String > unhandledStats
All unhandled stat values for which an error has been printed.
Definition: Stats.java:518
static final int CS_STAT_BASE_DEX
The dexterity primary stat without boosts or depletions.
Definition: Stats.java:264
static final int CS_STAT_RESIST_END
End index of the resistances.
Definition: Stats.java:334
void setStatInt4(final int stat, final int param)
Updates a stat value with a four-byte int value.
Definition: Stats.java:873
final ExperienceTable experienceTable
The ExperienceTable instance to use.
Definition: Stats.java:472
static final int CS_STAT_RACE_POW
The race&#39;s maximum power primary stat.
Definition: Stats.java:244
static final int CS_STAT_RES_SLOW
Resistance to slowness.
Definition: Stats.java:389
static final int CS_STAT_INT
The Intelligence Primary stat.
Definition: Stats.java:73
void setStat(final int statNo, final int value)
Sets the given statistic numerical value.
Definition: Stats.java:633
final int [] stats
The current stat values.
Definition: Stats.java:484
static final int CS_STAT_FLAGS
The various flags used in stats.
Definition: Stats.java:179
This is the representation of all the statistics of a player, like its speed or its experience...
Definition: Stats.java:43
static final int CS_STAT_WEAP_SP
The Weapon Speed stat.
Definition: Stats.java:148
Maintain the set of skills as sent by the server.
Definition: SkillSet.java:38
static final int CS_STAT_MAXSP
The Maximum Spell Points stat.
Definition: Stats.java:63
void remove(@NotNull final T listener)
Removes a listener.
static final int CS_STAT_APPLIED_POW
The power primary stat changes due to gear or skills.
Definition: Stats.java:314
static final int CS_STAT_RES_POISON
Resistance to poison.
Definition: Stats.java:384
Connection progress states of the Crossfire server connection.
static final int CS_STAT_RES_HOLYWORD
Resistance to holy word.
Definition: Stats.java:419
static final int CS_STAT_RES_ACID
Resistance to acid.
Definition: Stats.java:369
String getTitle()
Returns the current title.
Definition: Stats.java:649
static final int CS_STAT_SPEED
The Speed stat.
Definition: Stats.java:133
String title
The current value of the title stat.
Definition: Stats.java:506
void setStatInt8(final int stat, final long param)
Updates a stat value with an eight-byte int value.
Definition: Stats.java:899
static final int CS_STAT_GRACE
The Grace stat.
Definition: Stats.java:169
static final int CS_STAT_BASE_CHA
The charisma primary stat without boosts or depletions.
Definition: Stats.java:274
static final int CS_STAT_APPLIED_WIS
The wisdom primary stat changes due to gear or skills.
Definition: Stats.java:294
static final int CS_STAT_ARMOUR
The Armour stat.
Definition: Stats.java:128
int getStat(final int statNo)
Returns the numerical value of the given statistic.
Definition: Stats.java:615