Decompiled source of Wither Flyers v1.0.1

ProjectilePrefab.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using AssetShards;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
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("ProjectilePrefab")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ProjectilePrefab")]
[assembly: AssemblyTitle("ProjectilePrefab")]
[assembly: AssemblyVersion("1.0.0.0")]
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 ProjectilePrefab
{
	[BepInPlugin("com.Brandonious.ProjectilePrefab", "ProjectilePrefab", "1.0.0")]
	public class Loader : BasePlugin
	{
		public const string MODNAME = "ProjectilePrefab";

		public const string AUTHOR = "Brandonious";

		public const string GUID = "com.Brandonious.ProjectilePrefab";

		public const string VERSION = "1.0.0";

		public static ManualLogSource Logger;

		public override void Load()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			Logger = ((BasePlugin)this).Log;
			new Harmony("ProjectilePrefab").PatchAll();
			ManualLogSource log = ((BasePlugin)this).Log;
			bool flag = default(bool);
			BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(18, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ProjectilePrefab");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Loaded! :)");
			}
			log.LogWarning(val);
		}
	}
	[HarmonyPatch]
	internal class PrefabPatch : MonoBehaviour
	{
		public static Dictionary<int, GameObject> dict = new Dictionary<int, GameObject>();

		[HarmonyPatch(typeof(ProjectileManager), "LoadAssets")]
		[HarmonyPostfix]
		public static void LoadCustomAssets(ProjectileManager __instance)
		{
			for (int i = 0; i < ((Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs).Length; i++)
			{
				if (i == 9)
				{
					dict.Add(i, AssetShardManager.GetLoadedAsset<GameObject>("Assets/CustomEnemies/WitherProjectile.prefab", false));
				}
				else
				{
					dict.Add(i, ((Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs)[i]);
				}
				Debug.LogWarning(Object.op_Implicit("Loaded Asset " + ((Object)((Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs)[i].gameObject).name));
			}
			dict.Add(((Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs).Length + 1, AssetShardManager.GetLoadedAsset<GameObject>("Assets/CustomEnemies/WitherProjectile.prefab", false));
			Debug.LogWarning(Object.op_Implicit($"Loaded Asset {((Object)dict[((Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs).Length + 1].gameObject).name} at position {((Il2CppArrayBase<GameObject>)(object)__instance.m_projectilePrefabs).Length + 1}."));
		}

		[HarmonyPatch(typeof(ProjectileManager), "SpawnProjectileType")]
		[HarmonyPrefix]
		public static bool SpawnNewProjectileType(ProjectileType type, Vector3 pos, Quaternion rot, ProjectileManager __instance, ref GameObject __result)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Expected I4, but got Unknown
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			int key = (int)type;
			__result = Object.Instantiate<GameObject>(dict[key], pos, rot);
			return false;
		}

		[HarmonyPatch(typeof(GameDataInit), "Initialize")]
		[HarmonyPostfix]
		public static void TheOlSwitcheroo()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			GameDataBlockBase<EnemyDataBlock>.GetBlock(42u).ModelDatas[0].ModelFile = "Assets/CustomEnemies/Wither.prefab";
			GameDataBlockBase<EnemyDataBlock>.GetBlock(42u).ModelDatas[0].SizeRange = new Vector2(1.2f, 1.2f);
		}
	}
}