com.realtime.crossfire.jxclient.sound
Class StatsWatcher

java.lang.Object
  extended by com.realtime.crossfire.jxclient.sound.StatsWatcher

public class StatsWatcher
extends java.lang.Object

Monitors stat changes and generates appropriate sound effects.


Field Summary
private  boolean active
          Whether sounds should be generated.
private  CrossfireUpdateItemListener crossfireUpdateItemListener
          The CrossfireUpdateItemListener to receive item updates.
private static long DELAY
          Duration for which to ignore level changes after login.
private  long ignoreLevelChange
          Ignore level changes until this time has reached.
private  int level
          The last know level.
private  boolean poisoned
          The last known poisoned state.
private  RendererGuiStateListener rendererGuiStateListener
          The gui state listener.
private  SoundManager soundManager
          The SoundManager instance to watch.
private  StatsListener statsListener
          The crossfire stats listener.
 
Constructor Summary
StatsWatcher(Stats stats, JXCWindowRenderer windowRenderer, CrossfireServerConnection server, SoundManager soundManager)
          Creates a new instance.
 
Method Summary
private  void checkStats(int statNo, int value)
          Checks for changed stats and generate sound effects.
private  void playClip(java.lang.String clip)
          Plays a clip if sounds should be generated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

active

private boolean active
Whether sounds should be generated.


crossfireUpdateItemListener

@NotNull
private final CrossfireUpdateItemListener crossfireUpdateItemListener
The CrossfireUpdateItemListener to receive item updates.


DELAY

private static final long DELAY
Duration for which to ignore level changes after login.

See Also:
Constant Field Values

ignoreLevelChange

private long ignoreLevelChange
Ignore level changes until this time has reached. This is used to suppress false positives right after login. The value 0 means not to ignore level changes.


level

private int level
The last know level.


poisoned

private boolean poisoned
The last known poisoned state.


rendererGuiStateListener

@NotNull
private final RendererGuiStateListener rendererGuiStateListener
The gui state listener.


soundManager

@NotNull
private final SoundManager soundManager
The SoundManager instance to watch.


statsListener

@NotNull
private final StatsListener statsListener
The crossfire stats listener.

Constructor Detail

StatsWatcher

public StatsWatcher(@NotNull
                    Stats stats,
                    @NotNull
                    JXCWindowRenderer windowRenderer,
                    @NotNull
                    CrossfireServerConnection server,
                    @NotNull
                    SoundManager soundManager)
Creates a new instance.

Parameters:
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
Method Detail

checkStats

private void checkStats(int statNo,
                        int value)
Checks for changed stats and generate sound effects.

Parameters:
statNo - the changed stat number
value - the new stat value

playClip

private void playClip(@NotNull
                      java.lang.String clip)
Plays a clip if sounds should be generated.

Parameters:
clip - the sound clip to play