Decompiled source of Applephus v1.0.0

Applephus.dll

Decompiled 9 hours ago
using 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.Logging;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Applephus")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Greetings, child of apple..")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Applephus")]
[assembly: AssemblyTitle("Applephus")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LowTierSisy
{
	[BepInPlugin("kadence.Applephus", "Applephus", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(SisyphusPrimeIntro), "OnCollisionEnter")]
		internal class PatchSisyphus
		{
			private static void Postfix(SisyphusPrimeIntro __instance)
			{
				Log.LogInfo((object)"Landed - ok");
				((Component)__instance).GetComponent<Animator>().speed = 1.72f;
				Log.LogInfo((object)"SET ANIM speed");
				CutsceneSkip component = ((Component)__instance).GetComponent<CutsceneSkip>();
				((MonoBehaviour)instance).StartCoroutine(FinishCutsceneEarly(component, 24f));
				Log.LogInfo((object)"done!");
			}
		}

		[HarmonyPatch(typeof(StockMapInfo), "Awake")]
		internal class Patch00
		{
			private static void Postfix(StockMapInfo __instance)
			{
				AudioSource[] array = Resources.FindObjectsOfTypeAll<AudioSource>();
				foreach (AudioSource val in array)
				{
					if (Object.op_Implicit((Object)(object)val.clip))
					{
						bool flag = false;
						List<SubtitleDataLine> list = new List<SubtitleDataLine>();
						if (((Object)val.clip).name == "sp_intro")
						{
							Debug.Log((object)"Replacing sisyphus intro");
							val.clip = LowTierSisyBundle.LoadAsset<AudioClip>("applephus.wav");
							flag = true;
							list.Add(MakeLine("Greetings, child of apple.", 0f));
							list.Add(MakeLine("I know you've been yearning to get your hands on those foopy snats.", 2.3f));
							list.Add(MakeLine("since the dawn of time.", 5.8f));
							list.Add(MakeLine("Glart's been impending it.", 8.3f));
							list.Add(MakeLine("So worry not.", 10.3f));
							list.Add(MakeLine("I will dismantle his hold.", 11.9f));
							list.Add(MakeLine("I will tear down his buddies,", 14f));
							list.Add(MakeLine("and CRUSH the apples of club.", 15.7f));
							list.Add(MakeLine("So he may never fap again.", 17.8f));
							list.Add(MakeLine("APPLE", 20.4f));
							list.Add(MakeLine("APPLE CLUB!", 20.9f));
						}
						if (flag)
						{
							SubtitledAudioSource component = ((Component)val).GetComponent<SubtitledAudioSource>();
							Traverse val2 = Traverse.Create((object)component).Field("subtitles");
							object value = val2.GetValue();
							((SubtitleData)((value is SubtitleData) ? value : null)).lines = list.ToArray();
						}
					}
				}
			}
		}

		public static Plugin instance;

		private static Harmony harmony;

		internal static AssetBundle LowTierSisyBundle;

		internal static ManualLogSource Log;

		private void Awake()
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			Debug.Log((object)"Greetings, child of apple.");
			instance = this;
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string path = "applephus";
			LowTierSisyBundle = AssetBundle.LoadFromFile(Path.Combine(ModPath(), path));
			harmony = new Harmony("kade.applephus");
			harmony.PatchAll();
			Log = ((BaseUnityPlugin)this).Logger;
		}

		public static string ModPath()
		{
			return Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(Path.DirectorySeparatorChar));
		}

		private static SubtitleDataLine MakeLine(string subtitle, float time)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			SubtitleDataLine val = new SubtitleDataLine();
			val.subtitle = subtitle;
			val.time = time;
			return val;
		}

		private static IEnumerator FinishCutsceneEarly(CutsceneSkip skip, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			Traverse traverse = Traverse.Create((object)skip);
			traverse.Field("timeLeft").SetValue((object)0f);
			traverse.Field("waitingForInput").SetValue((object)false);
			skip.onSkip.Invoke("");
			MonoSingleton<CutsceneSkipText>.Instance.Hide();
		}
	}
}