Crossfire JXClient, Trunk
R20561
|
Monitors stat changes and generates appropriate sound effects. More...
Public Member Functions | |
StatsWatcher (@NotNull final Stats stats, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final CrossfireServerConnection server, @NotNull final SoundManager soundManager) | |
Creates a new instance. More... | |
Private Member Functions | |
void | checkStats (final int statNo, final int value) |
Checks for changed stats and generate sound effects. More... | |
void | playClip (@NotNull final String clip) |
Plays a clip if sounds should be generated. More... | |
Private Attributes | |
boolean | active |
Whether sounds should be generated. More... | |
final CrossfireUpdateItemListener | crossfireUpdateItemListener |
The CrossfireUpdateItemListener to receive item updates. More... | |
long | ignoreLevelChange = System.currentTimeMillis()+DELAY |
Ignore level changes until this time has reached. More... | |
int | level |
The last known level. More... | |
boolean | poisoned |
The last known poisoned state. More... | |
final RendererGuiStateListener | rendererGuiStateListener |
The gui state listener. More... | |
final SoundManager | soundManager |
The SoundManager instance to watch. More... | |
final StatsListener | statsListener |
The crossfire stats listener. More... | |
Static Private Attributes | |
static final long | DELAY = 5000 |
Duration for which to ignore level changes after login. More... | |
Monitors stat changes and generates appropriate sound effects.
Definition at line 37 of file StatsWatcher.java.
com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher | ( | @NotNull final Stats | stats, |
@NotNull final JXCWindowRenderer | windowRenderer, | ||
@NotNull final CrossfireServerConnection | server, | ||
@NotNull final SoundManager | soundManager | ||
) |
Creates a new instance.
stats | the stats instance to watch |
windowRenderer | the window renderer instance |
server | the crossfire server connection to watch |
soundManager | the sound manager instance to watch |
Definition at line 177 of file StatsWatcher.java.
References com.realtime.crossfire.jxclient.stats.Stats.C_STAT_POISONED, com.realtime.crossfire.jxclient.sound.StatsWatcher.crossfireUpdateItemListener, com.realtime.crossfire.jxclient.stats.Stats.CS_STAT_LEVEL, com.realtime.crossfire.jxclient.gui.gui.RendererGuiStateListener.guiStateChanged(), com.realtime.crossfire.jxclient.sound.StatsWatcher.level, com.realtime.crossfire.jxclient.sound.StatsWatcher.poisoned, com.realtime.crossfire.jxclient.sound.StatsWatcher.rendererGuiStateListener, com.realtime.crossfire.jxclient.sound.StatsWatcher.soundManager, and com.realtime.crossfire.jxclient.sound.StatsWatcher.statsListener.
|
private |
Checks for changed stats and generate sound effects.
statNo | the changed stat number |
value | the new stat value |
Definition at line 192 of file StatsWatcher.java.
References com.realtime.crossfire.jxclient.sound.StatsWatcher.active, com.realtime.crossfire.jxclient.stats.Stats.C_STAT_POISONED, com.realtime.crossfire.jxclient.stats.Stats.CS_STAT_LEVEL, com.realtime.crossfire.jxclient.sound.StatsWatcher.ignoreLevelChange, com.realtime.crossfire.jxclient.sound.StatsWatcher.level, com.realtime.crossfire.jxclient.sound.Sounds.LEVEL_UP, com.realtime.crossfire.jxclient.sound.StatsWatcher.playClip(), com.realtime.crossfire.jxclient.sound.Sounds.POISON_OFF, com.realtime.crossfire.jxclient.sound.Sounds.POISON_ON, and com.realtime.crossfire.jxclient.sound.StatsWatcher.poisoned.
|
private |
Plays a clip if sounds should be generated.
clip | the sound clip to play |
Definition at line 219 of file StatsWatcher.java.
References com.realtime.crossfire.jxclient.sound.StatsWatcher.active, com.realtime.crossfire.jxclient.sound.Sounds.CHARACTER, com.realtime.crossfire.jxclient.sound.SoundManager.playClip(), and com.realtime.crossfire.jxclient.sound.StatsWatcher.soundManager.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.checkStats().
|
private |
Whether sounds should be generated.
Definition at line 53 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.checkStats(), and com.realtime.crossfire.jxclient.sound.StatsWatcher.playClip().
|
private |
The CrossfireUpdateItemListener to receive item updates.
Definition at line 141 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().
|
staticprivate |
Duration for which to ignore level changes after login.
Definition at line 42 of file StatsWatcher.java.
|
private |
Ignore level changes until this time has reached.
This is used to suppress false positives right after login. The value
means not to ignore level changes.
Definition at line 70 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.checkStats().
|
private |
The last known level.
Definition at line 63 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.checkStats(), and com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().
|
private |
The last known poisoned state.
Definition at line 58 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.checkStats(), and com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().
|
private |
The gui state listener.
Definition at line 126 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().
|
private |
The SoundManager instance to watch.
Definition at line 48 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.playClip(), and com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().
|
private |
The crossfire stats listener.
Definition at line 77 of file StatsWatcher.java.
Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().