Decompiled source of KakalkoCustomNotes v1.0.1

KakalkoCustomNotes.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("KakalkoCustomNotes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KakalkoCustomNotes")]
[assembly: AssemblyTitle("KakalkoCustomNotes")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace KakalkoCustomNotes
{
	[BepInPlugin("kakalko.lethalcompany.customnotes", "Kakalko Custom Notes", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("kakalko.lethalcompany.customnotes");

		private void Awake()
		{
			harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"KakalkoCustomNotes pomyslnie zaladowany.");
		}
	}
	[HarmonyPatch(typeof(HUDManager), "FillEndGameStats")]
	public class EndGameStatsPatch
	{
		private static readonly Dictionary<string, string> CustomTranslations = new Dictionary<string, string>
		{
			{ "The laziest employee.", "retard" },
			{ "The most profitable.", "haker" },
			{ "The most paranoid.", "przegrał w chlebek" },
			{ "Sustained the most injuries.", "za mocno kichnął" },
			{ "Died the most.", "zmarł na liżme" },
			{ "The least profitable.", "1v1 me lil bro ;image;" },
			{ "Survived the longest.", "noob vs pro" },
			{ "Got lost the most.", "szuka tokena pirackiego" },
			{ "The most vocal.", "czyta regulamin autobusu" },
			{ "The quietest.", "pan zdrapka" },
			{ "Most items collected.", "randka z katarzyną" },
			{ "Most time spent outside.", "pojechał innym autobusem" },
			{ "Most time spent inside.", "miał rozmowę potliczną" },
			{ "Most jumps.", "pan skoczek" },
			{ "Most steps taken.", "walkmen(2026)" }
		};

		[HarmonyPostfix]
		private static void Postfix(HUDManager __instance)
		{
			for (int i = 0; i < __instance.statsUIElements.playerNotesText.Length; i++)
			{
				if (!((Object)(object)__instance.statsUIElements.playerNotesText[i] != (Object)null))
				{
					continue;
				}
				string text = ((TMP_Text)__instance.statsUIElements.playerNotesText[i]).text;
				if (string.IsNullOrWhiteSpace(text))
				{
					continue;
				}
				foreach (KeyValuePair<string, string> customTranslation in CustomTranslations)
				{
					if (text.Contains(customTranslation.Key))
					{
						text = text.Replace(customTranslation.Key, customTranslation.Value);
					}
				}
				((TMP_Text)__instance.statsUIElements.playerNotesText[i]).text = text;
			}
		}
	}
}