Decompiled source of Riven Sounds Pack v1.2.1
BonkHitSFX.dll
Decompiled 2 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using BonkHitSFX.Patches; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("BonkHitSFX")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BonkHitSFX")] [assembly: AssemblyTitle("BonkHitSFX")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace BonkHitSFX { [BepInPlugin("sunnobunno.bonkhitsfx", "Bonk Hit SFX", "1.0.5")] public class BonkHitSFXBase : BaseUnityPlugin { private const string modGUID = "sunnobunno.bonkhitsfx"; private const string modName = "Bonk Hit SFX"; private const string modVersion = "1.0.5"; private readonly Harmony harmony = new Harmony("sunnobunno.bonkhitsfx"); private static BonkHitSFXBase? Instance; internal ManualLogSource? mls; internal static AudioClip[]? newHitSFX; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("sunnobunno.bonkhitsfx"); mls.LogInfo((object)"sunnobunno.bonkhitsfx is loading."); string location = ((BaseUnityPlugin)Instance).Info.Location; string text = "BonkHitSFX.dll"; string text2 = location.TrimEnd(text.ToCharArray()); string text3 = text2 + "bonkhitsfx"; AssetBundle val = AssetBundle.LoadFromFile(text3); if ((Object)(object)val == (Object)null) { mls.LogError((object)"Failed to load audio assets!"); return; } newHitSFX = val.LoadAssetWithSubAssets<AudioClip>("Assets/bonkhitsfx.mp3"); harmony.PatchAll(typeof(HitSFXPatch)); mls.LogInfo((object)"sunnobunno.bonkhitsfx is loaded. Ow."); } } } namespace BonkHitSFX.Patches { [HarmonyPatch(typeof(Shovel))] internal class HitSFXPatch { [HarmonyPatch("HitShovelClientRpc")] [HarmonyPatch("HitShovel")] [HarmonyPrefix] public static void hitSFXPatch(ref AudioClip[] ___hitSFX) { AudioClip[] newHitSFX = BonkHitSFXBase.newHitSFX; ___hitSFX = newHitSFX; } } }
MinecraftCaveSounds.dll
Decompiled 2 hours agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using MinecraftCaveSounds.Patches; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MinecraftCaveSounds")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MinecraftCaveSounds")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("164802eb-4a80-44ec-9241-3c3bfcd42891")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace MinecraftCaveSounds { [BepInPlugin("BinglePringle.MinecraftCaveSounds", "Minecraft Cave Sounds", "1.0.0")] public class CaveSoundsBase : BaseUnityPlugin { private const string modGUID = "BinglePringle.MinecraftCaveSounds"; private const string modName = "Minecraft Cave Sounds"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("BinglePringle.MinecraftCaveSounds"); private static CaveSoundsBase instance; internal ManualLogSource mls; internal static List<AudioClip> SoundFX; internal static AssetBundle Bundle; private void Awake() { if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("BinglePringle.MinecraftCaveSounds"); mls.LogInfo((object)"Loaded MinecraftCaveSounds 1.0.0"); harmony.PatchAll(typeof(CaveSoundsBase)); harmony.PatchAll(typeof(LevelAmbiencePatch)); mls = ((BaseUnityPlugin)this).Logger; SoundFX = new List<AudioClip>(); string location = ((BaseUnityPlugin)instance).Info.Location; location = location.TrimEnd("MinecraftCaveSounds.dll".ToCharArray()); Bundle = AssetBundle.LoadFromFile(location + "cavesounds"); if ((Object)(object)Bundle != (Object)null) { mls.LogInfo((object)"Cave sounds loaded successfully."); SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList(); } else { mls.LogError((object)"Failed to load cave sounds."); } } } } namespace MinecraftCaveSounds.Patches { [HarmonyPatch(typeof(StartOfRound))] internal class LevelAmbiencePatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void AddAudio(StartOfRound __instance) { List<AudioClip> list = __instance.currentLevel.levelAmbienceClips.insideAmbience.ToList(); foreach (AudioClip item in CaveSoundsBase.SoundFX) { list.Add(item); } __instance.currentLevel.levelAmbienceClips.insideAmbience = list.ToArray(); } } }
BepInEx/plugins/LethalClunk/LethalClunk.dll
Decompiled 2 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalClunk")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Mod to replace the Large Axle drop sound with the metal bar meme sound")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+32ab32b67da71ea7b44296192ba03dfcf26f159a")] [assembly: AssemblyProduct("LethalClunk")] [assembly: AssemblyTitle("LethalClunk")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } public static class ExtensionMethods { public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOp) { TaskCompletionSource<object?> tcs = new TaskCompletionSource<object>(); asyncOp.completed += delegate { tcs.SetResult(null); }; return ((Task)tcs.Task).GetAwaiter(); } } namespace LethalClunk { [BepInPlugin("LethalClunk", "LethalClunk", "1.1.1")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("LethalClunk"); private readonly ManualLogSource logger; public Plugin() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown logger = Logger.CreateLogSource("LethalClunk"); } public void Awake() { harmony.PatchAll(); logger.LogInfo((object)"Plugin LethalClunk is loaded!"); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalClunk"; public const string PLUGIN_NAME = "LethalClunk"; public const string PLUGIN_VERSION = "1.1.1"; } } namespace LethalClunk.Patches { [HarmonyPatch(typeof(GrabbableObject))] internal class LethalClunkPatch { private static ManualLogSource logger = Logger.CreateLogSource("LethalClunk"); [HarmonyPatch("Start")] [HarmonyPostfix] private static async void ReplaceLargeAxleSFX(GrabbableObject __instance) { Item item = __instance.itemProperties; AudioClip audioClip = await LoadAudioClip("metal_bar.wav"); if (item.itemName == "Large axle") { logger.LogInfo((object)"Large Axle Spawned"); if ((Object)(object)audioClip != (Object)null) { item.dropSFX = audioClip; } } } private static async Task<AudioClip?> LoadAudioClip(string clipName) { string fullPath = GetAssemblyFullPath(clipName); UnityWebRequest audioClipReq = UnityWebRequestMultimedia.GetAudioClip(fullPath, (AudioType)20); await (AsyncOperation)(object)audioClipReq.SendWebRequest(); if (audioClipReq.error != null) { logger.LogError((object)audioClipReq.error); logger.LogError((object)"Failed to load audio clip for LethalClunk, sound will not be replaced"); return null; } AudioClip audioClip = DownloadHandlerAudioClip.GetContent(audioClipReq); ((Object)audioClip).name = Path.GetFileName(fullPath); return audioClip; } private static string GetAssemblyFullPath(string? additionalPath) { string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = ((additionalPath != null) ? Path.Combine(directoryName, ".\\" + additionalPath) : directoryName); return Path.GetFullPath(path); } } }
BepInEx/plugins/BarberClockTower.dll
Decompiled 2 hours agousing System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BarberClockTower.Patches; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("BarberClockTower")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BarberClockTower")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("65891697-b0dc-4cdd-b269-fbf8965a338b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace BarberClockTower { [BepInPlugin("Zomagon.BarberClockTower", "Barber Clock Tower Mod", "1.0.0.0")] public class BarberClockTower : BaseUnityPlugin { private const string modGUID = "Zomagon.BarberClockTower"; private const string modName = "Barber Clock Tower Mod"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Zomagon.BarberClockTower"); private static BarberClockTower Instance; internal static ManualLogSource mls; public static AssetBundle ModAssets; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Zomagon.BarberClockTower"); mls.LogInfo((object)"The Scissorman has awoken."); harmony.PatchAll(typeof(BarberClockTower)); harmony.PatchAll(typeof(ClaySurgeonAIPatch)); harmony.PatchAll(typeof(StartOfRoundPatch)); string path = "barberclocktower"; ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path)); if ((Object)(object)ModAssets == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load custom assets."); } } } } namespace BarberClockTower.Patches { [HarmonyPatch(typeof(ClaySurgeonAI))] internal class ClaySurgeonAIPatch { private static AudioClip clockTowerMus = null; internal static Dictionary<ClaySurgeonAI, AudioSource> surgeonSources = new Dictionary<ClaySurgeonAI, AudioSource>(); [HarmonyPatch("Start")] [HarmonyPostfix] public static void claySurgeonMusicStart(ClaySurgeonAI __instance) { if ((Object)(object)clockTowerMus == (Object)null) { if ((Object)(object)BarberClockTower.ModAssets == (Object)null) { BarberClockTower.mls.LogInfo((object)"Failed to load clockTowerMus asset bundle"); return; } clockTowerMus = BarberClockTower.ModAssets.LoadAsset<AudioClip>("Clock Tower - Scissorman.mp3"); } if (StartOfRoundPatch.surgeonSourceCount < 1) { AudioSource val = ((Component)__instance).gameObject.AddComponent<AudioSource>(); val.clip = clockTowerMus; val.volume = 40f; val.loop = true; val.dopplerLevel = 0f; val.spatialBlend = 1f; val.maxDistance = 300f; val.spatialize = false; surgeonSources[__instance] = val; } StartOfRoundPatch.surgeonSourceCount++; } [HarmonyPatch("Update")] [HarmonyPostfix] public static void claySurgeonMusicUpdate(ClaySurgeonAI __instance) { AudioSource val = surgeonSources[__instance]; if (((EnemyAI)__instance).isEnemyDead) { val.Stop(); } else if (!val.isPlaying) { if (val.time > 0f && (double)val.time <= (double)clockTowerMus.length - 0.1) { val.UnPause(); } else { val.Play(); } } } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { internal static int surgeonSourceCount; private static StartOfRoundPatch Instance; [HarmonyPatch("openingDoorsSequence")] [HarmonyPostfix] private static void PatchOpeningDoorsSequence() { ClaySurgeonAIPatch.surgeonSources.Clear(); surgeonSourceCount = 0; } } }
FrenBracken.dll
Decompiled 2 hours agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using FrenBracken.Patches; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("FrenBracken")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FrenBracken")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0f270ba5-54fa-4eac-8401-8f123e93a8f2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace FrenBracken { [BepInPlugin("God.FrenBracken", "Fren Bracken", "1.0.0")] public class FrenBrackenBase : BaseUnityPlugin { private const string modGUID = "God.FrenBracken"; private const string modName = "Fren Bracken"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("God.FrenBracken"); internal static FrenBrackenBase Instance; internal ManualLogSource mls; internal static List<AudioClip> soundFx; internal static AssetBundle Bundle; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("God.FrenBracken"); mls.LogInfo((object)"Fren Bracken awaken."); harmony.PatchAll(typeof(FrenBrackenBase)); harmony.PatchAll(typeof(FlowermanAIPatch)); soundFx = new List<AudioClip>(); string location = ((BaseUnityPlugin)Instance).Info.Location; location = location.TrimEnd("FrenBracken.dll".ToCharArray()); Bundle = AssetBundle.LoadFromFile(location + "fren"); if ((Object)(object)Bundle != (Object)null) { soundFx = Bundle.LoadAllAssets<AudioClip>().ToList(); } else { mls.LogError((object)"Failed to load asset bundle!"); } } } } namespace FrenBracken.Patches { [HarmonyPatch(typeof(FlowermanAI))] internal class FlowermanAIPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void SoundOverride(FlowermanAI __instance) { __instance.crackNeckSFX = FrenBrackenBase.soundFx[0]; __instance.crackNeckAudio.clip = FrenBrackenBase.soundFx[0]; } } }
BepInEx/plugins/dog.dll
Decompiled 2 hours agousing System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using UnityEngine; using dog.Pathes; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("dog")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("dog")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7543d7e1-7096-4b4d-9926-27e6f5ad370c")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace dog { [BepInPlugin("CbrovkinMods.WHO_LET_THE_DOGS_OUT", "WHO LET THE DOGS OUT", "1.0.0")] public class WHO_LET_THE_DOGS_OUT : BaseUnityPlugin { private const string modGUID = "CbrovkinMods.WHO_LET_THE_DOGS_OUT"; private const string modName = "WHO LET THE DOGS OUT"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("CbrovkinMods.WHO_LET_THE_DOGS_OUT"); private static WHO_LET_THE_DOGS_OUT Instance; internal ManualLogSource mls; internal static List<AudioClip> SoundFX; internal static AssetBundle Bundle; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("CbrovkinMods.WHO_LET_THE_DOGS_OUT"); mls.LogInfo((object)"WHO LET THE DOGS OUT?!"); harmony.PatchAll(typeof(MouthDogAIPatch)); mls = ((BaseUnityPlugin)this).Logger; SoundFX = new List<AudioClip>(); string location = ((BaseUnityPlugin)Instance).Info.Location; location = location.TrimEnd("wltdo.dll".ToCharArray()); Bundle = AssetBundle.LoadFromFile(location + "dog"); if ((Object)(object)Bundle != (Object)null) { mls.LogInfo((object)"Asset bundle loaded successfully"); SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList(); } else { mls.LogError((object)"Failed to load asset bundle"); } } } } namespace dog.Pathes { [HarmonyPatch(typeof(MouthDogAI))] internal class MouthDogAIPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void OverrideAudio(MouthDogAI __instance) { __instance.screamSFX = WHO_LET_THE_DOGS_OUT.SoundFX[0]; } } }
RevisitStingers.dll
Decompiled 2 hours agousing System; using System.Collections; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; 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("RevisitStingers")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Replay interior stingers when they are somewhere they shouldn't be")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0+450e4a7a579ad3f40109f106bb8d09c782e5d3f2")] [assembly: AssemblyProduct("RevisitStingers")] [assembly: AssemblyTitle("RevisitStingers")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 RevisitStingers { [BepInPlugin("butterystancakes.lethalcompany.revisitstingers", "Revisit Stingers", "1.2.0")] public class Plugin : BaseUnityPlugin { private const string PLUGIN_GUID = "butterystancakes.lethalcompany.revisitstingers"; private const string PLUGIN_NAME = "Revisit Stingers"; private const string PLUGIN_VERSION = "1.2.0"; internal static ConfigEntry<float> configMaxRarity; internal static ConfigEntry<float> configInterruptMusic; internal static ConfigEntry<float> configFallbackChance; internal static ManualLogSource Logger; private void Awake() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Logger = ((BaseUnityPlugin)this).Logger; AcceptableValueRange<float> val = new AcceptableValueRange<float>(0f, 1f); string text = " (0 = never, 1 = guaranteed, or anything in between - 0.5 = 50% chance)"; configMaxRarity = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "MaxRarity", 0.06f, new ConfigDescription("The highest spawn chance (0.06 = 6%) an interior can have on a specific moon for it to be considered \"rare\". Rare interiors will always play the stinger.", (AcceptableValueBase)(object)val, Array.Empty<object>())); configInterruptMusic = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "InterruptMusic", 0f, new ConfigDescription("The percentage chance for the stinger to play if you enter the building while an ambient music track is playing." + text, (AcceptableValueBase)(object)val, Array.Empty<object>())); configFallbackChance = ((BaseUnityPlugin)this).Config.Bind<float>("Misc", "FallbackChance", 0f, new ConfigDescription("The percentage chance that the stinger will still play, even if you are in a common interior and there is no music playing on the surface." + text, (AcceptableValueBase)(object)val, Array.Empty<object>())); new Harmony("butterystancakes.lethalcompany.revisitstingers").PatchAll(); Logger.LogInfo((object)"Revisit Stingers v1.2.0 loaded"); } } [HarmonyPatch] internal class RevisitStingersPatches { [HarmonyPatch(typeof(EntranceTeleport), "TeleportPlayer")] [HarmonyPrefix] private static void EntranceTeleportPreTeleportPlayer(EntranceTeleport __instance, bool ___checkedForFirstTime) { if (ReplayStinger.beenInsideThisRound || !__instance.FindExitPoint()) { return; } ReplayStinger.beenInsideThisRound = true; if (___checkedForFirstTime || !ES3.Load<bool>($"PlayedDungeonEntrance{RoundManager.Instance.currentDungeonType}", "LCGeneralSaveData", false)) { return; } try { AudioClip firstTimeAudio = RoundManager.Instance.dungeonFlowTypes[RoundManager.Instance.currentDungeonType].firstTimeAudio; if (ReplayStinger.StingerShouldReplay()) { ((MonoBehaviour)__instance).StartCoroutine(ReplayStinger.DelayedStinger(firstTimeAudio)); } } catch (Exception ex) { Plugin.Logger.LogError((object)"Ran into an error attempting to replay stinger - this is likely due to an incompatibility with modded content"); Plugin.Logger.LogError((object)ex.Message); } } [HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")] [HarmonyPostfix] private static void StartOfRoundPostSetShipReadyToLand() { ReplayStinger.beenInsideThisRound = false; } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPostfix] private static void StartOfRoundPostAwake() { ReplayStinger.beenInsideThisRound = false; } } internal class ReplayStinger { internal static bool beenInsideThisRound; internal static bool StingerShouldReplay() { if (Plugin.configInterruptMusic.Value > 0f && SoundManager.Instance.musicSource.isPlaying && Random.value <= Plugin.configInterruptMusic.Value) { return true; } IntWithRarity[] dungeonFlowTypes = StartOfRound.Instance.currentLevel.dungeonFlowTypes; if (dungeonFlowTypes != null && dungeonFlowTypes.Length > 1 && (!StartOfRound.Instance.isChallengeFile || !ES3.Load<bool>("FinishedChallenge", "LCChallengeFile", false))) { int num = 0; float num2 = 0f; IntWithRarity[] dungeonFlowTypes2 = StartOfRound.Instance.currentLevel.dungeonFlowTypes; foreach (IntWithRarity val in dungeonFlowTypes2) { if (val.id == RoundManager.Instance.currentDungeonType) { num = val.rarity; } num2 += (float)val.rarity; } if (num > 0 && (float)num / num2 <= Plugin.configMaxRarity.Value) { return true; } } if (Plugin.configFallbackChance.Value > 0f) { return Random.value <= Plugin.configFallbackChance.Value; } return false; } internal static IEnumerator DelayedStinger(AudioClip stinger) { yield return (object)new WaitForSeconds(0.6f); HUDManager.Instance.UIAudio.PlayOneShot(stinger); } } public static class PluginInfo { public const string PLUGIN_GUID = "RevisitStingers"; public const string PLUGIN_NAME = "RevisitStingers"; public const string PLUGIN_VERSION = "1.2.0"; } }
com.github.zehsteam.Hitmarker.dll
Decompiled 2 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; using com.github.zehsteam.Hitmarker.MonoBehaviours; using com.github.zehsteam.Hitmarker.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.github.zehsteam.Hitmarker")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Shows a hitmarker when you successfully hit an enemy. With additional features. (Client-side)")] [assembly: AssemblyFileVersion("1.2.3.0")] [assembly: AssemblyInformationalVersion("1.2.3+9f550c00a965039c6c13c3bda8cf3750925b11f7")] [assembly: AssemblyProduct("Hitmarker")] [assembly: AssemblyTitle("com.github.zehsteam.Hitmarker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 com.github.zehsteam.Hitmarker { internal class ConfigManager { public ConfigEntry<bool> ExtendedLogging { get; private set; } public ConfigEntry<bool> ShowHitmarkerImage { get; private set; } public ConfigEntry<int> HitmarkerImageSize { get; private set; } public ConfigEntry<bool> PlayHitmarkerSound { get; private set; } public ConfigEntry<float> MessageDuration { get; private set; } public ConfigEntry<int> MessageFontSize { get; private set; } public ConfigEntry<bool> ShowDamageMessage { get; private set; } public ConfigEntry<bool> ShowKillMessage { get; private set; } public ConfigEntry<bool> OnlyShowLocalKillMessage { get; private set; } public ConfigManager() { BindConfigs(); ClearUnusedEntries(); } private void BindConfigs() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; ExtendedLogging = config.Bind<bool>("General Settings", "ExtendedLogging", false, "Enable extended logging."); ShowHitmarkerImage = config.Bind<bool>("Hitmarker Settings", "ShowHitmarkerImage", true, "Do you want to show the hitmarker image?"); HitmarkerImageSize = config.Bind<int>("Hitmarker Settings", "HitmarkerImageSize", 40, new ConfigDescription("The size of the hitmarker image in pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); PlayHitmarkerSound = config.Bind<bool>("Hitmarker Settings", "PlayHitmarkerSound", true, "Do you want to play the hitmarker sound?"); MessageDuration = config.Bind<float>("Message Settings", "MessageDuration", 4f, "The message duration in seconds."); MessageFontSize = config.Bind<int>("Message Settings", "MessageFontSize", 35, new ConfigDescription("The message font size in pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); ShowDamageMessage = config.Bind<bool>("Message Settings", "ShowDamageMessage", true, "Shows a message of how much damage you did to an enemy."); ShowKillMessage = config.Bind<bool>("Message Settings", "ShowKillMessage", true, "Shows a message when an enemy is killed."); OnlyShowLocalKillMessage = config.Bind<bool>("Message Settings", "OnlyShowLocalKillMessage", true, "Will only show your kill messages."); } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal class Content { public static GameObject HitmarkerCanvasPrefab; public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, "hitmarker_assets"); AssetBundle val = AssetBundle.LoadFromFile(text); HitmarkerCanvasPrefab = val.LoadAsset<GameObject>("HitmarkerCanvas"); Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } catch (Exception arg) { Plugin.logger.LogError((object)$"Error: failed to load assets from AssetBundle.\n\n{arg}"); } } } [BepInPlugin("com.github.zehsteam.Hitmarker", "Hitmarker", "1.2.3")] internal class Plugin : BaseUnityPlugin { private readonly Harmony harmony = new Harmony("com.github.zehsteam.Hitmarker"); internal static Plugin Instance; internal static ManualLogSource logger; internal static ConfigManager ConfigManager; internal static bool IsHostOrServer => NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("com.github.zehsteam.Hitmarker"); logger.LogInfo((object)"Hitmarker has awoken!"); harmony.PatchAll(typeof(HUDManagerPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); ConfigManager = new ConfigManager(); Content.Load(); } public void CreateHitmarkerCanvas() { if (!((Object)(object)HitmarkerCanvasBehaviour.Instance != (Object)null)) { Object.Instantiate<GameObject>(Content.HitmarkerCanvasPrefab); logger.LogInfo((object)"Instantiated Hitmarker canvas."); } } public void LogInfoExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { logger.LogInfo(data); } } } internal class Utils { public static bool IsLocalPlayer(PlayerControllerB playerScript) { return (Object)(object)StartOfRound.Instance.localPlayerController == (Object)(object)playerScript; } public static PlayerControllerB GetPlayerScript(int playerWhoHit) { if (playerWhoHit < 0 || playerWhoHit > StartOfRound.Instance.allPlayerScripts.Length - 1) { return null; } return StartOfRound.Instance.allPlayerScripts[playerWhoHit]; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.Hitmarker"; public const string PLUGIN_NAME = "Hitmarker"; public const string PLUGIN_VERSION = "1.2.3"; } } namespace com.github.zehsteam.Hitmarker.Patches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { [HarmonyPatch("HitEnemyOnLocalClient")] [HarmonyPrefix] private static void HitEnemyOnLocalClientPatch(ref EnemyAI __instance, int force, PlayerControllerB playerWhoHit = null) { if (!((Object)(object)playerWhoHit == (Object)null) && Utils.IsLocalPlayer(playerWhoHit)) { HitEnemy(__instance, force, playerWhoHit); } } [HarmonyPatch("HitEnemyServerRpc")] [HarmonyPrefix] private static void HitEnemyServerRpcPatch(ref EnemyAI __instance, int force, int playerWhoHit) { if (playerWhoHit != -1) { PlayerControllerB playerScript = Utils.GetPlayerScript(playerWhoHit); if (!Utils.IsLocalPlayer(playerScript)) { HitEnemy(__instance, force, playerScript); } } } [HarmonyPatch("HitEnemyClientRpc")] [HarmonyPrefix] private static void HitEnemyClientRpcPatch(ref EnemyAI __instance, int force, int playerWhoHit) { if (playerWhoHit != -1 && !Plugin.IsHostOrServer) { PlayerControllerB playerScript = Utils.GetPlayerScript(playerWhoHit); if (!Utils.IsLocalPlayer(playerScript)) { HitEnemy(__instance, force, playerScript); } } } private static void HitEnemy(EnemyAI enemyAI, int force, PlayerControllerB playerWhoHit) { if (enemyAI.enemyType.canDie && !enemyAI.isEnemyDead && enemyAI.enemyHP > 0) { bool flag = Utils.IsLocalPlayer(playerWhoHit); string enemyName = enemyAI.enemyType.enemyName; bool flag2 = enemyAI.enemyHP - force <= 0; if (flag) { HitmarkerCanvasBehaviour.Instance.ShowHitmarker(flag2); HitmarkerCanvasBehaviour.Instance.ShowDamageMessage(enemyName, force); } if (flag2) { HitmarkerCanvasBehaviour.Instance.ShowKillMessage(enemyName, flag, playerWhoHit.playerUsername); } LogInfoExtended("HitEnemy();", enemyAI, force, playerWhoHit); } } private static void LogInfoExtended(string functionName, EnemyAI enemyAI, int force, PlayerControllerB playerWhoHit) { NetworkObject component = ((Component)enemyAI).gameObject.GetComponent<NetworkObject>(); string text = (Utils.IsLocalPlayer(playerWhoHit) ? " (LOCAL)" : ""); string text2 = $"{functionName} NetworkObjectId: {component.NetworkObjectId}\n\n"; text2 += $"Player \"{playerWhoHit.playerUsername}\"{text} hit \"{enemyAI.enemyType.enemyName}\" for {force} force.\n"; text2 += $"isEnemyDead: {enemyAI.isEnemyDead}, enemyHP: {enemyAI.enemyHP}, (new enemyHP should be {enemyAI.enemyHP - force})\n"; Plugin.Instance.LogInfoExtended("\n\n" + text2.Trim() + "\n"); } } [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch() { Plugin.Instance.CreateHitmarkerCanvas(); } } } namespace com.github.zehsteam.Hitmarker.MonoBehaviours { public class HitmarkerCanvasBehaviour : MonoBehaviour { public static HitmarkerCanvasBehaviour Instance; public HitmarkerImageBehaviour HitmarkerImageBehaviour; public AudioClip HitSFX; public RectTransform MessageListTransform; public RectTransform MessageItemPrefab; private Queue<RectTransform> _messageItemPool = new Queue<RectTransform>(); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } } private void Start() { InitializeMessageItemPool(); } private void InitializeMessageItemPool() { _messageItemPool = new Queue<RectTransform>(); for (int i = 0; i < 20; i++) { RectTransform val = Object.Instantiate<RectTransform>(MessageItemPrefab, (Transform)(object)MessageListTransform); ((Component)val).gameObject.SetActive(false); _messageItemPool.Enqueue(val); } } public void ShowHitmarker(bool killed = false) { ShowHitmarkerImage(killed); PlayHitSFX(); } private void ShowHitmarkerImage(bool killed = false) { if (Plugin.ConfigManager.ShowHitmarkerImage.Value) { HitmarkerImageBehaviour.ShowImage(killed); } } private void PlayHitSFX() { if (Plugin.ConfigManager.PlayHitmarkerSound.Value) { HUDManager.Instance.UIAudio.PlayOneShot(HitSFX); } } public void ShowDamageMessage(string enemyName, int damage = 1) { if (Plugin.ConfigManager.ShowDamageMessage.Value) { ShowMessage($"{enemyName} -{damage} HP"); } } public void ShowKillMessage(string enemyName, bool fromLocalPlayer = true, string fromPlayerName = "") { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ConfigManager.ShowKillMessage.Value && (fromLocalPlayer || !Plugin.ConfigManager.OnlyShowLocalKillMessage.Value)) { if (!fromLocalPlayer) { ShowMessage(fromPlayerName + " Killed " + enemyName, Color.red); } else { ShowMessage("Killed " + enemyName, Color.red); } } } private void ShowMessage(string text) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) ShowMessage(text, Color.white); } private void ShowMessage(string text, Color color) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SpawnMessageItemFromPool(text, color); } private RectTransform SpawnMessageItemFromPool(string text, Color color) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if (_messageItemPool == null || _messageItemPool.Count == 0) { Plugin.logger.LogError((object)"Error: Failed to spawn message item from pool. Message item pool is either null or empty."); return null; } RectTransform val = _messageItemPool.Dequeue(); ((Component)val).gameObject.SetActive(true); ((Transform)val).SetAsLastSibling(); MessageItemBehaviour messageItemBehaviour = default(MessageItemBehaviour); if (((Component)val).TryGetComponent<MessageItemBehaviour>(ref messageItemBehaviour)) { messageItemBehaviour.SetText(text, color); } _messageItemPool.Enqueue(val); return val; } } public class HitmarkerImageBehaviour : MonoBehaviour { public Image Image; public Color32 DefaultColor; public Color32 KilledColor; private Coroutine _fadeOutCoroutine; private void Start() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) int value = Plugin.ConfigManager.HitmarkerImageSize.Value; ((Graphic)Image).rectTransform.sizeDelta = new Vector2((float)value, (float)value); SetAlpha(0f); } public void ShowImage(bool killed = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) ((Graphic)Image).color = Color32.op_Implicit(killed ? KilledColor : DefaultColor); if (_fadeOutCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_fadeOutCoroutine); } _fadeOutCoroutine = ((MonoBehaviour)this).StartCoroutine(FadeOut(0.25f)); } private IEnumerator FadeOut(float duration) { SetAlpha(255f); for (float timer = 0f; timer < duration; timer += Time.deltaTime) { float percent = 1f / duration * timer; float alpha = 255f + -255f * percent; SetAlpha(alpha); yield return null; } SetAlpha(0f); } private void SetAlpha(float a) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) a = Mathf.Clamp(a, 0f, 255f); Color32 val = Color32.op_Implicit(((Graphic)Image).color); val.a = (byte)a; ((Graphic)Image).color = Color32.op_Implicit(val); } } public class MessageItemBehaviour : MonoBehaviour { public TextMeshProUGUI TextUGUI; private Coroutine _animationCoroutine; private void Start() { ((TMP_Text)TextUGUI).fontSize = Plugin.ConfigManager.MessageFontSize.Value; } private void OnEnable() { if (_animationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_animationCoroutine); } _animationCoroutine = ((MonoBehaviour)this).StartCoroutine(PlayAnimation()); } private void OnDisable() { if (_animationCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(_animationCoroutine); } } private IEnumerator PlayAnimation() { yield return (object)new WaitForSeconds(Plugin.ConfigManager.MessageDuration.Value); float fadeOutDuration = 1f; SetAlpha(255f); for (float timer = 0f; timer < fadeOutDuration; timer += Time.deltaTime) { float percent = 1f / fadeOutDuration * timer; float alpha = 255f + -255f * percent; SetAlpha(alpha); yield return null; } SetAlpha(0f); yield return null; ((Component)this).gameObject.SetActive(false); } public void SetText(string text) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) SetText(text, Color.white); } public void SetText(string text, Color color) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) ((TMP_Text)TextUGUI).text = text; ((Graphic)TextUGUI).color = color; } private void SetAlpha(float a) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) a = Mathf.Clamp(a, 0f, 255f); Color32 val = Color32.op_Implicit(((Graphic)TextUGUI).color); val.a = (byte)a; ((Graphic)TextUGUI).color = Color32.op_Implicit(val); } } }
BepInEx/plugins/PizzaTowerEscapeMusic.dll
Decompiled 2 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PizzaTowerEscapeMusic.Scripting; using PizzaTowerEscapeMusic.Scripting.Conditions; using PizzaTowerEscapeMusic.Scripting.ScriptEvents; using UnityEngine; using UnityEngine.Networking; [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("PizzaTowerEscapeMusic")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Plays music from Pizza Tower when the early ship leave alert appears")] [assembly: AssemblyFileVersion("2.4.0.0")] [assembly: AssemblyInformationalVersion("2.4.0")] [assembly: AssemblyProduct("PizzaTowerEscapeMusic")] [assembly: AssemblyTitle("PizzaTowerEscapeMusic")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.4.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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 PizzaTowerEscapeMusic { public class Configuration { private readonly ConfigFile config; internal ConfigEntry<float> volumeMaster; internal ConfigEntry<string> scriptingScripts; public Configuration(ConfigFile config) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown this.config = config; scriptingScripts = config.Bind<string>("Scripting", "Scripts", "Default", new ConfigDescription("The names of the JSON script files that will be loaded (Separated by commas, do not put a space after the commas)", (AcceptableValueBase)null, Array.Empty<object>())); volumeMaster = config.Bind<float>("Volume", "Master", 0.5f, new ConfigDescription("The volume of the music as a whole, all volumes are scaled by this value", (AcceptableValueBase)null, Array.Empty<object>())); RemoveObsoleteEntries(); } private void RemoveObsoleteEntry(string section, string key) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ConfigDefinition val = new ConfigDefinition(section, key); config.Bind<string>(val, "", (ConfigDescription)null); config.Remove(val); } private void ReplaceObsoleteEntry<T>(string section, string key, ConfigEntry<T> replacement) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ConfigDefinition val = new ConfigDefinition(section, key); ConfigEntry<T> val2 = config.Bind<T>(val, (T)((ConfigEntryBase)replacement).DefaultValue, (ConfigDescription)null); if (!EqualityComparer<T>.Default.Equals(val2.Value, (T)((ConfigEntryBase)replacement).DefaultValue)) { replacement.Value = val2.Value; } config.Remove(val); } private void RemoveObsoleteEntries() { RemoveObsoleteEntry("Volume", "InsideFacility"); RemoveObsoleteEntry("Volume", "OutsideFacility"); RemoveObsoleteEntry("Volume", "InsideShip"); RemoveObsoleteEntry("Volume", "CrouchingScale"); RemoveObsoleteEntry("Music", "InsideFacility"); RemoveObsoleteEntry("Music", "OutsideFacility"); RemoveObsoleteEntry("Music", "HeavyWeather"); ReplaceObsoleteEntry<string>("Scripting", "Script", scriptingScripts); config.Save(); } } internal static class CustomManager { public static string GetFilePath(string path, string fallbackPath) { string[] directories = Directory.GetDirectories(Paths.PluginPath); for (int i = 0; i < directories.Length; i++) { string text = directories[i] + "/BGN-PizzaTowerEscapeMusic/" + path; if (File.Exists(text)) { return text; } } string text2 = Paths.PluginPath + "/BGN-PizzaTowerEscapeMusic_Custom/" + path; if (File.Exists(text2)) { return text2; } return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/" + fallbackPath; } } public class GameEventListener : MonoBehaviour { private ManualLogSource logger; public Action OnFrameUpdate = delegate { }; public Action OnSoundManagerCreated = delegate { }; public Action OnSoundManagerDestroyed = delegate { }; public Action OnDungeonDoneGenerating = delegate { }; public Action OnShipLanded = delegate { }; public Action OnShipTakeOff = delegate { }; public Action OnShipReturnToOrbit = delegate { }; public Action OnShipLeavingAlertCalled = delegate { }; public Action OnPlayerDamaged = delegate { }; public Action OnPlayerDeath = delegate { }; public Action OnPlayerEnteredFacility = delegate { }; public Action OnPlayerExitedFacility = delegate { }; public Action OnPlayerEnteredShip = delegate { }; public Action OnPlayerExitedShip = delegate { }; public Action OnApparatusTaken = delegate { }; public Action<SelectableLevel?> OnCurrentMoonChanged = delegate { }; private readonly Dictionary<string, object?> previousValues = new Dictionary<string, object>(); private static LungProp? dockedApparatus; private void Awake() { logger = Logger.CreateLogSource("PizzaTowerEscapeMusic GameEventListener"); OnShipLanded = (Action)Delegate.Combine(OnShipLanded, new Action(FindDockedApparatus)); } private void FindDockedApparatus() { logger.LogDebug((object)"Checking for docked Apparatus..."); LungProp[] array = Object.FindObjectsOfType<LungProp>(); foreach (LungProp val in array) { if (val.isLungDocked) { logger.LogDebug((object)"Found docked Apparatus"); dockedApparatus = val; return; } } logger.LogDebug((object)"Could not find docked Apparatus"); } public static bool IsApparatusDocked() { return (Object)(object)dockedApparatus != (Object)null; } private void Update() { if ((Object)(object)SoundManager.Instance != (Object)null) { OnFrameUpdate(); } CheckSoundManager(); CheckDungeonDoneGenerating(); CheckShipLanded(); CheckShipReturnToOrbit(); CheckShipLeavingAlertCalled(); CheckPlayerDamaged(); CheckPlayerDeath(); CheckPlayerInsideFacility(); CheckPlayerInsideShip(); CheckApparatusTaken(); CheckCurrentMoonChanged(); } private T? UpdateCached<T>(string key, T? currentValue, T? defaultValue) { if (!previousValues.TryGetValue(key, out object value)) { value = defaultValue; } previousValues[key] = currentValue; return (T)value; } private void CheckSoundManager() { bool flag = (Object)(object)SoundManager.Instance != (Object)null; if (UpdateCached("SoundManager", flag, defaultValue: false) != flag) { if (flag) { logger.LogDebug((object)"Sound Manager created"); OnSoundManagerCreated(); } else { logger.LogDebug((object)"Sound Manager destroyed"); OnSoundManagerDestroyed(); } } } private void CheckDungeonDoneGenerating() { bool flag = (Object)(object)RoundManager.Instance != (Object)null && RoundManager.Instance.dungeonCompletedGenerating; bool flag2 = UpdateCached("DungeonDoneGenerating", flag, defaultValue: false); if (flag != flag2 && flag) { logger.LogDebug((object)"Dungeon done generating"); OnDungeonDoneGenerating(); } } private void CheckShipLanded() { bool flag = (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.shipHasLanded; bool flag2 = UpdateCached("ShipLanded", flag, defaultValue: true); if (flag != flag2 && !((Object)(object)StartOfRound.Instance == (Object)null)) { if (flag) { logger.LogDebug((object)"Ship has landed"); OnShipLanded(); } else { logger.LogDebug((object)"Ship has taken off"); OnShipTakeOff(); } } } private void CheckShipReturnToOrbit() { bool flag = (Object)(object)StartOfRound.Instance == (Object)null || (!StartOfRound.Instance.shipHasLanded && !StartOfRound.Instance.shipIsLeaving); bool flag2 = UpdateCached("ShipReturnToOrbit", flag, defaultValue: true); if (flag != flag2 && flag) { logger.LogDebug((object)"Ship returned to orbit"); OnShipReturnToOrbit(); } } private void CheckShipLeavingAlertCalled() { bool flag = (Object)(object)TimeOfDay.Instance != (Object)null && TimeOfDay.Instance.shipLeavingAlertCalled; bool flag2 = UpdateCached("ShipLeavingAlertCalled", flag, defaultValue: false); if (flag != flag2 && flag) { logger.LogDebug((object)"Ship leaving alert called"); OnShipLeavingAlertCalled(); } } private void CheckPlayerDamaged() { if (!((Object)(object)GameNetworkManager.Instance == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null)) { int health = GameNetworkManager.Instance.localPlayerController.health; int num = UpdateCached("PlayerDamaged", health, 100); if (health < num) { logger.LogDebug((object)$"Player took damage (Health: {GameNetworkManager.Instance.localPlayerController.health})"); OnPlayerDamaged(); } } } private void CheckPlayerDeath() { bool flag = (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && GameNetworkManager.Instance.localPlayerController.isPlayerDead; bool flag2 = UpdateCached("PlayerDeath", flag, defaultValue: false); if (flag != flag2 && flag) { logger.LogDebug((object)"Player has died"); OnPlayerDeath(); } } private void CheckPlayerInsideFacility() { bool flag = (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && GameNetworkManager.Instance.localPlayerController.isInsideFactory; bool flag2 = UpdateCached("PlayerInsideFacility", flag, defaultValue: false); if (flag != flag2) { if (flag) { logger.LogDebug((object)"Player entered facility"); OnPlayerEnteredFacility(); } else { logger.LogDebug((object)"Player exited facility"); OnPlayerExitedFacility(); } } } private void CheckPlayerInsideShip() { bool flag = (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom; bool flag2 = UpdateCached("PlayerInsideShip", flag, defaultValue: false); if (flag != flag2) { if (flag) { logger.LogDebug((object)"Player entered ship"); OnPlayerEnteredShip(); } else { logger.LogDebug((object)"Player exited ship"); OnPlayerExitedShip(); } } } private void CheckApparatusTaken() { bool flag = (Object)(object)dockedApparatus != (Object)null && !dockedApparatus.isLungDocked; bool flag2 = UpdateCached("ApparatusTaken", flag, defaultValue: false); if (flag != flag2 && flag) { dockedApparatus = null; logger.LogDebug((object)"Apparatus was taken"); OnApparatusTaken(); } } private void CheckCurrentMoonChanged() { SelectableLevel val = TimeOfDay.Instance?.currentLevel; SelectableLevel val2 = UpdateCached<SelectableLevel>("CurrentMoon", val, null); if (!((Object)(object)val == (Object)(object)val2)) { logger.LogDebug((object)("Level has changed to " + val?.PlanetName)); OnCurrentMoonChanged(val); } } } public class MusicManager : MonoBehaviour { private class MusicInstance { public Script script; public ScriptEvent_PlayMusic musicEvent; public AudioSource audioSource; public Script.VolumeGroup volumeGroup; private bool isStopping; private float volume; public float FadeSpeed { get; private set; } public MusicInstance(Script script, ScriptEvent_PlayMusic musicEvent, AudioSource audioSource, AudioClip? musicClip) { this.script = script; this.musicEvent = musicEvent; this.audioSource = audioSource; audioSource.clip = musicClip; audioSource.loop = musicEvent.loop; audioSource.Play(); musicInstances.Add(this); if (musicEvent.tag != null) { if (!musicInstancesByTag.TryGetValue(musicEvent.tag, out List<MusicInstance> value)) { value = new List<MusicInstance>(1); musicInstancesByTag.Add(musicEvent.tag, value); } value.Add(this); } volumeGroup = script.TryGetVolumeGroupOrDefault(musicEvent.tag); volume = volumeGroup.GetVolume(script); } public void Update(float deltaTime) { float num = (isStopping ? 0f : volumeGroup.GetVolume(script)); float num2 = (isStopping ? volumeGroup.stoppingVolumeLerpSpeed : volumeGroup.volumeLerpSpeed); volume = Mathf.Lerp(volume, num, num2 * deltaTime); audioSource.volume = volume * PizzaTowerEscapeMusicManager.Configuration.volumeMaster.Value; if (!audioSource.isPlaying || (isStopping && audioSource.volume < 0.005f)) { StopCompletely(); } } public void FadeStop() { if (!isStopping) { isStopping = true; FadeSpeed = volumeGroup.stoppingVolumeLerpSpeed; } } public void StopCompletely() { audioSource.Stop(); audioSourcePool.Push(audioSource); musicInstances.Remove(this); if (musicEvent.tag != null && musicInstancesByTag.TryGetValue(musicEvent.tag, out List<MusicInstance> value)) { value.Remove(this); } } } private ManualLogSource logger; private static readonly List<MusicInstance> musicInstances = new List<MusicInstance>(); private static readonly Dictionary<string, List<MusicInstance>> musicInstancesByTag = new Dictionary<string, List<MusicInstance>>(); private static readonly Stack<AudioSource> audioSourcePool = new Stack<AudioSource>(); private readonly Dictionary<string, AudioClip> loadedMusic = new Dictionary<string, AudioClip>(); private void Awake() { logger = Logger.CreateLogSource("PizzaTowerEscapeMusic MusicManager"); } private void Update() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return; } for (int num = musicInstances.Count - 1; num >= 0; num--) { musicInstances[num].Update(Time.deltaTime); } bool flag = false; foreach (MusicInstance musicInstance in musicInstances) { if (musicInstance.musicEvent.silenceGameMusic) { flag = true; break; } } if (flag) { if (SoundManager.Instance.playingOutsideMusic && GetIsMusicPlaying()) { SoundManager.Instance.playingOutsideMusic = false; logger.LogInfo((object)"Silenced the outside music because alternate music is playing"); } if (TimeOfDay.Instance.TimeOfDayMusic.isPlaying && GetIsMusicPlaying()) { TimeOfDay.Instance.TimeOfDayMusic.Stop(); logger.LogInfo((object)"Silenced the time of day music because alternate music is playing"); } } } public bool GetIsMusicPlaying(string? tag = null) { if (tag == null) { return musicInstances.Count > 0; } if (musicInstancesByTag.TryGetValue(tag, out List<MusicInstance> value)) { logger.LogDebug((object)$"GetIsMusicPlaying says there's {value.Count} music instance(s) with the tag \"{tag}\""); return value.Count > 0; } logger.LogDebug((object)("GetIsMusicPlaying says there was no music instance list for tag \"" + tag + "\"")); return false; } public void PlayMusic(Script script, ScriptEvent_PlayMusic musicEvent) { logger.LogDebug((object)("PlayMusic called\nTag: " + musicEvent.tag + $"\nOverlap handling: {musicEvent.overlapHandling}" + $"\nAny music playing?: {GetIsMusicPlaying()}" + $"\nAny music playing with tag?: {GetIsMusicPlaying(musicEvent.tag)}")); if (musicEvent.overlapHandling == ScriptEvent_PlayMusic.OverlapHandling.IgnoreAll && GetIsMusicPlaying()) { logger.LogDebug((object)"PlayMusic canceled because other music was playing"); return; } if (musicEvent.overlapHandling == ScriptEvent_PlayMusic.OverlapHandling.IgnoreTag && GetIsMusicPlaying(musicEvent.tag)) { logger.LogDebug((object)("PlayMusic canceled because other music with the tag \"" + musicEvent.tag + "\" was playing")); return; } switch (musicEvent.overlapHandling) { case ScriptEvent_PlayMusic.OverlapHandling.OverrideAll: StopMusic(); break; case ScriptEvent_PlayMusic.OverlapHandling.OverrideTag: StopMusic(musicEvent.tag); break; case ScriptEvent_PlayMusic.OverlapHandling.OverrideFadeAll: FadeStopMusic(); break; case ScriptEvent_PlayMusic.OverlapHandling.OverrideFadeTag: FadeStopMusic(musicEvent.tag); break; } string text = musicEvent.musicNames[Random.Range(0, musicEvent.musicNames.Length)]; loadedMusic.TryGetValue(text, out AudioClip value); if ((Object)(object)value != (Object)null) { new MusicInstance(script, musicEvent, GetAudioSource(), value); logger.LogInfo((object)("Playing music (" + text + ")")); } else { logger.LogWarning((object)("Music (" + text + ") is null, cannot play. Maybe it wasn't loaded correctly?")); } } public void StopMusic(string? targetTag = null) { foreach (MusicInstance item in new List<MusicInstance>(musicInstances)) { if (targetTag == null || !(item.musicEvent.tag != targetTag)) { item.StopCompletely(); } } } public void FadeStopMusic(string? targetTag = null) { foreach (MusicInstance item in new List<MusicInstance>(musicInstances)) { if (targetTag == null || !(item.musicEvent.tag != targetTag)) { item.FadeStop(); } } } private AudioSource GetAudioSource() { if (!audioSourcePool.TryPop(out AudioSource result)) { return ((Component)this).gameObject.AddComponent<AudioSource>(); } return result; } public async void LoadNecessaryMusicClips() { if (PizzaTowerEscapeMusicManager.ScriptManager.loadedScripts.Count == 0) { logger.LogError((object)"No scripts are loaded, cannot load their music!"); return; } UnloadMusicClips(); foreach (Script loadedScript in PizzaTowerEscapeMusicManager.ScriptManager.loadedScripts) { ScriptEvent[] scriptEvents = loadedScript.scriptEvents; for (int i = 0; i < scriptEvents.Length; i++) { if (!(scriptEvents[i] is ScriptEvent_PlayMusic scriptEvent_PlayMusic)) { continue; } string[] musicNames = scriptEvent_PlayMusic.musicNames; foreach (string musicName in musicNames) { if (!loadedMusic.ContainsKey(musicName)) { AudioClip val = await LoadMusicClip(musicName); if (!((Object)(object)val == (Object)null)) { loadedMusic.Add(musicName, val); } } } } } logger.LogInfo((object)"Music clips done loading"); } public void UnloadMusicClips() { foreach (AudioClip value in loadedMusic.Values) { value.UnloadAudioData(); } loadedMusic.Clear(); logger.LogInfo((object)"All music clips unloaded"); } private async Task<AudioClip?> LoadMusicClip(string musicFileName) { InterpretMusicFileName(musicFileName, out AudioType audioType, out string finalFileName); string path = "file:///" + CustomManager.GetFilePath("Music/" + finalFileName, "DefaultMusic/" + finalFileName); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(path, audioType); try { request.SendWebRequest(); while (!request.isDone) { await Task.Delay(50); } if ((int)request.result == 1) { logger.LogInfo((object)("Loaded music (" + musicFileName + ") from file")); AudioClip content = DownloadHandlerAudioClip.GetContent(request); ((Object)content).name = musicFileName; return content; } logger.LogError((object)($"Failed to load music ({musicFileName}) from file as audio type {audioType}, if the file extension and the audio type do not match the file extension may not be supported." + "\n- Path: " + path + "\n- Error: " + request.error)); return null; } finally { ((IDisposable)request)?.Dispose(); } } private void InterpretMusicFileName(string musicFileName, out AudioType audioType, out string finalFileName) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected I4, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!musicFileName.Contains('.')) { audioType = (AudioType)20; finalFileName = musicFileName + ".wav"; return; } string text = musicFileName.Split('.').Last().ToLower(); AudioType val = ((text == "ogg") ? ((AudioType)14) : ((!(text == "mp3")) ? ((AudioType)20) : ((AudioType)13))); audioType = (AudioType)(int)val; finalFileName = musicFileName; } } public class PizzaTowerEscapeMusicManager : MonoBehaviour { private GameEventListener gameEventListener; private ManualLogSource logger; public static Configuration Configuration { get; private set; } public static ScriptManager ScriptManager { get; private set; } public static MusicManager MusicManager { get; private set; } public void Initialise(ManualLogSource logger, ConfigFile config) { this.logger = logger; Configuration = new Configuration(config); MusicManager = ((Component)this).gameObject.AddComponent<MusicManager>(); gameEventListener = ((Component)this).gameObject.AddComponent<GameEventListener>(); GameEventListener obj = gameEventListener; obj.OnSoundManagerCreated = (Action)Delegate.Combine(obj.OnSoundManagerCreated, new Action(MusicManager.LoadNecessaryMusicClips)); GameEventListener obj2 = gameEventListener; obj2.OnSoundManagerDestroyed = (Action)Delegate.Combine(obj2.OnSoundManagerDestroyed, (Action)delegate { MusicManager.StopMusic(); }); GameEventListener obj3 = gameEventListener; obj3.OnSoundManagerDestroyed = (Action)Delegate.Combine(obj3.OnSoundManagerDestroyed, new Action(MusicManager.UnloadMusicClips)); ScriptManager = new ScriptManager(Configuration.scriptingScripts.Value.Split(','), gameEventListener); GameEventListener obj4 = gameEventListener; obj4.OnSoundManagerDestroyed = (Action)Delegate.Combine(obj4.OnSoundManagerDestroyed, new Action(ScriptManager.ClearAllScriptTimers)); ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; logger.LogInfo((object)"Plugin bgn.pizzatowerescapemusic is loaded!"); } private void Update() { ScriptManager.UpdateAllScriptTimers(Time.deltaTime); } } [BepInPlugin("bgn.pizzatowerescapemusic", "PizzaTowerEscapeMusic", "2.4.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { public const string GUID = "bgn.pizzatowerescapemusic"; private void Awake() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("PizzaTowerEscapeMusic Manager"); val.AddComponent<PizzaTowerEscapeMusicManager>().Initialise(((BaseUnityPlugin)this).Logger, ((BaseUnityPlugin)this).Config); ((Object)val).hideFlags = (HideFlags)61; } } public static class PluginInfo { public const string PLUGIN_GUID = "PizzaTowerEscapeMusic"; public const string PLUGIN_NAME = "PizzaTowerEscapeMusic"; public const string PLUGIN_VERSION = "2.4.0"; } } namespace PizzaTowerEscapeMusic.Scripting { public class Script { public class VolumeRule { public string comment = string.Empty; [JsonRequired] public float volume; public Condition? condition; } public class VolumeModifier { public string comment = string.Empty; [JsonRequired] public float volumeScale; public Condition? condition; } public class VolumeGroup { public string comment = string.Empty; public string tag = string.Empty; public float volumeLerpSpeed = 1f; public float stoppingVolumeLerpSpeed = 1f; public float masterVolume = 1f; public VolumeRule[] volumeRules = Array.Empty<VolumeRule>(); public VolumeModifier[] volumeModifiers = Array.Empty<VolumeModifier>(); public float GetVolume(Script script) { float num = 1f; VolumeRule[] array = volumeRules; foreach (VolumeRule volumeRule in array) { if (volumeRule.condition == null || volumeRule.condition.Check(script)) { num = volumeRule.volume; break; } } VolumeModifier[] array2 = volumeModifiers; foreach (VolumeModifier volumeModifier in array2) { if (volumeModifier.condition == null || volumeModifier.condition.Check(script)) { num *= volumeModifier.volumeScale; } } return num * masterVolume; } } public class Timer { public string name; public float time; public Timer(string name) { this.name = name; } } public string comment = string.Empty; public bool isAddon; public VolumeGroup[] volumeGroups = Array.Empty<VolumeGroup>(); [JsonRequired] public ScriptEvent[] scriptEvents = Array.Empty<ScriptEvent>(); [JsonIgnore] public readonly Dictionary<ScriptEvent.GameEventType, List<ScriptEvent>> loadedScriptEvents = new Dictionary<ScriptEvent.GameEventType, List<ScriptEvent>>(); [JsonIgnore] public readonly Dictionary<string, VolumeGroup> loadedScriptVolumeGroups = new Dictionary<string, VolumeGroup>(); [JsonIgnore] public readonly Dictionary<string, Timer> activeTimers = new Dictionary<string, Timer>(); [JsonIgnore] public static VolumeGroup DefaultVolumeGroup { get; private set; } = new VolumeGroup(); public void Initialise(ManualLogSource logger) { ScriptEvent[] array = scriptEvents; foreach (ScriptEvent scriptEvent in array) { if (!loadedScriptEvents.TryGetValue(scriptEvent.gameEventType, out List<ScriptEvent> value)) { value = new List<ScriptEvent>(1); loadedScriptEvents.Add(scriptEvent.gameEventType, value); } value.Add(scriptEvent); } VolumeGroup[] array2 = volumeGroups; foreach (VolumeGroup volumeGroup in array2) { if (!loadedScriptVolumeGroups.TryAdd(volumeGroup.tag, volumeGroup)) { logger.LogError((object)("Volume group tag \"" + volumeGroup.tag + "\" was already declared, you cannot have two volume groups with the same tag")); } } } public VolumeGroup TryGetVolumeGroupOrDefault(string? tag) { if (tag == null || !loadedScriptVolumeGroups.ContainsKey(tag)) { return DefaultVolumeGroup; } return loadedScriptVolumeGroups[tag]; } public bool TryGetVolumeGroup(string? tag, [NotNullWhen(true)] out VolumeGroup? volumeGroup) { if (tag == null || !loadedScriptVolumeGroups.ContainsKey(tag)) { volumeGroup = null; return false; } volumeGroup = loadedScriptVolumeGroups[tag]; return true; } public void UpdateTimers(float deltaTime) { foreach (Timer value in activeTimers.Values) { value.time += deltaTime; } } public void ClearTimers() { activeTimers.Clear(); } internal void ClearTimer(string timerName) { activeTimers.Remove(timerName); } } public class ScriptManager { public readonly List<Script> loadedScripts = new List<Script>(); public ManualLogSource Logger { get; private set; } public ScriptManager(string[] scriptNames, GameEventListener gameEventListener) { Logger = Logger.CreateLogSource("PizzaTowerEscapeMusic ScriptManager"); Script script = new Script(); loadedScripts.Add(script); foreach (string text in scriptNames) { Script script2 = DeserializeScript(text); if (script2 != null) { script2.Initialise(Logger); if (script2.isAddon) { List<Script.VolumeGroup> list = script.volumeGroups.ToList(); list.AddRange(script2.volumeGroups); script.volumeGroups = list.ToArray(); List<ScriptEvent> list2 = script.scriptEvents.ToList(); list2.AddRange(script2.scriptEvents); script.scriptEvents = list2.ToArray(); } else { loadedScripts.Add(script2); } if (script2.isAddon) { Logger.LogInfo((object)("Script (" + text + ") loaded as addon")); } else { Logger.LogInfo((object)("Script (" + text + ") loaded")); } } } script.Initialise(Logger); gameEventListener.OnFrameUpdate = (Action)Delegate.Combine(gameEventListener.OnFrameUpdate, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.FrameUpdated); }); gameEventListener.OnShipLanded = (Action)Delegate.Combine(gameEventListener.OnShipLanded, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.ShipLanded); }); gameEventListener.OnShipTakeOff = (Action)Delegate.Combine(gameEventListener.OnShipTakeOff, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.ShipTakeOff); }); gameEventListener.OnShipLeavingAlertCalled = (Action)Delegate.Combine(gameEventListener.OnShipLeavingAlertCalled, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.ShipLeavingAlertCalled); }); gameEventListener.OnPlayerDamaged = (Action)Delegate.Combine(gameEventListener.OnPlayerDamaged, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.PlayerDamaged); }); gameEventListener.OnPlayerDeath = (Action)Delegate.Combine(gameEventListener.OnPlayerDeath, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.PlayerDied); }); gameEventListener.OnPlayerEnteredFacility = (Action)Delegate.Combine(gameEventListener.OnPlayerEnteredFacility, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.PlayerEnteredFacility); }); gameEventListener.OnPlayerExitedFacility = (Action)Delegate.Combine(gameEventListener.OnPlayerExitedFacility, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.PlayerExitedFacility); }); gameEventListener.OnPlayerEnteredShip = (Action)Delegate.Combine(gameEventListener.OnPlayerEnteredShip, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.PlayerEnteredShip); }); gameEventListener.OnPlayerExitedShip = (Action)Delegate.Combine(gameEventListener.OnPlayerExitedShip, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.PlayerExitedShip); }); gameEventListener.OnApparatusTaken = (Action)Delegate.Combine(gameEventListener.OnApparatusTaken, (Action)delegate { CheckScriptEvents(ScriptEvent.GameEventType.ApparatusTaken); }); gameEventListener.OnCurrentMoonChanged = (Action<SelectableLevel>)Delegate.Combine(gameEventListener.OnCurrentMoonChanged, (Action<SelectableLevel>)delegate { CheckScriptEvents(ScriptEvent.GameEventType.CurrentMoonChanged); }); Logger.LogInfo((object)"Done loading scripts"); } private void CheckScriptEvents(ScriptEvent.GameEventType eventType) { foreach (Script loadedScript in loadedScripts) { if (!loadedScript.loadedScriptEvents.TryGetValue(eventType, out List<ScriptEvent> value)) { continue; } foreach (ScriptEvent item in value) { if (item.CheckConditions(loadedScript)) { Logger.LogDebug((object)("Conditions for a script event have been met!\n Script Event Type: " + item.scriptEventType + $"\n Game Event Type: {item.gameEventType}" + "\n Comment: " + item.comment)); item.Run(loadedScript); } } } } private Script? DeserializeScript(string name) { string filePath = CustomManager.GetFilePath("Scripts/" + name + ".json", "DefaultScripts/" + name + ".json"); if (!File.Exists(filePath)) { Logger.LogError((object)("Script \"" + name + "\" does not exist! Make sure you spelt it right the config, and make sure its file extension is \".json\"")); return null; } string text = File.ReadAllText(filePath); try { return JsonConvert.DeserializeObject<Script>(text); } catch (Exception ex) { Logger.LogError((object)("Failed to deserialize script \"" + name + "\":\n" + ex.Message)); return null; } } public void UpdateAllScriptTimers(float deltaTime) { foreach (Script loadedScript in loadedScripts) { loadedScript.UpdateTimers(deltaTime); } } public void ClearAllScriptTimers() { foreach (Script loadedScript in loadedScripts) { loadedScript.ClearTimers(); } } } } namespace PizzaTowerEscapeMusic.Scripting.ScriptEvents { public class ScriptEventConverter : JsonConverter<ScriptEvent> { public override bool CanWrite => false; public override ScriptEvent ReadJson(JsonReader reader, Type objectType, ScriptEvent? existingValue, bool hasExistingValue, JsonSerializer serializer) { JObject val = JObject.Load(reader); JToken val2 = default(JToken); if (!val.TryGetValue("scriptEventType", ref val2)) { throw new Exception("scriptEventType type is null!"); } ScriptEvent scriptEvent = Extensions.Value<string>((IEnumerable<JToken>)val2) switch { "PlayMusic" => new ScriptEvent_PlayMusic(), "StopMusic" => new ScriptEvent_StopMusic(), "ResetTimers" => new ScriptEvent_ResetTimers(), "SetVolumeGroupMasterVolume" => new ScriptEvent_SetVolumeGroupMasterVolume(), _ => throw new Exception($"Condition type \"{val2}\" does not exist"), }; serializer.Populate(((JToken)val).CreateReader(), (object)scriptEvent); return scriptEvent; } public override void WriteJson(JsonWriter writer, ScriptEvent? value, JsonSerializer serializer) { throw new NotImplementedException(); } } [JsonConverter(typeof(ScriptEventConverter))] public abstract class ScriptEvent { public enum GameEventType { FrameUpdated, ShipLanded, ShipTakeOff, ShipLeavingAlertCalled, PlayerDamaged, PlayerDied, PlayerEnteredFacility, PlayerExitedFacility, PlayerEnteredShip, PlayerExitedShip, ApparatusTaken, CurrentMoonChanged } public string comment = string.Empty; [JsonRequired] public string scriptEventType = string.Empty; [JsonRequired] public GameEventType gameEventType; public Condition[] conditions = Array.Empty<Condition>(); public bool CheckConditions(Script script) { Script script2 = script; return !conditions.Any((Condition c) => !c.Check(script2)); } public abstract void Run(Script script); } public class ScriptEvent_PlayMusic : ScriptEvent { public enum OverlapHandling { IgnoreAll, IgnoreTag, OverrideAll, OverrideTag, OverrideFadeAll, OverrideFadeTag, Overlap } public bool loop; public bool silenceGameMusic = true; [JsonRequired] public OverlapHandling overlapHandling; public string? tag; [JsonRequired] public string[] musicNames = Array.Empty<string>(); public override void Run(Script script) { if (musicNames.Length != 0) { PizzaTowerEscapeMusicManager.MusicManager.PlayMusic(script, this); } } } public class ScriptEvent_StopMusic : ScriptEvent { public string[]? targetTags; public bool instant; public override void Run(Script script) { if (targetTags != null) { string[] array = targetTags; foreach (string targetTag in array) { if (instant) { PizzaTowerEscapeMusicManager.MusicManager.StopMusic(targetTag); } else { PizzaTowerEscapeMusicManager.MusicManager.FadeStopMusic(targetTag); } } } else if (instant) { PizzaTowerEscapeMusicManager.MusicManager.StopMusic(); } else { PizzaTowerEscapeMusicManager.MusicManager.FadeStopMusic(); } } } public class ScriptEvent_ResetTimers : ScriptEvent { public string[]? targetTimerNames; public override void Run(Script script) { if (targetTimerNames == null) { script.ClearTimers(); return; } string[] array = targetTimerNames; foreach (string timerName in array) { script.ClearTimer(timerName); } } } public class ScriptEvent_SetVolumeGroupMasterVolume : ScriptEvent { public string[] targetTags = Array.Empty<string>(); [JsonRequired] public float masterVolume; public override void Run(Script script) { if (targetTags.Length == 0) { Script.DefaultVolumeGroup.masterVolume = masterVolume; return; } string[] array = targetTags; foreach (string text in array) { if (!script.loadedScriptVolumeGroups.TryGetValue(text, out Script.VolumeGroup value)) { PizzaTowerEscapeMusicManager.ScriptManager.Logger.LogError((object)("Script Event SetVolumeGroupMasterVolume was called for volume group with tag \"" + text + "\", but there is no volume group of that tag")); } else { value.masterVolume = masterVolume; } } } } } namespace PizzaTowerEscapeMusic.Scripting.Conditions { public class ConditionConverter : JsonConverter<Condition> { public override bool CanWrite => false; public override Condition ReadJson(JsonReader reader, Type objectType, Condition? existingValue, bool hasExistingValue, JsonSerializer serializer) { JObject val = JObject.Load(reader); JToken val2 = default(JToken); if (!val.TryGetValue("conditionType", ref val2)) { throw new Exception("Condition type is null!"); } Condition condition = Extensions.Value<string>((IEnumerable<JToken>)val2) switch { "And" => new Condition_And(), "Or" => new Condition_Or(), "Not" => new Condition_Not(), "Weather" => new Condition_Weather(), "PlayerLocation" => new Condition_PlayerLocation(), "PlayerAlive" => new Condition_PlayerAlive(), "PlayerHealth" => new Condition_PlayerHealth(), "PlayerCrouching" => new Condition_PlayerCrouching(), "PlayerInsanity" => new Condition_PlayerInsanity(), "ShipLanded" => new Condition_ShipLanded(), "ShipLeavingAlertCalled" => new Condition_ShipLeavingAlertCalled(), "MusicWithTagPlaying" => new Condition_MusicWithTagPlaying(), "CurrentMoon" => new Condition_CurrentMoon(), "Timer" => new Condition_Timer(), "Random" => new Condition_Random(), "ApparatusDocked" => new Condition_ApparatusDocked(), "TimeOfDay" => new Condition_TimeOfDay(), _ => throw new Exception($"Condition type \"{val2}\" does not exist"), }; serializer.Populate(((JToken)val).CreateReader(), (object)condition); return condition; } public override void WriteJson(JsonWriter writer, Condition? value, JsonSerializer serializer) { throw new NotImplementedException(); } } [JsonConverter(typeof(ConditionConverter))] public abstract class Condition { [JsonRequired] public string conditionType = string.Empty; public abstract bool Check(Script script); } public abstract class ConditionComparableNumber : Condition { public enum ComparisonType { Equals, NotEquals, GreaterThan, LessThan, GreaterThanOrEquals, LessThanOrEquals } [JsonRequired] public ComparisonType comparisonType; } public class Condition_And : Condition { [JsonRequired] public Condition[] conditions = Array.Empty<Condition>(); public override bool Check(Script script) { Script script2 = script; return !conditions.Any((Condition c) => !c.Check(script2)); } } public class Condition_Or : Condition { [JsonRequired] public Condition[] conditions = Array.Empty<Condition>(); public override bool Check(Script script) { Script script2 = script; return conditions.Any((Condition c) => c.Check(script2)); } } public class Condition_Not : Condition { [JsonRequired] public Condition? condition; public override bool Check(Script script) { if (condition == null) { return true; } return !condition.Check(script); } } public class Condition_Weather : Condition { [JsonRequired] public LevelWeatherType weather; public override bool Check(Script script) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)TimeOfDay.Instance == (Object)null) { return false; } return TimeOfDay.Instance.currentLevelWeather == weather; } } public class Condition_PlayerLocation : Condition { public enum Location { Ship, Facility } [JsonRequired] public Location location; public override bool Check(Script script) { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return false; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } return location switch { Location.Ship => GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom, Location.Facility => GameNetworkManager.Instance.localPlayerController.isInsideFactory, _ => false, }; } } public class Condition_PlayerAlive : Condition { public override bool Check(Script script) { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return false; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } return !GameNetworkManager.Instance.localPlayerController.isPlayerDead; } } public class Condition_PlayerHealth : ConditionComparableNumber { [JsonRequired] public int value; public override bool Check(Script script) { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return false; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } int health = GameNetworkManager.Instance.localPlayerController.health; return comparisonType switch { ComparisonType.Equals => health == value, ComparisonType.NotEquals => health != value, ComparisonType.GreaterThan => health > value, ComparisonType.LessThan => health < value, ComparisonType.GreaterThanOrEquals => health >= value, ComparisonType.LessThanOrEquals => health <= value, _ => false, }; } } public class Condition_PlayerCrouching : Condition { public override bool Check(Script script) { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return false; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } return GameNetworkManager.Instance.localPlayerController.isCrouching; } } public class Condition_PlayerInsanity : ConditionComparableNumber { [JsonRequired] public float level; public override bool Check(Script script) { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return false; } if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null) { return false; } float num = GameNetworkManager.Instance.localPlayerController.insanityLevel / GameNetworkManager.Instance.localPlayerController.maxInsanityLevel; return comparisonType switch { ComparisonType.Equals => level == num, ComparisonType.NotEquals => level != num, ComparisonType.GreaterThan => level > num, ComparisonType.LessThan => level < num, ComparisonType.GreaterThanOrEquals => level >= num, ComparisonType.LessThanOrEquals => level <= num, _ => false, }; } } public class Condition_ShipLanded : Condition { public override bool Check(Script script) { if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } return StartOfRound.Instance.shipHasLanded; } } public class Condition_ShipLeavingAlertCalled : Condition { public override bool Check(Script script) { if ((Object)(object)TimeOfDay.Instance == (Object)null) { return false; } return TimeOfDay.Instance.shipLeavingAlertCalled; } } public class Condition_MusicWithTagPlaying : Condition { [JsonRequired] public string tag = string.Empty; public override bool Check(Script script) { return PizzaTowerEscapeMusicManager.MusicManager.GetIsMusicPlaying(tag); } } public class Condition_CurrentMoon : Condition { private static readonly Dictionary<string, int> moonNameToId = new Dictionary<string, int>(); [JsonRequired] public string moonName = string.Empty; private bool isDisabled; public override bool Check(Script script) { if ((Object)(object)TimeOfDay.Instance == (Object)null) { return false; } if ((Object)(object)StartOfRound.Instance == (Object)null) { return false; } if (isDisabled) { return false; } if (!moonNameToId.TryGetValue(moonName, out var value)) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { moonNameToId.TryAdd(val.PlanetName, val.levelID); } if (!moonNameToId.TryGetValue(moonName, out value)) { PizzaTowerEscapeMusicManager.ScriptManager.Logger.LogError((object)("From CurrentMoon condition: Found no existing level with the name \"" + moonName + "\"")); isDisabled = true; return false; } } return TimeOfDay.Instance.currentLevel.levelID == value; } } public class Condition_Timer : Condition { [JsonRequired] public string timerName = string.Empty; [JsonRequired] public float timeGoal; public bool resetsTimer = true; public override bool Check(Script script) { if (!script.activeTimers.TryGetValue(timerName, out Script.Timer value)) { value = new Script.Timer(timerName); script.activeTimers.Add(timerName, value); } if (value.time >= timeGoal) { if (resetsTimer) { value.time = 0f; } return true; } return false; } } public class Condition_Random : Condition { [JsonRequired] public float chance; public override bool Check(Script script) { return Random.Range(0f, 1f) <= chance; } } public class Condition_ApparatusDocked : Condition { public override bool Check(Script script) { return GameEventListener.IsApparatusDocked(); } } public class Condition_TimeOfDay : ConditionComparableNumber { [JsonRequired] public float time; public override bool Check(Script script) { if ((Object)(object)TimeOfDay.Instance == (Object)null) { return false; } float num = TimeOfDay.Instance.currentDayTime / TimeOfDay.Instance.totalTime; return comparisonType switch { ComparisonType.Equals => num == time, ComparisonType.NotEquals => num != time, ComparisonType.GreaterThan => num > time, ComparisonType.LessThan => num < time, ComparisonType.GreaterThanOrEquals => num >= time, ComparisonType.LessThanOrEquals => num <= time, _ => false, }; } } }
Snowlance.SoThisIsImmortalSnail.dll
Decompiled 2 hours agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using ImmortalSnail; using LCSoundTool; using Microsoft.CodeAnalysis; using SoThisIsImmortalSnail; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: AssemblyCompany("Snowlance.SoThisIsImmortalSnail")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+dc8111b331b16e38a3ad6e3ff61b36912c65e465")] [assembly: AssemblyProduct("SoThisIsImmortalSnail")] [assembly: AssemblyTitle("Snowlance.SoThisIsImmortalSnail")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.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; } } } public class SnailMusicController : MonoBehaviour { public SnailAI SnailInstance; public void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) SoThisIsImmortalSnailBase.LoggerInstance.LogDebug((object)"SnailMusicController.Update"); if (!SoThisIsImmortalSnailBase.configPlayWhenLookingAtSnail.Value) { return; } if (GameNetworkManager.Instance.localPlayerController.HasLineOfSightToPosition(((Component)SnailInstance).transform.position, 70f, SoThisIsImmortalSnailBase.configDistance.Value, -1f)) { if (!((EnemyAI)SnailInstance).creatureSFX.isPlaying) { ((EnemyAI)SnailInstance).creatureSFX.Play(); } } else if (SoThisIsImmortalSnailBase.configPauseWhenNotLooking.Value) { ((EnemyAI)SnailInstance).creatureSFX.Pause(); } else { ((EnemyAI)SnailInstance).creatureSFX.Stop(); } } } namespace SoThisIsImmortalSnail { [BepInPlugin("Snowlance.SoThisIsImmortalSnail", "SoThisIsImmortalSnail", "1.0.0")] public class SoThisIsImmortalSnailBase : BaseUnityPlugin { private const string modGUID = "Snowlance.SoThisIsImmortalSnail"; private const string modName = "SoThisIsImmortalSnail"; private const string modVersion = "1.0.0"; private readonly Harmony harmony = new Harmony("Snowlance.SoThisIsImmortalSnail"); public static ConfigEntry<float> configVolume; public static ConfigEntry<bool> configPlayWhenLookingAtSnail; public static ConfigEntry<int> configDistance; public static ConfigEntry<bool> configPauseWhenNotLooking; public static AudioClip christmasMusic; public static SoThisIsImmortalSnailBase PluginInstance { get; private set; } public static ManualLogSource LoggerInstance { get; private set; } private void Awake() { if ((Object)(object)PluginInstance == (Object)null) { PluginInstance = this; } LoggerInstance = ((BaseUnityPlugin)PluginInstance).Logger; LoggerInstance.LogDebug((object)"Plugin SoThisIsImmortalSnail loaded successfully."); configVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Volume", "MusicVolume", 1f, "Volume of the music. Must be between 0 and 1."); configPlayWhenLookingAtSnail = ((BaseUnityPlugin)this).Config.Bind<bool>("Looking Mechanic", "PlayWhenLookingAtSnail", true, "Play the music only when the player is looking at the snail. Everything below this only works if this is set to true."); configDistance = ((BaseUnityPlugin)this).Config.Bind<int>("Looking Mechanic", "Distance", 50, "Play the music only when the player is looking at a certain distance of the snail."); configPauseWhenNotLooking = ((BaseUnityPlugin)this).Config.Bind<bool>("Looking Mechanic", "PauseWhenNotLooking", true, "Wether to pause the music when not looking at the snail, or stop it and start it over again when looking again. true = Pause, false = Stop."); christmasMusic = SoundTool.GetAudioClip(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "christmasMusic.wav"); LoggerInstance.LogDebug((object)$"Loaded christmasMusic: {christmasMusic}"); harmony.PatchAll(); LoggerInstance.LogInfo((object)"Snowlance.SoThisIsImmortalSnail v1.0.0 has loaded!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Snowlance.SoThisIsImmortalSnail"; public const string PLUGIN_NAME = "SoThisIsImmortalSnail"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace SoThisIsImmortalSnail.Patches { [HarmonyPatch(typeof(SnailAI))] internal class SnailAIPatch { private static ManualLogSource LoggerInstance = SoThisIsImmortalSnailBase.LoggerInstance; [HarmonyPatch("Start")] [HarmonyPostfix] private static void StartPatch(SnailAI __instance) { ((EnemyAI)__instance).creatureSFX = ((Component)__instance).gameObject.AddComponent<AudioSource>(); ((EnemyAI)__instance).creatureSFX.clip = SoThisIsImmortalSnailBase.christmasMusic; ((EnemyAI)__instance).creatureSFX.loop = true; ((EnemyAI)__instance).creatureSFX.volume = 1f; ((EnemyAI)__instance).creatureSFX.spatialBlend = 1f; SnailMusicController snailMusicController = ((Component)__instance).gameObject.AddComponent<SnailMusicController>(); snailMusicController.SnailInstance = __instance; if (!SoThisIsImmortalSnailBase.configPlayWhenLookingAtSnail.Value) { ((EnemyAI)__instance).creatureSFX.Play(); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }