Decompiled source of YippieePlus v1.0.0

plugins/YippeePlus/ModThing.dll

Decompiled 4 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.InteropServices;
using System.Runtime.Versioning;
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("ModThing")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ModThing")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("23effcdc-1716-41bc-8ede-7c8a4c11b5eb")]
[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")]
[BepInPlugin("imas.YippeeMod", "YippeePlus", "1.0.0")]
public class YippieeModPlusBase : BaseUnityPlugin
{
	private const string modGUID = "imas.YippeeMod";

	private const string modName = "YippeePlus";

	private const string modVersion = "1.0.0";

	internal static ManualLogSource Log;

	private static GameObject imageInstance;

	public static string folder;

	public static AudioClip[] newClip;

	private void Awake()
	{
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		folder = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		Yippee();
		Harmony val = new Harmony("imas.YippeeMod");
		val.PatchAll();
		Log.LogInfo((object)"Harmony patched");
	}

	internal static void ImageSpawn(Vector3 pos, Vector3 rot, Vector3 scale)
	{
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0089: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Expected O, but got Unknown
		if (!((Object)(object)imageInstance != (Object)null))
		{
			GameObject val = GameObject.Find("HangarShip");
			if ((Object)(object)val == (Object)null)
			{
				Log.LogWarning((object)"Ship not found yet");
				return;
			}
			GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5);
			Object.Destroy((Object)(object)val2.GetComponent<Collider>());
			((Object)val2).name = "imageInst";
			val2.transform.position = pos;
			val2.transform.rotation = Quaternion.Euler(rot);
			val2.transform.localScale = scale;
			val2.transform.SetParent(val.transform);
			string path = Path.Combine(folder, "Assets\\yippieeImage.jpg");
			Texture2D val3 = LoadTexture(path);
			Material val4 = new Material(Shader.Find("HDRP/Lit"));
			val4.SetTexture("_BaseColorMap", (Texture)(object)val3);
			((Renderer)val2.GetComponent<MeshRenderer>()).material = val4;
			imageInstance = val2;
		}
	}

	internal static void Yippee()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Expected O, but got Unknown
		string text = Path.Combine(folder, "Assets\\yippeesound");
		Debug.Log((object)text);
		Debug.Log((object)File.Exists(text));
		AssetBundle val = AssetBundle.LoadFromFile(text);
		if ((Object)val == (Object)null)
		{
			Log.LogError((object)"Couldn't find audio clip!");
			return;
		}
		string[] allAssetNames = val.GetAllAssetNames();
		foreach (string text2 in allAssetNames)
		{
			Debug.Log((object)("Member of pack: " + text2));
		}
		newClip = val.LoadAssetWithSubAssets<AudioClip>("assets/yippee-tbh.mp3");
	}

	private static Texture2D LoadTexture(string path)
	{
		//IL_002d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0033: Expected O, but got Unknown
		if (!File.Exists(path))
		{
			Debug.LogError((object)("File not found: " + path));
			return null;
		}
		byte[] array = File.ReadAllBytes(path);
		Texture2D val = new Texture2D(2, 2);
		if (!ImageConversion.LoadImage(val, array))
		{
			Debug.LogError((object)"Failed to load image data");
			return null;
		}
		return val;
	}
}
[HarmonyPatch(typeof(HoarderBugAI))]
internal class HoarderBugPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void hoarderBugAudioPatch(ref AudioClip[] ___chitterSFX)
	{
		AudioClip[] newClip = YippieeModPlusBase.newClip;
		___chitterSFX = newClip;
		Debug.Log((object)"Replaced Sound");
	}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch : MonoBehaviour
{
	private class CoroutineRunner : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DelayStart>d__1 : IEnumerator<object>, IDisposable, IEnumerator
		{
			private int <>1__state;

			private object <>2__current;

			public CoroutineRunner <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <DelayStart>d__1(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				//IL_0065: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0088: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					Debug.Log((object)"DelayStart called");
					<>2__current = (object)new WaitForSeconds(1f);
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					Debug.Log((object)"DelayStart finished");
					YippieeModPlusBase.ImageSpawn(new Vector3(10.5f, 2.3f, -17.46f), new Vector3(0f, 180f, 270f), 0.3f * Vector3.one);
					Object.Destroy((Object)(object)((Component)<>4__this).gameObject);
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(DelayStart());
		}

		[IteratorStateMachine(typeof(<DelayStart>d__1))]
		private IEnumerator DelayStart()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <DelayStart>d__1(0)
			{
				<>4__this = this
			};
		}
	}

	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void OnStart()
	{
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Expected O, but got Unknown
		Debug.Log((object)"Onstart called");
		YippieeModPlusBase.Log.LogInfo((object)"Onstart called");
		GameObject val = new GameObject("ShipPosterCoroutineRunner");
		((Object)val).hideFlags = (HideFlags)61;
		val.AddComponent<CoroutineRunner>();
	}
}