Decompiled source of DAAMN turret v1.0.0

DAAMN.dll

Decompiled 5 hours ago
using System;
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 HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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("TurretTest")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TurretTest")]
[assembly: AssemblyTitle("TurretTest")]
[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 TurretTest
{
	[BepInPlugin("DAAMNturret", "DAAMNturret", "1.0.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static Object turret;

		public static Object leg;

		private void Awake()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin TurretTest is loaded!");
			new Harmony("DAAMNturret").PatchAll(typeof(Patches));
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "daamn");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			turret = val.LoadAsset<Object>("damnturret.prefab");
			leg = val.LoadAsset<Object>("damnleg.prefab");
		}
	}
	internal class Patches
	{
		[HarmonyPatch(typeof(Turret), "Start")]
		[HarmonyPostfix]
		private static void Start(Turret __instance)
		{
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Patching turret");
			Transform val = ((Component)__instance).transform.GetParent().Find("MeshContainer/Mount");
			MeshFilter component = ((Component)val).GetComponent<MeshFilter>();
			component.mesh = null;
			Object val2 = Object.Instantiate(Plugin.leg, val);
			((GameObject)((val2 is GameObject) ? val2 : null)).transform.localScale = new Vector3(7f, 8f, 7f);
			((GameObject)((val2 is GameObject) ? val2 : null)).transform.localRotation = Quaternion.Euler(270f, 180f, 0f);
			((GameObject)((val2 is GameObject) ? val2 : null)).transform.localPosition = new Vector3(0f, -0.1f, -4.03f);
			Transform val3 = ((Component)__instance).transform.GetParent().Find("MeshContainer/RotatingRodContainer/Rod/GunBody");
			MeshFilter component2 = ((Component)val3).GetComponent<MeshFilter>();
			component2.mesh = null;
			Object val4 = Object.Instantiate(Plugin.turret, val3);
			((GameObject)((val4 is GameObject) ? val4 : null)).transform.localScale = Vector3.one * 45f;
			((GameObject)((val4 is GameObject) ? val4 : null)).transform.localRotation = Quaternion.Euler(270f, 180f, 0f);
			((GameObject)((val4 is GameObject) ? val4 : null)).transform.localPosition = new Vector3(0f, 3f, -8.3f);
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "TurretTest";

		public const string PLUGIN_NAME = "TurretTest";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}