Please disclose if any significant portion of your mod was created 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 v1.1.0
PompsUwuCompany.dll
Decompiled 2 months agousing System; using System.Collections; 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 Newtonsoft.Json; using Newtonsoft.Json.Converters; using PompsUwuCompany.Config; using PompsUwuCompany.Models; using PompsUwuCompany.Patches; using PompsUwuCompany.Utils; using Unity.Netcode; 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("PompsUwuCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Annoying cutesy notifications to troll you with.")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+8ac5da8edf06fea6fd7ec3bfaf0f6d0ba1ef6a9b")] [assembly: AssemblyProduct("PompsUwuCompany")] [assembly: AssemblyTitle("PompsUwuCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.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 PompsUwuCompany { [BepInPlugin("PompsUwuCompany", "PompsUwuCompany", "1.1.0")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource? Logger; private static Harmony _harmony = new Harmony("PompsUwuCompany"); public static Terminal? _terminal; public static string ModDirectory { get; private set; } = ""; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; ModDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); 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)); return; } Logger.LogInfo((object)"Custom plugin PompsUwuCompany (PompsUwuCompany) is loaded! Currently on version 1.1.0"); } private static void ApplyAllPatches() { try { _harmony.PatchAll(typeof(HarmonySingleton<UWUController>)); } catch (Exception ex) { Logger.LogWarning((object)$"Could not patch {typeof(HarmonySingleton<UWUController>)}: {ex.Message}"); } List<Type> list = new List<Type>(); list.Add(typeof(StartOfRoundPatch)); list.Add(typeof(TerminalPatch)); list.Add(typeof(EntranceTeleportPatch)); list.Add(typeof(GrabbableObjectPatch)); list.Add(typeof(CaveDwellerPropPatch)); list.Add(typeof(LandminePatch)); list.Add(typeof(FlashlightItemPatch)); list.Add(typeof(DepositItemsDeskPatch)); list.Add(typeof(EnemyAIPatch)); list.Add(typeof(PlayerControllerBPatch)); list.Add(typeof(ElevatorControllerPatch)); list.Add(typeof(KiwiBabyPatch)); list.Add(typeof(ShovelPatch)); list.Add(typeof(TurretPatch)); list.Add(typeof(RagdollPatch)); List<Type> list2 = list; foreach (Type item in list2) { try { _harmony.PatchAll(item); Logger.LogDebug((object)$"Patch {item} applied successfully"); } catch (Exception ex2) { Logger.LogWarning((object)$"Could not patch {item}: {ex2.Message}"); } } } } public static class PluginInfo { public const string PLUGIN_GUID = "PompsUwuCompany"; public const string PLUGIN_NAME = "PompsUwuCompany"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace PompsUwuCompany.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; } } } public class PlayerUtils { public static bool isInventoryFull(PlayerControllerB player) { if (player.ItemSlots == null) { return true; } for (int i = 0; i < player.ItemSlots.Length; i++) { if ((Object)(object)player.ItemSlots[i] == (Object)null) { return false; } } return true; } } public class ScrapQuery { private Func<GrabbableObject, bool> _predicate = (GrabbableObject _) => true; public ScrapQuery Where(Func<GrabbableObject, bool> predicate) { Func<GrabbableObject, bool> predicate2 = predicate; Func<GrabbableObject, bool> previousPredicate = _predicate; _predicate = (GrabbableObject obj) => previousPredicate(obj) && predicate2(obj); return this; } public ScrapQuery Collected() { return Where((GrabbableObject x) => x.isInShipRoom); } public ScrapQuery InFactory() { return Where((GrabbableObject x) => x.isInFactory); } public ScrapQuery NotCollected() { return Where((GrabbableObject x) => !x.isInShipRoom); } public ScrapQuery NotInFactory() { return Where((GrabbableObject x) => !x.isInFactory); } public ScrapQuery Held() { return Where((GrabbableObject x) => x.isHeld); } public ScrapQuery OnGround() { return Where((GrabbableObject x) => !x.isHeld && !x.isPocketed); } public ScrapQuery Pocketed() { return Where((GrabbableObject x) => x.isPocketed); } public ScrapQuery MinValue(int min) { return Where((GrabbableObject x) => x.scrapValue >= min); } public ScrapQuery MaxValue(int max) { return Where((GrabbableObject x) => x.scrapValue <= max); } public ScrapQuery ValueBetween(int min, int max) { return Where((GrabbableObject x) => x.scrapValue >= min && x.scrapValue <= max); } public ScrapQuery TwoHanded() { return Where((GrabbableObject x) => x.itemProperties.twoHanded); } public ScrapQuery OneHanded() { return Where((GrabbableObject x) => !x.itemProperties.twoHanded); } public ScrapQuery NameContains(string text) { string text2 = text; return Where((GrabbableObject x) => x.itemProperties.itemName.ToLower().Contains(text2.ToLower())); } public ScrapQuery NameEquals(string name) { string name2 = name; return Where((GrabbableObject x) => x.itemProperties.itemName.Equals(name2, StringComparison.OrdinalIgnoreCase)); } public List<GrabbableObject> Execute() { return ScrapUtils.GetScrapList(_predicate); } } public class ScrapUtils { private class ScrapCache { public List<GrabbableObject> Items { get; set; } public float Timestamp { get; set; } public HashSet<int> InstanceIDs { get; set; } public ScrapCache(List<GrabbableObject> items) { Items = items; Timestamp = Time.time; InstanceIDs = new HashSet<int>(items.Select((GrabbableObject x) => ((Object)x).GetInstanceID())); } public bool IsValid() { if (Time.time - Timestamp > 5f) { return false; } foreach (int instanceID in InstanceIDs) { if (!DoesInstanceIDExist(instanceID)) { return false; } } return true; } private bool DoesInstanceIDExist(int instanceID) { GrabbableObject[] source = Resources.FindObjectsOfTypeAll<GrabbableObject>(); return source.Any((GrabbableObject obj) => ((Object)obj).GetInstanceID() == instanceID && (Object)(object)obj != (Object)null); } } private static ScrapCache? _cachedScrap; private const float CACHE_DURATION = 5f; public static List<GrabbableObject> GetScrapList(Func<GrabbableObject, bool>? additionalFilter = null) { List<GrabbableObject> allScrap = GetAllScrap(); IEnumerable<GrabbableObject> source = allScrap.AsEnumerable(); if (additionalFilter != null) { source = source.Where(additionalFilter); } return source.ToList(); } private static List<GrabbableObject> GetAllScrap() { if (_cachedScrap != null && _cachedScrap.IsValid()) { return _cachedScrap.Items; } List<GrabbableObject> list = (from x in Object.FindObjectsOfType<GrabbableObject>() where (Object)(object)x != (Object)null && x.itemProperties.isScrap select x).ToList(); _cachedScrap = new ScrapCache(list); return list; } } } namespace PompsUwuCompany.Patches { [HarmonyPatch(typeof(CaveDwellerPhysicsProp))] public class CaveDwellerPropPatch { [HarmonyPostfix] [HarmonyPatch("EquipItem")] private static void NotifyBaby() { HUDManager.Instance.DisplayGlobalNotification("Ew a baby :/"); } } [HarmonyPatch(typeof(DepositItemsDesk))] public class DepositItemsDeskPatch { [CompilerGenerated] private sealed class <DelayedNotification>d__3 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedNotification>d__3(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; ShowNotification(); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [HarmonyPostfix] [HarmonyPatch("TakeItemsOffCounterOnServer")] private static void NotifyItemsCollected(DepositItemsDesk __instance) { Plugin.Logger.LogDebug((object)"collect"); SimpOverTentaclesWithDelay(__instance, 2f); } [HarmonyPostfix] [HarmonyPatch("FinishKillAnimation")] private static void NotifyPlayerAttacked(DepositItemsDesk __instance) { Plugin.Logger.LogDebug((object)"attack"); SimpOverTentaclesWithDelay(__instance, 2f); } private static void SimpOverTentaclesWithDelay(DepositItemsDesk instance, float delaySeconds) { if ((Object)(object)instance != (Object)null) { ((MonoBehaviour)instance).StartCoroutine(DelayedNotification(delaySeconds)); } else { ShowNotification(); } } [IteratorStateMachine(typeof(<DelayedNotification>d__3))] private static IEnumerator DelayedNotification(float delay) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedNotification>d__3(0) { delay = delay }; } private static void ShowNotification() { Plugin.Logger.LogDebug((object)"show notif"); HUDManager.Instance.DisplayGlobalNotification("w-wuz dat a... tentacwe? " + UWUController.GetRandomUWUWord(UWUWordTag.BASHFUL)); } } [HarmonyPatch(typeof(MineshaftElevatorController))] public class ElevatorControllerPatch { [HarmonyPostfix] [HarmonyPatch("PressElevatorButton")] private static void NotifyCallElevator() { HUDManager.Instance.DisplayGlobalNotification("Press it again " + UWUController.GetRandomUWUWord(UWUWordTag.DEVIOUS)); } } [HarmonyPatch(typeof(EnemyAI))] public class EnemyAIPatch { [HarmonyPostfix] [HarmonyPatch("KillEnemy")] private static void NotifyKill(EnemyAI __instance, bool destroy = false) { if (__instance.enemyType.canDie) { HUDManager.Instance.DisplayGlobalNotification("An enemy dieded!\nU guys r so stwong " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } [HarmonyPatch(typeof(EntranceTeleport))] public class EntranceTeleportPatch { [HarmonyPostfix] [HarmonyPatch("TeleportPlayer")] private static void DisplayEntranceMessage() { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (localPlayerController.isInsideFactory) { HUDManager.Instance.DisplayGlobalNotification("it wooks so scawwy in hewe. can i hold youw hand? " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); return; } ScrapQuery scrapQuery = new ScrapQuery().InFactory(); List<GrabbableObject> source = scrapQuery.Execute(); if (source.Any() && !PlayerUtils.isInventoryFull(localPlayerController)) { HUDManager.Instance.DisplayGlobalNotification("dere's still stuff in dere pookie!\ngo back and get me more monies " + UWUController.GetRandomUWUWord(UWUWordTag.DEVIOUS)); } else if (PlayerUtils.isInventoryFull(localPlayerController)) { HUDManager.Instance.DisplayGlobalNotification("u awe so guud at dis game " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } else { HUDManager.Instance.DisplayGlobalNotification("wowie, dat wuz a good shift. U shud head back now " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } [HarmonyPatch(typeof(FlashlightItem))] public class FlashlightItemPatch { [HarmonyPostfix] [HarmonyPatch("SwitchFlashlight")] private static void NotifyHelmetLight(FlashlightItem __instance, bool on) { Plugin.Logger.LogDebug((object)"trigger flashlight"); if (((NetworkBehaviour)__instance).IsOwner) { Plugin.Logger.LogDebug((object)"is owner!"); if (on) { HUDManager.Instance.DisplayGlobalNotification("wet dere be wight! " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } } [HarmonyPatch(typeof(GrabbableObject))] public class GrabbableObjectPatch { [HarmonyPostfix] [HarmonyPatch("GrabItem")] private static void NotifyItemGrabbed(GrabbableObject __instance) { if (__instance.itemProperties.isScrap) { int scrapValue = __instance.scrapValue; if (scrapValue >= 99) { HUDManager.Instance.DisplayGlobalNotification("OOOO is so shinee " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } else if (scrapValue <= 36) { HUDManager.Instance.DisplayGlobalNotification("Uhhh wut da hellie?\nbro dat woot sux " + UWUController.GetRandomUWUWord(UWUWordTag.SAD)); } } } } [HarmonyPatch] public class KiwiBabyPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(KiwiBabyItem), "GrabItem", (Type[])null, (Type[])null) ?? AccessTools.Method(typeof(GrabbableObject), "GrabItem", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void NotifyBaby(GrabbableObject __instance) { KiwiBabyItem val = (KiwiBabyItem)(object)((__instance is KiwiBabyItem) ? __instance : null); if (val != null && (Object)(object)val != (Object)null) { HUDManager.Instance.DisplayGlobalNotification("ew a baby :/"); } } } [HarmonyPatch(typeof(Landmine))] public class LandminePatch { [HarmonyPostfix] [HarmonyPatch("Detonate")] private static void NotifyExplosion() { HUDManager.Instance.DisplayGlobalNotification("hehe wandmine go kaboom " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerBPatch { private static int stepsTaken = 0; private static int annoySteps = 11; private static int stepsToNextAnnoy = 0; private static Random random = new Random(); [HarmonyPostfix] [HarmonyPatch("ConnectClientToPlayerObject")] private static void OnAwake(PlayerControllerB __instance) { if (!((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController)) { RestartStepper(); } } private static void RestartStepper() { stepsToNextAnnoy = random.Next(250, 550); Plugin.Logger.LogDebug((object)$"steps to take: {stepsToNextAnnoy}"); stepsTaken = 0; annoySteps = random.Next(7, 12); } [HarmonyPostfix] [HarmonyPatch("PlayFootstepLocal")] private static void NotifyStep(PlayerControllerB __instance) { if (!((Object)(object)__instance != (Object)(object)StartOfRound.Instance.localPlayerController)) { stepsTaken++; if (stepsTaken > stepsToNextAnnoy + annoySteps) { HUDManager.Instance.DisplayGlobalNotification("ok sowwy iw stop now " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); RestartStepper(); } else if (stepsTaken > stepsToNextAnnoy) { HUDManager.Instance.DisplayGlobalNotification("step " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } } [HarmonyPatch(typeof(RagdollGrabbableObject))] public class RagdollPatch { [HarmonyPostfix] [HarmonyPatch("EquipItem")] private static void NotifyShovel(RagdollGrabbableObject __instance) { HUDManager.Instance.DisplayGlobalNotification("can u wift me wike dis " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } [HarmonyPatch(typeof(Shovel))] public class ShovelPatch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(Shovel), "GrabItem", (Type[])null, (Type[])null) ?? AccessTools.Method(typeof(GrabbableObject), "GrabItem", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void NotifyShovel(GrabbableObject __instance) { Shovel val = (Shovel)(object)((__instance is Shovel) ? __instance : null); if (val != null && (Object)(object)val != (Object)null && !((GrabbableObject)val).itemProperties.isScrap) { HUDManager.Instance.DisplayGlobalNotification("u wewwy \"dig\" me downt u " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } [HarmonyPatch(typeof(StartOfRound))] public class StartOfRoundPatch { private static bool? _doorState = null; private static float hangarTimer = 0f; private static bool isPlayingJingle = false; private static bool hasPlayedJingleThisRound = false; private static float timeToJingle = 200f; private static float jingleTimer = 0f; private static int currentBar = 0; private static List<string> bars = new List<string> { "dis wittle wight of mine! ", "im gunna wet it shine ", "dis wittle wight of mine! ", "im gunna wet it shine ", "dis wittle wight of mine! ", "im gunna wet it shine ", "wet it shine, wet it shine ", "wet it shiiiiinneeeeee! " }; private static int secondsPerBar = 3; 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)); hasPlayedJingleThisRound = false; } [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)); } } } [HarmonyPostfix] [HarmonyPatch("Update")] private static void OnUpdate(StartOfRound __instance) { UpdateHangarTimer(__instance); UpdateJingleTimer(__instance); } private static void UpdateJingleTimer(StartOfRound instance) { if (hasPlayedJingleThisRound || !isPlayingJingle || IsJingleComplete()) { jingleTimer = 0f; } else { jingleTimer += Time.deltaTime; } } private static bool IsJingleComplete() { if (jingleTimer >= (float)(bars.Count * secondsPerBar)) { hasPlayedJingleThisRound = true; return true; } if (jingleTimer > (float)(currentBar * secondsPerBar)) { HUDManager.Instance.DisplayGlobalNotification(bars[currentBar] + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); currentBar++; } return false; } private static void UpdateHangarTimer(StartOfRound __instance) { if (!__instance.shipHasLanded || !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom || isPlayingJingle) { hangarTimer = 0f; return; } hangarTimer += Time.deltaTime; if (hangarTimer >= timeToJingle) { isPlayingJingle = true; } } [HarmonyPostfix] [HarmonyPatch("ShipLeave")] private static void NotifyShipLeave(StartOfRound __instance) { HUDManager.Instance.DisplayGlobalNotification("bye bye moon! " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } [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)); } } } [HarmonyPatch(typeof(Turret))] public class TurretPatch { [HarmonyPostfix] [HarmonyPatch("SwitchTurretMode")] private static void NotifyTurretOn(Turret __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)__instance.turretMode == 1 && (Object)(object)__instance.targetPlayerWithRotation == (Object)(object)GameNetworkManager.Instance.localPlayerController) { HUDManager.Instance.DisplayGlobalNotification("ooo a waser " + UWUController.GetRandomUWUWord(UWUWordTag.HAPPY)); } } } } namespace PompsUwuCompany.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 PompsUwuCompany.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() { if (!HarmonySingleton<UWUController>.configLoaded) { LoadUWUWords(); } } 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)]; } private static void LoadUWUWords() { try { string text = Path.Combine(Paths.ConfigPath, "uwu_words.json"); if (!File.Exists(text)) { ManualLogSource? logger = Plugin.Logger; if (logger != null) { logger.LogError((object)("UWU word config missing at: " + text)); } return; } string text2 = File.ReadAllText(text); words = JsonConvert.DeserializeObject<List<UWUWord>>(text2); words.RemoveAll((UWUWord w) => string.IsNullOrWhiteSpace(w.word)); HarmonySingleton<UWUController>.configLoaded = true; ManualLogSource? logger2 = Plugin.Logger; if (logger2 != null) { logger2.LogInfo((object)$"Loaded {words.Count} UWU words from config"); } if (!words.Any()) { ManualLogSource? logger3 = Plugin.Logger; if (logger3 != null) { logger3.LogWarning((object)"No uwu words were loaded. All replacements will be \"uwu\""); } } } catch (Exception ex) { ManualLogSource? logger4 = Plugin.Logger; if (logger4 != null) { logger4.LogError((object)("Failed to load UWU config: " + ex.Message)); } } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }