Decompiled source of Lins Spear Practice Mod v1.0.0

SpearPractice.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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("SpearPractice")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("SpearPractice")]
[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 SpearPractice
{
	[BepInPlugin("SpearPractice", "My first plugin", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(M_Gamemode), "Initialize")]
		private static class GM_Initialize_Postfix
		{
			private static void Postfix(M_Gamemode __instance)
			{
				//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00db: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e6: 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_00f5: Unknown result type (might be due to invalid IL or missing references)
				Inventory inventory = ENT_Player.GetInventory();
				if ((Object)(object)inventory == (Object)null)
				{
					return;
				}
				Debug.Log((object)"[GM] Inventory after Initialize:");
				foreach (Item bagItem in inventory.bagItems)
				{
					Debug.Log((object)("  - " + bagItem.itemName));
				}
				List<Item> list = new List<Item>();
				Item clone = CL_AssetManager.GetAssetGameObject("Item_Artifact_Rebar_Return", "").GetComponent<Item_Object>().itemData.GetClone();
				Vector3 val = new Vector3(0f, 1f, 1f);
				clone.bagPosition = ((Vector3)(ref val)).normalized;
				clone.bagRotation = Quaternion.LookRotation(-((Component)ENT_Player.GetPlayer()).transform.forward + Vector3.up * 0.5f) * Quaternion.LookRotation(clone.upDirection);
				list.Add(clone);
				if ((Object)(object)ENT_Player.GetInventory() != (Object)null)
				{
					MethodInfo methodInfo = AccessTools.Method(typeof(Inventory), "LoadItemsIntoBag", (Type[])null, (Type[])null);
					methodInfo.Invoke(inventory, new object[1] { list });
				}
				CommandConsole.cheatsEnabled = true;
				CommandConsole.hasCheated = true;
			}
		}

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("com.lin.SpearPractice").PatchAll();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "SpearPractice";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}