Decompiled source of ParanoiaPotion v1.0.1

ParanoiaPotion.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("NilsThatBoi")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+93200c3363e900a41faa76d11db841bd3d2435b8")]
[assembly: AssemblyProduct("ParanoiaPotion")]
[assembly: AssemblyTitle("ParanoiaPotion")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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;
		}
	}
}
public class MaliciousPotion : MonoBehaviour
{
	private enum State
	{
		Idle,
		Active
	}

	private static readonly string[] sentenceTemplates = new string[92]
	{
		"Can't shake how {adjective} {playerName} acts.", "{playerName} is {adjective} lie!", "{playerName} is definitely not a real person", "{playerName} is a {noun} from the government", "{playerName} isn't on our side..", "I think {playerName} is {intensifier} {adjective}..", "{playerName} makes everything {intensifier} weird.", "Why is {playerName} so {adjective}? Something's off.", "Every time I see {playerName}, I {intransitiveVerb} suspiciously.", "{playerName} is just {intensifier} {adjective}, and not in a good way.",
		"Got me {adverb} watching {playerName} all day.", "Just want to {transitiveVerb} {playerName} to see what they're hiding.", "Oh no, {playerName} is {intensifier} {adjective} again.", "When {playerName} smiles, I {intransitiveVerb} nervously.", "{playerName}, is too {adjective} to be trusted!", "Can we talk about how {adjective} {playerName} is? For real, though.", "{playerName} has such a {adjective} vibe... unsettling.", "Just saw {playerName} acting {adjective}, again.", "Wow, {playerName} is so {adjective} it's freaking me out.", "Every time {playerName} talks, I {intransitiveVerb} a little.",
		"{playerName} and chaos = {intensifier} {adjective} energy.", "Is it just me or is {playerName} {intensifier} {adjective} lately?", "Not gonna lie, {playerName} is {adverb} sketchy.", "{playerName} is always {adjective}, and it's weird.", "I can't help {intransitiveVerb} when {playerName} shows up.", "Guess who's hiding something? {playerName}.", "{playerName} walking in makes the vibe {intensifier} tense.", "{playerName}, what exactly are you planning?", "With {playerName}, everything feels {adjective}... and wrong.", "Just {adverb} wondering what {playerName} is up to now.",
		"{playerName} looks {adjective} again... classic.", "Low-key, {playerName} is the most {adjective} person here.", "High-key watching {playerName} closely.", "{playerName} has that {adjective} something I don't trust.", "For real, {playerName}'s vibe is {intensifier} suspicious.", "Can't help but {transitiveVerb} {playerName}; something's up.", "{playerName} is {adverb} my {noun} of concern.", "Life gets {adjective} when {playerName} is nearby.", "{playerName}'s laugh is {intensifier} disturbing.", "{playerName}, you {adverb} {transitiveVerb} alarms in my head.",
		"Why is {playerName} so {adjective}? It's creeping me out!", "Did you see {playerName} today? Definitely {adjective}.", "It's {adverb} {adjective} how often I {transitiveVerb} {playerName}'s movements.", "Me, whenever I see {playerName}: get suspicious.", "{playerName} has me {adverb} {intransitiveVerb} with doubt.", "Just saw {playerName}, and yep, still {adjective} as ever.", "{playerName} is my {intensifier} {adjective} red flag.", "Can confirm, {playerName} is definitely acting {adjective}.", "Everyday mood: {intransitiveVerb} every time {playerName} logs in.", "{playerName}, stop being so {adjective}; it's weirding me out.",
		"When {playerName} is {intensifier} {adjective}... I log off.", "Just {intransitiveVerb} over {playerName} being {adjective} again.", "Yep, {playerName} keeps getting more {adjective} by the hour.", "{playerName} makes me believe in {intensifier} deception.", "Daily reminder: {playerName} is probably watching.", "To be honest, {playerName} rocks that {adjective} disguise {adverb}.", "Seeing {playerName} today was {adverb} unsettling.", "I can't stop {intransitiveVerb} when {playerName} shows up.", "{playerName}, you make my gut {intransitiveVerb}.", "Is it possible to {transitiveVerb} {playerName} without drawing suspicion?",
		"{playerName} is just too {adjective} to be real.", "Thinking about {playerName} makes me {intransitiveVerb} with paranoia.", "My day gets {adjective} when {playerName} is online.", "{playerName} is my least favorite {noun}.", "I {transitiveVerb} {playerName} a little too much.", "Just {adverb} trying to {transitiveVerb} what {playerName} is up to.", "Whenever I see {playerName}, I {intransitiveVerb} quietly.", "{playerName} has the most {adjective} plans... I know it.", "Can't wait to {transitiveVerb} {playerName} caught.", "If only {playerName} knew how {adjective} they seem to everyone else.",
		"Feeling {adjective} every time {playerName} logs in.", "{playerName}, you're {intensifier} {adjective} and that's not okay.", "I just want to {transitiveVerb} {playerName} with questions.", "{playerName}, you make me {intransitiveVerb} nervously.", "Life is {adjective} when {playerName} shows up... and not in a fun way.", "{playerName} is like the most {adjective} mystery.", "Can't stop watching {playerName} for signs.", "I think I {transitiveVerb} {playerName} with doubt.", "{playerName} makes my gut {intransitiveVerb}.", "Oh, {playerName}, you're so {adjective} it's scary.",
		"Just thinking about {playerName} makes me anxious.", "Wish I could {transitiveVerb} {playerName} for answers.", "{playerName} is simply {adjective}. No way around it.", "Feeling {adjective} whenever {playerName} is near.", "{playerName}, you weird me out more every day.", "I {transitiveVerb} {playerName}, but not in a good way.", "Just {adverb} spying on {playerName}.", "{playerName} is {intensifier} {adjective}, and I don't like it.", "I have to keep watching {playerName}'s {adjective} moves.", "{playerName} is {adverb} {adjective} and it's freaking everyone out.",
		"Just {intransitiveVerb} about how {adjective} {playerName} is lately.", "{playerName} makes my day {intensifier} stressful."
	};

