Decompiled source of ModulCamoshopFix v1.0.0

ModulCamoshopFix.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ModularWorkshop;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("NGA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0")]
[assembly: AssemblyProduct("ModulCamoshopFix")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
		{
		}
	}
}
namespace NGA
{
	[BepInPlugin("NGA.ModulCamoshopFix", "ModulCamoshopFix", "0.0.1")]
	[BepInProcess("h3vr.exe")]
	public class ModulCamoshopFix : BaseUnityPlugin
	{
		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			Harmony val = new Harmony("NGA.ModulCamoshopFix");
			SetUpConfigFields();
			Logger.LogMessage((object)"Initialized :)");
			val.PatchAll();
			Logger.LogMessage((object)"Hello, world! Sent from NGA.ModulCamoshopFix 0.0.1");
		}

		private void SetUpConfigFields()
		{
		}

		private static bool ShouldBlockSkin(Transform targetTransform)
		{
			if ((Object)(object)targetTransform == (Object)null)
			{
				return true;
			}
			MasteryCamosGunState component = ((Component)targetTransform).GetComponent<MasteryCamosGunState>();
			return (Object)(object)component == (Object)null;
		}

		[HarmonyPatch(typeof(ModularWeaponPart), "ApplySkin")]
		[HarmonyPrefix]
		public static bool ModularWeaponPartApplySkinPrefix(ModularWeaponPart __instance, SkinDefinition skinDefinition)
		{
			return ShouldBlockSkin(((Component)__instance).transform);
		}

		[HarmonyPatch(typeof(ModularWeaponPartsAttachmentPoint), "ApplySkin")]
		[HarmonyPrefix]
		public static bool ModularWeaponPartsAttachmentPointApplySkinPrefix(ModularWeaponPartsAttachmentPoint __instance, SkinDefinition skinDefinition)
		{
			Transform modularPartPoint = __instance.ModularPartPoint;
			Transform targetTransform = ((modularPartPoint != null) ? ((Component)modularPartPoint).transform : null);
			return ShouldBlockSkin(targetTransform);
		}

		[HarmonyPatch(typeof(ModularFVRPhysicalObject), "ApplyReceiverSkin")]
		[HarmonyPrefix]
		public static bool ModularFVRPhysicalObjectApplyReceiverSkinPrefix(ModularFVRPhysicalObject __instance, SkinDefinition skinDefinition)
		{
			return ShouldBlockSkin(((Component)__instance).transform);
		}
	}
}