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 Polarite.Multiplayer;
using Polarite.Networking.Extensions;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UKMod template")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UKMod template")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3d018c2f-f5bc-47be-a844-3e9888579d1f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace PolariteTMP;
[BepInPlugin("com.nico.polaritetmp", "Polarite TMP", "0.2.1")]
public class Plugin : BaseUnityPlugin
{
public const string PluginGuid = "com.nico.polaritetmp";
public const string PluginName = "Polarite TMP";
public const string PluginVersion = "0.2.1";
internal static ManualLogSource Log;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Polarite TMP loaded!");
Harmony val = new Harmony("com.nico.polaritetmp");
val.PatchAll();
}
}
[HarmonyPatch(typeof(ChatUI), "<CreateUI>b__20_0")]
internal static class ChatUI_MessageBuild_Patch
{
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
MethodInfo methodInfo = AccessTools.Method(typeof(StringExtensions), "WithoutTMP", (Type[])null, (Type[])null);
List<CodeInstruction> list = new List<CodeInstruction>(instructions);
int num = 0;
for (int i = 0; i < list.Count; i++)
{
if (CodeInstructionExtensions.Calls(list[i], methodInfo))
{
list[i] = new CodeInstruction(OpCodes.Nop, (object)null);
num++;
}
}
if (num == 0)
{
Plugin.Log.LogWarning((object)"PolariteTMP: no WithoutTMP calls found to patch - game may have updated.");
}
else
{
Plugin.Log.LogInfo((object)$"PolariteTMP: Successfully patched {num} instance(s) of WithoutTMP.");
}
return list;
}
}