using System;
using System.Diagnostics;
using System.IO;
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 Microsoft.CodeAnalysis;
using On.RoR2;
using On.RoR2.Items;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Items;
using UnityEngine;
[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("UnnerfedSauteedWorms")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c8b4bee03cecb408b04a4099b7d9ee91d3f80359")]
[assembly: AssemblyProduct("UnnerfedSauteedWorms")]
[assembly: AssemblyTitle("UnnerfedSauteedWorms")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 RoR2UnnerfedSauteedWorms
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInPlugin("SSM24.UnnerfedSauteedWorms", "UnnerfedSauteedWorms", "1.0.0")]
public class UnnerfedSauteedWormsPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_TryFire <0>__On_WyrmOnHitBehavior_TryFire;
}
public const string PluginGUID = "SSM24.UnnerfedSauteedWorms";
public const string PluginAuthor = "SSM24";
public const string PluginName = "UnnerfedSauteedWorms";
public const string PluginVersion = "1.0.0";
public static ConfigEntry<bool> DisableCooldown;
public static ConfigEntry<bool> DisableChanceDecay;
public static ConfigEntry<bool> DisableWormLimit;
public void Awake()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
DisableCooldown = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Cooldown", true, "Disables the 1-second cooldown between worm procs");
DisableChanceDecay = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Chance Decay", true, "If true, proc chance is not reduced by the number of active worms");
DisableWormLimit = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Worm Limit", true, "Disables the limit of 8 active worms at once");
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DisableCooldown));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DisableChanceDecay));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(DisableWormLimit));
try
{
using Stream stream = File.OpenRead(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png"));
Texture2D val = new Texture2D(0, 0);
byte[] array = new byte[stream.Length];
stream.Read(array, 0, (int)stream.Length);
if (ImageConversion.LoadImage(val, array))
{
ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f)));
}
}
catch (FileNotFoundException)
{
}
object obj = <>O.<0>__On_WyrmOnHitBehavior_TryFire;
if (obj == null)
{
hook_TryFire val2 = On_WyrmOnHitBehavior_TryFire;
<>O.<0>__On_WyrmOnHitBehavior_TryFire = val2;
obj = (object)val2;
}
WyrmOnHitBehavior.TryFire += (hook_TryFire)obj;
WyrmOnHitBehavior.SolveForProcChance += new hook_SolveForProcChance(On_WyrmOnHitBehavior_SolveForProcChance);
CharacterMaster.GetDeployableSameSlotLimit += new hook_GetDeployableSameSlotLimit(On_CharacterMaster_GetDeployableSameSlotLimit);
}
public void OnDestroy()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__On_WyrmOnHitBehavior_TryFire;
if (obj == null)
{
hook_TryFire val = On_WyrmOnHitBehavior_TryFire;
<>O.<0>__On_WyrmOnHitBehavior_TryFire = val;
obj = (object)val;
}
WyrmOnHitBehavior.TryFire -= (hook_TryFire)obj;
WyrmOnHitBehavior.SolveForProcChance -= new hook_SolveForProcChance(On_WyrmOnHitBehavior_SolveForProcChance);
CharacterMaster.GetDeployableSameSlotLimit -= new hook_GetDeployableSameSlotLimit(On_CharacterMaster_GetDeployableSameSlotLimit);
}
private static bool On_WyrmOnHitBehavior_TryFire(orig_TryFire orig, WyrmOnHitBehavior self, ref DamageInfo damageInfo)
{
bool result = orig.Invoke(self, ref damageInfo);
if (DisableCooldown.Value)
{
self._timer = 0f;
}
return result;
}
private float On_WyrmOnHitBehavior_SolveForProcChance(orig_SolveForProcChance orig, WyrmOnHitBehavior self, CharacterMaster master)
{
if (DisableChanceDecay.Value)
{
return 10f;
}
return orig.Invoke(self, master);
}
private int On_CharacterMaster_GetDeployableSameSlotLimit(orig_GetDeployableSameSlotLimit orig, CharacterMaster self, DeployableSlot slot)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if ((int)slot == 33 && DisableWormLimit.Value)
{
return int.MaxValue;
}
return orig.Invoke(self, slot);
}
}
}