Decompiled source of FasterConsume v1.0.0

FasterConsume.dll

Decompiled 2 days 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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("FasterConsume")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Vibe O'Drone")]
[assembly: AssemblyProduct("FasterConsume")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2c07991a-dc10-43ae-ad60-8553206a233a")]
[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 FasterConsume;

[BepInPlugin("vibeodrone.fasterconsume", "Faster Consume", "1.0.0")]
public class Plugin : BasePlugin
{
	public const string PluginGuid = "vibeodrone.fasterconsume";

	public const string PluginName = "Faster Consume";

	public const string PluginVersion = "1.0.0";

	internal static ManualLogSource Log;

	internal static ConfigEntry<int> SpeedMultiplier;

	private Harmony _harmony;

	public override void Load()
	{
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Expected O, but got Unknown
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Expected O, but got Unknown
		Log = ((BasePlugin)this).Log;
		SpeedMultiplier = ((BasePlugin)this).Config.Bind<int>("Consumables", "SpeedMultiplier", 3, new ConfigDescription("Во сколько раз быстрее проходит анимация еды/питья (1 = как в оригинале, 3 = втрое быстрее).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 25), Array.Empty<object>()));
		_harmony = new Harmony("vibeodrone.fasterconsume");
		_harmony.PatchAll();
		ManualLogSource log = Log;
		bool flag = default(bool);
		BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 2, ref flag);
		if (flag)
		{
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Faster Consume");
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
			((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
			((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded!");
		}
		log.LogInfo(val);
	}
}
[HarmonyPatch(typeof(FirstPersonItemController), "Update")]
internal static class ConsumeSpeedPatch
{
	private static bool _inExtraCall;

	private static void Postfix(FirstPersonItemController __instance)
	{
		if (_inExtraCall || !__instance.isConsuming)
		{
			return;
		}
		int num = Plugin.SpeedMultiplier.Value - 1;
		if (num <= 0)
		{
			return;
		}
		_inExtraCall = true;
		try
		{
			for (int i = 0; i < num; i++)
			{
				if (!__instance.isConsuming)
				{
					break;
				}
				__instance.Update();
			}
		}
		finally
		{
			_inExtraCall = false;
		}
	}
}