Decompiled source of PartialProgress v1.1.0

VPartialProgress.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VPartialProgress")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VPartialProgress")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("317F6D38-CB91-4E3E-A052-3DE469E22F98")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace VPartialProgress
{
	[BepInPlugin("Yorimor-PartialProgress", "PartialProgress", "1.1.0")]
	public class Main : BaseUnityPlugin
	{
		private const string pluginGUID = "Yorimor-PartialProgress";

		private const string pluginName = "PartialProgress";

		private const string pluginVersion = "1.1.0";

		private readonly Harmony HarmonyInstance = new Harmony("Yorimor-PartialProgress");

		public static ManualLogSource logger = Logger.CreateLogSource("PartialProgress");

		public void Awake()
		{
			logger.LogInfo((object)"Plugin loaded!");
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			HarmonyInstance.PatchAll(executingAssembly);
		}
	}
}
namespace VPartialProgress.Patches
{
	[HarmonyPatch(typeof(AchievementsGui))]
	[HarmonyPatch("CreateStatRow")]
	public class AchievementsPatches
	{
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Expected O, but got Unknown
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Expected O, but got Unknown
			int num = -1;
			MethodInfo methodInfo = AccessTools.Method(typeof(AchievementsPatches), "MyGetColor", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(Color), "get_green", (Type[])null, (Type[])null);
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode.Equals(OpCodes.Blt_Un) && i > 1)
				{
					num = i;
					if (list[i - 1].opcode.Equals(OpCodes.Ldarg_3))
					{
						list[i - 1] = new CodeInstruction(OpCodes.Ldc_R4, (object)1f);
					}
				}
				if (num != -1 && list[i].opcode.Equals(OpCodes.Call) && list[i].operand is MethodInfo methodInfo3 && methodInfo3 == methodInfo2)
				{
					list[i] = new CodeInstruction(OpCodes.Call, (object)methodInfo);
					list.InsertRange(i, (IEnumerable<CodeInstruction>)(object)new CodeInstruction[2]
					{
						new CodeInstruction(OpCodes.Ldarg_2, (object)null),
						new CodeInstruction(OpCodes.Ldarg_3, (object)null)
					});
				}
			}
			return list;
		}

		public static Color MyGetColor(float current, float total)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Color result = Color.gray;
			if (current >= total)
			{
				result = Color.green;
			}
			else if (current >= 1f)
			{
				result = Color.red;
			}
			return result;
		}
	}
}