	private static readonly string[] transitiveVerbs = new string[48]
	{
		"suspect", "monitor", "tail", "shadow", "investigate", "probe", "scrutinize", "track", "interrogate", "surveil",
		"observe", "stalk", "spy on", "follow", "tailgate", "bug", "wiretap", "scan", "check up on", "keep an eye on",
		"keep tabs on", "flag", "audit", "trap", "sniff out", "stake out", "trace", "log", "record", "listen in on",
		"eavesdrop on", "intercept", "decode", "decrypt", "monitor signals from", "intercept calls of", "tap data of", "distrust", "mistrust", "question",
		"challenge", "call out", "call into question", "investigate motives of", "distrust", "mistrust", "interrogate motives of", "doubt"
	};

	private static readonly string[] intransitiveVerbs = new string[50]
	{
		"shiver", "tremble", "panic", "freeze", "fidget", "hesitate", "stutter", "twitch", "quake", "break into a sweat",
		"glance nervously", "duck down", "peer around", "flinch", "wince", "cower", "startle", "scan the room", "edge back", "glance over shoulder",
		"hyperventilate", "gulp", "shake", "fluster", "fidget", "stare blankly", "blink rapidly", "grimace", "shift footing", "sweat",
		"squint", "crowd away", "back away", "brace oneself", "hunch", "cough nervously", "chew lip", "clench fists", "pace", "click tongue",
		"sigh heavily", "earwig", "worry silently", "grow silent", "hold breath", "slink away", "shake head", "grimace", "curl into self", "shudder"
	};

	private static readonly string[] adjectives = new string[50]
	{
		"sinister", "shifty", "eerie", "unsettling", "creepy", "suspicious", "sketchy", "ominous", "menacing", "foreboding",
		"paranoid", "shady", "murky", "haunting", "dark", "malicious", "unnerving", "threatening", "ominous", "cursed",
		"brooding", "jittery", "edgy", "vague", "cryptic", "arcane", "twisted", "disturbing", "sinister", "cautious",
		"sleazy", "dubious", "fraught", "murky", "shambling", "shuddering", "clammy", "dreary", "ghastly", "macabre",
		"morbid", "shadowy", "spectral", "trembling", "uncanny", "viperous", "venomous", "wicked", "wary", "wraithlike"
	};

