Decompiled source of CNOOPS v1.1.0

BepInEx/plugins/CNOOPS/CNOOPS.dll

Decompiled 2 weeks 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 ComputerysModdingUtilities;
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: StraftatMod(true)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.1", FrameworkDisplayName = ".NET Framework 4.7.1")]
[assembly: AssemblyCompany("CNOOPS")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("6.9.4.20")]
[assembly: AssemblyInformationalVersion("6.9.4.20")]
[assembly: AssemblyProduct("debugPlgn")]
[assembly: AssemblyTitle("CNOOPS")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("6.9.4.20")]
[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 STRAFMOD
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CNOOPS";

		public const string PLUGIN_NAME = "debugPlgn";

		public const string PLUGIN_VERSION = "6.9.4.20";
	}
}
namespace STRAFTATMod
{
	[BepInPlugin("dimolade.fixes.cnoops", "CNOOPS", "1.1.0.0")]
	public class Loader : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(ItemBehaviour))]
		private static class ItemBehaviourPatch
		{
			[HarmonyPatch("Start")]
			[HarmonyPrefix]
			private static void AddNames(ItemBehaviour __instance)
			{
				string name = ((Object)((Component)__instance).gameObject).name;
				string text = name;
				if (text == "DF_GodSword")
				{
					string item = "OPSWORD";
					m_renamedItems.Add(__instance, (__instance.weaponName, item));
				}
			}

			[HarmonyPatch("OnFocus")]
			[HarmonyPrefix]
			private static void GainFocus(ItemBehaviour __instance)
			{
				if (m_renamedItems.TryGetValue(__instance, out (string, string) value))
				{
					__instance.weaponName = value.Item2;
				}
			}

			[HarmonyPatch("OnLoseFocus")]
			[HarmonyPrefix]
			private static void LoseFocus(ItemBehaviour __instance)
			{
				if (m_renamedItems.TryGetValue(__instance, out (string, string) value))
				{
					(__instance.weaponName, _) = value;
				}
			}
		}

		private static Dictionary<ItemBehaviour, (string original, string renamed)> m_renamedItems = new Dictionary<ItemBehaviour, (string, string)>();

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("dimolade.fixes.cnoops");
			val.PatchAll();
		}
	}
}