Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Pomps UWU Company v0.2.1
MyFirstLethalCompanyMod.dll
Decompiled 3 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using MyFirstLethalCompanyMod.Config; using MyFirstLethalCompanyMod.Models; using MyFirstLethalCompanyMod.Patches; using MyFirstLethalCompanyMod.Utils; using Newtonsoft.Json; using Newtonsoft.Json.Converters; 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: IgnoresAccessChecksTo("")] [assembly: AssemblyCompany("MyFirstLethalCompanyMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My First Mod Created to test the limitations of the game")] [assembly: AssemblyFileVersion("0.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.0+06fd48f511f45aabc58c408768f33a8e13f1cabc")] [assembly: AssemblyProduct("MyFirstLethalCompanyMod")] [assembly: AssemblyTitle("MyFirstLethalCompanyMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MyFirstLethalCompanyMod { [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { private static bool? _doorState; private static List<PlayerControllerB> ActivePlayers { get { if ((Object)(object)StartOfRound.Instance == (Object)null) { return new List<PlayerControllerB>(); } return StartOfRound.Instance.allPlayerScripts.Where((PlayerControllerB p) => p.isPlayerControlled || p.isPlayerDead).ToList(); } } [HarmonyPostfix] [HarmonyPatch("OnShipLandedMiscEvents")] private static void DisplayStartMessage() { HUDManager.Instance.DisplayGlobalNotification("you awe wooking vewwy cute today " + UWUController.GetRandomUWUWord(UWUWordTag.BASHFUL)); } [HarmonyPostfix] [HarmonyPatch("SetShipDoorsClosed")] private static void NotifyOfSafety(StartOfRound __instance) { if (__instance.shipHasLanded && GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && _doorState != __instance.hangarDoorsClosed) { _doorState = __instance.hangarDoorsClosed; if (__instance.hangarDoorsClosed) { HUDManager.Instance.DisplayGlobalNotification("it wooks so cozy in thewe. can i join? " + UWUController.GetRandomUWUWord(UWUWordTag.DEVIOUS)); } else if (!__instance.hangarDoorsClosed) { HUDManager.Instance.DisplayGlobalNotification("oh no te doow opened " + UWUController.GetRandomUWUWord(UWUWordTag.DEVIOUS) + "\nbe cawefuw out thewe pwincess " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } } [BepInPlugin("MyFirstLethalCompanyMod", "MyFirstLethalCompanyMod", "0.2.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource? Logger; private static Harmony _harmony = new Harmony("MyFirstLethalCompanyMod"); public static Terminal? _terminal; public static string ModDirectory { get; private set; } = ""; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Custom plugin MyFirstLethalCompanyMod (MyFirstLethalCompanyMod) is loaded! Currently on version 0.2.0"); ModDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); InitializeNetworkSingletons(); ApplyAllPatches(); try { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } catch (Exception ex) { Logger.LogDebug((object)("Exception while executing Netcode setup " + ex.Message)); } } private void InitializeNetworkSingletons() { ManualLogSource? logger = Logger; if (logger != null) { logger.LogInfo((object)"Network singletons initialized"); } } private static void ApplyAllPatches() { _harmony.PatchAll(typeof(HarmonySingleton<UWUController>)); _harmony.PatchAll(typeof(StartOfRoundPatch)); _harmony.PatchAll(typeof(TerminalPatch)); } } public static class PluginInfo { public const string PLUGIN_GUID = "MyFirstLethalCompanyMod"; public const string PLUGIN_NAME = "MyFirstLethalCompanyMod"; public const string PLUGIN_VERSION = "0.2.0"; } } namespace MyFirstLethalCompanyMod.Utils { [HarmonyPatch] public abstract class HarmonySingleton<T> where T : HarmonySingleton<T> { private static T? instance; protected static bool configLoaded; public static T? Instance => instance; protected abstract Type TargetClass { get; } protected abstract string TargetMethodName { get; } protected virtual Type[] TargetMethodParameters => Type.EmptyTypes; static HarmonySingleton() { configLoaded = false; instance = Activator.CreateInstance<T>(); } private static MethodBase? TargetMethod() { return AccessTools.Method(instance.TargetClass, instance.TargetMethodName, instance.TargetMethodParameters, (Type[])null); } [HarmonyPrefix] [HarmonyPatch] private static void ConfigPatch() { if (!configLoaded) { Plugin.Logger.LogDebug((object)"load config - harmony singleton"); instance.LoadConfig(); configLoaded = true; } } public abstract void LoadConfig(); } public abstract class MonoBehaviourSingleton<T> : MonoBehaviour where T : MonoBehaviourSingleton<T> { private static T? instance; public static T? Instance { get { return instance; } protected set { if (!((Object)(object)instance == (Object)(object)value)) { instance = value; MonoBehaviourSingleton<T>.OnInstanceSet?.Invoke(instance); } } } public static bool hasInstance => (Object)(object)instance != (Object)null; public static event Action<MonoBehaviourSingleton<T>>? OnInstanceSet; protected virtual void Awake() { if ((Object)(object)instance != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } instance = (T)this; MonoBehaviourSingleton<T>.OnInstanceSet?.Invoke(this); } protected virtual void OnDestroy() { if ((Object)(object)instance == (Object)(object)this) { instance = null; } } } } namespace MyFirstLethalCompanyMod.Patches { [HarmonyPatch(typeof(Terminal))] public class TerminalPatch { [HarmonyPrefix] [HarmonyPatch("Awake")] private static void CaptureTerminal(Terminal __instance) { Plugin._terminal = __instance; } [HarmonyPostfix] [HarmonyPatch("SetTerminalInUseClientRpc")] private static void NotifyPlayersOfTerminalFreeClient(bool inUse) { ManualLogSource? logger = Plugin.Logger; if (logger != null) { logger.LogDebug((object)$"notify of terminal use (client side) {inUse}"); } if (inUse) { HUDManager.Instance.DisplayGlobalNotification("Te Tewminawl is in use " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } else { HUDManager.Instance.DisplayGlobalNotification("Te Tewminawl is fwee " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } [HarmonyPostfix] [HarmonyPatch("SetTerminalInUseServerRpc")] private static void NotifyPlayersOfTerminalFreeServer(bool inUse) { ManualLogSource? logger = Plugin.Logger; if (logger != null) { logger.LogDebug((object)$"notify of terminal use (server side) {inUse}"); } if (inUse) { HUDManager.Instance.DisplayGlobalNotification("Te Tewminawl is in use " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } else { HUDManager.Instance.DisplayGlobalNotification("Te Tewminawl is fwee " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } } namespace MyFirstLethalCompanyMod.Models { [Serializable] [JsonConverter(typeof(StringEnumConverter))] public enum UWUWordTag { NONE = -1, HAPPY, BASHFUL, DEVIOUS, SAD, UPSET, SERIOUS } [Serializable] public class UWUWord { public string? word; [JsonProperty(ItemConverterType = typeof(StringEnumConverter))] public List<UWUWordTag> tags = new List<UWUWordTag>(); } } namespace MyFirstLethalCompanyMod.Config { public class UWUController : HarmonySingleton<UWUController> { protected override Type TargetClass => typeof(PlayerControllerB); protected override string TargetMethodName => "ConnectClientToPlayerObject"; public static List<UWUWord> words { get; private set; } = new List<UWUWord>(); public override void LoadConfig() { //IL_0139: Expected O, but got Unknown if (HarmonySingleton<UWUController>.configLoaded) { return; } try { string text = null; string text2 = null; string text3 = Path.Combine(Paths.ConfigPath, "uwu_words.json"); Plugin.Logger.LogDebug((object)("Checking standard config path: " + text3)); if (File.Exists(text3)) { text = File.ReadAllText(text3); text2 = text3; } if (text == null) { ManualLogSource? logger = Plugin.Logger; if (logger != null) { logger.LogError((object)"UWU word config missing! Tried all paths."); } ManualLogSource? logger2 = Plugin.Logger; if (logger2 != null) { logger2.LogError((object)("Expected location: " + Path.Combine(Paths.ConfigPath, "uwu_words.json"))); } return; } ManualLogSource? logger3 = Plugin.Logger; if (logger3 != null) { logger3.LogDebug((object)("Loading UWU config from: " + text2)); } List<UWUWord> list = JsonConvert.DeserializeObject<List<UWUWord>>(text); if (list == null || !list.Any()) { ManualLogSource? logger4 = Plugin.Logger; if (logger4 != null) { logger4.LogError((object)"UWU word config is empty or invalid"); } return; } words = list; HarmonySingleton<UWUController>.configLoaded = true; ManualLogSource? logger5 = Plugin.Logger; if (logger5 != null) { logger5.LogInfo((object)$"Loaded {words.Count} UWU words from config"); } } catch (JsonException val) { JsonException val2 = val; ManualLogSource? logger6 = Plugin.Logger; if (logger6 != null) { logger6.LogError((object)("JSON parsing error: " + ((Exception)(object)val2).Message)); } ManualLogSource? logger7 = Plugin.Logger; if (logger7 != null) { logger7.LogError((object)("Check your JSON format at: " + Path.Combine(Paths.ConfigPath, "uwu_words.json"))); } } catch (Exception ex) { ManualLogSource? logger8 = Plugin.Logger; if (logger8 != null) { logger8.LogError((object)("Failed to load UWU config: " + ex.Message)); } ManualLogSource? logger9 = Plugin.Logger; if (logger9 != null) { logger9.LogError((object)("Stack trace: " + ex.StackTrace)); } } } public static string? GetRandomUWUWord(UWUWordTag tag = UWUWordTag.NONE) { if (words == null || !words.Any()) { ManualLogSource? logger = Plugin.Logger; if (logger != null) { logger.LogWarning((object)"No UWU words loaded - returning 'uwu'"); } return "uwu"; } List<string> list = (from word in words where tag == UWUWordTag.NONE || word.tags.Contains(tag) select word.word into w where !string.IsNullOrEmpty(w) select w).ToList(); if (!list.Any()) { ManualLogSource? logger2 = Plugin.Logger; if (logger2 != null) { logger2.LogWarning((object)$"No words with tag {tag} - returning 'uwu'"); } return "uwu"; } Random random = new Random(); return list[random.Next(list.Count)]; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }