Decompiled source of MoreFriendStuff v1.0.3

MoreFriendStuff.dll

Decompiled 3 weeks 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;

[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("MoreFriendStuff")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("MoreFriendStuff")]
[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 MoreFriendStuff
{
	[BepInPlugin("MoreFriendStuff", "My first plugin", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(ValuableLovePotion), "GenerateAffectionateSentence")]
		internal static class ValuableLovePotionSentencePatch
		{
			private static void Postfix(ValuableLovePotion __instance, ref string __result)
			{
				if (((Object)((Component)__instance).gameObject).name.Contains("Frame_Ellie", StringComparison.OrdinalIgnoreCase))
				{
					List<string> list = new List<string> { "Can't stop smiling because of Ellie.", "I think I love Ellie.", "Just can't stop thinking about Ellie.", "Ellie makes my day awesome." };
					__result = list[Random.Range(0, list.Count)];
				}
			}
		}

		[HarmonyPatch(typeof(ValuableLovePotion), "Update")]
		internal static class ValuableLovePotionUpdatePatch
		{
			private static bool Prefix(ValuableLovePotion __instance)
			{
				//IL_0046: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0050: Unknown result type (might be due to invalid IL or missing references)
				//IL_0055: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Invalid comparison between Unknown and I4
				if (((Object)((Component)__instance).gameObject).name.Contains("Frame_Ellie", StringComparison.OrdinalIgnoreCase))
				{
					if (__instance.particlesPlaying)
					{
						__instance.particles.Stop();
						__instance.particlesPlaying = false;
					}
					if (SemiFunc.IsMultiplayer())
					{
						State currentState = __instance.currentState;
						State val = currentState;
						if ((int)val != 0)
						{
							if ((int)val == 1)
							{
								__instance.StateActive();
							}
						}
						else
						{
							__instance.StateIdle();
						}
					}
					return false;
				}
				return true;
			}
		}

		private readonly Harmony _harmony = new Harmony("MoreFriendStuff");

		internal static ManualLogSource Logger;

		internal static Plugin Instance { get; private set; }

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Logger = ((BaseUnityPlugin)this).Logger;
			AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Instance).Info.Location), "morefriendstuff_assets.file"));
			string[] array = new string[5] { "frame_ellie", "frame_tom", "frame_tom_2", "painting_tom", "cardboard_tom" };
			string[] array2 = array;
			foreach (string text in array2)
			{
				GameObject val2 = val.LoadAsset<GameObject>(text);
				Valuables.RegisterValuable(val2);
				Logger.LogInfo((object)("Registered valuable: " + text));
			}
			_harmony.PatchAll(typeof(ValuableLovePotionSentencePatch));
			_harmony.PatchAll(typeof(ValuableLovePotionUpdatePatch));
			Logger.LogInfo((object)"Plugin MoreFriendStuff is loaded!");
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoreFriendStuff";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}