From a96ab7c52336888d153c45ac3933a2d09143dd2f Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Fri, 21 Oct 2022 11:30:49 +0200 Subject: [PATCH] stoff --- Library/_res/0BDFDB.data.json | 1 + .../NotificationSounds.plugin.js | 21 ++++--------------- 2 files changed, 5 insertions(+), 17 deletions(-) diff --git a/Library/_res/0BDFDB.data.json b/Library/_res/0BDFDB.data.json index 93f4f27846..6a96f824ab 100644 --- a/Library/_res/0BDFDB.data.json +++ b/Library/_res/0BDFDB.data.json @@ -183,6 +183,7 @@ "SoundParser": {"strings": ["discodo", "ddr-down", "mute"]}, "SoundUtils": {"strings": [".play()", ".disableSounds", "getSoundpack"], "nonStrings": ["createElement"], "exported": false, "value": "exports", "map": { "createSound": ["return new"], + "createSoundpackSound": [");return"], "playSound": ["getSoundpack"] }}, "SortedGuildUtils": {"props": ["getSortedGuilds", "getFlattenedGuildIds"]}, diff --git a/Plugins/NotificationSounds/NotificationSounds.plugin.js b/Plugins/NotificationSounds/NotificationSounds.plugin.js index 31eea0039d..a275e7c342 100644 --- a/Plugins/NotificationSounds/NotificationSounds.plugin.js +++ b/Plugins/NotificationSounds/NotificationSounds.plugin.js @@ -2,7 +2,7 @@ * @name NotificationSounds * @author DevilBro * @authorId 278543574059057154 - * @version 3.7.3 + * @version 3.7.4 * @description Allows you to replace the native Sounds with custom Sounds * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -62,7 +62,7 @@ module.exports = (_ => { const removeAllKey = "REMOVE_ALL_BDFDB_DEVILBRO_DO_NOT_COPY"; const defaultDevice = "default"; - var currentDevice = defaultDevice, createdAudios = {}, repatchIncoming; + var currentDevice = defaultDevice, createdAudios = {}; let types = {}; @@ -299,7 +299,7 @@ module.exports = (_ => { } else e.callOriginalMethodAfterwards(); }}); - BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => { + BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, ["createSound", "createSoundpackSound"], {after: e => { let type = e.methodArguments[0]; if (type && choices[type]) { let audio = new WebAudioSound(type); @@ -312,18 +312,6 @@ module.exports = (_ => { this.loadAudios(); this.loadChoices(); - let callListenerModule = BDFDB.ModuleUtils.findByProperties("handleRingUpdate"); - if (callListenerModule) { - callListenerModule.terminate(); - BDFDB.PatchUtils.patch(this, callListenerModule, "handleRingUpdate", {instead: e => { - if (BDFDB.LibraryStores.CallStore.getCalls().filter(call => call.ringing.length > 0 && BDFDB.LibraryStores.SortedVoiceStateStore.getCurrentClientVoiceChannelId() === call.channelId).length > 0 && !BDFDB.LibraryStores.NotificationSettingsStore.isSoundDisabled("call_calling") && !BDFDB.LibraryStores.StreamerModeStore.disableSounds) { - createdAudios["call_calling"].loop(); - } - else createdAudios["call_calling"].stop(); - }}); - callListenerModule.initialize(); - } - this.forceUpdateAll(); } @@ -672,9 +660,8 @@ module.exports = (_ => { } forceUpdateAll () { - repatchIncoming = true; - createdAudios["call_calling"] = BDFDB.LibraryModules.SoundUtils.createSound("call_calling"); volumes = BDFDB.DataUtils.get(this, "volumes"); + if (BDFDB.LibraryStores.SoundpackStore) BDFDB.LibraryStores.SoundpackStore.emitChange(); BDFDB.PatchUtils.forceAllUpdates(this); BDFDB.DiscordUtils.rerenderAll(); }