Decompiled source of ZedFumo v1.0.1

plugin/FumoDog.dll

Decompiled 7 hours ago
using System.Collections.Generic;
using System.Diagnostics;
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("FumoDog")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FumoDog")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("97c0b612-ce9d-4399-ad72-a3612b522283")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace FumoDog
{
	[BepInPlugin("fosterchild.FumoDog", "FumoDog", "1.0.0")]
	public class FumoDogBase : BaseUnityPlugin
	{
		private const string modGUID = "fosterchild.FumoDog";

		private const string modName = "FumoDog";

		private const string modVersion = "1.0.0";

		public static FumoDogBase Instance;

		private readonly Harmony harmony = new Harmony("fosterchild.FumoDog");

		public ManualLogSource mls = null;

		internal static Dictionary<string, GameObject> Models { get; private set; } = new Dictionary<string, GameObject>();


		public void Awake()
		{
			mls = Logger.CreateLogSource("fosterchild.FumoDog");
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("FumoDog".ToCharArray());
			AssetBundle val = AssetBundle.LoadFromFile(location.Remove(location.IndexOf("FumoDog.dll"), 11) + "model");
			GameObject[] array = val.LoadAllAssets<GameObject>();
			List<GameObject> list = new List<GameObject>(array.Length);
			list.AddRange(array);
			List<GameObject> list2 = list;
			list2.ForEach(delegate(GameObject model2)
			{
				Models.Add(((Object)model2).name, model2);
			});
			mls.LogInfo((object)"Loaded the fumo successfully");
		}
	}
}
namespace FumoDog.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class PipePatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ModelPatch(GrabbableObject __instance)
		{
			if ((Object)(object)__instance != (Object)null && ((Object)__instance.itemProperties).name == "Zeddog")
			{
				((Component)__instance).gameObject.AddComponent<Fumo>();
			}
		}
	}
	internal class Fumo : MonoBehaviour
	{
		private GrabbableObject instance;

		private void hideModel()
		{
			Renderer[] components = ((Component)instance).GetComponents<Renderer>();
			Renderer[] array = components;
			Renderer[] array2 = array;
			foreach (Renderer val in array2)
			{
				if (!(((Object)val).name == "Fumo(Clone)"))
				{
					val.enabled = false;
				}
			}
		}

		private void Start()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			instance = ((Component)this).GetComponent<GrabbableObject>();
			if (FumoDogBase.Models.TryGetValue("fumo", out var value))
			{
				GameObject val = Object.Instantiate<GameObject>(value, ((Component)instance).gameObject.transform);
				((Object)val).name = "Fumo(Clone)";
				val.transform.localPosition = Vector3.zero;
				val.transform.localScale = Vector3.one / 3f;
				val.transform.localRotation = Quaternion.Euler(-90f, -30f, 0f);
				Transform transform = val.transform;
				val.SetActive(true);
			}
		}

		private void Update()
		{
			hideModel();
		}
	}
}