Crossfire JXClient, Trunk
R20561
|
Helper class to synthesize an "is poisoned" stat value. More...
Public Member Functions | |
PoisonWatcher (@NotNull final Stats stats, @NotNull final CrossfireServerConnection crossfireServerConnection) | |
Creates a new instance. More... | |
Private Member Functions | |
void | check (@NotNull final String message) |
Examines a text message. More... | |
void | setActive (final boolean active) |
Sets the current poisoned state. More... | |
Private Attributes | |
boolean | active = true |
Whether poisoning is active. More... | |
final CrossfireDrawextinfoListener | drawextinfoListener |
The drawextinfo listener to receive drawextinfo messages. More... | |
final CrossfireDrawinfoListener | drawinfoListener = (text, type) -> check(text) |
The drawinfo listener to receive drawinfo messages. More... | |
final Stats | stats |
The stats instance to notify. More... | |
final Object | sync = new Object() |
The object used for synchronization. More... | |
final ActionListener | timeoutEvent = e -> setActive(false) |
The timeout event used to turn off poisoning if the de-assert message was missed. More... | |
final Timer | timer = new Timer(TIMEOUT_DE_ASSERT, timeoutEvent) |
The Timer for turning off the poison symbol. More... | |
Static Private Attributes | |
static final String | ASSERT_MESSAGE = "You feel very sick..." |
The text message the server sends in poisoned state. More... | |
static final String | CURE_MESSAGE = "Your body feels cleansed" |
The text message the server sends when the poison is cured via a spell. More... | |
static final String | DE_ASSERT_MESSAGE = "You feel much better now." |
The text message the server sends when the poison wears off. More... | |
static final int | TIMEOUT_DE_ASSERT = 10000 |
Timeout after that the "poisoned" state is reset. More... | |
Helper class to synthesize an "is poisoned" stat value.
The Crossfire server currently does not send this information, therefore drawinfo messages are tracked.
Definition at line 37 of file PoisonWatcher.java.
com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher | ( | @NotNull final Stats | stats, |
@NotNull final CrossfireServerConnection | crossfireServerConnection | ||
) |
Creates a new instance.
stats | the stats instance to notify |
crossfireServerConnection | the connection to watch |
Definition at line 124 of file PoisonWatcher.java.
References com.realtime.crossfire.jxclient.stats.PoisonWatcher.drawextinfoListener, com.realtime.crossfire.jxclient.stats.PoisonWatcher.drawinfoListener, com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.stats.
|
private |
Examines a text message.
message | the text message |
Definition at line 136 of file PoisonWatcher.java.
References com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().
|
private |
Sets the current poisoned state.
active | the new poisoned state |
Definition at line 148 of file PoisonWatcher.java.
References com.realtime.crossfire.jxclient.stats.PoisonWatcher.active, com.realtime.crossfire.jxclient.stats.Stats.C_STAT_POISONED, com.realtime.crossfire.jxclient.stats.Stats.setStat(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.sync.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.check(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
Whether poisoning is active.
Definition at line 78 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().
|
staticprivate |
The text message the server sends in poisoned state.
Definition at line 49 of file PoisonWatcher.java.
|
staticprivate |
The text message the server sends when the poison is cured via a spell.
Definition at line 61 of file PoisonWatcher.java.
|
staticprivate |
The text message the server sends when the poison wears off.
Definition at line 55 of file PoisonWatcher.java.
|
private |
The drawextinfo listener to receive drawextinfo messages.
Definition at line 92 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
The drawinfo listener to receive drawinfo messages.
Definition at line 85 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
The stats instance to notify.
Definition at line 73 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
The object used for synchronization.
Definition at line 67 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().
|
staticprivate |
Timeout after that the "poisoned" state is reset.
This allow to prevent a stuck poison warning if the de-assertion was missed for any reason.
Definition at line 43 of file PoisonWatcher.java.
|
private |
The timeout event used to turn off poisoning if the de-assert message was missed.
Definition at line 111 of file PoisonWatcher.java.
|
private |
The Timer for turning off the poison symbol.
Definition at line 117 of file PoisonWatcher.java.