Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of BirthdayMod v1.0.0
BirthdayMod.dll
Decompiled 2 years agousing System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; 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("RainbowMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RainbowMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d9026984-5ba0-4abe-ab8b-c2e1ba63ab7b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BirthdayMod { [BepInPlugin("Terry.BirthdayMod", "Birthday Mod", "1.0.0.0")] public class BirthdayModBase : BaseUnityPlugin { private const string modGUID = "Terry.BirthdayMod"; private const string modName = "Birthday Mod"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Terry.BirthdayMod"); private static BirthdayModBase Instance; internal ManualLogSource mls; internal static AudioClip[] newDeathSFX; public static Dictionary<PlayerControllerB, AudioSource> BirthdayModSources = new Dictionary<PlayerControllerB, AudioSource>(); private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("Terry.BirthdayMod"); mls.LogInfo((object)"Starting Terry's birthday mod"); mls.LogInfo((object)(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("BirthdayMod.dll".ToCharArray()) + "rainbowmodassets")); AssetBundle val = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("BirthdayMod.dll".ToCharArray()) + "rainbowmodassets"); if (val == null) { mls.LogError((object)"Failed to load audio assets"); return; } newDeathSFX = val.LoadAssetWithSubAssets<AudioClip>("NewDeathSound.wav"); harmony.PatchAll(); mls.LogInfo((object)"Birthday mod successfully loaded!"); } } } namespace BirthdayMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Awake")] [HarmonyPrefix] public static void CreateAudioSource(ref PlayerControllerB __instance) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) BirthdayModBase.BirthdayModSources[__instance] = ((Component)__instance).gameObject.AddComponent<AudioSource>(); } [HarmonyPatch("KillPlayer")] [HarmonyPostfix] public static void NewDeathPatch(ref PlayerControllerB __instance) { AudioClip[] newDeathSFX = BirthdayModBase.newDeathSFX; if (newDeathSFX != null && newDeathSFX.Length != 0) { BirthdayModBase.BirthdayModSources[__instance].PlayOneShot(newDeathSFX[0]); } } } }