22 package com.realtime.crossfire.jxclient.stats;
27 import org.jetbrains.annotations.NotNull;
47 private final Object
sync =
new Object();
65 @SuppressWarnings(
"FieldCanBeLocal")
74 public void statChanged(
final int statNo,
final int value) {
79 public void simpleWeaponSpeedChanged(
final boolean simpleWeaponSpeed) {
84 public void titleChanged(@NotNull
final String title) {
89 public void rangeChanged(@NotNull
final String range) {
94 public void activeSkillChanged(@NotNull
final String activeSkill) {
99 public void experienceChanged(
final long exp) {
104 public void experienceNextLevelChanged(
final long expNextLevel) {
114 @SuppressWarnings(
"FieldCanBeLocal")
121 @SuppressWarnings("FieldCanBeLocal")
125 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
130 public void setDebugMode(
final boolean printMessageTypes) {
154 if (range.startsWith(
"Skill: ")) {
166 setActive(tmp.endsWith(
".") ? tmp.substring(0, tmp.length()-1) : tmp);
174 @SuppressWarnings(
"IfMayBeConditional")
178 final String normalizedActiveSkill;
179 switch (activeSkill) {
181 normalizedActiveSkill =
"lockpicking";
185 normalizedActiveSkill =
"inscription";
193 synchronized (
sync) {
194 if (this.activeSkill.equals(normalizedActiveSkill)) {
198 this.activeSkill = normalizedActiveSkill;
Interface for listeners interested in drawinfo messages received from the Crossfire server...
final CrossfireDrawextinfoListener drawextinfoListener
The drawextinfo listener to receive drawextinfo messages.
static final String READIED_SKILLS
Prefix string when searching for the currently active skill.
void setActiveSkill(@NotNull final String activeSkill)
Sets the active skill name.
final Stats stats
The stats instance to notify.
String activeSkill
The last known active skill name.
void addCrossfireStatsListener(@NotNull final StatsListener statsListener)
Adds a StatsListener to be notified about stat changes.
void setActive(@NotNull final String activeSkill)
Sets the active skill name.
Helper class to synthesize an "active skill" stat value.
ActiveSkillWatcher(@NotNull final Stats stats, @NotNull final CrossfireServerConnection crossfireServerConnection)
Creates a new instance.
final Object sync
The object used for synchronization.
Interface for listeners interested in changes of Stats instances.
final StatsListener statsListener
The stats listener to detect the range stat.
Interface for listeners interested in drawextinfo messages received from the Crossfire server...
void checkMessage(@NotNull final String message)
Checks whether a drawinfo message is skill related.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
final CrossfireDrawinfoListener drawinfoListener
The drawinfo listener to receive drawinfo messages.
This is the representation of all the statistics of a player, like its speed or its experience...
void checkRange(@NotNull final String range)
Checks whether the range attribute has changed.