Decompiled source of PoteChanges v1.0.1

potepat.potechanges.dll

Decompiled 6 months ago
using System;
using System.Collections.Generic;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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("potepat.potechanges")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+b9df7ea4d9b577b7f5c50c2b1b350eb508555bc6")]
[assembly: AssemblyProduct("PoteChanges")]
[assembly: AssemblyTitle("potepat.potechanges")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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;
		}
	}
}
namespace PotePat
{
	[BepInPlugin("potepat.potechanges", "PoteChanges", "1.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "potepat.potechanges";

		private const string Name = "PoteChanges";

		private const string Version = "1.0.1";

		public static Plugin Instance { get; private set; } = null;


		private static Harmony? Harmony { get; set; }

		public static ManualLogSource Logger { get; private set; } = null;


		public static Dictionary<string, AudioClip> AudioClips { get; } = new Dictionary<string, AudioClip>();


		private void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Harmony = new Harmony("potepat.potechanges");
			Logger = ((BaseUnityPlugin)this).Logger;
			LoadAudioAsset("fart");
			Harmony.PatchAll();
			Logger.LogInfo((object)"");
			Logger.LogInfo((object)"     -- PoteChanges v1.0.1 --     ");
			Logger.LogInfo((object)"");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣤⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠟⠉⠉⠉⠉⠉⠉⠉⠙⠻⢶⣄⠀⠀⠀⠀⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣾⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠙⣷⡀⠀⠀⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡟⠀⣠⣶⠛⠛⠛⠛⠛⠛⠳⣦⡀⠀⠘⣿⡄⠀⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⠁⠀⢹⣿⣦⣀⣀⣀⣀⣀⣠⣼⡇⠀⠀⠸⣷⠀⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡏⠀⠀⠀⠉⠛⠿⠿⠿⠿⠛⠋⠁⠀⠀⠀⠀⣿");
			Logger.LogInfo((object)"⠀⠀      ⢠⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡇⠀");
			Logger.LogInfo((object)"      ⠀⠀⣸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣧⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⣿⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⣿⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  ⠀⠀⠀⠀⣿⠀");
			Logger.LogInfo((object)"⠀⠀⠀⠀⠀⠀⢰⣿⠀⠀⠀⠀⣠⡶⠶⠿⠿⠿⠿⢷⣦⠀⠀⠀⠀⠀    ⣿");
			Logger.LogInfo((object)"⠀⠀⣀⣀⣀⠀⣸⡇⠀⠀⠀⠀⣿⡀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⣿⠀");
			Logger.LogInfo((object)"⣠⡿⠛⠛⠛⠛⠻⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⣿⠇⠀⠀⠀⠀⠀ ⠀⣿⠀");
			Logger.LogInfo((object)"⢻⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⡟⠀⠀⢀⣤⣤⣴⣿⠀⠀⠀⠀⠀⠀  ⠀⣿⠀");
			Logger.LogInfo((object)"⠈⠙⢷⣶⣦⣤⣤⣤⣴⣶⣾⠿⠛⠁⢀⣶⡟⠉⠀⠀⠀⠀⠀⠀  ⠀⠀⠀⢀⡟⠀");
			Logger.LogInfo((object)"             ⠀⠀⠈⣿⣆⡀⠀⠀⠀⠀⠀⠀⢀⣠⣴⡾⠃⠀");
			Logger.LogInfo((object)"⠀           ⠀⠀⠀⠀⠈⠛⠻⢿⣿⣾⣿⡿⠿⠟⠋⠁⠀⠀⠀");
			Logger.LogInfo((object)"");
			Logger.LogInfo((object)"potepat.potechanges v1.0.1 has loaded!");
		}

		public void LoadAudioAsset(string clipName, string? audioFile = null)
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Invalid comparison between Unknown and I4
			if (!AudioClips.ContainsKey(clipName))
			{
				string text = ((BaseUnityPlugin)this).Info.Location.TrimEnd("potepat.potechanges.dll".ToCharArray());
				string text2 = ((audioFile == null) ? (text + clipName + ".mp3") : (text + audioFile));
				UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip("File://" + text2, (AudioType)13);
				audioClip.SendWebRequest();
				while (!audioClip.isDone)
				{
				}
				if ((int)audioClip.result != 1)
				{
					Logger.LogError((object)("Failed to load audio file: " + text2));
				}
				else
				{
					AudioClips.Add(clipName, DownloadHandlerAudioClip.GetContent(audioClip));
				}
			}
		}
	}
	[HarmonyPatch(typeof(JesterAI))]
	public class PoteJesterFart
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start(JesterAI __instance)
		{
			__instance.popGoesTheWeaselTheme = Plugin.AudioClips["fart"];
		}

		[HarmonyPatch("SetJesterInitialValues")]
		[HarmonyPostfix]
		public static void SetJesterInitialValues(JesterAI __instance)
		{
			__instance.popUpTimer = Plugin.AudioClips["fart"].length;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "potepat.potechanges";

		public const string PLUGIN_NAME = "PoteChanges";

		public const string PLUGIN_VERSION = "1.0.1";
	}
}