Crossfire JXClient, Trunk
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
com.realtime.crossfire.jxclient.sound.SoundStatsWatcher Class Reference
Collaboration diagram for com.realtime.crossfire.jxclient.sound.SoundStatsWatcher:
Collaboration graph

Public Member Functions

 SoundStatsWatcher (@NotNull final Stats stats, @NotNull final JXCWindowRenderer windowRenderer, @NotNull final CrossfireServerConnection server, @NotNull final SoundManager soundManager)
 

Private Member Functions

void checkStats (final int statNo, final int value)
 
void playClip (@NotNull final CharSequence clip)
 

Private Attributes

boolean active
 
final CrossfireUpdateItemListener crossfireUpdateItemListener
 
long ignoreLevelChange = System.currentTimeMillis()+DELAY
 
int level
 
boolean poisoned
 
final RendererGuiStateListener rendererGuiStateListener
 
final SoundManager soundManager
 
final StatsListener statsListener
 

Static Private Attributes

static final long DELAY = 5000
 

Detailed Description

Monitors stat changes and generates appropriate sound effects.

Author
Andreas Kirschbaum

Definition at line 38 of file SoundStatsWatcher.java.

Constructor & Destructor Documentation

◆ SoundStatsWatcher()

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

Member Function Documentation

◆ checkStats()

void com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.checkStats ( final int  statNo,
final int  value 
)
private

◆ playClip()

void com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.playClip ( @NotNull final CharSequence  clip)
private

Plays a clip if sounds should be generated.

Parameters
clipthe sound clip to play

Definition at line 224 of file SoundStatsWatcher.java.

References com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.active, com.realtime.crossfire.jxclient.sound.Sounds.CHARACTER, com.realtime.crossfire.jxclient.sound.SoundManager.playClip(), and com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.soundManager.

Referenced by com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.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.SoundStatsWatcher.active
private

◆ crossfireUpdateItemListener

final CrossfireUpdateItemListener com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.crossfireUpdateItemListener
private
Initial value:
= new CrossfireUpdateItemListener() {
@Override
public void delinvReceived(final int tag) {
}
@Override
public void delitemReceived(final int @NotNull [] 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 147 of file SoundStatsWatcher.java.

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

◆ DELAY

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

Duration for which to ignore level changes after login.

Definition at line 43 of file SoundStatsWatcher.java.

◆ ignoreLevelChange

long com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.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 71 of file SoundStatsWatcher.java.

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

◆ level

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

◆ poisoned

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

◆ rendererGuiStateListener

final RendererGuiStateListener com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.rendererGuiStateListener
private
Initial value:
= rendererGuiState -> {
active = rendererGuiState == RendererGuiState.PLAYING;
ignoreLevelChange = System.currentTimeMillis()+DELAY;
}

The gui state listener.

Definition at line 137 of file SoundStatsWatcher.java.

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

◆ soundManager

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

◆ statsListener

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

The crossfire stats listener.

Definition at line 78 of file SoundStatsWatcher.java.

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


The documentation for this class was generated from the following file:
com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.DELAY
static final long DELAY
Definition: SoundStatsWatcher.java:43
com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.active
boolean active
Definition: SoundStatsWatcher.java:54
com.realtime.crossfire.jxclient.sound.SoundStatsWatcher.ignoreLevelChange
long ignoreLevelChange
Definition: SoundStatsWatcher.java:71