Decompiled source of Lethal Ranking v0.6.5

Lethal_Ranking.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Lethal_Ranking.Patches;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lethal_Ranking")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal_Ranking")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2b052562-873f-49e4-aa3c-8160616e9ec2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Lethal_Ranking
{
	[BepInPlugin("claymor_wan.Lethal_Ranking", "Lethal Ranking", "0.6.5")]
	public class Lethal_Ranking_Base : BaseUnityPlugin
	{
		private const string modGUID = "claymor_wan.Lethal_Ranking";

		private const string modName = "Lethal Ranking";

		private const string modVersion = "0.6.5";

		private const string modAuthor = "claymor_wan";

		private readonly Harmony harmony = new Harmony("claymor_wan.Lethal_Ranking");

		private static Lethal_Ranking_Base Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("claymor_wan.Lethal_Ranking");
			mls.LogInfo((object)"The femboy's mod as awaken");
			harmony.PatchAll(typeof(Lethal_Ranking_Base));
			harmony.PatchAll(typeof(QuickMenuManagerPatch));
		}
	}
}
namespace Lethal_Ranking.Patches
{
	[HarmonyPatch(typeof(QuickMenuManager))]
	internal class QuickMenuManagerPatch
	{
		private static GameObject _infoDisplay;

		private static GameObject _xpProgDisplay;

		private static TextMeshProUGUI _xpDisplayText;

