Decompiled source of HoHoHo v0.0.4

HoHoHo.dll

Decompiled a week ago
using System;
using System.CodeDom.Compiler;
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.Unity.IL2CPP;
using Enemies;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using SNetwork;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("HoHoHo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HoHoHo")]
[assembly: AssemblyTitle("HoHoHo")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace HoHoHo
{
	public class HoHoHoCone : MonoBehaviour
	{
		private static bool outside = true;

		private static bool inside = false;

		private static int numVertices = 10;

		private static float radiusTop = 0f;

		private static float radiusBottom = 0.15f;

		private static float length = 0.35f;

		private static GameObject conego = new GameObject();

		private static Mesh mesh = new Mesh();

		private static int multiplier = (outside ? 1 : 0) + (inside ? 1 : 0);

		private static int offset = ((outside && inside) ? (2 * numVertices) : 0);

		private static Vector3[] vertices = (Vector3[])(object)new Vector3[2 * multiplier * numVertices];

		private static Vector3[] normals = (Vector3[])(object)new Vector3[2 * multiplier * numVertices];

		private static Vector2[] uvs = (Vector2[])(object)new Vector2[2 * multiplier * numVertices];

		private static int[] tris;

		private static float slope = Mathf.Atan((radiusBottom - radiusTop) / length);

		private static float slopeSin = Mathf.Sin(slope);

		private static float slopeCos = Mathf.Cos(slope);

		public static GameObject Create()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Expected O, but got Unknown
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_0285: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			conego = new GameObject();
			for (int i = 0; i < numVertices; i++)
			{
				float num = MathF.PI * 2f * (float)i / (float)numVertices;
				float num2 = Mathf.Sin(num);
				float num3 = Mathf.Cos(num);
				float num4 = MathF.PI * 2f * ((float)i + 0.5f) / (float)numVertices;
				float num5 = Mathf.Sin(num4);
				float num6 = Mathf.Cos(num4);
				vertices[i] = new Vector3(radiusTop * num3, radiusTop * num2, 0f);
				vertices[i + numVertices] = new Vector3(radiusBottom * num3, radiusBottom * num2, length);
				if (radiusTop == 0f)
				{
					normals[i] = new Vector3(num6 * slopeCos, num5 * slopeCos, 0f - slopeSin);
				}
				else
				{
					normals[i] = new Vector3(num3 * slopeCos, num2 * slopeCos, 0f - slopeSin);
				}
				if (radiusBottom == 0f)
				{
					normals[i + numVertices] = new Vector3(num6 * slopeCos, num5 * slopeCos, 0f - slopeSin);
				}
				else
				{
					normals[i + numVertices] = new Vector3(num3 * slopeCos, num2 * slopeCos, 0f - slopeSin);
				}
				uvs[i] = new Vector2(1f * (float)i / (float)numVertices, 1f);
				uvs[i + numVertices] = new Vector2(1f * (float)i / (float)numVertices, 0f);
				if (outside && inside)
				{
					vertices[i + 2 * numVertices] = vertices[i];
					vertices[i + 3 * numVertices] = vertices[i + numVertices];
					uvs[i + 2 * numVertices] = uvs[i];
					uvs[i + 3 * numVertices] = uvs[i + numVertices];
				}
				if (inside)
				{
					normals[i + offset] = -normals[i];
					normals[i + numVertices + offset] = -normals[i + numVertices];
				}
			}
			mesh.vertices = Il2CppStructArray<Vector3>.op_Implicit(vertices);
			mesh.normals = Il2CppStructArray<Vector3>.op_Implicit(normals);
			mesh.uv = Il2CppStructArray<Vector2>.op_Implicit(uvs);
			int num7 = 0;
			if (radiusTop == 0f)
			{
				tris = new int[numVertices * 3 * multiplier];
				if (outside)
				{
					for (int j = 0; j < numVertices; j++)
					{
						tris[num7++] = j + numVertices;
						tris[num7++] = j;
						if (j == numVertices - 1)
						{
							tris[num7++] = numVertices;
						}
						else
						{
							tris[num7++] = j + 1 + numVertices;
						}
					}
				}
				if (inside)
				{
					for (int k = offset; k < numVertices + offset; k++)
					{
						tris[num7++] = k;
						tris[num7++] = k + numVertices;
						if (k == numVertices - 1 + offset)
						{
							tris[num7++] = numVertices + offset;
						}
						else
						{
							tris[num7++] = k + 1 + numVertices;
						}
					}
				}
			}
			else if (radiusBottom == 0f)
			{
				tris = new int[numVertices * 3 * multiplier];
				if (outside)
				{
					for (int l = 0; l < numVertices; l++)
					{
						tris[num7++] = l;
						if (l == numVertices - 1)
						{
							tris[num7++] = 0;
						}
						else
						{
							tris[num7++] = l + 1;
						}
						tris[num7++] = l + numVertices;
					}
				}
				if (inside)
				{
					for (int m = offset; m < numVertices + offset; m++)
					{
						if (m == numVertices - 1 + offset)
						{
							tris[num7++] = offset;
						}
						else
						{
							tris[num7++] = m + 1;
						}
						tris[num7++] = m;
						tris[num7++] = m + numVertices;
					}
				}
			}
			else
			{
				tris = new int[numVertices * 6 * multiplier];
				if (outside)
				{
					for (int n = 0; n < numVertices; n++)
					{
						int num8 = n + 1;
						if (num8 == numVertices)
						{
							num8 = 0;
						}
						tris[num7++] = n;
						tris[num7++] = num8;
						tris[num7++] = n + numVertices;
						tris[num7++] = num8 + numVertices;
						tris[num7++] = n + numVertices;
						tris[num7++] = num8;
					}
				}
				if (inside)
				{
					for (int num9 = offset; num9 < numVertices + offset; num9++)
					{
						int num10 = num9 + 1;
						if (num10 == numVertices + offset)
						{
							num10 = offset;
						}
						tris[num7++] = num10;
						tris[num7++] = num9;
						tris[num7++] = num9 + numVertices;
						tris[num7++] = num9 + numVertices;
						tris[num7++] = num10 + numVertices;
						tris[num7++] = num10;
					}
				}
			}
			mesh.triangles = Il2CppStructArray<int>.op_Implicit(tris);
			conego.AddComponent<MeshFilter>().mesh = mesh;
			conego.AddComponent<MeshRenderer>();
			return conego;
		}
	}
	[BepInPlugin("HoHoHo", "HoHoHo", "0.0.4")]
	public class Plugin : BasePlugin
	{
		[HarmonyPatch]
		private class hohohopatches : MonoBehaviour
		{
			public static void EmptyList()
			{
				enemydone.Clear();
			}

			[HarmonyPatch(typeof(EnemyAllocator), "SpawnEnemy")]
			[HarmonyPostfix]
			public static void Posttix(EnemyAllocator __instance)
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Expected O, but got Unknown
				//IL_0098: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_0109: Unknown result type (might be due to invalid IL or missing references)
				//IL_0127: Unknown result type (might be due to invalid IL or missing references)
				//IL_0146: Unknown result type (might be due to invalid IL or missing references)
				//IL_0176: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_0209: Unknown result type (might be due to invalid IL or missing references)
				//IL_0228: Unknown result type (might be due to invalid IL or missing references)
				EnemyAgent spawnedEnemyAgent = __instance.m_spawnedEnemyAgent;
				if (enemydone.Contains(spawnedEnemyAgent))
				{
					return;
				}
				byte[] array = File.ReadAllBytes(Path.Combine(Paths.ConfigPath, "../Assets/HoHoHo/gift1.png"));
				Texture2D val = new Texture2D(512, 512, (TextureFormat)5, false);
				ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array));
				try
				{
					foreach (SkinnedMeshRenderer componentsInChild in ((Component)spawnedEnemyAgent).GetComponentsInChildren<SkinnedMeshRenderer>())
					{
						((Renderer)componentsInChild).material.SetTexture("_MainTex", (Texture)(object)val);
					}
					Dam_EnemyDamageLimb headLimb = spawnedEnemyAgent.m_headLimb;
					_ = ((Component)spawnedEnemyAgent.m_headLimb).transform.position;
					GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
					((Renderer)obj.GetComponentInChildren<MeshRenderer>()).material.color = Color.white;
					Object.Destroy((Object)(object)obj.GetComponentInChildren<Collider>());
					obj.transform.parent = ((Component)headLimb).transform;
					obj.transform.localPosition = new Vector3(0f, 0f, 0f);
					obj.transform.localScale = new Vector3(0.3f, 0.05f, 0.3f);
					obj.transform.localEulerAngles = new Vector3(0f, 90f, 0f);
					GameObject obj2 = Object.Instantiate<GameObject>(HoHoHoCone.Create());
					((Renderer)obj2.GetComponentInChildren<MeshRenderer>()).material.color = Color.red;
					obj2.transform.parent = ((Component)headLimb).transform;
					obj2.transform.localPosition = new Vector3(0f, 0.4f, 0f);
					obj2.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
					obj2.transform.localScale = new Vector3(1f, 1f, 1f);
					GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)0);
					Object.Destroy((Object)(object)obj3.GetComponentInChildren<Collider>());
					((Renderer)obj3.GetComponentInChildren<MeshRenderer>()).material.color = Color.white;
					obj3.transform.parent = ((Component)headLimb).transform;
					obj3.transform.localPosition = new Vector3(0f, 0.5f, 0f);
					obj3.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
					Light obj4 = obj3.AddComponent<Light>();
					obj4.range = 1f;
					obj4.intensity = 0.6f;
				}
				catch (Exception)
				{
				}
				enemydone.Add(spawnedEnemyAgent);
			}

			[HarmonyPatch(typeof(EnemyAllocator), "OnEnemySpawned")]
			[HarmonyPostfix]
			public static void Postfix2(EnemyAllocator __instance, pEnemySpawnData spawnData, EnemyReplicator replicator)
			{
				//IL_0040: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: Expected O, but got Unknown
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_0113: Unknown result type (might be due to invalid IL or missing references)
				//IL_0131: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Unknown result type (might be due to invalid IL or missing references)
				//IL_0180: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
				//IL_0213: Unknown result type (might be due to invalid IL or missing references)
				//IL_0232: Unknown result type (might be due to invalid IL or missing references)
				EnemyAgent component = ((SNet_Replicator)replicator).ReplicatorSupplier.gameObject.GetComponent<EnemyAgent>();
				if (enemydone.Contains(component))
				{
					return;
				}
				byte[] array = File.ReadAllBytes(Path.Combine(Paths.ConfigPath, "../Assets/HoHoHo/gift1.png"));
				Texture2D val = new Texture2D(512, 512, (TextureFormat)5, false);
				ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array));
				try
				{
					foreach (SkinnedMeshRenderer componentsInChild in ((Component)component).GetComponentsInChildren<SkinnedMeshRenderer>())
					{
						((Renderer)componentsInChild).material.SetTexture("_MainTex", (Texture)(object)val);
					}
					Dam_EnemyDamageLimb headLimb = component.m_headLimb;
					_ = ((Component)component.m_headLimb).transform.position;
					GameObject obj = GameObject.CreatePrimitive((PrimitiveType)2);
					((Renderer)obj.GetComponentInChildren<MeshRenderer>()).material.color = Color.white;
					Object.Destroy((Object)(object)obj.GetComponentInChildren<Collider>());
					obj.transform.parent = ((Component)headLimb).transform;
					obj.transform.localPosition = new Vector3(0f, 0f, 0f);
					obj.transform.localScale = new Vector3(0.3f, 0.05f, 0.3f);
					obj.transform.localEulerAngles = new Vector3(0f, 90f, 0f);
					GameObject obj2 = Object.Instantiate<GameObject>(HoHoHoCone.Create());
					((Renderer)obj2.GetComponentInChildren<MeshRenderer>()).material.color = Color.red;
					obj2.transform.parent = ((Component)headLimb).transform;
					obj2.transform.localPosition = new Vector3(0f, 0.4f, 0f);
					obj2.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
					obj2.transform.localScale = new Vector3(1f, 1f, 1f);
					GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)0);
					Object.Destroy((Object)(object)obj3.GetComponentInChildren<Collider>());
					((Renderer)obj3.GetComponentInChildren<MeshRenderer>()).material.color = Color.white;
					obj3.transform.parent = ((Component)headLimb).transform;
					obj3.transform.localPosition = new Vector3(0f, 0.5f, 0f);
					obj3.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
					Light obj4 = obj3.AddComponent<Light>();
					obj4.range = 1f;
					obj4.intensity = 0.6f;
					enemydone.Add(component);
				}
				catch (Exception)
				{
				}
			}
		}

		private static List<EnemyAgent> enemydone = new List<EnemyAgent>();

		public override void Load()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			ClassInjector.RegisterTypeInIl2Cpp<HoHoHoCone>();
			new Harmony("HoHoHo").PatchAll();
			LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)hohohopatches.EmptyList);
		}
	}
	[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
	[CompilerGenerated]
	internal static class VersionInfo
	{
		public const string RootNamespace = "HoHoHo";

		public const string Version = "1.0.0";

		public const string VersionPrerelease = null;

		public const string VersionMetadata = null;

		public const string SemVer = "1.0.0";

		public const string GitRevShort = null;

		public const string GitRevLong = null;

		public const string GitBranch = null;

		public const string GitTag = null;

		public const bool GitIsDirty = false;
	}
}