Decompiled source of WereRich v1.0.0

WereRich.dll

Decompiled 9 months ago
using System;
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 Microsoft.CodeAnalysis;
using On.RoR2.UI;
using R2API;
using R2API.Utils;
using RoR2;
using RoR2.UI;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("WereRich")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a839fd19c17b78bbd2f4d0a1667fbd981fa43fa3")]
[assembly: AssemblyProduct("WereRich")]
[assembly: AssemblyTitle("WereRich")]
[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 com.boyoboy.wererich
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.boyoboy.WereRich", "WereRich", "1.0.0")]
	[R2APISubmoduleDependency(new string[] { "SoundAPI" })]
	public class WereRich : BaseUnityPlugin
	{
		private protected static ManualLogSource _logger;

		public const string PluginGUID = "com.boyoboy.WereRich";

		public const string PluginAuthor = "com.boyoboy";

		public const string PluginName = "WereRich";

		public const string PluginVersion = "1.0.0";

		public void Awake()
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			_logger = Logger.CreateLogSource("WereRich");
			using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("com.boyoboy.wererich.dwarf_lines.bnk"))
			{
				byte[] array = new byte[stream.Length];
				int num = stream.Read(array, 0, array.Length);
				_logger.LogInfo((object)$"Loaded {num} bytes");
				uint num2 = SoundBanks.Add(array);
				_logger.LogInfo((object)$"Bank added as ID : {num2}");
			}
			PingIndicator.RebuildPing += new hook_RebuildPing(PingIndicator_RebuildPing);
			_logger.LogInfo((object)"We're rich!");
		}

		private void PingIndicator_RebuildPing(orig_RebuildPing orig, PingIndicator self)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (!Object.op_Implicit((Object)(object)self.pingTarget) || !Object.op_Implicit((Object)(object)self.pingOwner))
			{
				return;
			}
			GameObject pingTarget = self.pingTarget;
			GameObject bodyObject = self.pingOwner.GetComponent<CharacterMaster>().GetBodyObject();
			GenericPickupController component = pingTarget.GetComponent<GenericPickupController>();
			ShrineBloodBehavior component2 = pingTarget.GetComponent<ShrineBloodBehavior>();
			ShopTerminalBehavior component3 = pingTarget.GetComponent<ShopTerminalBehavior>();
			PickupIndex val = PickupCatalog.FindPickupIndex(ItemCatalog.FindItemIndex("Mushroom"));
			if (Object.op_Implicit((Object)(object)component))
			{
				if (component.pickupIndex == val)
				{
					_logger.LogInfo((object)"Mushroom!");
					Util.PlaySound("Play_drg_mushroom", bodyObject);
				}
			}
			else if (Object.op_Implicit((Object)(object)component2))
			{
				_logger.LogInfo((object)"We're rich!");
				Util.PlaySound("Play_drg_wererich", bodyObject);
			}
			else if (Object.op_Implicit((Object)(object)component3) && !component3.pickupIndexIsHidden && component3.CurrentPickupIndex() == val)
			{
				_logger.LogInfo((object)"Mushroom! (for sale)");
				Util.PlaySound("Play_drg_mushroom", bodyObject);
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "WereRich";

		public const string PLUGIN_NAME = "WereRich";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}