Decompiled source of ExploitFix v2.3.1

ExploitFixes.dll

Decompiled a day 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.Configuration;
using BepInEx.Logging;
using ExploitFixes;
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: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("Enchanted_Games")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fc766014a2d9f2913d4f3fb8515116291667a04b")]
[assembly: AssemblyProduct("ExploitFixes")]
[assembly: AssemblyTitle("ExploitFixes")]
[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;
		}
	}
}
internal class ItemGunPatches
{
	[HarmonyPatch(typeof(ItemGun))]
	[HarmonyPatch("ShootRPC")]
	private class ItemGun_ShootRPC_Patch
	{
		public static bool Prefix(ItemGun __instance)
		{
			if (!batteryDrainFullBarRef.Invoke(__instance))
			{
				return true;
			}
			ItemBattery val = itemBatteryRef.Invoke(__instance);
			if (!SemiFunc.IsMasterClientOrSingleplayer() || !(val.batteryLife <= 17.1f))
			{
				return true;
			}
			bool result = val.batteryLife >= 7f;
			val.batteryLife = -1f;
			return result;
		}
	}

	private static FieldRef<ItemGun, ItemBattery> itemBatteryRef = AccessTools.FieldRefAccess<ItemGun, ItemBattery>("itemBattery");

	private static FieldRef<ItemGun, bool> batteryDrainFullBarRef = AccessTools.FieldRefAccess<ItemGun, bool>("batteryDrainFullBar");
}
internal class ItemHealthPackPatches
{
	[HarmonyPatch(typeof(ItemHealthPack))]
	[HarmonyPatch("Start")]
	private class ItemHealthPack_Start_Patch
	{
		public static void Postfix(ItemHealthPack __instance)
		{
			if (SemiFunc.RunIsShop())
			{
				Plugin.LogMessage("Force disabled healthpack in the shop");
				((Behaviour)itemToggleRef.Invoke(__instance)).enabled = false;
			}
		}
	}

	private static FieldRef<ItemHealthPack, ItemToggle> itemToggleRef = AccessTools.FieldRefAccess<ItemHealthPack, ItemToggle>("itemToggle");
}
namespace ExploitFixes
{
	public static class PluginInfo
	{
		public const string PLUGIN_ID = "ExploitFixes";

		public const string PLUGIN_NAME = "ExploitFixes";

		public const string PLUGIN_VERSION = "2.3.0";

		public const string PLUGIN_GUID = "games.enchanted.ExploitFixes";
	}
	[BepInPlugin("games.enchanted.ExploitFixes", "ExploitFixes", "2.3.0")]
	public class Plugin : BaseUnityPlugin
	{
		public ManualLogSource PluginLogger;

		public static ConfigEntry<bool> enableDebugLogs;

		public static Plugin Instance { get; private set; }

		public static void LogMessage(object message)
		{
			Instance.PluginLogger.LogMessage((object)("ExploitFixes: " + message));
		}

		public static void LogError(object message)
		{
			Instance.PluginLogger.LogError((object)("ExploitFixes Debug: " + message));
		}

		public static void LogWarning(object message)
		{
			Instance.PluginLogger.LogWarning((object)("ExploitFixes: " + message));
		}

		private void Awake()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected O, but got Unknown
			Instance = this;
			PluginLogger = ((BaseUnityPlugin)this).Logger;
			PluginLogger.LogInfo((object)"Loading plugin ExploitFixes! (games.enchanted.ExploitFixes)");
			Harmony val = new Harmony("games.enchanted.ExploitFixes");
			val.PatchAll();
			PluginLogger.LogInfo((object)"Loading finished for ExploitFixes! (games.enchanted.ExploitFixes)");
		}
	}
}