Decompiled source of RicksPickles v1.0.4

ClassLibrary1.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Plugin.Patches;
using TMPro;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ClassLibrary1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("ClassLibrary1")]
[assembly: AssemblyCopyright("Copyright © HP 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b40bd14b-f0a3-437c-af5c-3f06a171db80")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Plugin
{
	[BepInPlugin("POOPMAN.RICKSPICKLES", "RICKSPICKLES", "1.0.4")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "POOPMAN.RICKSPICKLES";

		private const string modName = "RICKSPICKLES";

		private const string modVersion = "1.0.4";

		private readonly Harmony harmony = new Harmony("POOPMAN.RICKSPICKLES");

		public static Plugin instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)instance == (Object)null)
			{
				instance = this;
			}
			mls = Logger.CreateLogSource("POOPMAN.RICKSPICKLES");
			mls.LogInfo((object)"I have awoken");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(PickleSearch));
			harmony.PatchAll(typeof(ScanPatch));
		}
	}
}
namespace Plugin.Patches
{
	[HarmonyPatch(typeof(RoundManager))]
	internal class PickleSearch
	{
		public static Plugin plugin = Plugin.instance;

		[HarmonyPatch("LoadNewLevel")]
		[HarmonyPrefix]
		private static bool Pickle_Search(ref SelectableLevel newLevel)
		{
			try
			{
				foreach (SpawnableItemWithRarity item in newLevel.spawnableScrap)
				{
					if (item.spawnableItem.itemName == "Jar of pickles")
					{
						for (int i = 0; i < 15; i++)
						{
							plugin.mls.LogInfo((object)"------FOUND---PICKLES------");
						}
						item.spawnableItem.itemName = "Ricks' Pickles";
						item.spawnableItem.minValue = 2500;
						item.spawnableItem.maxValue = 25000;
					}
				}
			}
			catch (Exception)
			{
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(HUDManager))]
	internal class ScanPatch
	{
		public static Plugin plugin = Plugin.instance;

		private static TextMeshProUGUI _textMesh;

		[HarmonyPatch(typeof(HUDManager), "UpdateScanNodes")]
		[HarmonyPostfix]
		private static void PrintScanNodesName(ref RectTransform[] ___scanElements)
		{
			for (int i = 0; i < ___scanElements.Length; i++)
			{
				TextMeshProUGUI[] componentsInChildren = ((Component)___scanElements[i]).gameObject.GetComponentsInChildren<TextMeshProUGUI>();
				if (componentsInChildren.Length > 1 && ((TMP_Text)componentsInChildren[0]).text == "Jar of pickles")
				{
					((TMP_Text)componentsInChildren[0]).text = "Ricks' Pickles";
				}
			}
		}
	}
}