Decompiled source of PortalNames v1.0.0

PortalNames.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace PortalNames;

[BepInPlugin("wick.portalnames", "PortalNames", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public const string Guid = "wick.portalnames";

	public const string Version = "1.0.0";

	internal static ConfigEntry<int> MaxLength;

	private void Awake()
	{
		//IL_0025: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Expected O, but got Unknown
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		MaxLength = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxLength", 30, new ConfigDescription("Longest portal name you can type (vanilla: 10).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>()));
		new Harmony("wick.portalnames").PatchAll(typeof(Plugin).Assembly);
		((BaseUnityPlugin)this).Logger.LogInfo((object)("[portalnames] ready 1.0.0 - portal names up to " + MaxLength.Value + " characters"));
	}
}
[HarmonyPatch(typeof(TextInput), "RequestText")]
internal static class RequestTextPatch
{
	private static void Prefix(TextReceiver __0, ref int __2)
	{
		if (__0 is TeleportWorld && __2 < Plugin.MaxLength.Value)
		{
			__2 = Plugin.MaxLength.Value;
		}
	}
}