Decompiled source of Actually Faster v1.1.4

ActuallyFaster.dll

Decompiled 2 months ago
using System;
using System.Collections;
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.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Duplicator;
using EntityStates.Scrapper;
using MonoMod.RuntimeDetour;
using On.EntityStates.Duplicator;
using On.RoR2;
using RoR2;
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.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ActuallyFaster")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ActuallyFaster")]
[assembly: AssemblyTitle("ActuallyFaster")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ActuallyFaster;

[BepInPlugin("Felda.ActuallyFaster", "ActuallyFaster", "1.1.4")]
public class ActuallyFaster : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Start <>9__48_0;

		public static hook_Start <>9__48_1;

		public static hook_DropDroplet <>9__48_2;

		public static hook_ItemDrop <>9__48_3;

		internal IEnumerator <Awake>b__48_0(orig_Start orig, Stage self)
		{
			WaitToBeginScrapping.duration = 0f;
			Scrapping.duration = 0f;
			ScrappingToIdle.duration = 0f;
			return orig.Invoke(self);
		}

		internal IEnumerator <Awake>b__48_1(orig_Start orig, Stage self)
		{
			Duplicating.initialDelayDuration = 0f;
			Duplicating.timeBetweenStartAndDropDroplet = 0f;
			return orig.Invoke(self);
		}

		internal void <Awake>b__48_2(orig_DropDroplet orig, Duplicating self)
		{
			((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().Networkavailable = true;
			orig.Invoke(self);
		}

		internal void <Awake>b__48_3(orig_ItemDrop orig, ChestBehavior self)
		{
			self.dropUpVelocityStrength = 0f;
			self.dropForwardVelocityStrength = 0f;
			orig.Invoke(self);
		}
	}

	public const string PluginGUID = "Felda.ActuallyFaster";

	public const string PluginAuthor = "Felda";

	public const string PluginName = "ActuallyFaster";

	public const string PluginVersion = "1.1.4";

	public static ConfigEntry<bool> scrapper { get; set; }

	public static ConfigEntry<bool> printer { get; set; }

	public static ConfigEntry<bool> chanceShrine { get; set; }

	public static ConfigEntry<float> chanceShrineRefresh { get; set; }

	public static ConfigEntry<bool> cauldron { get; set; }

	public static ConfigEntry<bool> cleansingPool { get; set; }

	public static ConfigEntry<bool> chestDrop { get; set; }

	public static ConfigEntry<bool> woodShrine { get; set; }

	public static ConfigEntry<float> woodShrineRefresh { get; set; }

	public static ConfigEntry<bool> bloodShrine { get; set; }

	public static ConfigEntry<float> bloodShrineRefresh { get; set; }

	public void Awake()
	{
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a8: Expected O, but got Unknown
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Expected O, but got Unknown
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Expected O, but got Unknown
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		//IL_025f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0265: Expected O, but got Unknown
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Expected O, but got Unknown
		scrapper = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Scrapper brrrrrt", true, "Should the scrapper go brrrrrt?");
		printer = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Printer brrrrrt", true, "Should the printer go brrrrrt?");
		chanceShrine = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Chance Shrine brrrrrt", true, "Should the chance shrine go brrrrrt?");
		chanceShrineRefresh = ((BaseUnityPlugin)this).Config.Bind<float>("Actually Faster", "Chance Shrine refreshTimer brrrrrt", 0.1f, "Original is 2.0");
		bloodShrine = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Blood Shrine brrrrrt", true, "Should the blood shrine go brrrrrt?");
		bloodShrineRefresh = ((BaseUnityPlugin)this).Config.Bind<float>("Actually Faster", "Blood Shrine refreshTimer brrrrrt", 0.1f, "Original is 2.0");
		woodShrine = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Wood Shrine brrrrrt", true, "Should the wood shrine go brrrrrt?");
		woodShrineRefresh = ((BaseUnityPlugin)this).Config.Bind<float>("Actually Faster", "Wood Shrine refreshTimer brrrrrt", 0.1f, "Original is 2.0");
		cauldron = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Cauldron brrrrrt", true, "Should the cauldrons go brrrrrt?");
		cleansingPool = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Cleansing Pool brrrrrt", true, "Should the cleansing pool go brrrrrt?");
		chestDrop = ((BaseUnityPlugin)this).Config.Bind<bool>("Actually Faster", "Chest drop brrrrrt", true, "Should the chests go brrrrrt?");
		Hook val = new Hook((MethodBase)typeof(PurchaseInteraction).GetMethod("OnInteractionBegin", BindingFlags.Instance | BindingFlags.Public), typeof(ActuallyFaster).GetMethod("PurchaseInteraction_OnInteractionBegin"));
		if (scrapper.Value)
		{
			object obj = <>c.<>9__48_0;
			if (obj == null)
			{
				hook_Start val2 = delegate(orig_Start orig, Stage self)
				{
					WaitToBeginScrapping.duration = 0f;
					Scrapping.duration = 0f;
					ScrappingToIdle.duration = 0f;
					return orig.Invoke(self);
				};
				<>c.<>9__48_0 = val2;
				obj = (object)val2;
			}
			Stage.Start += (hook_Start)obj;
		}
		if (printer.Value)
		{
			object obj2 = <>c.<>9__48_1;
			if (obj2 == null)
			{
				hook_Start val3 = delegate(orig_Start orig, Stage self)
				{
					Duplicating.initialDelayDuration = 0f;
					Duplicating.timeBetweenStartAndDropDroplet = 0f;
					return orig.Invoke(self);
				};
				<>c.<>9__48_1 = val3;
				obj2 = (object)val3;
			}
			Stage.Start += (hook_Start)obj2;
			object obj3 = <>c.<>9__48_2;
			if (obj3 == null)
			{
				hook_DropDroplet val4 = delegate(orig_DropDroplet orig, Duplicating self)
				{
					((Component)((EntityState)self).outer).GetComponent<PurchaseInteraction>().Networkavailable = true;
					orig.Invoke(self);
				};
				<>c.<>9__48_2 = val4;
				obj3 = (object)val4;
			}
			Duplicating.DropDroplet += (hook_DropDroplet)obj3;
		}
		if (!chestDrop.Value)
		{
			return;
		}
		object obj4 = <>c.<>9__48_3;
		if (obj4 == null)
		{
			hook_ItemDrop val5 = delegate(orig_ItemDrop orig, ChestBehavior self)
			{
				self.dropUpVelocityStrength = 0f;
				self.dropForwardVelocityStrength = 0f;
				orig.Invoke(self);
			};
			<>c.<>9__48_3 = val5;
			obj4 = (object)val5;
		}
		ChestBehavior.ItemDrop += (hook_ItemDrop)obj4;
	}

	public static void PurchaseInteraction_OnInteractionBegin(Action<PurchaseInteraction, Interactor> orig, PurchaseInteraction self, Interactor activator)
	{
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Invalid comparison between Unknown and I4
		//IL_013c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Invalid comparison between Unknown and I4
		//IL_0145: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Invalid comparison between Unknown and I4
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Invalid comparison between Unknown and I4
		orig(self, activator);
		if ((chanceShrine.Value || cauldron.Value || cleansingPool.Value || bloodShrine.Value || woodShrine.Value) && !((Object)(object)self == (Object)null))
		{
			if (chanceShrine.Value && self.displayNameToken.ToLower() == "shrine_chance_name")
			{
				ShrineChanceBehavior component = ((Component)self).GetComponent<ShrineChanceBehavior>();
				component.refreshTimer = chanceShrineRefresh.Value;
			}
			else if (bloodShrine.Value && self.displayNameToken.ToLower() == "shrine_blood_name")
			{
				ShrineBloodBehavior component2 = ((Component)self).GetComponent<ShrineBloodBehavior>();
				component2.refreshTimer = bloodShrineRefresh.Value;
			}
			else if (woodShrine.Value && self.displayNameToken.ToLower() == "shrine_healing_name")
			{
				ShrineHealingBehavior component3 = ((Component)self).GetComponent<ShrineHealingBehavior>();
				component3.refreshTimer = woodShrineRefresh.Value;
			}
			if (((int)self.costType == 4 || (int)self.costType == 5 || (int)self.costType == 6) && cauldron.Value && self.Networkcost > 0 && !self.isShrine)
			{
				self.available = true;
			}
			if ((int)self.costType == 9 && self.Networkcost > 0 && cleansingPool.Value)
			{
				self.available = true;
			}
		}
	}
}
internal static class Log
{
	internal static ManualLogSource _logSource;

	internal static void Init(ManualLogSource logSource)
	{
		_logSource = logSource;
	}

	internal static void LogDebug(object data)
	{
		_logSource.LogDebug(data);
	}

	internal static void LogError(object data)
	{
		_logSource.LogError(data);
	}

	internal static void LogFatal(object data)
	{
		_logSource.LogFatal(data);
	}

	internal static void LogInfo(object data)
	{
		_logSource.LogInfo(data);
	}

	internal static void LogMessage(object data)
	{
		_logSource.LogMessage(data);
	}

	internal static void LogWarning(object data)
	{
		_logSource.LogWarning(data);
	}
}