Crossfire JXClient, Trunk  R20561
com.realtime.crossfire.jxclient.sound.StatsWatcher Class Reference

Monitors stat changes and generates appropriate sound effects. More...

+ Collaboration diagram for com.realtime.crossfire.jxclient.sound.StatsWatcher:

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...
 

Detailed Description

Monitors stat changes and generates appropriate sound effects.

Author
Andreas Kirschbaum

Definition at line 37 of file StatsWatcher.java.

Constructor & Destructor Documentation

◆ StatsWatcher()

com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher ( @NotNull final Stats  stats,
@NotNull final JXCWindowRenderer  windowRenderer,
@NotNull final CrossfireServerConnection  server,
@NotNull final SoundManager  soundManager 
)

Member Function Documentation

◆ checkStats()

◆ playClip()

void com.realtime.crossfire.jxclient.sound.StatsWatcher.playClip ( @NotNull final String  clip)
private

Plays a clip if sounds should be generated.

Parameters
clipthe 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ active

boolean com.realtime.crossfire.jxclient.sound.StatsWatcher.active
private

◆ crossfireUpdateItemListener

final CrossfireUpdateItemListener com.realtime.crossfire.jxclient.sound.StatsWatcher.crossfireUpdateItemListener
private
Initial value:
= new CrossfireUpdateItemListener() {
@Override
public void delinvReceived(final int tag) {
}
@Override
public void delitemReceived(@NotNull final int[] tags) {
}
@Override
public void addItemReceived(final int location, final int tag, final int flags, final int weight, final int faceNum, @NotNull final String name, @NotNull final String namePl, final int anim, final int animSpeed, final int nrof, final int type) {
}
@Override
public void playerReceived(final int tag, final int weight, final int faceNum, @NotNull final String name) {
ignoreLevelChange = System.currentTimeMillis()+DELAY;
}
@Override
public void upditemReceived(final int flags, final int tag, final int valLocation, final int valFlags, final int valWeight, final int valFaceNum, @NotNull final String valName, @NotNull final String valNamePl, final int valAnim, final int valAnimSpeed, final int valNrof) {
}
}

The CrossfireUpdateItemListener to receive item updates.

Definition at line 141 of file StatsWatcher.java.

Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().

◆ DELAY

final long com.realtime.crossfire.jxclient.sound.StatsWatcher.DELAY = 5000
staticprivate

Duration for which to ignore level changes after login.

Definition at line 42 of file StatsWatcher.java.

◆ ignoreLevelChange

long com.realtime.crossfire.jxclient.sound.StatsWatcher.ignoreLevelChange = System.currentTimeMillis()+DELAY
private

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.

Definition at line 70 of file StatsWatcher.java.

Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.checkStats().

◆ level

int com.realtime.crossfire.jxclient.sound.StatsWatcher.level
private

◆ poisoned

boolean com.realtime.crossfire.jxclient.sound.StatsWatcher.poisoned
private

◆ rendererGuiStateListener

final RendererGuiStateListener com.realtime.crossfire.jxclient.sound.StatsWatcher.rendererGuiStateListener
private
Initial value:
= new RendererGuiStateListener() {
@Override
public void guiStateChanged(@NotNull final RendererGuiState rendererGuiState) {
active = rendererGuiState == RendererGuiState.PLAYING;
ignoreLevelChange = System.currentTimeMillis()+DELAY;
}
}

The gui state listener.

Definition at line 126 of file StatsWatcher.java.

Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().

◆ soundManager

final SoundManager com.realtime.crossfire.jxclient.sound.StatsWatcher.soundManager
private

◆ statsListener

final StatsListener com.realtime.crossfire.jxclient.sound.StatsWatcher.statsListener
private

The crossfire stats listener.

Definition at line 77 of file StatsWatcher.java.

Referenced by com.realtime.crossfire.jxclient.sound.StatsWatcher.StatsWatcher().


The documentation for this class was generated from the following file: