Decompiled source of DoubleTheFlax v1.0.0

DoubleTheFlax.dll

Decompiled 2 months 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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using SSSGame;
using SSSGame.Render;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("DoubleTheFlax")]
[assembly: AssemblyTitle("DoubleTheFlax")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DoubleTheFlax;

[BepInPlugin("blacks7ar.DoubleTheFlax", "DoubleTheFlax", "1.0.0")]
public class Plugin : BasePlugin
{
	[HarmonyPatch]
	private static class Patch
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GatherInteraction), "add_OnItemsGathered")]
		private static void add_OnItemsGathered_Prefix(GatherInteraction __instance)
		{
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Expected O, but got Unknown
			bool flag = default(bool);
			try
			{
				Pickable componentInParent = ((Component)__instance).gameObject.GetComponentInParent<Pickable>();
				if ((Object)(object)componentInParent != (Object)null && ((Object)((Component)componentInParent).gameObject).name.Contains("Flax"))
				{
					__instance._gatherModifier.SetQuantity(10);
					ManualLogSource dLogger = DLogger;
					BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(19, 2, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)componentInParent).gameObject).name);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" gathered, amount: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(__instance._gatherModifier.GetQuantity());
					}
					dLogger.LogDebug(val);
				}
			}
			catch (Exception ex)
			{
				ManualLogSource dLogger2 = DLogger;
				BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(46, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Exception thrown while adding items gathered: ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
				}
				dLogger2.LogError(val2);
			}
		}
	}

	private const string modGUID = "blacks7ar.DoubleTheFlax";

	public const string modName = "DoubleTheFlax";

	public const string modAuthor = "blacks7ar";

	public const string modVersion = "1.0.0";

	private static ManualLogSource DLogger;

	public override void Load()
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		DLogger = ((BasePlugin)this).Log;
		DLogger.LogInfo((object)"Mod loaded.");
		new Harmony("blacks7ar.DoubleTheFlax").PatchAll();
	}
}