Made chat notifications a littlebit more silent
parent
6830058c2c
commit
aa2ab6fbd6
|
@ -1189,17 +1189,17 @@ class ConnectionCommandHandler {
|
|||
return;
|
||||
}
|
||||
if(invoker == this.connection._client.getClient()) {
|
||||
sound.play(Sound.MESSAGE_SEND);
|
||||
sound.play(Sound.MESSAGE_SEND, {default_volume: .5});
|
||||
target.chat(true).appendMessage("{0}: {1}", true, this.connection._client.getClient().createChatTag(true), MessageHelper.bbcode_chat(json["msg"]));
|
||||
} else {
|
||||
sound.play(Sound.MESSAGE_RECEIVED);
|
||||
sound.play(Sound.MESSAGE_RECEIVED, {default_volume: .5});
|
||||
invoker.chat(true).appendMessage("{0}: {1}", true, ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"], true), MessageHelper.bbcode_chat(json["msg"]));
|
||||
}
|
||||
} else if(mode == 2) {
|
||||
if(json["invokerid"] == this.connection._client.clientId)
|
||||
sound.play(Sound.MESSAGE_SEND);
|
||||
sound.play(Sound.MESSAGE_SEND, {default_volume: .5});
|
||||
else
|
||||
sound.play(Sound.MESSAGE_RECEIVED);
|
||||
sound.play(Sound.MESSAGE_RECEIVED, {default_volume: .5});
|
||||
chat.channelChat().appendMessage("{0}: {1}", true, ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"], true), MessageHelper.bbcode_chat(json["msg"]))
|
||||
} else if(mode == 3) {
|
||||
chat.serverChat().appendMessage("{0}: {1}", true, ClientEntry.chatTag(json["invokerid"], json["invokername"], json["invokeruid"], true), MessageHelper.bbcode_chat(json["msg"]));
|
||||
|
|
|
@ -83,10 +83,14 @@ namespace sound {
|
|||
speech_mapping[key] = {key: key, filename: file} as SpeechFile;
|
||||
}
|
||||
|
||||
export function get_sound_volume(sound: Sound) : number {
|
||||
export function get_sound_volume(sound: Sound, default_volume?: number) : number {
|
||||
let result = speech_volume[sound];
|
||||
if(typeof(result) === "undefined")
|
||||
result = 1;
|
||||
if(typeof(result) === "undefined") {
|
||||
if(typeof(default_volume) !== "undefined")
|
||||
result = default_volume;
|
||||
else
|
||||
result = 1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -213,6 +217,8 @@ namespace sound {
|
|||
export interface PlaybackOptions {
|
||||
ignore_muted?: boolean;
|
||||
ignore_overlap?: boolean;
|
||||
|
||||
default_volume?: number;
|
||||
}
|
||||
|
||||
export function play(sound: Sound, options?: PlaybackOptions) {
|
||||
|
@ -234,7 +240,7 @@ namespace sound {
|
|||
|
||||
const path = "audio/" + file.filename;
|
||||
const context = audio.player.context();
|
||||
const volume = get_sound_volume(sound);
|
||||
const volume = get_sound_volume(sound, options.default_volume);
|
||||
|
||||
console.log(tr("Replaying sound %s (Sound volume: %o | Master volume %o)"), sound, volume, master_volume);
|
||||
if(volume == 0) return;
|
||||
|
|
Loading…
Reference in New Issue