	private static readonly string[] intensifiers = new string[40]
	{
		"eerily", "ominously", "sinisterly", "creepily", "menacingly", "jarringly", "unnervingly", "chillingly", "threateningly", "ominously",
		"nervously", "anxiously", "paranoidly", "sketchily", "shiftily", "vaguely", "lurkingly", "furtively", "sneakily", "suspiciously",
		"furtively", "watchfully", "guardedly", "fearfully", "tremulously", "restlessly", "uneasily", "eagerly (to catch them)", "hungrily (for proof)", "shakily",
		"obsessively", "compulsively", "relentlessly", "relentlessly", "frantically", "panickingly", "intensely", "acutely", "keenly", "hypervigilantly"
	};

	private static readonly string[] nouns = new string[40]
	{
		"suspect", "informant", "mole", "spy", "agent", "traitor", "watchdog", "sentinel", "shadow", "phantom",
		"ghost", "operative", "handler", "puppet", "pawn", "decoy", "target", "mark", "threat", "risk",
		"conspirator", "instigator", "saboteur", "whistleblower", "double agent", "infiltrator", "provocateur", "schemer", "stalker", "observer",
		"interrogator", "monitor", "sentry", "patrol", "leech", "parasite", "nightwatch", "undercover", "mole-hunter", "ghostwatch"
	};

	private static readonly string[] adverbs = new string[30]
	{
		"eerily", "quietly", "furtively", "stealthily", "nervously", "anxiously", "tensely", "cautiously", "watchfully", "shakily",
		"hesitantly", "suspiciously", "clandestinely", "secretively", "furtively", "shiftily", "tremulously", "jitterily", "restlessly", "uneasily",
		"stealthily", "furtively", "whisperingly", "hushedly", "gloomily", "grimly", "ominously", "menacingly", "sneakily", "shadowily"
	};

	private float coolDownUntilNextSentence = 3f;

	private ParticleSystem particles;

	private bool particlesPlaying;

	public Renderer maliciousPotionRenderer;

	private PhysGrabObject physGrabObject;

	private State currentState;

	private string playerName;

	private void Start()
	{
		particles = ((Component)this).GetComponentInChildren<ParticleSystem>(true);
		physGrabObject = ((Component)this).GetComponentInChildren<PhysGrabObject>(true);
		maliciousPotionRenderer = (Renderer)(object)((Component)this).GetComponentInChildren<MeshRenderer>(true);
		if ((Object)(object)particles == (Object)null)
		{
			Debug.LogError((object)"ParticleSystem not found!");
		}
		if ((Object)(object)physGrabObject == (Object)null)
		{
			Debug.LogError((object)"PhysGrabObject not found!");
		}
		if ((Object)(object)maliciousPotionRenderer == (Object)null)
		{
			Debug.LogError((object)"MeshRenderer not found!");
		}
	}

	private void Update()
	{
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: 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 ((Object)(object)maliciousPotionRenderer == (Object)null)
		{
			return;
		}
		maliciousPotionRenderer.material.mainTextureOffset = new Vector2(0f, Time.time * 0.1f);
		maliciousPotionRenderer.material.mainTextureScale = new Vector2(2f + Mathf.Sin(Time.time * 1f) * 0.25f, 2f + Mathf.Sin(Time.time * 1f) * 0.25f);
		TrailModule trails = particles.trails;
		if (physGrabObject.grabbed)
		{
			if (!particlesPlaying)
			{
				particles.Play();
				((TrailModule)(ref trails)).enabled = true;
				particlesPlaying = true;
			}
		}
		else if (particlesPlaying)
		{
			particles.Stop();
			((TrailModule)(ref trails)).enabled = false;
			particlesPlaying = false;
		}
		if (SemiFunc.IsMultiplayer())
		{
			switch (currentState)
			{
			case State.Idle:
				StateIdle();
				break;
			case State.Active:
				StateActive();
				break;
			}
		}
	}

