![]() |
Crossfire JXClient, Trunk
|
Helper class to listen on Stats#CF_POISONED. 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... | |
boolean | serverSupportsPoisonedFlag |
Whether the server supports the Stats#CF_POISONED flag. More... | |
final Stats | stats |
The stats instance to notify. More... | |
final StatsListener | statsListener |
The StatsListener registered to be notified about stat changes. More... | |
final Object | sync = new Object() |
The object used for synchronization. More... | |
final ActionListener | timeoutEvent |
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 listen on Stats#CF_POISONED.
If the Crossfire server does not support this flag drawinfo messages are tracked instead.
Definition at line 36 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 185 of file PoisonWatcher.java.
References com.realtime.crossfire.jxclient.stats.Stats.addCrossfireStatsListener(), com.realtime.crossfire.jxclient.stats.PoisonWatcher.check(), com.realtime.crossfire.jxclient.stats.PoisonWatcher.drawextinfoListener, com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive(), com.realtime.crossfire.jxclient.stats.PoisonWatcher.stats, com.realtime.crossfire.jxclient.stats.PoisonWatcher.statsListener, com.realtime.crossfire.jxclient.stats.PoisonWatcher.sync, and com.realtime.crossfire.jxclient.stats.PoisonWatcher.timer.
|
private |
Examines a text message.
message | the text message |
Definition at line 200 of file PoisonWatcher.java.
References com.realtime.crossfire.jxclient.stats.PoisonWatcher.ASSERT_MESSAGE, com.realtime.crossfire.jxclient.stats.PoisonWatcher.CURE_MESSAGE, com.realtime.crossfire.jxclient.stats.PoisonWatcher.DE_ASSERT_MESSAGE, com.realtime.crossfire.jxclient.stats.PoisonWatcher.serverSupportsPoisonedFlag, com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.sync.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
Sets the current poisoned state.
active | the new poisoned state |
Definition at line 216 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.PoisonWatcher.serverSupportsPoisonedFlag, com.realtime.crossfire.jxclient.stats.Stats.setStat(), com.realtime.crossfire.jxclient.stats.PoisonWatcher.stats, com.realtime.crossfire.jxclient.stats.PoisonWatcher.sync, and com.realtime.crossfire.jxclient.stats.PoisonWatcher.timer.
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 77 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 48 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.check().
|
staticprivate |
The text message the server sends when the poison is cured via a spell.
Definition at line 60 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.check().
|
staticprivate |
The text message the server sends when the poison wears off.
Definition at line 54 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.check().
|
private |
The drawextinfo listener to receive drawextinfo messages.
Definition at line 89 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
Whether the server supports the Stats#CF_POISONED flag.
Definition at line 82 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.check(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().
|
private |
The stats instance to notify.
Definition at line 72 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().
|
private |
The StatsListener registered to be notified about stat changes.
Definition at line 108 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher().
|
private |
The object used for synchronization.
Definition at line 66 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.check(), com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().
|
staticprivate |
Timeout after that the "poisoned" state is reset.
This allows to prevent a stuck poison warning if the de-assertion was missed for any reason.
Definition at line 42 of file PoisonWatcher.java.
|
private |
The timeout event used to turn off poisoning if the de-assert message was missed.
Definition at line 166 of file PoisonWatcher.java.
|
private |
The Timer for turning off the poison symbol.
Definition at line 178 of file PoisonWatcher.java.
Referenced by com.realtime.crossfire.jxclient.stats.PoisonWatcher.PoisonWatcher(), and com.realtime.crossfire.jxclient.stats.PoisonWatcher.setActive().