Decompiled source of RedHotSilencers v0.1.1

NGA.RedHot.dll

Decompiled 10 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.Configuration;
using BepInEx.Logging;
using FistVR;
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: 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("NGA.RedHot")]
[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]
	[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 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.RedHot", "RedHot", "0.1.0")]
	[BepInDependency("nrgill28.Sodalite", "1.4.1")]
	[BepInProcess("h3vr.exe")]
	public class RedHot : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Suppressor))]
		[HarmonyPatch("ShotEffect")]
		private class SuppressorShotEffectHook
		{
			private static Color colour = Color.red;

			private static void Prefix(Suppressor __instance)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
				foreach (Transform item in ((Component)__instance).transform)
				{
					Transform val = item;
					if (((Component)val).gameObject.activeSelf && (Object)(object)((Component)val).GetComponent<MeshRenderer>() != (Object)null)
					{
						Renderer component = (Renderer)(object)((Component)val).GetComponent<MeshRenderer>();
						if ((Object)(object)component != (Object)null)
						{
							Material material = component.material;
							Color color = material.GetColor("_Color");
							color.g -= 0.01f;
							color.b -= 0.01f;
							color.g = Mathf.Clamp(color.g, 0.5f, 1f);
							color.b = Mathf.Clamp(color.b, 0.5f, 1f);
							material.SetColor("_Color", color);
							material.SetColor("_Tint", color);
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(Suppressor))]
		[HarmonyPatch("FVRUpdate")]
		private class SuppressorFVRUpdateHook
		{
			private static void Prefix(Suppressor __instance)
			{
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Expected O, but got Unknown
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d6: Expected O, but got Unknown
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				foreach (Transform item in ((Component)__instance).transform)
				{
					Transform val = item;
					if (!((Component)val).gameObject.activeSelf || !((Object)(object)((Component)val).GetComponent<MeshRenderer>() != (Object)null))
					{
						continue;
					}
					Renderer component = (Renderer)(object)((Component)val).GetComponent<MeshRenderer>();
					if (!((Object)(object)component != (Object)null))
					{
						continue;
					}
					Material material = component.material;
					Color color = material.GetColor("_Color");
					if ((double)color.g < 0.7 && Object.op_Implicit((Object)(object)((FVRFireArmAttachment)__instance).curMount) && Object.op_Implicit((Object)(object)((FVRFireArmAttachment)__instance).curMount.Parent) && ((FVRFireArmAttachment)__instance).curMount.Parent is FVRFireArm)
					{
						FVRFireArm val2 = (FVRFireArm)((FVRFireArmAttachment)__instance).curMount.Parent;
						for (int i = 0; i < val2.GasOutEffects.Length; i++)
						{
							if (val2.GasOutEffects[i].FollowsMuzzle)
							{
								val2.GasOutEffects[i].GasPerEvent.y = val2.GasOutEffects[i].GasPerEvent.x;
								((Component)val2.GasOutEffects[i].PSystem).transform.position = val2.GetMuzzle().position;
								val2.GasOutEffects[i].PSystem.Emit(1);
							}
						}
					}
					color.g += 0.01f * Time.deltaTime;
					color.b += 0.01f * Time.deltaTime;
					color.g = Mathf.Clamp(color.g, 0.5f, 1f);
					color.b = Mathf.Clamp(color.b, 0.5f, 1f);
					material.SetColor("_Color", color);
					material.SetColor("_Tint", color);
				}
			}
		}

		private static ConfigEntry<bool> config_enable_vanilla;

		private static ConfigEntry<bool> config_enable_tnh;

		private static ConfigEntry<bool> config_enable_modded;

		private static ConfigEntry<string> config_exclude_ids;

		private static ConfigEntry<string> config_include_ids;

		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.RedHot");
			Logger.LogMessage((object)"New harmony");
			SetUpConfigFields();
			Logger.LogMessage((object)"Setted the fields");
			val.PatchAll();
			Logger.LogMessage((object)"Hello, world! Sent from NGA.RedHot 0.0.1");
		}

		private void SetUpConfigFields()
		{
		}
	}
}