Decompiled source of IncreasedSliderLimits v1.0.1

plugins/IncreasedSliderLimits.dll

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

		public const string PluginName = "IncreasedSliderLimits";

		public const string PluginVer = "1.0.1";

		internal static ManualLogSource Log;

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

		internal static string PluginPath;

		public static ConfigEntry<float> minStat;

		public static ConfigEntry<float> maxStat;

		public static ConfigEntry<float> minHeight;

		public static ConfigEntry<float> maxHeight;

		public static ConfigEntry<bool> KeepPopAttLocked;

		public static ConfigEntry<float> minMusic;

		public static ConfigEntry<float> maxMusic;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			minStat = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Min Stat", 50f, "The min stat limit");
			maxStat = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Stat", 99f, "The max stat limit");
			KeepPopAttLocked = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Keep Popularity and attitude limits", true, "Keep default popularity and attitude limits (may prevent some issues)");
			minHeight = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Min Height", 0.8f, "The min height limit (by the game units)");
			maxHeight = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Height", 1.2f, "The max height limit (by the game units)");
			minMusic = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Min Music speed", 0.7f, "The min theme song speed limit");
			maxMusic = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Max Music speed", 1.2f, "The max theme song speed limit");
		}

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

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

		[HarmonyPatch(typeof(AKFIIKOMPLL), "ODONMLDCHHF")]
		[HarmonyPrefix]
		private static bool Prefix(AKFIIKOMPLL __instance, float __0, float __1, float __2, ref float __3, ref float __4, int __5)
		{
			if (__1 == 1f && __2 == 5f && __3 == 50f && __4 == 99f && __5 == 0 && (__instance == LIPNHOMGGHF.FKANHDIMMBJ[1] || __instance == LIPNHOMGGHF.FKANHDIMMBJ[2] || __instance == LIPNHOMGGHF.FKANHDIMMBJ[3] || __instance == LIPNHOMGGHF.FKANHDIMMBJ[4] || __instance == LIPNHOMGGHF.FKANHDIMMBJ[5] || __instance == LIPNHOMGGHF.FKANHDIMMBJ[6]) && LIPNHOMGGHF.CHLJMEPFJOK == 1)
			{
				__3 = minStat.Value;
				__4 = maxStat.Value;
				if ((__instance == LIPNHOMGGHF.FKANHDIMMBJ[1] || __instance == LIPNHOMGGHF.FKANHDIMMBJ[6]) && KeepPopAttLocked.Value)
				{
					__3 = 50f;
					__4 = 99f;
				}
			}
			if (__1 == 0.01f && __2 == 10f && __3 == 0.8f && __4 == 1.2f && __5 == 0 && __instance == LIPNHOMGGHF.FKANHDIMMBJ[3] && LIPNHOMGGHF.CHLJMEPFJOK == 2)
			{
				__3 = minHeight.Value;
				__4 = maxHeight.Value;
			}
			if (__1 == 0.01f && __2 == 10f && __3 == 0.7f && __4 == 1.2f && __5 == 0 && __instance == LIPNHOMGGHF.FKANHDIMMBJ[9] && LIPNHOMGGHF.CHLJMEPFJOK == 1)
			{
				__3 = minMusic.Value;
				__4 = maxMusic.Value;
			}
			return true;
		}

		[HarmonyPatch(typeof(Character), "IMMIIDECGCF")]
		[HarmonyPrefix]
		private static bool CharacterIMMIIDECGCF(Character __instance, int LGLHGGDPNPD, ref float OEGLNPMNEOE)
		{
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0263: Unknown result type (might be due to invalid IL or missing references)
			if (NAEEIFNFBBO.CBMHGKFFHJE > 0)
			{
				OEGLNPMNEOE *= MBLIOKEDHHB.MCJHGEHEPMD;
				int num = Mathf.RoundToInt(__instance.stat[LGLHGGDPNPD]);
				if (LGLHGGDPNPD == 6 && OEGLNPMNEOE > 0f)
				{
					OEGLNPMNEOE *= (150f - __instance.stat[LGLHGGDPNPD]) / 100f;
				}
				__instance.stat[LGLHGGDPNPD] += OEGLNPMNEOE;
				if ((LGLHGGDPNPD == 1 || LGLHGGDPNPD == 6) && KeepPopAttLocked.Value)
				{
					if (__instance.stat[LGLHGGDPNPD] < 50f)
					{
						__instance.stat[LGLHGGDPNPD] = 50f;
					}
					if (__instance.stat[LGLHGGDPNPD] > 99f)
					{
						__instance.stat[LGLHGGDPNPD] = 99f;
					}
				}
				else
				{
					if (__instance.stat[LGLHGGDPNPD] < minStat.Value)
					{
						__instance.stat[LGLHGGDPNPD] = minStat.Value;
					}
					if (__instance.stat[LGLHGGDPNPD] > maxStat.Value)
					{
						__instance.stat[LGLHGGDPNPD] = maxStat.Value;
					}
				}
				if (LIPNHOMGGHF.FAKHAFKOBPB == 50 && FFCEGMEAIBP.LOBDMDPMFLK == 0 && __instance.id == Characters.star && NJBJIIIACEP.DCAFAIGGFCC != null && NJBJIIIACEP.DCAFAIGGFCC[1].GHGLMKCECOI == 0f)
				{
					if (Mathf.RoundToInt(__instance.stat[LGLHGGDPNPD]) < num)
					{
						CHLPMKEGJBJ.DNNPEAOCDOG(CHLPMKEGJBJ.AEJEOKACNBJ, 1f, 1f);
						NJBJIIIACEP.DCAFAIGGFCC[1].BFBKLJHKKGE(Characters.statName[LGLHGGDPNPD] + ": " + Mathf.RoundToInt(__instance.stat[LGLHGGDPNPD]).ToString("0") + "%", new Color(0.9f, 0.1f, 0.1f));
					}
					if (Mathf.RoundToInt(__instance.stat[LGLHGGDPNPD]) > num)
					{
						CHLPMKEGJBJ.DNNPEAOCDOG(CHLPMKEGJBJ.MBEMMCMOJFF, 1f, 1f);
						NJBJIIIACEP.DCAFAIGGFCC[1].BFBKLJHKKGE(Characters.statName[LGLHGGDPNPD] + ": " + Mathf.RoundToInt(__instance.stat[LGLHGGDPNPD]).ToString("0") + "%", new Color(0.1f, 0.9f, 0.1f));
					}
				}
			}
			return false;
		}

		[HarmonyPatch(typeof(Character), "LLJKACBKKJM")]
		[HarmonyPrefix]
		private static bool CharacterLLJKACBKKJM(Character __instance)
		{
			if (__instance.health < 0f)
			{
				__instance.health = 0f;
			}
			if (__instance.health > 100f)
			{
				__instance.health = 100f;
			}
			if (__instance.oldStat[0] < 0f)
			{
				__instance.oldStat[0] = 0f;
			}
			if (__instance.oldStat[0] > 100f)
			{
				__instance.oldStat[0] = 100f;
			}
			if (__instance.newStat[0] < 0f)
			{
				__instance.newStat[0] = 0f;
			}
			if (__instance.newStat[0] > 100f)
			{
				__instance.newStat[0] = 100f;
			}
			for (int i = 1; i <= 6; i++)
			{
				if ((i == 1 || i == 6) && KeepPopAttLocked.Value)
				{
					if (__instance.stat[i] < 50f)
					{
						__instance.stat[i] = 50f;
					}
					if (__instance.stat[i] > 99f)
					{
						__instance.stat[i] = 99f;
					}
					if (__instance.oldStat[i] < 50f)
					{
						__instance.oldStat[i] = 50f;
					}
					if (__instance.oldStat[i] > 99f)
					{
						__instance.oldStat[i] = 99f;
					}
					if (__instance.newStat[i] < 50f)
					{
						__instance.newStat[i] = 50f;
					}
					if (__instance.newStat[i] > 99f)
					{
						__instance.newStat[i] = 99f;
					}
				}
				else
				{
					if (__instance.stat[i] < minStat.Value)
					{
						__instance.stat[i] = minStat.Value;
					}
					if (__instance.stat[i] > maxStat.Value)
					{
						__instance.stat[i] = maxStat.Value;
					}
					if (__instance.oldStat[i] < minStat.Value)
					{
						__instance.oldStat[i] = minStat.Value;
					}
					if (__instance.oldStat[i] > maxStat.Value)
					{
						__instance.oldStat[i] = maxStat.Value;
					}
					if (__instance.newStat[i] < minStat.Value)
					{
						__instance.newStat[i] = minStat.Value;
					}
					if (__instance.newStat[i] > maxStat.Value)
					{
						__instance.newStat[i] = maxStat.Value;
					}
				}
			}
			if (__instance.id == Characters.fraud)
			{
				__instance.stat[1] = 110f;
				__instance.oldStat[1] = __instance.stat[1];
				__instance.newStat[1] = __instance.stat[1];
			}
			return false;
		}
	}
}