Decompiled source of Bazaar Qol v1.0.0

BazaarQol.dll

Decompiled 10 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API.Utils;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BazaarQol")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BazaarQol")]
[assembly: AssemblyTitle("BazaarQol")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 BazaarQol
{
	[BepInPlugin("kft.r2.bazaarqol", "Bazaar Qol", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static hook_TakeDamage <>9__0_0;

			public static hook_OnTargetSceneChanged <>9__0_1;

			internal void <Awake>b__0_0(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_001d: Invalid comparison between Unknown and I4
				if (Object.op_Implicit((Object)(object)BazaarController.instance) && (int)self.body.teamComponent.teamIndex == 1)
				{
					damageInfo.damage = 0f;
				}
				orig.Invoke(self, damageInfo);
			}

			internal void <Awake>b__0_1(orig_OnTargetSceneChanged orig, SeerStationController self, SceneDef targetSceneDef)
			{
				orig.Invoke(self, targetSceneDef);
				((Component)self).GetComponent<PurchaseInteraction>().contextToken = targetSceneDef.nameToken;
			}
		}

		private void Awake()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Expected O, but got Unknown
			object obj = <>c.<>9__0_0;
			if (obj == null)
			{
				hook_TakeDamage val = delegate(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
				{
					//IL_0017: Unknown result type (might be due to invalid IL or missing references)
					//IL_001d: Invalid comparison between Unknown and I4
					if (Object.op_Implicit((Object)(object)BazaarController.instance) && (int)self.body.teamComponent.teamIndex == 1)
					{
						damageInfo.damage = 0f;
					}
					orig.Invoke(self, damageInfo);
				};
				<>c.<>9__0_0 = val;
				obj = (object)val;
			}
			HealthComponent.TakeDamage += (hook_TakeDamage)obj;
			object obj2 = <>c.<>9__0_1;
			if (obj2 == null)
			{
				hook_OnTargetSceneChanged val2 = delegate(orig_OnTargetSceneChanged orig, SeerStationController self, SceneDef targetSceneDef)
				{
					orig.Invoke(self, targetSceneDef);
					((Component)self).GetComponent<PurchaseInteraction>().contextToken = targetSceneDef.nameToken;
				};
				<>c.<>9__0_1 = val2;
				obj2 = (object)val2;
			}
			SeerStationController.OnTargetSceneChanged += (hook_OnTargetSceneChanged)obj2;
		}
	}
}