Decompiled source of pbucky2 v1.0.0

BepInEx/plugins/pbucky1/norabug.dll

Decompiled 11 months ago
using System;
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 LCSoundTool;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using norabug.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("norabug")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("wow i love that all my loot bugs in lethal company look and sound like eunora !")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("norabug")]
[assembly: AssemblyTitle("norabug")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace norabug
{
	[BepInPlugin("norabug", "norabug", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Plugin Instance { get; private set; }

		public static ManualLogSource Log { get; private set; }

		public static string Location { get; private set; }

		public static AudioClip[] PickupSfx { get; private set; }

		public static AudioClip[] HitSfx { get; private set; }

		private void Awake()
		{
			//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f9: Expected O, but got Unknown
			Instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			Location = ((BaseUnityPlugin)Instance).Info.Location.TrimEnd(".dll".ToCharArray());
			Log.LogInfo((object)Path.Join((ReadOnlySpan<char>)Location, (ReadOnlySpan<char>)"chitter", (ReadOnlySpan<char>)"1.wav"));
			List<AudioClip> list = new List<AudioClip>();
			List<AudioClip> list2 = new List<AudioClip>();
			List<AudioClip> list3 = new List<AudioClip>();
			List<AudioClip> list4 = new List<AudioClip>();
			List<AudioClip> list5 = new List<AudioClip>();
			List<AudioClip> list6 = new List<AudioClip>();
			int num = 9;
			int num2 = 17;
			int num3 = 4;
			int num4 = 3;
			int num5 = 5;
			int num6 = 3;
			PickupSfx = (AudioClip[])(object)new AudioClip[num6];
			HitSfx = (AudioClip[])(object)new AudioClip[num5];
			for (int i = 1; i <= num; i++)
			{
				AudioClip audioClip = SoundTool.GetAudioClip(Location, "angry", $"angry_{i}.wav");
				SoundTool.ReplaceAudioClip("AngryScreech1", audioClip, (float)(100 / num));
				SoundTool.ReplaceAudioClip("AngryScreech2", audioClip, (float)(100 / num));
			}
			for (int j = 1; j <= num2; j++)
			{
				AudioClip audioClip2 = SoundTool.GetAudioClip(Location, "chitters", $"chitter_{j}.wav");
				SoundTool.ReplaceAudioClip("Chitter1", audioClip2, (float)(100 / num2));
				SoundTool.ReplaceAudioClip("Chitter2", audioClip2, (float)(100 / num2));
				SoundTool.ReplaceAudioClip("Chitter3", audioClip2, (float)(100 / num2));
			}
			for (int k = 1; k <= num3; k++)
			{
				AudioClip audioClip3 = SoundTool.GetAudioClip(Location, "crying", $"crying_{k}.wav");
				SoundTool.ReplaceAudioClip("HoarderBugCry", audioClip3, (float)(100 / num3));
			}
			for (int l = 1; l <= num4; l++)
			{
				AudioClip audioClip4 = SoundTool.GetAudioClip(Location, "dying", $"dying_{l}.wav");
				SoundTool.ReplaceAudioClip("BugDie", audioClip4, (float)(100 / num4));
			}
			for (int m = 1; m <= num5; m++)
			{
				HitSfx[m - 1] = SoundTool.GetAudioClip(Location, "gettinghit", $"hit_{m}.wav");
			}
			for (int n = 1; n <= num6; n++)
			{
				PickupSfx[n - 1] = SoundTool.GetAudioClip(Location, "itemcollect", $"collect_{n}.wav");
			}
			Log.LogInfo((object)"Plugin norabug is loaded!");
			Log.LogInfo((object)"LMFAOOOOOOOOO PAULY'S IN");
			Harmony val = new Harmony("pissbucket1.pbucky");
			val.PatchAll(typeof(HoarderBugNameplatePatch));
			val.PatchAll(typeof(Plugin));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "norabug";

		public const string PLUGIN_NAME = "norabug";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace norabug.Patches
{
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal static class HoarderBugNameplatePatch
	{
		public static Canvas canvas;

		public static GameObject canvasItem;

		public static CanvasGroup canvasItemAlpha;

		private static void PrintChildren(Transform parent, int depth)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in parent)
			{
				Transform val = item;
				string text = new string('-', depth * 2);
				GameObject gameObject = ((Component)val).gameObject;
				Plugin.Log.LogInfo((object)$"{text}{((Object)gameObject).name} (GameObject), Active: {gameObject.activeSelf}, Layer: {LayerMask.LayerToName(gameObject.layer)}");
				Plugin.Log.LogInfo((object)$"{text}  Position: {gameObject.transform.position}, Rotation: {gameObject.transform.rotation}, Scale: {gameObject.transform.localScale}");
				Component[] components = ((Component)val).GetComponents<Component>();
				foreach (Component val2 in components)
				{
					string componentDetails = GetComponentDetails(val2);
					Plugin.Log.LogInfo((object)$"{text}  - {((object)val2).GetType()}, {componentDetails}");
				}
				PrintChildren(val, depth + 1);
			}
		}

		private static string GetComponentDetails(Component component)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			Canvas val = (Canvas)(object)((component is Canvas) ? component : null);
			if (val != null)
			{
				return $"RenderMode: {val.renderMode}, WorldCamera: {val.worldCamera}";
			}
			CanvasGroup val2 = (CanvasGroup)(object)((component is CanvasGroup) ? component : null);
			if (val2 != null)
			{
				return $"Alpha: {val2.alpha}, Interactable: {val2.interactable}, BlocksRaycasts: {val2.blocksRaycasts}";
			}
			TextMeshProUGUI val3 = (TextMeshProUGUI)(object)((component is TextMeshProUGUI) ? component : null);
			if (val3 != null)
			{
				return $"Text: {((TMP_Text)val3).text}, FontSize: {((TMP_Text)val3).fontSize}, Color: {((Graphic)val3).color}";
			}
			return "Details not specified for this component type";
		}

		private static void FUCKYOU()
		{
			GameObject val = GameObject.Find("HoarderBugModel");
			if ((Object)(object)val != (Object)null)
			{
				PrintHierarchyDetails(val.transform);
			}
			else
			{
				Plugin.Log.LogInfo((object)"HoarderBugModel not found in the scene.");
			}
		}

		private static void PrintHierarchyDetails(Transform currentTransform)
		{
			while ((Object)(object)currentTransform != (Object)null)
			{
				PrintDetails(currentTransform);
				PrintChildrenDetails(currentTransform, 1);
				currentTransform = currentTransform.parent;
			}
		}

		private static void PrintDetails(Transform transform)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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_007e: 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)
			Plugin.Log.LogInfo((object)("GameObject: " + ((Object)((Component)transform).gameObject).name));
			ManualLogSource log = Plugin.Log;
			Vector3 val = transform.position;
			log.LogInfo((object)("  Position: " + ((object)(Vector3)(ref val)).ToString()));
			ManualLogSource log2 = Plugin.Log;
			Quaternion rotation = transform.rotation;
			log2.LogInfo((object)("  Rotation: " + ((object)(Quaternion)(ref rotation)).ToString()));
			ManualLogSource log3 = Plugin.Log;
			val = transform.localScale;
			log3.LogInfo((object)("  Scale: " + ((object)(Vector3)(ref val)).ToString()));
		}

		private static void PrintChildrenDetails(Transform parent, int depth)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			string text = new string('-', depth * 2);
			foreach (Transform item in parent)
			{
				Transform val = item;
				Plugin.Log.LogInfo((object)$"{text}Child: {((Object)((Component)val).gameObject).name}, Position: {val.position}, Rotation: {val.rotation}, Scale: {val.localScale}");
				PrintChildrenDetails(val, depth + 1);
			}
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void StartPostfix(HoarderBugAI __instance)
		{
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			Transform parent = ((Component)__instance).transform.Find("HoarderBugModel");
			Canvas usernameCanvas = StartOfRound.Instance.allPlayerScripts[0].usernameCanvas;
			canvas = Object.Instantiate<Canvas>(usernameCanvas);
			canvasItem = ((Component)canvas).gameObject;
			canvasItem.transform.SetParent(parent);
			canvasItem.transform.localScale = new Vector3(-0.025f, 0.025f, 0.025f);
			canvasItem.transform.localPosition = new Vector3(0f, 8.5f, 0f);
			CanvasGroup componentInChildren = canvasItem.GetComponentInChildren<CanvasGroup>();
			componentInChildren.alpha = 1f;
			TextMeshProUGUI componentInChildren2 = canvasItem.GetComponentInChildren<TextMeshProUGUI>();
			((TMP_Text)componentInChildren2).text = "eunora";
			((Behaviour)componentInChildren2).enabled = true;
			((Component)canvas).gameObject.SetActive(true);
		}

		[HarmonyPatch("LateUpdate")]
		[HarmonyPrefix]
		private static bool LateUpdatePrefix(HoarderBugAI __instance)
		{
			canvasItem.transform.LookAt(GameNetworkManager.Instance.localPlayerController.localVisorTargetPoint);
			return true;
		}

		[HarmonyPatch("GrabItem")]
		[HarmonyPostfix]
		public static void hoarderBugOnPickupPatch(ref AudioSource ___creatureVoice)
		{
			RoundManager.PlayRandomClip(___creatureVoice, Plugin.PickupSfx, true, 1f, 0);
		}

		[HarmonyPatch("HitEnemy")]
		[HarmonyPostfix]
		public static void hoarderBugOnHitPatch(ref AudioSource ___creatureVoice)
		{
			RoundManager.PlayRandomClip(___creatureVoice, Plugin.HitSfx, true, 1f, 0);
		}
	}
}