Decompiled source of StopScotlandReacting v1.0.2

StopScotlandReacting.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;

[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("StopScotlandReacting")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+67ff4ba77ef1183c0c39603d911c4db07a67443c")]
[assembly: AssemblyProduct("StopScotlandReacting")]
[assembly: AssemblyTitle("StopScotlandReacting")]
[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 StopScotlandReacting
{
	[BepInPlugin("prodzpod.StopScotlandReacting", "StopScotlandReacting", "1.0.1")]
	public class Main : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static Func<string, bool> <>9__13_4;

			public static Action <>9__13_0;

			public static hook_Start <>9__13_1;

			public static hook_OnInteractionBegin <>9__13_2;

			public static hook_GenerateNewPickupServer <>9__13_3;

			public static Converter<int, char> <>9__14_0;

			internal void <Awake>b__13_0()
			{
				if (Chainloader.PluginInfos.Keys.Any((string x) => x.Contains("SCOTLANDFOREVER")))
				{
					Console.instance.SubmitCmd((NetworkUser)null, m(113, 117, 105, 116), false);
				}
			}

			internal bool <Awake>b__13_4(string x)
			{
				return x.Contains("SCOTLANDFOREVER");
			}

			internal IEnumerator <Awake>b__13_1(orig_Start orig, Stage self)
			{
				IEnumerator result = orig.Invoke(self);
				xqs.Clear();
				if (SceneCatalog.mostRecentSceneDef.cachedName == zzz && Object.op_Implicit((Object)(object)GameObject.Find("LunarShop")))
				{
					GameObject gameObject = GameObject.Find("LunarShop").gameObject;
					for (int i = 0; i < gameObject.transform.childCount; i++)
					{
						xqs.Add(((Component)gameObject.transform.GetChild(i)).GetComponent<ShopTerminalBehavior>());
					}
				}
				return result;
			}

			internal void <Awake>b__13_2(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor)
			{
				orig.Invoke(self, interactor);
				if (((Object)((Component)self).gameObject).name == ((Object)ob).name)
				{
					Chat.AddMessage(m(60, 99, 111, 108, 111, 114, 61, 35, 99, 54, 100, 53, 102, 102, 62, 60, 115, 105, 122, 101, 61, 49, 50, 48, 37, 62, 83, 108, 97, 98, 58, 32, 77, 109, 44, 32, 110, 97, 104, 46, 60, 47, 115, 105, 122, 101, 62, 60, 47, 99, 111, 108, 111, 114, 62));
				}
			}

			internal void <Awake>b__13_3(orig_GenerateNewPickupServer orig, ShopTerminalBehavior self)
			{
				if (xqs.Contains(self))
				{
					self.SetNoPickup();
				}
				else
				{
					orig.Invoke(self);
				}
			}

			internal char <m>b__14_0(int x)
			{
				return (char)x;
			}
		}

		public const string PluginGUID = "prodzpod.StopScotlandReacting";

		public const string PluginAuthor = "prodzpod";

		public const string PluginName = "StopScotlandReacting";

		public const string PluginVersion = "1.0.1";

		public static ManualLogSource Log;

		public static PluginInfo pluginInfo;

		public static Harmony Harmony;

		public static List<ShopTerminalBehavior> xqs = new List<ShopTerminalBehavior>();

		public static string zzz = m(98, 97, 122, 97, 97, 114);

		public static string zzzq = m(72, 79, 76, 68, 69, 82, 58, 32, 83, 116, 111, 114, 101);

		public static string zzzb = m(76, 117, 110, 97, 114, 83, 104, 111, 112);

		public static string zzza = m(76, 117, 110, 97, 114, 84, 97, 98, 108, 101);

		public static GameObject ob = Addressables.LoadAssetAsync<GameObject>((object)m(82, 111, 82, 50, 47, 66, 97, 115, 101, 47, 76, 117, 110, 97, 114, 82, 101, 99, 121, 99, 108, 101, 114, 47, 76, 117, 110, 97, 114, 82, 101, 99, 121, 99, 108, 101, 114, 46, 112, 114, 101, 102, 97, 98)).WaitForCompletion();

		public void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_006d: 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)
			//IL_0078: Expected O, but got Unknown
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			pluginInfo = ((BaseUnityPlugin)this).Info;
			Log = ((BaseUnityPlugin)this).Logger;
			Harmony = new Harmony("prodzpod.StopScotlandReacting");
			RoR2Application.onStart = (Action)Delegate.Combine(RoR2Application.onStart, (Action)delegate
			{
				if (Chainloader.PluginInfos.Keys.Any((string x) => x.Contains("SCOTLANDFOREVER")))
				{
					Console.instance.SubmitCmd((NetworkUser)null, m(113, 117, 105, 116), false);
				}
			});
			object obj = <>c.<>9__13_1;
			if (obj == null)
			{
				hook_Start val = delegate(orig_Start orig, Stage self)
				{
					IEnumerator result = orig.Invoke(self);
					xqs.Clear();
					if (SceneCatalog.mostRecentSceneDef.cachedName == zzz && Object.op_Implicit((Object)(object)GameObject.Find("LunarShop")))
					{
						GameObject gameObject = GameObject.Find("LunarShop").gameObject;
						for (int i = 0; i < gameObject.transform.childCount; i++)
						{
							xqs.Add(((Component)gameObject.transform.GetChild(i)).GetComponent<ShopTerminalBehavior>());
						}
					}
					return result;
				};
				<>c.<>9__13_1 = val;
				obj = (object)val;
			}
			Stage.Start += (hook_Start)obj;
			object obj2 = <>c.<>9__13_2;
			if (obj2 == null)
			{
				hook_OnInteractionBegin val2 = delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor)
				{
					orig.Invoke(self, interactor);
					if (((Object)((Component)self).gameObject).name == ((Object)ob).name)
					{
						Chat.AddMessage(m(60, 99, 111, 108, 111, 114, 61, 35, 99, 54, 100, 53, 102, 102, 62, 60, 115, 105, 122, 101, 61, 49, 50, 48, 37, 62, 83, 108, 97, 98, 58, 32, 77, 109, 44, 32, 110, 97, 104, 46, 60, 47, 115, 105, 122, 101, 62, 60, 47, 99, 111, 108, 111, 114, 62));
					}
				};
				<>c.<>9__13_2 = val2;
				obj2 = (object)val2;
			}
			PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj2;
			object obj3 = <>c.<>9__13_3;
			if (obj3 == null)
			{
				hook_GenerateNewPickupServer val3 = delegate(orig_GenerateNewPickupServer orig, ShopTerminalBehavior self)
				{
					if (xqs.Contains(self))
					{
						self.SetNoPickup();
					}
					else
					{
						orig.Invoke(self);
					}
				};
				<>c.<>9__13_3 = val3;
				obj3 = (object)val3;
			}
			ShopTerminalBehavior.GenerateNewPickupServer += (hook_GenerateNewPickupServer)obj3;
		}

		private static string m(params int[] z)
		{
			return new string(z.ToList().ConvertAll((int x) => (char)x).ToArray());
		}
	}
}