		private static TextMeshProUGUI _rankDisplayText;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(QuickMenuManager), "OpenQuickMenu")]
		private static void QuickMenuXP(QuickMenuManager __instance)
		{
			if (__instance.isMenuOpen)
			{
				if (!Object.op_Implicit((Object)(object)_infoDisplay) || !Object.op_Implicit((Object)(object)_xpProgDisplay))
				{
					MakeNewXPBar();
				}
				_infoDisplay.SetActive(true);
				_xpProgDisplay.SetActive(true);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(QuickMenuManager), "Update")]
		private static void XPDisplay(QuickMenuManager __instance)
		{
			if (Object.op_Implicit((Object)(object)_infoDisplay) && Object.op_Implicit((Object)(object)_xpProgDisplay))
			{
				if (__instance.mainButtonsPanel.activeSelf)
				{
					_infoDisplay.SetActive(true);
					_xpProgDisplay.SetActive(true);
					((Component)_rankDisplayText).gameObject.SetActive(true);
				}
				else
				{
					_infoDisplay.SetActive(false);
					_xpProgDisplay.SetActive(false);
					((Component)_rankDisplayText).gameObject.SetActive(false);
				}
				((TMP_Text)_xpDisplayText).text = "EXP: " + HUDManager.Instance.localPlayerXP;
				switch (HUDManager.Instance.localPlayerLevel)
				{
				case 0:
					((TMP_Text)_rankDisplayText).text = "Intern";
					break;
				case 1:
					((TMP_Text)_rankDisplayText).text = "Part-Timer";
					break;
				case 2:
					((TMP_Text)_rankDisplayText).text = "Employee";
					break;
				case 3:
					((TMP_Text)_rankDisplayText).text = "Leader";
					break;
				case 4:
					((TMP_Text)_rankDisplayText).text = "Boss";
					break;
				}
			}
		}

		public static void MakeNewXPBar()
		{
			//IL_0303: Unknown result type (might be due to invalid IL or missing references)
			//IL_0389: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = GameObject.Find("/Systems/UI/Canvas/QuickMenu");
			int localPlayerXP = HUDManager.Instance.localPlayerXP;
			float fillAmount = (float)localPlayerXP * 0.002f;
			if (!Object.op_Implicit((Object)(object)_infoDisplay))
			{
				if (Screen.fullScreen)
				{
					GameObject val2 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpBox");
					_infoDisplay = Object.Instantiate<GameObject>(val2);
					((Object)_infoDisplay).name = "XPDisplay";
					_infoDisplay.transform.SetParent(val.transform, false);
					_infoDisplay.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
					_infoDisplay.transform.Translate(-2.05f, 1.05f, 0f);
					GameObject val3 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpMeter");
					_xpProgDisplay = Object.Instantiate<GameObject>(val3);
					((Object)_xpProgDisplay).name = "XPBarProgress";
					_xpProgDisplay.transform.SetParent(_infoDisplay.transform, false);
					_xpProgDisplay.transform.localScale = new Vector3(0.597f, 5.21f, 1f);
					_xpProgDisplay.GetComponent<Image>().fillAmount = fillAmount;
					_xpProgDisplay.transform.Translate(-0.775f, 0.186f, 0f);
					Vector3 localPosition = _xpProgDisplay.transform.localPosition;
					GameObject val4 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total");
					_xpDisplayText = Object.Instantiate<GameObject>(val4).GetComponent<TextMeshProUGUI>();
					((Object)_xpDisplayText).name = "XPText";
					((TMP_Text)_xpDisplayText).alignment = (TextAlignmentOptions)514;
					((TMP_Text)_xpDisplayText).transform.SetParent(_infoDisplay.transform, false);
					((TMP_Text)_xpDisplayText).transform.localScale = new Vector3(1f, 1f, 1f);
					((TMP_Text)_xpDisplayText).transform.Translate(-1.06f, 0f, 0f);
					GameObject val5 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total");
					_rankDisplayText = Object.Instantiate<GameObject>(val5).GetComponent<TextMeshProUGUI>();
					((Object)_rankDisplayText).name = "RankText";
					((TMP_Text)_rankDisplayText).alignment = (TextAlignmentOptions)514;
					((TMP_Text)_rankDisplayText).transform.SetParent(_infoDisplay.transform, false);
					((TMP_Text)_rankDisplayText).transform.localScale = new Vector3(1f, 1f, 1f);
					((TMP_Text)_rankDisplayText).transform.Translate(-1.11f, -0.08f, 0f);
				}
				else
				{
					GameObject val6 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpBox");
					_infoDisplay = Object.Instantiate<GameObject>(val6);
					((Object)_infoDisplay).name = "XPDisplay";
					_infoDisplay.transform.SetParent(val.transform, false);
					_infoDisplay.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
					_infoDisplay.transform.Translate(-2.3f, 1f, 0f);
					GameObject val7 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/LevelUpMeter");
					_xpProgDisplay = Object.Instantiate<GameObject>(val7);
					((Object)_xpProgDisplay).name = "XPBarProgress";
					_xpProgDisplay.transform.SetParent(_infoDisplay.transform, false);
					_xpProgDisplay.transform.localScale = new Vector3(0.597f, 5.21f, 1f);
					_xpProgDisplay.GetComponent<Image>().fillAmount = fillAmount;
					_xpProgDisplay.transform.Translate(-0.845f, 0.205f, 0f);
					Vector3 localPosition2 = _xpProgDisplay.transform.localPosition;
					GameObject val8 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total");
					_xpDisplayText = Object.Instantiate<GameObject>(val8).GetComponent<TextMeshProUGUI>();
					((Object)_xpDisplayText).name = "XPText";
					((TMP_Text)_xpDisplayText).alignment = (TextAlignmentOptions)514;
					((TMP_Text)_xpDisplayText).transform.SetParent(_infoDisplay.transform, false);
					((TMP_Text)_xpDisplayText).transform.localScale = new Vector3(1f, 1f, 1f);
					((TMP_Text)_xpDisplayText).transform.Translate(-1.15f, 0f, 0f);
					GameObject val9 = GameObject.Find("/Systems/UI/Canvas/EndgameStats/LevelUp/Total");
					_rankDisplayText = Object.Instantiate<GameObject>(val9).GetComponent<TextMeshProUGUI>();
					((Object)_rankDisplayText).name = "RankText";
					((TMP_Text)_rankDisplayText).alignment = (TextAlignmentOptions)514;
					((TMP_Text)_rankDisplayText).transform.SetParent(_infoDisplay.transform, false);
					((TMP_Text)_rankDisplayText).transform.localScale = new Vector3(1f, 1f, 1f);
					((TMP_Text)_rankDisplayText).transform.Translate(-1.2f, -0.08f, 0f);
				}
			}
		}
	}
}