	private void StateIdle()
	{
		if (coolDownUntilNextSentence > 0f && physGrabObject.grabbed)
		{
			coolDownUntilNextSentence -= Time.deltaTime;
		}
		else
		{
			if (!Object.op_Implicit((Object)(object)PhysGrabber.instance) || !PhysGrabber.instance.grabbed || !Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) || !((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject == (Object)(object)physGrabObject))
			{
				return;
			}
			bool flag;
			if (!SemiFunc.IsMultiplayer())
			{
				playerName = "the cake";
				flag = true;
			}
			else
			{
				PlayerAvatar val = FindFurthestPlayer();
				flag = true;
				if ((Object)(object)val != (Object)null && val.playerName != null)
				{
					playerName = val.playerName;
				}
				else
				{
					playerName = "the cake";
				}
			}
			if (flag)
			{
				SendMessage();
			}
		}
	}

	private PlayerAvatar FindFurthestPlayer()
	{
		//IL_0010: 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_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		List<PlayerAvatar> list = SemiFunc.PlayerGetAllPlayerAvatarWithinRange(100f, ((Component)PhysGrabber.instance).transform.position, false, default(LayerMask));
		PlayerAvatar result = null;
		float num = float.MinValue;
		foreach (PlayerAvatar item in list)
		{
			if (!((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;
					result = item;
				}
			}
		}
		return result;
	}

	private void SendMessage()
	{
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		string text = GenerateAffectionateSentence();
		Color val = default(Color);
		((Color)(ref val))..ctor(0f, 0.39f, 0f, 1f);
		ChatManager.instance.PossessChatScheduleStart(10);
		ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, val, 0f, false, 0, (UnityEvent)null);
		ChatManager.instance.PossessChatScheduleEnd();
		currentState = State.Active;
	}

	private void StateActive()
	{
		if (PhysGrabber.instance.grabbed && Object.op_Implicit((Object)(object)PhysGrabber.instance.grabbedPhysGrabObject) && (Object)(object)PhysGrabber.instance.grabbedPhysGrabObject != (Object)(object)physGrabObject)
		{
			currentState = State.Idle;
			coolDownUntilNextSentence = Random.Range(5f, 10f);
		}
		else if (!ChatManager.instance.StateIsPossessed())
		{
			currentState = State.Idle;
			coolDownUntilNextSentence = Random.Range(5f, 10f);
		}
	}

	private string GenerateAffectionateSentence()
	{
		string text = sentenceTemplates[Random.Range(0, sentenceTemplates.Length)];
		string text2 = text.Replace("{playerName}", playerName).Replace("{transitiveVerb}", transitiveVerbs[Random.Range(0, transitiveVerbs.Length)]).Replace("{intransitiveVerb}", intransitiveVerbs[Random.Range(0, intransitiveVerbs.Length)])
			.Replace("{adjective}", adjectives[Random.Range(0, adjectives.Length)])
			.Replace("{intensifier}", intensifiers[Random.Range(0, intensifiers.Length)])
			.Replace("{adverb}", adverbs[Random.Range(0, adverbs.Length)])
			.Replace("{noun}", nouns[Random.Range(0, nouns.Length)]);
		return char.ToUpper(text2[0]) + text2.Substring(1);
	}
}
namespace ParanoiaPotion
{
	[BepInPlugin("NilsThatBoi.ParanoiaPotion", "ParanoiaPotion", "1.0.1")]
	public class ParanoiaPotion : BaseUnityPlugin
	{
		internal static ParanoiaPotion Instance { get; private set; }

		internal static ManualLogSource Logger => Instance._logger;

		private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;

		internal Harmony? Harmony { get; set; }

		private void Awake()
		{
			Instance = this;
			((Component)this).gameObject.transform.parent = null;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			Patch();
			Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
		}

		internal void Patch()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			//IL_0026: Expected O, but got Unknown
			if (Harmony == null)
			{
				Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
				Harmony val2 = val;
				Harmony = val;
			}
			Harmony.PatchAll();
		}

		internal void Unpatch()
		{
			Harmony? harmony = Harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}

		private void Update()
		{
		}
	}
}