22 package com.realtime.crossfire.jxclient.stats;
27 import java.awt.event.ActionListener;
28 import javax.swing.Timer;
29 import org.jetbrains.annotations.NotNull;
61 private static final String
CURE_MESSAGE =
"Your body feels cleansed";
67 private final Object
sync =
new Object();
84 @SuppressWarnings(
"FieldCanBeLocal")
91 @SuppressWarnings("FieldCanBeLocal")
95 public void commandDrawextinfoReceived(
final int color,
final int type,
final int subtype, @NotNull
final String message) {
100 public void setDebugMode(
final boolean printMessageTypes) {
117 private final Timer
timer =
new Timer(TIMEOUT_DE_ASSERT, timeoutEvent);
126 timer.setRepeats(
false);
136 private void check(@NotNull
final String message) {
137 if (message.equals(ASSERT_MESSAGE)) {
139 }
else if (message.equals(DE_ASSERT_MESSAGE) || message.equals(CURE_MESSAGE)) {
149 synchronized (
sync) {
156 if (this.active == active) {
final Stats stats
The stats instance to notify.
Interface for listeners interested in drawinfo messages received from the Crossfire server...
final Timer timer
The Timer for turning off the poison symbol.
Helper class to synthesize an "is poisoned" stat value.
void check(@NotNull final String message)
Examines a text message.
static final String ASSERT_MESSAGE
The text message the server sends in poisoned state.
static final String CURE_MESSAGE
The text message the server sends when the poison is cured via a spell.
static final String DE_ASSERT_MESSAGE
The text message the server sends when the poison wears off.
PoisonWatcher(@NotNull final Stats stats, @NotNull final CrossfireServerConnection crossfireServerConnection)
Creates a new instance.
static final int TIMEOUT_DE_ASSERT
Timeout after that the "poisoned" state is reset.
void setActive(final boolean active)
Sets the current poisoned state.
final ActionListener timeoutEvent
The timeout event used to turn off poisoning if the de-assert message was missed. ...
static final int C_STAT_POISONED
The "is poisoned" indicator.
Interface for listeners interested in drawextinfo messages received from the Crossfire server...
final Object sync
The object used for synchronization.
final CrossfireDrawinfoListener drawinfoListener
The drawinfo listener to receive drawinfo messages.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
void setStat(final int statNo, final int value)
Sets the given statistic numerical value.
This is the representation of all the statistics of a player, like its speed or its experience...
final CrossfireDrawextinfoListener drawextinfoListener
The drawextinfo listener to receive drawextinfo messages.
boolean active
Whether poisoning is active.