Decompiled source of GIANTROBOT v1.0.0

GiantFuckingRobot.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour;
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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("GiantFuckingRobot")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+16f4d1b9965ee1908d4ac5a1a0a0ae6b7d7aa50a")]
[assembly: AssemblyProduct("GiantFuckingRobot")]
[assembly: AssemblyTitle("GiantFuckingRobot")]
[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.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;
		}
	}
	[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 GiantFuckingRobot
{
	internal static class LobbyCompat
	{
		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility");

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			PluginHelper.RegisterPlugin("grug.lethalcompany.giantrobot", Version.Parse("09.04.2996"), (CompatibilityLevel)2, (VersionStrictness)0);
		}
	}
	[BepInPlugin("grug.lethalcompany.giantrobot", "Giant Robot", "09.04.2996")]
	public class RobotPlugin : BaseUnityPlugin
	{
		public const string modGUID = "grug.lethalcompany.giantrobot";

		public const string modName = "Giant Robot";

		public const string modVersion = "09.04.2996";

		public static ManualLogSource mls;

		public static Hook? grabbableObjectHook;

		public static Hook? quickMenu;

		public static QuickMenuManager quickMenuManager;

		public void Awake()
		{
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected O, but got Unknown
			if (LobbyCompat.Enabled)
			{
				LobbyCompat.Init();
			}
			mls = ((BaseUnityPlugin)this).Logger;
			grabbableObjectHook = new Hook((MethodBase)typeof(StormyWeather).GetMethod("LightningStrike", AccessTools.allDeclared), (Delegate)new Action<Action<StormyWeather, Vector3, bool>, StormyWeather, Vector3, bool>(StormyWeatherPatch));
			quickMenu = new Hook((MethodBase)typeof(QuickMenuManager).GetMethod("Start", AccessTools.allDeclared), (Delegate)new Action<Action<QuickMenuManager>, QuickMenuManager>(QuickMMPatch));
		}

		public static void QuickMMPatch(Action<QuickMenuManager> orig, QuickMenuManager self)
		{
			quickMenuManager = self;
			orig(self);
		}

		public static void StormyWeatherPatch(Action<StormyWeather, Vector3, bool> orig, StormyWeather self, Vector3 pos, bool atobj)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			orig(self, pos, atobj);
			if (atobj && (Object)(object)self.targetingMetalObject != (Object)null && ((Object)self.targetingMetalObject.itemProperties).name == "RobotToy")
			{
				RoundManager.Instance.SpawnEnemyGameObject(((Component)self.targetingMetalObject).transform.position, 0f, -1, quickMenuManager.testAllEnemiesLevel.OutsideEnemies[4].enemyType);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "GiantFuckingRobot";

		public const string PLUGIN_NAME = "GiantFuckingRobot";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}