Decompiled source of Hate Potion v1.1.0

HatePotion.dll

Decompiled a month ago
using 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 HarmonyLib;
using Microsoft.CodeAnalysis;
using REPOLib.Modules;
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("HatePotion")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 Spoopylocal")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HatePotion")]
[assembly: AssemblyTitle("HatePotion")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace HatePotion
{
	[BepInPlugin("HatePotion", "HatePotion", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("HatePotion");

		internal static Plugin Instance { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Expected O, but got Unknown
			Instance = this;
			Logger = Logger.CreateLogSource("HatePotion");
			Logger.LogInfo((object)"HatePotion has awoken!");
			Harmony val = new Harmony("HatePotion");
			val.PatchAll();
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "hatepotionassets");
			AssetBundle val2 = AssetBundle.LoadFromFile(text);
			GameObject val3 = val2.LoadAsset<GameObject>("Valuable Hate Potion");
			List<string> list = new List<string> { "Valuables - Generic" };
			Valuables.RegisterValuable(val3, list);
		}
	}
	public class ValuableHatePotion : MonoBehaviour
	{
		private enum State
		{
			Idle,
			Active
		}

		public Renderer liquidRenderer;

		public Light lightObject;

		public Color heldColor = new Color(0.6f, 0f, 0f, 1f);

		public Color lightColor = new Color(0.6f, 0f, 0f, 1f);

		public float colorChangeSpeed = 2f;

		private Color baseLiquidColor;

		private Color currentLiquidColor;

		public Renderer HatePotionRenderer;

		private ParticleSystem particles;

		private PhysGrabObject physGrabObject;

		private bool particlesPlaying;

		private float coolDownUntilNextSentence = 3f;

		private State currentState;

		private string playerName = "[playerName]";

		private List<string> transitiveVerbs = new List<string>();

		private List<string> intransitiveVerbs = new List<string>();

		private List<string> adjectives = new List<string>();

		private List<string> intensifiers = new List<string>();

		private List<string> nouns = new List<string>();

		private List<string> adverbs = new List<string>();

		private void Start()
		{
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			particles = ((Component)this).GetComponentInChildren<ParticleSystem>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			InitializeWordLists();
			if ((Object)(object)liquidRenderer != (Object)null)
			{
				baseLiquidColor = liquidRenderer.material.GetColor("_Color");
				currentLiquidColor = baseLiquidColor;
			}
			else
			{
				Debug.LogWarning((object)"liquidRenderer not assigned. Please assign the renderer for the liquid part in the Inspector.");
			}
		}

		private void Update()
		{
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)liquidRenderer != (Object)null)
			{
				Color val = (physGrabObject.grabbed ? heldColor : baseLiquidColor);
				currentLiquidColor = Color.Lerp(currentLiquidColor, val, Time.deltaTime * colorChangeSpeed);
				liquidRenderer.material.SetColor("_Color", currentLiquidColor);
				lightObject.color = currentLiquidColor;
			}
			HatePotionRenderer.material.mainTextureOffset = new Vector2(0f, Time.time * 0.1f);
			HatePotionRenderer.material.mainTextureScale = new Vector2(2f + Mathf.Sin(Time.time * 1f) * 0.25f, 2f + Mathf.Sin(Time.time * 1f) * 0.25f);
			if (physGrabObject.grabbed)
			{
				if (!particlesPlaying)
				{
					particles.Play();
					particlesPlaying = true;
				}
			}
			else if (particlesPlaying)
			{
				particles.Stop();
				particlesPlaying = false;
			}
			if (SemiFunc.IsMultiplayer())
			{
				switch (currentState)
				{
				case State.Idle:
					StateIdle();
					break;
				case State.Active:
					StateActive();
					break;
				}
			}
		}

		private void StateIdle()
		{
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			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 = "this potion";
					flag = true;
				}
				else
				{
					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)(object)PlayerAvatar.instance))
						{
							float num2 = Vector3.Distance(((Component)PhysGrabber.instance).transform.position, ((Component)item).transform.position);
							if (num2 < num)
							{
								num = num2;
								val = item;
							}
						}
					}
					flag = true;
					if ((Object)(object)val != (Object)null)
					{
						playerName = val.playerName;
					}
					else
					{
						playerName = "this potion";
					}
				}
				if (flag)
				{
					string text = GenerateHatefulSentence();
					currentState = State.Active;
					Color val2 = default(Color);
					((Color)(ref val2))..ctor(0.6f, 0f, 0f, 1f);
					ChatManager.instance.PossessChatScheduleStart(10);
					ChatManager.instance.PossessChat((PossessChatID)1, text, 1f, val2, 0f, false, 0, (UnityEvent)null);
					ChatManager.instance.PossessChatScheduleEnd();
				}
			}
		}

		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, 15f);
			}
			else if (!ChatManager.instance.StateIsPossessed())
			{
				currentState = State.Idle;
				coolDownUntilNextSentence = Random.Range(5f, 15f);
			}
		}

		private void InitializeWordLists()
		{
			transitiveVerbs.AddRange(new string[10] { "despise", "hate", "loathe", "detest", "abhor", "scorn", "mock", "disdain", "reject", "insult" });
			intransitiveVerbs.AddRange(new string[9] { "seethe", "fume", "sulk", "smolder", "snarl", "rile", "grumble", "roar", "spit" });
			adjectives.AddRange(new string[10] { "horrible", "terrible", "disgusting", "repulsive", "loathsome", "vile", "abominable", "nasty", "awful", "dreadful" });
			intensifiers.AddRange(new string[9] { "utterly", "completely", "absolutely", "profoundly", "viscerally", "deeply", "thoroughly", "totally", "consummately" });
			nouns.AddRange(new string[10] { "loser", "scum", "trash", "jerk", "rat", "freak", "bastard", "miscreant", "sniveler", "worm" });
			adverbs.AddRange(new string[8] { "bitterly", "fiercely", "vehemently", "sourly", "intensely", "miserably", "ruthlessly", "caustically" });
		}

		private string GenerateHatefulSentence()
		{
			List<string> list = new List<string>
			{
				"Can't stand how {adjective} {playerName} is.", "{playerName} makes everything {intensifier} awful.", "Why is {playerName} so {adjective}? It's infuriating!", "Every time I see {playerName}, I {intransitiveVerb}.", "{playerName} is just {intensifier} {adjective}, no doubt about it.", "Got me {adverb} thinking about how terrible {playerName} is.", "Just want to {transitiveVerb} {playerName} out of existence.", "Oh my, {playerName} is {intensifier} {adjective}!", "When {playerName} speaks, I can't help but {intransitiveVerb}.", "{playerName}, you are so {adjective}!",
				"Can we talk about how {adjective} {playerName} is? So frustrating!", "{playerName} has such a {adjective} vibe.", "Just saw {playerName} looking {adjective}, absolutely detestable.", "Wow, {playerName} is so {adjective}!", "Every time {playerName} talks, I {intransitiveVerb}.", "{playerName} and I = {intensifier} {adjective} conflict.", "Is it just me or is {playerName} {intensifier} {adjective}?", "Not gonna lie, {playerName} is {adverb} {adjective}.", "{playerName} is always {adjective}, and I can't stand it.", "I can't help {intransitiveVerb} over {playerName}.",
				"Guess who despises {playerName}? Me!", "{playerName} walking in makes my day {intensifier} worse.", "Hey {playerName}, keep being {adjective}!", "With {playerName}, everything feels {adjective}.", "Just {adverb} ruminating about {playerName}.", "{playerName} looks so {adjective} today.", "Low-key, {playerName} is the most {adjective} person.", "High-key, I detest {playerName}!", "{playerName} has that {adjective} something.", "For real, {playerName}'s vibe is {intensifier} {adjective}.",
				"Can't help but {transitiveVerb} {playerName}; they're so {adjective}.", "{playerName} is {adverb} my {noun}!", "Life is more miserable with {playerName} around.", "{playerName}'s voice is {intensifier} {adjective}.", "{playerName}, you {adverb} {transitiveVerb} my patience.", "Why is {playerName} so {adjective}?", "Did you see {playerName} today? So {adjective}!", "It's {adverb} {adjective} how much I {transitiveVerb} {playerName}.", "Me, whenever I see {playerName}: So {adjective}!", "{playerName} has me {adverb} {intransitiveVerb}.",
				"Just saw {playerName}, and yep, still {adjective}.", "{playerName} is my {intensifier} {adjective} enemy.", "Can confirm, {playerName} is {adjective}!", "Everyday mood: {intransitiveVerb} about how {adjective} {playerName} is.", "{playerName}, stop being so {adjective}; you're unbearable.", "When {playerName} is {intensifier} {adjective}... I just can't.", "Just {intransitiveVerb} about {playerName} being so {adjective}.", "Yep, {playerName} keeps getting more {adjective}.", "{playerName} makes me believe in {intensifier} {adjective} misfortune.", "Daily reminder: {playerName} is {intensifier} {adjective}.",
				"To be honest, {playerName} rocks that {adjective} look {adverb}.", "Seeing {playerName} today was {adverb} the worst.", "I can't stop {intransitiveVerb} when I think of {playerName}.", "{playerName}, you make my blood {intransitiveVerb}.", "Is it possible to {transitiveVerb} {playerName} more?", "{playerName} is just too {adjective}!", "Thinking about {playerName} makes me {intransitiveVerb}.", "My day gets {adjective} when I see {playerName}.", "{playerName} is my favorite {noun} to despise.", "I {transitiveVerb} {playerName} with all my might!",
				"Just {adverb} wishing I could {transitiveVerb} {playerName}.", "Whenever I see {playerName}, I {intransitiveVerb} inside.", "{playerName} has the most {adjective} scowl.", "Can't wait to {transitiveVerb} {playerName} again.", "If only {playerName} knew how {adjective} they are.", "Feeling {adjective} because of {playerName}.", "{playerName}, you're {intensifier} {adjective}!", "I just want to {transitiveVerb} {playerName} all day.", "{playerName}, you make me {intransitiveVerb}.", "Life is {adjective} with {playerName}.",
				"{playerName} is like the most {adjective} nightmare.", "Can't stop frowning because of {playerName}.", "I think I {transitiveVerb} {playerName}.", "{playerName} makes my blood {intransitiveVerb}.", "Oh, {playerName}, you're so {adjective}!", "Just thinking about {playerName} makes my skin crawl.", "Wish I could {transitiveVerb} {playerName} right now.", "{playerName} is simply {adjective}.", "Feeling {adjective} whenever {playerName} is around.", "{playerName}, you ruin my day!",
				"I {transitiveVerb} {playerName} more than anything.", "Just {adverb} thinking about {playerName}.", "{playerName} is {intensifier} {adjective}!", "Can't get enough of {playerName}'s {adjective} aura.", "{playerName} is {adverb} {adjective}.", "Just {intransitiveVerb} about how {adjective} {playerName} is.", "{playerName} makes my day {intensifier} dreadful."
			};
			string text = list[Random.Range(0, list.Count)];
			string text2 = text.Replace("{playerName}", playerName);
			if (text.Contains("{transitiveVerb}"))
			{
				string newValue = transitiveVerbs[Random.Range(0, transitiveVerbs.Count)];
				text2 = text2.Replace("{transitiveVerb}", newValue);
			}
			if (text.Contains("{intransitiveVerb}"))
			{
				string text3 = intransitiveVerbs[Random.Range(0, intransitiveVerbs.Count)];
				if (text2.Contains("{intransitiveVerb}s"))
				{
					text3 += (text3.EndsWith("e") ? "s" : "es");
					text2 = text2.Replace("{intransitiveVerb}s", text3);
				}
				else
				{
					text2 = text2.Replace("{intransitiveVerb}", text3);
				}
			}
			if (text.Contains("{adjective}"))
			{
				string newValue2 = adjectives[Random.Range(0, adjectives.Count)];
				text2 = text2.Replace("{adjective}", newValue2);
			}
			if (text.Contains("{intensifier}"))
			{
				string newValue3 = intensifiers[Random.Range(0, intensifiers.Count)];
				text2 = text2.Replace("{intensifier}", newValue3);
			}
			if (text.Contains("{adverb}"))
			{
				string newValue4 = adverbs[Random.Range(0, adverbs.Count)];
				text2 = text2.Replace("{adverb}", newValue4);
			}
			if (text.Contains("{noun}"))
			{
				string newValue5 = nouns[Random.Range(0, nouns.Count)];
				text2 = text2.Replace("{noun}", newValue5);
			}
			return char.ToUpper(text2[0]) + text2.Substring(1);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "HatePotion";

		public const string PLUGIN_NAME = "HatePotion";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}