Decompiled source of OnlyGoldBars v1.0.3

OnlyGoldBars.dll

Decompiled a year ago
using System;
using System.Diagnostics;
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;

[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("OnlyGoldBars")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A mod to change all items to gold bars")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3+9b3771d6fb97c2a7c76be4d51afbb8092cd51743")]
[assembly: AssemblyProduct("OnlyGoldBars")]
[assembly: AssemblyTitle("OnlyGoldBars")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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 OnlyGoldBars
{
	[BepInPlugin("Alphonso.OnlyGoldBars", "OnlyGoldBars", "1.0.3")]
	public class OnlyGoldBars : BaseUnityPlugin
	{
		public static bool loaded;

		private const string modGUID = "Alphonso.OnlyGoldBars";

		private const string modName = "OnlyGoldBars";

		private const string modVersion = "1.0.3";

		private readonly Harmony harmony = new Harmony("Alphonso.OnlyGoldBars");

		private static OnlyGoldBars Instance;

		public static ManualLogSource mls;

		private void Awake()
		{
			mls = Logger.CreateLogSource("OnlyGoldBars");
			mls.LogInfo((object)"Loaded OnlyGoldBars and applying patches.");
			harmony.PatchAll(typeof(OnlyGoldBars));
			mls = ((BaseUnityPlugin)this).Logger;
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPrefix]
		private static bool Only_Gold_Bars(ref SelectableLevel newLevel)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			bool flag = false;
			foreach (SpawnableItemWithRarity item in newLevel.spawnableScrap)
			{
				item.rarity = 0;
				if (item.spawnableItem.itemName == "Gold bar")
				{
					item.rarity = 999;
					flag = true;
				}
			}
			if (!flag)
			{
				StartOfRound val = new StartOfRound();
				foreach (Item items in StartOfRound.Instance.allItemsList.itemsList)
				{
					if (items.itemName == "Gold bar")
					{
						SpawnableItemWithRarity val2 = new SpawnableItemWithRarity();
						val2.spawnableItem = items;
						val2.rarity = 999;
						newLevel.spawnableScrap.Add(val2);
					}
				}
			}
			return true;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "OnlyGoldBars";

		public const string PLUGIN_NAME = "OnlyGoldBars";

		public const string PLUGIN_VERSION = "1.0.3";
	}
}