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 HarmonyLib;
using Microsoft.CodeAnalysis;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.blueraja.double_silk")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+f83cd5b0175296b8a399eb484cbdf5479f6085c6")]
[assembly: AssemblyProduct("Double Silk")]
[assembly: AssemblyTitle("com.blueraja.double_silk")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace double_silk
{
[BepInPlugin("com.blueraja.double_silk", "Double Silk", "1.3.0")]
[BepInProcess("Hollow Knight Silksong.exe")]
public class Plugin : BaseUnityPlugin
{
private static ConfigEntry<float> _silkMultiplier;
private static readonly Random Random = new Random();
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(Plugin), (string)null);
_silkMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Cheats", "SilkMultiplier", 2f, "The multiplier for generating silk. Fractional values work by randomly rounding up/down to get the desired multiplier on average.");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.blueraja.double_silk is loaded!");
}
[HarmonyPatch(typeof(HeroController), "AddSilk", new Type[]
{
typeof(int),
typeof(bool),
typeof(SilkAddSource),
typeof(bool)
})]
[HarmonyPrefix]
private static void AddSilkPrefix(ref int amount, ref bool heroEffect, ref SilkAddSource source, ref bool forceCanBindEffect)
{
amount = RoundRandomly((float)amount * _silkMultiplier.Value);
}
private static int RoundRandomly(float roundMe)
{
int num = (int)Math.Floor(roundMe);
float num2 = roundMe - (float)num;
if (!(num2 > 0f) || !((double)num2 > Random.NextDouble()))
{
return num;
}
return num + 1;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.blueraja.double_silk";
public const string PLUGIN_NAME = "Double Silk";
public const string PLUGIN_VERSION = "1.3.0";
}
}