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 SandSailorStudio.Types;
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("SummonTimeModifier")]
[assembly: AssemblyTitle("SummonTimeModifier")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SummonTimeModifier;
[BepInPlugin("blacks7ar.SummonTimeModifier", "SummonTimeModifier", "1.0.0")]
public class Plugin : BasePlugin
{
[HarmonyPatch]
private static class Patches
{
private const float MinCooldown = 1f;
[HarmonyPostfix]
[HarmonyPatch(typeof(IntThresholdList<float>), "GetValue")]
private static void GetValue_Postfix(int thresholdValue, ref float __result)
{
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Expected O, but got Unknown
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
bool flag = default(bool);
try
{
BepInExDebugLogInterpolatedStringHandler val;
if (float.IsNaN(__result) || float.IsInfinity(__result))
{
ManualLogSource sLogger = SLogger;
val = new BepInExDebugLogInterpolatedStringHandler(55, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GetValue returned invalid float: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__result);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(". Skipping multiplier.");
}
sLogger.LogDebug(val);
return;
}
float value = _summonTimeMultiplier.Value;
float num = Mathf.Max(__result * value, 1f);
ManualLogSource sLogger2 = SLogger;
val = new BepInExDebugLogInterpolatedStringHandler(75, 4, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Villager count/threshold: (");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(thresholdValue);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") original value: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__result);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> new value: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" [multiplier: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(value);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
}
sLogger2.LogDebug(val);
__result = num;
}
catch (Exception ex)
{
ManualLogSource sLogger3 = SLogger;
BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(31, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Exception in GetValue postfix: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex);
}
sLogger3.LogDebug(val);
}
}
}
private const string modGUID = "blacks7ar.SummonTimeModifier";
public const string modName = "SummonTimeModifier";
public const string modAuthor = "blacks7ar";
public const string modVersion = "1.0.0";
private static ManualLogSource SLogger;
private static ConfigEntry<float> _summonTimeMultiplier;
public override void Load()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
SLogger = ((BasePlugin)this).Log;
_summonTimeMultiplier = ((BasePlugin)this).Config.Bind<float>("General", "Summon Time Multiplier", 0.5f, "Multiplies the villagers summon time countdown. (0.5 = 50% faster, 1 = normal speed, 2 = 2x slower)");
SLogger.LogInfo((object)"Mod loaded!");
new Harmony("blacks7ar.SummonTimeModifier").PatchAll();
}
}