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.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using SSSGame;
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.3")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GatherTimeModifier")]
[assembly: AssemblyTitle("GatherTimeModifier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
namespace GatherTimeModifier;
[BepInPlugin("blacks7ar.GatherTimeModifier", "GatherTimeModifier", "1.0.3")]
public class Plugin : BasePlugin
{
[HarmonyPatch]
private static class Patch
{
[HarmonyPrefix]
[HarmonyPatch(typeof(GatherInteraction), "add_OnItemsGathered")]
private static void add_OnItemsGathered_Prefix(GatherInteraction __instance)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
try
{
bool flag = false;
Structure componentInParent = ((Component)__instance).gameObject.GetComponentInParent<Structure>();
if ((Object)(object)componentInParent != (Object)null && (((Object)((Component)componentInParent).gameObject).name.Contains("WaterWell") || ((Object)((Component)componentInParent).gameObject).name.Contains("WaterCollector")))
{
flag = true;
}
if (!flag)
{
float gatherVolumePerCharge = __instance.gatherVolumePerCharge * _gatherTimer.Value;
__instance.gatherVolumePerCharge = gatherVolumePerCharge;
}
}
catch (Exception ex)
{
ManualLogSource gTMLogger = GTMLogger;
bool flag2 = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag2);
if (flag2)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("add_OnItemsGathered patch error exception: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
gTMLogger.LogError(val);
}
}
}
private const string modGUID = "blacks7ar.GatherTimeModifier";
public const string modName = "GatherTimeModifier";
public const string modAuthor = "blacks7ar";
public const string modVersion = "1.0.3";
private static ManualLogSource GTMLogger;
private static ConfigEntry<float> _gatherTimer;
public override void Load()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
GTMLogger = ((BasePlugin)this).Log;
_gatherTimer = ((BasePlugin)this).Config.Bind<float>("General", "Modifier", 0.25f, "Gather time modifier. (ie. 1 = normal time, 0.25 = 75% faster, 2 = 2x slower, etc.");
GTMLogger.LogInfo((object)"Mod loaded.");
new Harmony("blacks7ar.GatherTimeModifier").PatchAll();
}
}