Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of WishboneMute v1.2.2
WishboneMute.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WishboneMute")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WishboneMute")] [assembly: AssemblyTitle("WishboneMute")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WishboneMute { [BepInPlugin("com.Azura.wishbonemute", "WishboneMute", "1.2.2")] public class WishboneMutePlugin : BaseUnityPlugin { public const string PluginGUID = "com.Azura.wishbonemute"; public const string PluginName = "WishboneMute"; public const string PluginVersion = "1.2.2"; public static ConfigEntry<KeyCode> ToggleKey; public static ConfigEntry<bool> MuteAudio; public static ConfigEntry<bool> ShowNotification; public static ConfigEntry<float> MutedVolume; public static bool IsFinderUpdating; public static bool IsMuted { get { if (MuteAudio != null) { return MuteAudio.Value; } return false; } } private void Awake() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Général", "ToucheBasculement", (KeyCode)289, "Key that turns the Wishbone sound off or back on.\nTouche pour couper ou réactiver le son du bréchet (Wishbone)."); MuteAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("Général", "CouperSonBrechet", true, "true = the Wishbone sound is muted (its visual effect stays), false = normal sound.\ntrue = le son du bréchet est coupé (l'effet visuel reste), false = son normal."); ShowNotification = ((BaseUnityPlugin)this).Config.Bind<bool>("Général", "AfficherNotificationHUD", true, "Show a notice on screen when you switch.\nAffiche un message à l'écran lors du basculement."); MutedVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Général", "VolumeCoupe", 0f, new ConfigDescription("Volume of the Wishbone sound while muted: 0 = silence, 0.3 = much quieter.\nVolume du son du bréchet quand il est coupé : 0 = silence, 0.3 = bien plus discret.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); new Harmony("com.Azura.wishbonemute").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} v{1} loaded. Key: {2}, muted: {3}", "WishboneMute", "1.2.2", ToggleKey.Value, MuteAudio.Value)); } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (ToggleKey != null && Input.GetKeyDown(ToggleKey.Value) && !SaisieEnCours()) { MuteAudio.Value = !MuteAudio.Value; string text = Traductions.Texte(MuteAudio.Value ? "coupe" : "actif"); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Wishbone sound: " + (MuteAudio.Value ? "muted" : "on"))); if (ShowNotification.Value && (Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)1, Traductions.Format("son", null, new object[1] { text }), 0, (Sprite)null, false, true); } } } private static bool SaisieEnCours() { if ((!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && !Console.IsVisible() && !Menu.IsVisible()) { return TextInput.IsVisible(); } return true; } } [HarmonyPatch(typeof(SE_Finder), "UpdateStatusEffect")] public static class SE_Finder_UpdateStatusEffect_Patch { public static void Prefix() { WishboneMutePlugin.IsFinderUpdating = true; } public static void Finalizer() { WishboneMutePlugin.IsFinderUpdating = false; } } [HarmonyPatch(typeof(EffectList), "Create")] public static class EffectList_Create_Patch { private static readonly List<AudioSource> Sons = new List<AudioSource>(); private static readonly List<ZSFX> Effets = new List<ZSFX>(); public static void Postfix(GameObject[] __result) { if (!WishboneMutePlugin.IsFinderUpdating || !WishboneMutePlugin.IsMuted || __result == null) { return; } float num = Mathf.Clamp01(WishboneMutePlugin.MutedVolume.Value); foreach (GameObject val in __result) { if ((Object)(object)val == (Object)null) { continue; } if (num > 0f) { Baisser(val, num); continue; } val.GetComponentsInChildren<AudioSource>(true, Sons); foreach (AudioSource son in Sons) { if (!((Object)(object)son == (Object)null)) { son.mute = true; son.volume = 0f; son.clip = null; son.Stop(); ((Behaviour)son).enabled = false; } } val.GetComponentsInChildren<ZSFX>(true, Effets); foreach (ZSFX effet in Effets) { if (!((Object)(object)effet == (Object)null)) { effet.Stop(); ((Behaviour)effet).enabled = false; } } if (!((Object)(object)val.GetComponentInChildren<ParticleSystem>(true) != (Object)null) && !((Object)(object)val.GetComponentInChildren<Renderer>(true) != (Object)null) && !((Object)(object)val.GetComponentInChildren<Light>(true) != (Object)null) && (Sons.Count > 0 || Effets.Count > 0 || ((Object)val).name.IndexOf("sfx", StringComparison.OrdinalIgnoreCase) >= 0)) { val.SetActive(false); } Sons.Clear(); Effets.Clear(); } } private static void Baisser(GameObject go, float volume) { go.GetComponentsInChildren<ZSFX>(true, Effets); foreach (ZSFX effet in Effets) { if ((Object)(object)effet != (Object)null) { effet.m_minVol *= volume; effet.m_maxVol *= volume; } } go.GetComponentsInChildren<AudioSource>(true, Sons); foreach (AudioSource son in Sons) { if ((Object)(object)son != (Object)null) { son.volume *= volume; } } Sons.Clear(); Effets.Clear(); } } internal static class Traductions { internal static readonly string[] Langues = new string[36] { "English", "Swedish", "French", "Italian", "German", "Spanish", "Russian", "Romanian", "Bulgarian", "Macedonian", "Finnish", "Danish", "Norwegian", "Icelandic", "Turkish", "Lithuanian", "Czech", "Hungarian", "Slovak", "Polish", "Dutch", "Portuguese_European", "Portuguese_Brazilian", "Chinese", "Chinese_Trad", "Japanese", "Korean", "Hindi", "Thai", "Abenaki", "Croatian", "Georgian", "Greek", "Serbian", "Ukrainian", "Latvian" }; private static readonly string[] Cultures = new string[36] { "en-US", "sv-SE", "fr-FR", "it-IT", "de-DE", "es-ES", "ru-RU", "ro-RO", "bg-BG", "mk-MK", "fi-FI", "da-DK", "nb-NO", "is-IS", "tr-TR", "lt-LT", "cs-CZ", "hu-HU", "sk-SK", "pl-PL", "nl-NL", "pt-PT", "pt-BR", "zh-CN", "zh-TW", "ja-JP", "ko-KR", "hi-IN", "th-TH", "en-US", "hr-HR", "ka-GE", "el-GR", "sr-Latn-RS", "uk-UA", "lv-LV" }; internal static readonly Dictionary<string, string[]> Textes = new Dictionary<string, string[]> { ["son"] = new string[36] { "Wishbone sound: {0}", "Önskebenets ljud: {0}", "Son du bréchet : {0}", "Suono della forcula: {0}", "Ton der Wünschelrute: {0}", "Sonido de la fúrcula: {0}", "Звук дужки: {0}", "Sunetul claviculei: {0}", "Звук на ядеца: {0}", "Звук на коскичката за желби: {0}", "Toivomusluun ääni: {0}", "Ønskebenets lyd: {0}", "Ønskebeinets lyd: {0}", "Hljóð óskabeinsins: {0}", "Lades kemiği sesi: {0}", "Noro kaulo garsas: {0}", "Zvuk pamětní kosti: {0}", "A villacsont hangja: {0}", "Zvuk kosti prosperity: {0}", "Dźwięk kości pomyślności: {0}", "Geluid van het vorkbeen: {0}", "Som do osso dos desejos: {0}", "Som do ossinho da sorte: {0}", "愿望骨声音:{0}", "許願骨聲音:{0}", "叉骨の音:{0}", "위시본 소리: {0}", "व\u093fशब\u094bन क\u0940 आव\u093eज\u093c: {0}", "เส\u0e35ยงว\u0e34ชโบน: {0}", null, "Zvuk kosti želja: {0}", "სურვილის ძვლის ხმა: {0}", "Ήχος του κόκαλου των ευχών: {0}", "Zvuk kosti želja: {0}", "Звук вилочки: {0}", "Vēlmju kaula skaņa: {0}" }, ["coupe"] = new string[36] { "MUTED", "AVSTÄNGT", "COUPÉ", "DISATTIVATO", "STUMM", "SILENCIADO", "ВЫКЛЮЧЕН", "OPRIT", "ИЗКЛЮЧЕН", "ИСКЛУЧЕН", "MYKISTETTY", "SLÅET FRA", "DEMPET", "ÞAGGAÐ", "KAPALI", "NUTILDYTAS", "ZTLUMENO", "NÉMÍTVA", "STLMENÝ", "WYCISZONY", "GEDEMPT", "SILENCIADO", "SILENCIADO", "已静音", "已靜音", "ミュート", "음소거", "म\u094dय\u0942ट", "ป\u0e34ดเส\u0e35ยง", null, "UTIŠANO", "დადუმებულია", "ΣΙΓΑΣΗ", "UTIŠANO", "ВИМКНЕНО", "IZSLĒGTA" }, ["actif"] = new string[36] { "ON", "PÅ", "ACTIF", "ATTIVO", "AN", "ACTIVO", "ВКЛЮЧЁН", "PORNIT", "ВКЛЮЧЕН", "ВКЛУЧЕН", "PÄÄLLÄ", "TIL", "PÅ", "Á", "AÇIK", "ĮJUNGTAS", "ZAPNUTO", "BE", "ZAPNUTÝ", "WŁĄCZONY", "AAN", "LIGADO", "LIGADO", "开启", "開啟", "オン", "켜짐", "च\u093eल\u0942", "เป\u0e34ด", null, "UKLJUČENO", "ჩართულია", "ΑΝΟΙΧΤΟΣ", "UKLJUČENO", "УВІМКНЕНО", "IESLĒGTA" } }; private static readonly FieldInfo TraductionDuJeu = typeof(Localization).GetField("m_instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static bool jeuPret; internal static string LangueDuJeu { get { try { if (!jeuPret) { if (TraductionDuJeu != null && TraductionDuJeu.GetValue(null) == null) { return PlayerPrefs.GetString("language", "English"); } jeuPret = true; } return Localization.instance.GetSelectedLanguage(); } catch (Exception) { return "English"; } } } internal static string Texte(string cle, string langue = null) { if (!Textes.TryGetValue(cle, out var value)) { return cle; } int num = Array.IndexOf(Langues, langue ?? LangueDuJeu); if (num <= 0 || num >= value.Length || string.IsNullOrEmpty(value[num])) { return value[0]; } return value[num]; } internal static string Format(string cle, string langue, object[] valeurs) { string text = Texte(cle, langue); if (valeurs != null && valeurs.Length != 0) { return string.Format(Culture(langue), text, valeurs); } return text; } internal static CultureInfo Culture(string langue = null) { int num = Array.IndexOf(Langues, langue ?? LangueDuJeu); try { return CultureInfo.GetCultureInfo((num >= 0) ? Cultures[num] : "en-US"); } catch { return CultureInfo.InvariantCulture; } } } }