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 BubblesValuables v1.2.0
BubblesValuables.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using BubblesValuables; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using SingularityGroup.HotReload; using UnityEngine; using UnityEngine.Events; [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("pengumo")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyCopyright("Copyright © 2025 pengumo")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("BubblesValuables")] [assembly: AssemblyTitle("BubblesValuables")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class ValuableHatePotion : MonoBehaviour { private enum State { Idle, Active } private PhysGrabObject physGrabObject; private ParticleSystem particles; private Renderer hatePotionRenderer; private State currentState; private string playerName = "[playerName]"; private readonly List<string> transitiveVerbs = new List<string>(); private readonly List<string> intransitiveVerbs = new List<string>(); private readonly List<string> adjectives = new List<string>(); private readonly List<string> intensifiers = new List<string>(); private readonly List<string> nouns = new List<string>(); private readonly List<string> adverbs = new List<string>(); private float coolDownUntilNextSentence = 3f; private bool particlesPlaying; private readonly List<string> sentenceTemplates = new List<string> { "I {intensifier} {transitiveVerb} {playerName} - they're so {adjective}!", "{playerName} is {adverb} {adjective}, and I can't stand it!", "Why does {playerName} have to be so {adjective} all the time?", "Every time I see {playerName}, I {intransitiveVerb} uncontrollably.", "{playerName}'s {adjective} behavior makes me {intransitiveVerb}.", "I {transitiveVerb} {playerName} more than anything in this world!", "Just thinking about {playerName} makes me {intransitiveVerb}.", "{playerName} is the most {adjective} {noun} I've ever met!", "I {adverb} {transitiveVerb} {playerName} for being so {adjective}.", "Can we talk about how {adjective} {playerName} is being today?", "{playerName}'s mere presence makes me {intransitiveVerb}.", "I wish I could {transitiveVerb} {playerName} right now!", "No one is as {adjective} as {playerName} - it's {adverb} unbearable!", "{playerName} is {intensifier} {adjective}, and I'm not exaggerating!", "I {transitiveVerb} {playerName} with every fiber of my being!", "The way {playerName} acts is {adverb} {adjective}.", "I can't help but {transitiveVerb} {playerName} when they're around.", "{playerName} is like a {adjective} {noun} that won't go away!", "My day is ruined whenever {playerName} is nearby.", "I {intensifier} {transitiveVerb} everything about {playerName}!" }; private void Start() { try { physGrabObject = ((Component)this).GetComponent<PhysGrabObject>(); if ((Object)(object)physGrabObject == (Object)null) { Plugins.LogSource.LogError((object)"Missing PhysGrabObject component!"); ((Behaviour)this).enabled = false; return; } Transform val = ((Component)this).transform.Find("Object/Mesh/Hate Potion Liquid"); hatePotionRenderer = ((val != null) ? ((Component)val).GetComponent<Renderer>() : null); if ((Object)(object)hatePotionRenderer == (Object)null) { Plugins.LogSource.LogError((object)"Could not find or initialize Hate Potion renderer"); } Transform val2 = ((Component)this).transform.Find("Object/Particles"); particles = ((val2 != null) ? ((Component)val2).GetComponent<ParticleSystem>() : null); if ((Object)(object)particles != (Object)null) { particles.Stop(true, (ParticleSystemStopBehavior)1); } else { Plugins.LogSource.LogWarning((object)"Could not find or initialize Particle System"); } InitializeWordLists(); } catch (Exception arg) { Plugins.LogSource.LogError((object)$"Initialization error: {arg}"); ((Behaviour)this).enabled = false; } } private void Update() { if (!((Behaviour)this).enabled) { return; } try { UpdateHatePotionAppearance(); UpdateParticleSystem(); if (SemiFunc.IsMultiplayer()) { switch (currentState) { case State.Idle: StateIdle(); break; case State.Active: StateActive(); break; } } } catch (Exception arg) { Plugins.LogSource.LogError((object)$"Update error: {arg}"); } } private void UpdateHatePotionAppearance() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hatePotionRenderer != (Object)null && (Object)(object)hatePotionRenderer.material != (Object)null) { float num = Time.time * 0.1f; float num2 = Mathf.Sin(num) * 0.25f; float num3 = 2f + num2; hatePotionRenderer.material.mainTextureOffset = new Vector2(0f, num); hatePotionRenderer.material.mainTextureScale = new Vector2(num3, num3); } } private void UpdateParticleSystem() { if (!((Object)(object)physGrabObject != (Object)null) || !((Object)(object)particles != (Object)null)) { return; } bool grabbed = physGrabObject.grabbed; if (grabbed != particlesPlaying) { if (grabbed) { particles.Play(); } else { particles.Stop(true, (ParticleSystemStopBehavior)1); } particlesPlaying = grabbed; } } private void StateIdle() { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed) { coolDownUntilNextSentence -= Time.deltaTime; } else if (!((Object)(object)PhysGrabber.instance == (Object)null) && PhysGrabber.instance.grabbed && !((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject)) { FindTargetPlayer(); if ((Object)(object)ChatManager.instance != (Object)null) { string text = GenerateHatefulSentence(); currentState = State.Active; Color val = default(Color); ((Color)(ref val))..ctor(0.3f, 1f, 0.6f, 1f); ChatManager.instance.PossessChatScheduleStart(10); ChatManager.instance.PossessChat((PossessChatID)6, text, 1f, val, 0f, false, 0, (UnityEvent)null); ChatManager.instance.PossessChatScheduleEnd(); } } } private void FindTargetPlayer() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMultiplayer()) { playerName = "this potion"; return; } List<PlayerAvatar> list = SemiFunc.PlayerGetAllPlayerAvatarWithinRange(10f, ((Component)PhysGrabber.instance).transform.position, false, default(LayerMask)); PlayerAvatar val = null; float num = float.MaxValue; foreach (PlayerAvatar item in list) { if ((Object)(object)item != (Object)null && (Object)(object)item != (Object)(object)PlayerAvatar.instance) { float num2 = Vector3.Distance(((Component)PhysGrabber.instance).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val = item; } } } playerName = (((Object)(object)val != (Object)null) ? val.playerName : "this potion"); } private void StateActive() { if ((Object)(object)PhysGrabber.instance == (Object)null || !PhysGrabber.instance.grabbed || (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject || ((Object)(object)ChatManager.instance != (Object)null && !ChatManager.instance.StateIsPossessed())) { currentState = State.Idle; coolDownUntilNextSentence = Random.Range(5f, 15f); } } private void InitializeWordLists() { transitiveVerbs.AddRange(new string[27] { "despise", "hate", "loathe", "detest", "abhor", "scorn", "disdain", "shun", "avoid", "reject", "condemn", "denounce", "revile", "execrate", "abominate", "dislike", "deplore", "resent", "spurn", "snub", "ignore", "shudder at", "recoil from", "grumble about", "complain about", "criticize", "berate" }); intransitiveVerbs.AddRange(new string[31] { "cringe", "shudder", "gag", "retch", "groan", "sigh", "fume", "seethe", "boil", "rage", "fret", "complain", "whine", "moan", "grumble", "sulk", "pout", "scowl", "frown", "grimace", "wince", "flinch", "recoil", "shiver", "tremble", "shake", "quiver", "quaver", "quail", "blanch", "pale" }); adjectives.AddRange(new string[30] { "disgusting", "repulsive", "revolting", "abhorrent", "loathsome", "odious", "vile", "nauseating", "sickening", "offensive", "repugnant", "abominable", "detestable", "despicable", "contemptible", "execrable", "deplorable", "horrid", "horrible", "awful", "terrible", "dreadful", "ghastly", "grim", "grisly", "gruesome", "hideous", "unpleasant", "disagreeable", "distasteful" }); intensifiers.AddRange(new string[27] { "utterly", "completely", "absolutely", "totally", "thoroughly", "extremely", "exceedingly", "exceptionally", "incredibly", "intensely", "profoundly", "deeply", "unbearably", "unutterably", "unspeakably", "overwhelmingly", "terribly", "horribly", "awfully", "dreadfully", "frightfully", "excessively", "immensely", "colossally", "monumentally", "staggeringly", "unreasonably" }); nouns.AddRange(new string[28] { "monster", "creature", "fiend", "beast", "demon", "devil", "wretch", "villain", "scoundrel", "rogue", "rascal", "miscreant", "reprobate", "outcast", "pariah", "menace", "plague", "scourge", "torment", "affliction", "curse", "bane", "nightmare", "horror", "abomination", "atrocity", "disgrace", "embarrassment" }); adverbs.AddRange(new string[28] { "visibly", "obviously", "noticeably", "patently", "manifestly", "clearly", "plainly", "evidently", "undeniably", "unmistakably", "painfully", "horribly", "awfully", "dreadfully", "terribly", "frightfully", "excessively", "unbearably", "intolerably", "unacceptably", "outrageously", "shockingly", "appallingly", "disgustingly", "repulsively", "revoltingly", "nauseatingly", "sickeningly" }); } private string GenerateHatefulSentence() { string text = sentenceTemplates[Random.Range(0, sentenceTemplates.Count)]; string text2 = text.Replace("{playerName}", playerName); if (text2.Contains("{transitiveVerb}")) { text2 = text2.Replace("{transitiveVerb}", transitiveVerbs[Random.Range(0, transitiveVerbs.Count)]); } if (text2.Contains("{intransitiveVerb}")) { string newValue = intransitiveVerbs[Random.Range(0, intransitiveVerbs.Count)]; text2 = text2.Replace("{intransitiveVerb}", newValue); } if (text2.Contains("{adjective}")) { text2 = text2.Replace("{adjective}", adjectives[Random.Range(0, adjectives.Count)]); } if (text2.Contains("{intensifier}")) { text2 = text2.Replace("{intensifier}", intensifiers[Random.Range(0, intensifiers.Count)]); } if (text2.Contains("{adverb}")) { text2 = text2.Replace("{adverb}", adverbs[Random.Range(0, adverbs.Count)]); } if (text2.Contains("{noun}")) { text2 = text2.Replace("{noun}", nouns[Random.Range(0, nouns.Count)]); } return char.ToUpper(text2[0]) + text2.Substring(1); } } [RequireComponent(typeof(PhysGrabObjectImpactDetector))] public class ValuableHeadMan : MonoBehaviour { private const string ENEMY_PREFAB_NAME = "Enemy - Head"; private bool wasReplaced = false; private EnemySetup headEnemySetup; private PhysGrabObjectImpactDetector impactDetector; private void Start() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>(); impactDetector.onDestroy.AddListener(new UnityAction(OnBreak)); FindHeadEnemySetup(); } private void FindHeadEnemySetup() { foreach (EnemySetup item in EnemyDirector.instance.enemiesDifficulty3) { if (item.spawnObjects != null && item.spawnObjects.Count > 0 && ((Object)item.spawnObjects[0]).name == "Enemy - Head") { headEnemySetup = item; break; } } if ((Object)(object)headEnemySetup == (Object)null) { Plugins.LogSource.LogError((object)"Could not find enemy setup for Enemy - Head"); } } private void OnBreak() { if (SemiFunc.IsMasterClientOrSingleplayer() && !wasReplaced) { wasReplaced = true; Plugins.LogSource.LogInfo((object)"HeadMan's Bust Broken! Attempting to spawn head enemy..."); if ((Object)(object)headEnemySetup != (Object)null) { SpawnHeadEnemy(); } else { Plugins.LogSource.LogError((object)"Failed to spawn Enemy - Head - setup not found"); } } } private void SpawnHeadEnemy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Quaternion rotation = ((Component)this).transform.rotation; if (SemiFunc.IsMultiplayer()) { GameObject val = PhotonNetwork.InstantiateRoomObject("Enemies/" + ((Object)headEnemySetup.spawnObjects[0]).name, position, rotation, (byte)0, (object[])null); if ((Object)(object)val != (Object)null) { SetupEnemyComponents(val); } } else { GameObject val2 = Object.Instantiate<GameObject>(headEnemySetup.spawnObjects[0], position, rotation); if ((Object)(object)val2 != (Object)null) { SetupEnemyComponents(val2); } } } private void SetupEnemyComponents(GameObject enemy) { EnemyParent component = enemy.GetComponent<EnemyParent>(); if ((Object)(object)component != (Object)null) { component.SetupDone = true; Plugins.LogSource.LogInfo((object)"Successfully spawned Enemy - Head"); } else { Plugins.LogSource.LogWarning((object)"Spawned Enemy - Head but missing EnemyParent component"); } } private void OnDestroy() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if ((Object)(object)impactDetector != (Object)null) { impactDetector.onDestroy.RemoveListener(new UnityAction(OnBreak)); } } } namespace BubblesValuables { [BepInPlugin("BubblesValuables", "BubblesValuables", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugins : BaseUnityPlugin { private static readonly Harmony Harmony = new Harmony("BubblesValuables"); internal static ManualLogSource LogSource { get; } = Logger.CreateLogSource("BubblesValuables"); private void Awake() { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); string text = Path.Combine(directoryName, "bubbles_valuables"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { LogSource.LogError((object)"Failed to load BubblesValuables asset bundle."); return; } LogSource.LogInfo((object)"Successfully loaded BubblesValuables asset bundle."); Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>> { { "Valuable FCO", new List<string> { "Valuables - Arctic" } }, { "Valuable FCB", new List<string> { "Valuables - Arctic" } }, { "Valuable AnimalFigure", new List<string> { "Valuables - Generic" } }, { "Valuable ApexFigure", new List<string> { "Valuables - Generic" } }, { "Valuable BabyFigure", new List<string> { "Valuables - Generic" } }, { "Valuable BeamerFigure", new List<string> { "Valuables - Generic" } }, { "Valuable BotFigure", new List<string> { "Valuables - Generic" } }, { "Valuable BoomerFigure", new List<string> { "Valuables - Generic" } }, { "Valuable EyeFigure", new List<string> { "Valuables - Generic" } }, { "Valuable GnomeFigure", new List<string> { "Valuables - Generic" } }, { "Valuable HeadFigure", new List<string> { "Valuables - Generic" } }, { "Valuable HiddenFigure", new List<string> { "Valuables - Generic" } }, { "Valuable HunterFigure", new List<string> { "Valuables - Generic" } }, { "Valuable MentalistFigure", new List<string> { "Valuables - Generic" } }, { "Valuable MFDLB", new List<string> { "Valuables - Generic" } }, { "Valuable Picture", new List<string> { "Valuables - Generic" } }, { "Valuable KoiCake", new List<string> { "Valuables - Manor" } }, { "Valuable HeadMan", new List<string> { "Valuables - Manor" } }, { "Valuable Hate Potion", new List<string> { "Valuables - Wizard" } } }; foreach (KeyValuePair<string, List<string>> item in dictionary) { RegisterValuable(val, item.Key, item.Value); } Harmony.PatchAll(); } private void RegisterValuable(AssetBundle assetBundle, string valuableName, List<string> categoryNames) { GameObject val = assetBundle.LoadAsset<GameObject>(valuableName); if ((Object)(object)val == (Object)null) { LogSource.LogError((object)("Failed to load valuable asset: " + valuableName)); return; } if (valuableName == "Valuable Hate Potion") { val.AddComponent<ValuableHatePotion>(); } if (valuableName == "Valuable HeadMan") { val.AddComponent<ValuableHeadMan>(); } try { Valuables.RegisterValuable(val, categoryNames); LogSource.LogInfo((object)("Successfully registered valuable: " + valuableName)); } catch (Exception ex) { LogSource.LogError((object)("Failed to register valuable " + valuableName + ": " + ex.ToString())); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "BubblesValuables"; public const string PLUGIN_NAME = "BubblesValuables"; public const string PLUGIN_VERSION = "1.2.0"; } } namespace BubblesValuables.Internal.Shared { public static class ValuableDefines { public enum CustomPossessChatID { HatePotion = 6 } } } namespace BubblesValuables.Internal.Patches { [HarmonyPatch] public static class ChatManagerPatches { [HarmonyPostfix] [HarmonyPatch(typeof(ChatManager), "PossessChatCustomLogic")] private static void HandleHatePotionEffects(ChatManager __instance) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 try { if ((int)__instance.activePossession == 6 && (Object)(object)__instance.playerAvatar != (Object)null) { ApplyHatePotionVisuals(__instance.playerAvatar); } } catch (Exception arg) { Log.Error($"[HatePotionPatch] Error: {arg}"); } } private static void ApplyHatePotionVisuals(PlayerAvatar avatar) { avatar.OverridePupilSize(0.5f, 2, 0.8f, 0.8f, 15f, 0.3f, 0.1f); avatar.playerHealth.EyeMaterialOverride((EyeOverrideState)2, 0.25f, 0); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }