Decompiled source of Terminal Fixes v1.0.0

plugins/ShowMoonPriceFormattingFix.dll

Decompiled a day ago
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using BepInEx;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LocalMoonListFix;

[BepInPlugin("local.showmoonprice.formattingfix", "ShowMoonPrice Formatting Fix", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Expected O, but got Unknown
		Type type = AccessTools.TypeByName("ShowMoonPriceLLL.Terminal_Patch_Override");
		MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "getFormattedLine", (Type[])null, (Type[])null));
		if (methodInfo == null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"ShowMoonPriceLLL formatter was not found; no patch applied.");
			return;
		}
		new Harmony("local.showmoonprice.formattingfix").Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "Transpile", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Applied safe risk-label and spacing handling to ShowMoonPriceLLL.");
	}

	public static IEnumerable<CodeInstruction> Transpile(IEnumerable<CodeInstruction> instructions)
	{
		MethodInfo pad = typeof(string).GetMethod("PadLeft", new Type[1] { typeof(int) });
		foreach (CodeInstruction instruction in instructions)
		{
			FieldInfo field = instruction.operand as FieldInfo;
			if (CodeInstructionExtensions.Calls(instruction, pad))
			{
				instruction.opcode = OpCodes.Call;
				instruction.operand = AccessTools.Method(typeof(Formatting), "SafePadLeft", (Type[])null, (Type[])null);
			}
			yield return instruction;
			if (instruction.opcode == OpCodes.Ldfld && field != null && field.Name == "riskLevel" && field.FieldType == typeof(string))
			{
				yield return new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(Formatting), "CompactRisk", (Type[])null, (Type[])null));
			}
		}
	}
}
public static class Formatting
{
	public static string CompactRisk(string risk)
	{
		if (risk == null)
		{
			return null;
		}
		string input = Regex.Replace(risk, "<[^>]*>", "");
		input = Regex.Replace(input, "\\s+", " ").Trim();
		return (input.Length <= 8) ? input : (input.Substring(0, 7) + "~");
	}

	public static string SafePadLeft(string value, int width)
	{
		return value.PadLeft(Math.Max(value.Length + 1, width));
	}
}

plugins/StoreScrollActivationFix.dll

Decompiled a day ago
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using HarmonyLib;

[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace LocalStoreScrollFix;

[BepInPlugin("local.storescroll.activationfix", "Store Scroll Activation Fix", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public sealed class Plugin : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Expected O, but got Unknown
		try
		{
			Type type = AccessTools.TypeByName("StoreRotationConfig.Patches.TerminalScrollMousePatch");
			Type type2 = AccessTools.TypeByName("GameNetcodeStuff.PlayerControllerB");
			MethodInfo methodInfo = ((type == null) ? null : AccessTools.Method(type, "ScrollMousePerformed_Transpiler", (Type[])null, (Type[])null));
			MethodInfo methodInfo2 = ((type2 == null) ? null : AccessTools.Method(type2, "ScrollMouse_performed", (Type[])null, (Type[])null));
			if (methodInfo == null || methodInfo2 == null)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)"Expected StoreRotationConfig scroll patch was not found; no changes applied.");
				return;
			}
			Patches patchInfo = Harmony.GetPatchInfo((MethodBase)methodInfo2);
			if (patchInfo != null)
			{
				foreach (Patch transpiler in patchInfo.Transpilers)
				{
					if (transpiler.PatchMethod == methodInfo)
					{
						((BaseUnityPlugin)this).Logger.LogInfo((object)"StoreRotationConfig scrolling is already registered; no duplicate added.");
						return;
					}
				}
			}
			new Harmony("local.storescroll.activationfix").Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(methodInfo), (HarmonyMethod)null, (HarmonyMethod)null);
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Activated StoreRotationConfig's missing scroll patch. Uses its relativeScroll and linesToScroll settings.");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("Unable to activate StoreRotationConfig scrolling: " + ex));
		}
	}
}