Decompiled source of IncreasedCharacterLimit v1.0.0

plugins/IncreasedCharacterLimit.dll

Decompiled 2 years ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine.SceneManagement;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("IncreasedCharacterLimit")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("IncreasedCharacterLimit")]
[assembly: AssemblyTitle("IncreasedCharacterLimit")]
[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 IncreasedCharacterLimit
{
	[BepInPlugin("GeeEm.WrestlingEmpire.IncreasedCharacterLimit", "IncreasedCharacterLimit", "1.0.0")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "GeeEm.WrestlingEmpire.IncreasedCharacterLimit";

		public const string PluginName = "IncreasedCharacterLimit";

		public const string PluginVer = "1.0.0";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("GeeEm.WrestlingEmpire.IncreasedCharacterLimit");

		internal static string PluginPath;

		public static float? oldHealth;

		public static bool resized = false;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded IncreasedCharacterLimit!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded IncreasedCharacterLimit!");
		}

		[HarmonyPatch(typeof(AKFIIKOMPLL), "ODONMLDCHHF")]
		[HarmonyPrefix]
		private static void AKFIIKOMPLL_ODONMLDCHHFPrefix_OPTIONS(AKFIIKOMPLL __instance, float __result, float CAAJBNHEFJJ, float OEGLNPMNEOE, float NOGFHHECJBM, float JBPAELFIDOP, ref float LKBOHHGFJFO, int LKJHMOHMKCM)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name != "Options") && LIPNHOMGGHF.CHLJMEPFJOK == 3 && LIPNHOMGGHF.PIEMLEPEDFN == 0 && LIPNHOMGGHF.FKANHDIMMBJ[1] == __instance)
			{
				LKBOHHGFJFO = Characters.no_chars;
			}
		}

		[HarmonyPatch(typeof(AKFIIKOMPLL), "ODONMLDCHHF")]
		[HarmonyPrefix]
		private static void AKFIIKOMPLL_ODONMLDCHHFPrefix_SETUP(AKFIIKOMPLL __instance, float __result, float CAAJBNHEFJJ, float OEGLNPMNEOE, float NOGFHHECJBM, float JBPAELFIDOP, ref float LKBOHHGFJFO, int LKJHMOHMKCM)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			Scene activeScene = SceneManager.GetActiveScene();
			if (!(((Scene)(ref activeScene)).name != "Match_Setup") && LIPNHOMGGHF.CHLJMEPFJOK == 1 && LIPNHOMGGHF.ODOAPLMOJPD == 2)
			{
				if (LIPNHOMGGHF.FKANHDIMMBJ[1] == __instance && LKBOHHGFJFO > 100f)
				{
					LKBOHHGFJFO = 100f;
				}
				if (LIPNHOMGGHF.FKANHDIMMBJ[4] == __instance && LKBOHHGFJFO > 150f)
				{
					LKBOHHGFJFO = 150f;
				}
			}
		}

		[HarmonyPatch(typeof(Scene_Titles), "Start")]
		[HarmonyPostfix]
		private static void TitlesPostfix(Scene_Titles __instance)
		{
			if (!resized)
			{
				ResizeRequiredArrays();
				resized = true;
			}
		}

		[HarmonyPatch(typeof(AKFIIKOMPLL), "ODONMLDCHHF")]
		[HarmonyPostfix]
		private static void AKFIIKOMPLL_ODONMLDCHHFPostfix(AKFIIKOMPLL __instance, float __result, float CAAJBNHEFJJ, float OEGLNPMNEOE, float NOGFHHECJBM, float JBPAELFIDOP, ref float LKBOHHGFJFO, int LKJHMOHMKCM)
		{
			if (LIPNHOMGGHF.CHLJMEPFJOK == 3 && LIPNHOMGGHF.PIEMLEPEDFN == 0 && LIPNHOMGGHF.FKANHDIMMBJ[1] == __instance)
			{
				NJBJIIIACEP.KLDJKHPCDHM = (int)__result;
			}
		}

		public static void ResizeRequiredArrays()
		{
			Resize(ref FFCEGMEAIBP.NMMABDGIJNC, Characters.no_chars + 1);
			Resize(ref FFCEGMEAIBP.DJCDPNPLICD, Characters.no_chars + 1);
			Resize(ref FFCEGMEAIBP.EKKIPMFPMEE, Characters.no_chars + 1);
			Resize(ref FFCEGMEAIBP.COIGEGPKLCP, Characters.no_chars + 1);
			Resize(ref FFCEGMEAIBP.AJMAFHIBCGJ, Characters.no_chars + 1);
			Resize(ref FFCEGMEAIBP.MHHLHMDOFBP, Characters.no_chars + 1);
			NJBJIIIACEP.KLDJKHPCDHM = Characters.no_chars;
		}

		public static void Resize<T>(ref T[] original, int newsize)
		{
			T[] array = new T[newsize];
			Array.Copy(length: (original.Length <= newsize) ? original.Length : newsize, sourceArray: original, destinationArray: array);
			original = array;
		}
	}
}