Decompiled source of RaccoonLib v1.0.8

BepInEx/plugins/RaccoonLib.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
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("RaccoonLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RaccoonLib")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("258c7a29-631a-44b3-9772-c8c169fa4186")]
[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")]
namespace RaccoonLib
{
	[BepInPlugin("Brew.RaccoonLib", "RacoonLib", "1.0.0")]
	public class RaccoonBase : BaseUnityPlugin
	{
		private const string modGUID = "Brew.RaccoonLib";

		private const string modName = "RacoonLib";

		private const string modVersion = "1.0.0";

		private static RaccoonBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Brew.RaccoonLib");
			mls.LogInfo((object)"Raccoon Library Initialised");
		}

		public static void LogWarningPlugin(string msg, string pluginName)
		{
			Debug.LogWarning((object)("[RaccoonLib] {" + pluginName + "} " + msg));
		}

		public static void LogWarning(string msg)
		{
			Debug.LogWarning((object)("[RaccoonLib] " + msg));
		}
	}
}
namespace RaccoonLib.Modules
{
	public class AudioChanger
	{
		public static void BrackenNeckSnap(FlowermanAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {FlowermanAI} {enemyInstance} for function (BrackenNeckSnap) missing or null.");
				return;
			}
			if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (BrackenNeckSnap) missing or null.");
				return;
			}
			enemyInstance.crackNeckSFX = newAudio;
			enemyInstance.crackNeckAudio.clip = newAudio;
		}

		public static void BrackenAnger(FlowermanAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {FlowermanAI} {enemyInstance} for function (BrackenAnger) missing or null.");
			}
			else if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (BrackenAnger) missing or null.");
			}
			else
			{
				enemyInstance.creatureAngerVoice.clip = newAudio;
			}
		}

		public static void JesterCrankSound(JesterAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {JesterAI} {enemyInstance} for function (JesterCrankSound) missing or null.");
			}
			else if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (JesterCrankSound) missing or null.");
			}
			else
			{
				enemyInstance.popGoesTheWeaselTheme = newAudio;
			}
		}

		public static void HoarderFlySound(HoarderBugAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (HoarderFlySound) missing or null.");
			}
			else if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (HoarderFlySound) missing or null.");
			}
			else
			{
				enemyInstance.bugFlySFX = newAudio;
			}
		}

		public static void HoarderHitSFX(HoarderBugAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (HoarderHitSFX) missing or null.");
			}
			else if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (HoarderHitSFX) missing or null.");
			}
			else
			{
				enemyInstance.hitPlayerSFX = newAudio;
			}
		}

		public static void HoarderAngryVoice(HoarderBugAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (HoarderAngryVoice) missing or null.");
			}
			else if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (HoarderAngryVoice) missing or null.");
			}
			else
			{
				enemyInstance.angryVoiceSFX = newAudio;
			}
		}

		public static void HoarderChitterSFX(HoarderBugAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (HoarderChitterSFX) missing or null.");
				return;
			}
			if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (HoarderChitterSFX) missing or null.");
				return;
			}
			enemyInstance.chitterSFX = (AudioClip[])(object)new AudioClip[1] { newAudio };
		}

		public static void HoarderScreechSFX(HoarderBugAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (HoarderScreechSFX) missing or null.");
				return;
			}
			if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (HoarderScreechSFX) missing or null.");
				return;
			}
			enemyInstance.angryScreechSFX = (AudioClip[])(object)new AudioClip[1] { newAudio };
		}

		public static void CoilHeadSpringSFX(SpringManAI enemyInstance, AudioClip newAudio)
		{
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (CoilHeadSpringSFX) missing or null.");
				return;
			}
			if ((Object)(object)newAudio == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {AudioClip} {newAudio} for function (CoilHeadSpringSFX) missing or null.");
				return;
			}
			enemyInstance.springNoises = (AudioClip[])(object)new AudioClip[1] { newAudio };
		}
	}
	public class Extra
	{
		public static void BrackenDotSize(FlowermanAI enemyInstance, Vector3 newSize)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {FlowermanAI} {enemyInstance} for function (BrackenMapDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("FlowermanModel");
			Transform val2 = ((Component)val).transform.Find("MapDot");
			((Component)val2).transform.localScale = newSize;
		}

		public static void HoarderDotSize(HoarderBugAI enemyInstance, Vector3 newSize)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {HoarderBugAI} {enemyInstance} for function (BugMapDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("HoarderBugModel");
			Transform val2 = ((Component)val).transform.Find("MapDot (3)");
			((Component)val2).transform.localScale = newSize;
		}

		public static void ThumperDotSize(CrawlerAI enemyInstance, Vector3 newSize)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {CrawlerAI} {enemyInstance} for function (ThumperDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("CrawlerModel");
			Transform val2 = ((Component)val).transform.Find("MapDot");
			((Component)val2).transform.localScale = newSize;
		}

		public static void CoilheadDotSize(SpringManAI enemyInstance, Vector3 newSize)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {SpringManAI} {enemyInstance} for function (CoilheadDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("SpringManModel");
			Transform val2 = ((Component)val).transform.Find("MapDot (2)");
			((Component)val2).transform.localScale = newSize;
		}

		public static void NutcrackerDotSize(NutcrackerEnemyAI enemyInstance, Vector3 newSize)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {NutcrackerEnemyAI} {enemyInstance} for function (NutcrackerDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("MapDot (3)");
			((Component)val).transform.localScale = newSize;
		}

		public static void JesterDotSize(JesterAI enemyInstance, Vector3 newSize)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {JesterAI} {enemyInstance} for function (JesterDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("MapDot");
			((Component)val).transform.localScale = newSize;
		}

		public static void MaskedDotSize(MaskedPlayerEnemy enemyInstance, Vector3 newSize)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {MaskedPlayerEnemy} {enemyInstance} for function (MaskedDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("Misc");
			Transform val2 = ((Component)enemyInstance).transform.Find("MapDot");
			((Component)val2).transform.localScale = newSize;
		}

		public static void CentipedeDotSize(CentipedeAI enemyInstance, Vector3 newSize)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {CentipedeAI} {enemyInstance} for function (CentipedeDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("MapDot (1)");
			((Component)val).transform.localScale = newSize;
		}

		public static void SlimeDotSize(BlobAI enemyInstance, Vector3 newSize)
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {BlobAI} {enemyInstance} for function (SlimeDotSize) missing or null.");
				return;
			}
			bool flag = false;
			Transform val = ((Component)enemyInstance).transform.Find("MapDot (1)");
			((Component)val).transform.localScale = newSize;
		}
	}
	public class EnemyReskinner
	{
		private void Reskin(string enemyType, EnemyAI enemyInstance)
		{
		}

		public static GameObject ReskinBracken(FlowermanAI enemyInstance, GameObject newModel)
		{
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Expected O, but got Unknown
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Expected O, but got Unknown
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {FlowermanAI} {enemyInstance} for function (ReskinBracken) missing or null.");
				return null;
			}
			if ((Object)(object)newModel == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {GameObject} {newModel} for function (ReskinBracken) missing or null.");
				return null;
			}
			Transform val = ((Component)enemyInstance).transform.Find("FlowermanModel");
			SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("LOD1")).GetComponent<SkinnedMeshRenderer>() : null);
			object obj = null;
			if ((Object)(object)val == (Object)null)
			{
				RaccoonBase.LogWarning(" {function}(ReskinBracken) Game's FlowermanModel does not exist; missing.\nThere may be another mod interrupting/conflictng.");
				return null;
			}
			Transform val3 = val.Find("AnimContainer");
			obj = (((Object)(object)val3 != (Object)null) ? val3.Find("metarig") : null);
			Transform val4 = (Transform)obj;
			if (!((Object)val2 == (Object)null) && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				Renderer[] componentsInChildren = ((Component)val4).gameObject.GetComponentsInChildren<Renderer>();
				Renderer[] array = componentsInChildren;
				Renderer[] array2 = array;
				foreach (Renderer val5 in array2)
				{
					val5.enabled = false;
				}
				GameObject val6 = Object.Instantiate<GameObject>(newModel, ((Component)enemyInstance).gameObject.transform);
				val6.transform.SetParent(val);
				return val6;
			}
			RaccoonBase.LogWarning(" {function}(ReskinBracken) Game's FlowermanModel mesh renderer is missing or null.\nThere may be another mod interrupting/conflictng.");
			return null;
		}

		public static GameObject ReskinHoarder(HoarderBugAI enemyInstance, GameObject newModel)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {F} {HoarderBugAI} for function (ReskinHoarder) missing or null.");
				return null;
			}
			if ((Object)(object)newModel == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {GameObject} {newModel} for function (ReskinHoarder) missing or null.");
				return null;
			}
			Transform val = ((Component)enemyInstance).transform.Find("HoarderBugModel");
			SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("Cube")).GetComponent<SkinnedMeshRenderer>() : null);
			SkinnedMeshRenderer val3 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("Cube.001")).GetComponent<SkinnedMeshRenderer>() : null);
			if (!((Object)val2 == (Object)null) && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				((Renderer)val3).enabled = false;
				GameObject val4 = Object.Instantiate<GameObject>(newModel, ((Component)enemyInstance).gameObject.transform);
				val4.transform.SetParent(val);
				return val4;
			}
			RaccoonBase.LogWarning(" {function}(ReskinHoarder) Game's HoarderBugModel mesh renderer is missing or null.\nThere may be another mod interrupting/conflicting.");
			return null;
		}

		public static GameObject ReskinThumper(CrawlerAI enemyInstance, GameObject newModel)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Expected O, but got Unknown
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {F} {CrawlerAI} for function (ReskinThumper) missing or null.");
				return null;
			}
			if ((Object)(object)newModel == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {GameObject} {newModel} for function (ReskinThumper) missing or null.");
				return null;
			}
			Transform val = ((Component)enemyInstance).transform.Find("CrawlerModel");
			SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("Cube.002")).GetComponent<SkinnedMeshRenderer>() : null);
			if (!((Object)val2 == (Object)null) && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				GameObject val3 = Object.Instantiate<GameObject>(newModel, ((Component)enemyInstance).gameObject.transform);
				val3.transform.SetParent(val);
				return val3;
			}
			RaccoonBase.LogWarning(" {function}(ReskinThumper) Game's CrawlerModel mesh renderer is missing or null.\nThere may be another mod interrupting/conflicting.");
			return null;
		}

		public static GameObject ReskinNutcracker(NutcrackerEnemyAI enemyInstance, GameObject newModel)
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			if ((Object)(object)enemyInstance == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {F} {NutcrackerEnemyAI} for function (ReskinNutcracker) missing or null.");
				return null;
			}
			if ((Object)(object)newModel == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #2 {GameObject} {newModel} for function (ReskinNutcracker) missing or null.");
				return null;
			}
			Transform val = ((Component)enemyInstance).transform.Find("MeshContainer");
			SkinnedMeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("LOD0")).GetComponent<SkinnedMeshRenderer>() : null);
			SkinnedMeshRenderer val3 = (((Object)(object)val != (Object)null) ? ((Component)val.Find("LOD0")).GetComponent<SkinnedMeshRenderer>() : null);
			if (!((Object)val3 == (Object)null) && ((Renderer)val3).enabled)
			{
				((Renderer)val3).enabled = false;
				((Renderer)val2).enabled = false;
				GameObject val4 = Object.Instantiate<GameObject>(newModel, ((Component)enemyInstance).gameObject.transform);
				val4.transform.SetParent(val);
				return val4;
			}
			RaccoonBase.LogWarning(" {function}(ReskinThumper) Game's CrawlerModel mesh renderer is missing or null.\nThere may be another mod interrupting/conflicting.");
			return null;
		}
	}
	public class ContentLoader
	{
		public static AssetBundle FetchAssetBundle(BaseUnityPlugin plugin, string dllName, string bundleName)
		{
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			if ((Object)(object)plugin == (Object)null)
			{
				RaccoonBase.LogWarning("parameter #1 {BaseUnityPlugin} {plugin} for function (FetchAssetBundle) missing or null.\nPlugin required for improved terminal debugging purposes.");
			}
			string name = plugin.Info.Metadata.Name;
			if (bundleName == null || bundleName == "")
			{
				RaccoonBase.LogWarningPlugin("Parameter #3 (bundleName) for function (FetchAssetBundle) is empty or null.", name);
				return null;
			}
			if (dllName == null || dllName == "")
			{
				RaccoonBase.LogWarningPlugin("Parameter #2 (dllName) for (FetchAssetBundle) is empty or null.", name);
				return null;
			}
			if ((Object)(object)plugin == (Object)null)
			{
				RaccoonBase.LogWarningPlugin("Parameter #1 (plugin) for (FetchAssetBundle) is null.", name);
				return null;
			}
			string location = plugin.Info.Location;
			string text = location.TrimEnd(dllName.ToCharArray());
			string text2 = text + bundleName;
			AssetBundle val = AssetBundle.LoadFromFile(text2);
			if ((Object)val == (Object)null)
			{
				RaccoonBase.LogWarningPlugin("Failed to load AssetBundle (" + bundleName + ").\nLocation: " + text2, name);
				return null;
			}
			return val;
		}

		public static Object[] GetAllAssets(AssetBundle bundle, BaseUnityPlugin plugin)
		{
			return bundle.LoadAllAssets();
		}
	}
}